@chaibuilder/sdk 1.2.46 → 1.2.47

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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/{AddBlocks-Jse1nYBd.cjs → AddBlocks-_fhhS7Lm.cjs} +1 -1
  3. package/dist/{AddBlocks-wY7YpsXy.js → AddBlocks-cX8vIt0V.js} +7 -7
  4. package/dist/{CanvasArea-2widR9Ry.js → CanvasArea-HRipTJFS.js} +271 -263
  5. package/dist/CanvasArea-N3rYeBJV.cjs +55 -0
  6. package/dist/{ChaiBuilderEditor-74s7jELl.cjs → ChaiBuilderEditor-EtQOC5uy.cjs} +1 -1
  7. package/dist/{ChaiBuilderEditor-wriVkIG1.js → ChaiBuilderEditor-dKHRL-Es.js} +20 -20
  8. package/dist/{CurrentPage-UozVUoj8.cjs → CurrentPage-9FijxWbn.cjs} +1 -1
  9. package/dist/{CurrentPage--JhcSlGs.js → CurrentPage-U8ms8Hs7.js} +2 -2
  10. package/dist/{ListTree-qTfVR-jh.js → ListTree-OgLdyfQs.js} +1 -1
  11. package/dist/{ListTree-aFX8fD7v.cjs → ListTree-jOvHpo3_.cjs} +1 -1
  12. package/dist/{PagesPanel-1ZzPulaC.cjs → PagesPanel-8Cd6UYsh.cjs} +1 -1
  13. package/dist/{PagesPanel-qatBt4Nf.js → PagesPanel-MsUBq9Xx.js} +3 -3
  14. package/dist/{ProjectPanel-QUIcKWwM.cjs → ProjectPanel-KmnXPfxx.cjs} +1 -1
  15. package/dist/{ProjectPanel-Vp-EZS_Y.js → ProjectPanel-hsZG_Btj.js} +3 -3
  16. package/dist/{Settings-E_xif3_e.js → Settings-WcLqIeQy.js} +7 -7
  17. package/dist/{Settings-jKpJi5Wy.cjs → Settings-xVjTnVSf.cjs} +1 -1
  18. package/dist/{SidePanels-s_Yl7HhG.cjs → SidePanels-6zRgfZpi.cjs} +1 -1
  19. package/dist/{SidePanels-UEa90HOL.js → SidePanels-PmCljlnf.js} +2 -2
  20. package/dist/{ThemeConfiguration-IUuxGaDf.js → ThemeConfiguration-mkbFdePB.js} +17 -17
  21. package/dist/{ThemeConfiguration-YkPc6RGq.cjs → ThemeConfiguration-pt7TTAty.cjs} +1 -1
  22. package/dist/{Topbar-YzdQKElx.cjs → Topbar--m1E08Jl.cjs} +1 -1
  23. package/dist/{Topbar-C7Qfcatg.js → Topbar-FPywhpub.js} +1 -1
  24. package/dist/{UILibrariesPanel-qv8AiOn1.cjs → UILibrariesPanel-HhHGcexY.cjs} +1 -1
  25. package/dist/{UILibrariesPanel-didKK7tC.js → UILibrariesPanel-VrA2X4LO.js} +1 -1
  26. package/dist/{UnsplashImages-VkZ_KszK.js → UnsplashImages-7uAXYHPH.js} +1 -1
  27. package/dist/{UnsplashImages-QeZ65lKC.cjs → UnsplashImages-Yu0msAD8.cjs} +1 -1
  28. package/dist/{UploadImages-6drauLA-.js → UploadImages-5M0Q27R-.js} +1 -1
  29. package/dist/{UploadImages-igQroUtu.cjs → UploadImages-jS51ZcPG.cjs} +1 -1
  30. package/dist/{add-page-modal-rJ7OwdoX.js → add-page-modal-6o7MAbq-.js} +3 -3
  31. package/dist/{add-page-modal-esHlLYay.cjs → add-page-modal-KAbflupJ.cjs} +1 -1
  32. package/dist/{confirm-alert-08q_BmL6.cjs → confirm-alert-dow0GlxC.cjs} +1 -1
  33. package/dist/{confirm-alert-HfChUtfw.js → confirm-alert-jL0z_gFv.js} +1 -1
  34. package/dist/core.cjs +1 -1
  35. package/dist/core.js +1 -1
  36. package/dist/{delete-page-modal-SOCB_9UB.cjs → delete-page-modal-EDQZneVM.cjs} +1 -1
  37. package/dist/{delete-page-modal-E3tO5Q1p.js → delete-page-modal-U5_JYYp7.js} +2 -2
  38. package/dist/email.cjs +1 -1
  39. package/dist/email.js +1 -1
  40. package/dist/{form-gRWwpKzq.cjs → form-KBtrnNWh.cjs} +1 -1
  41. package/dist/{form-hi_RCepy.js → form-Sgpl2fXL.js} +1 -1
  42. package/dist/functions-7ybAMUuA.js +31 -0
  43. package/dist/functions-yvRwasT2.cjs +1 -0
  44. package/dist/{index-3j3SZ9Pb.cjs → index-HjN7LtDT.cjs} +1 -1
  45. package/dist/{index-OnzJQ25d.js → index-po-naEa5.js} +2 -2
  46. package/dist/lib.cjs +2 -3
  47. package/dist/lib.d.ts +11 -11
  48. package/dist/lib.js +175 -100
  49. package/dist/{page-viewer-S3xZLu53.cjs → page-viewer-PfZEbcDZ.cjs} +1 -1
  50. package/dist/{page-viewer-K_8dfU3A.js → page-viewer-nLRRk7DR.js} +3 -3
  51. package/dist/{project-general-setting-vSkiqVk-.js → project-general-setting-D1UJdZ2D.js} +3 -3
  52. package/dist/{project-general-setting-IRQ9TNAd.cjs → project-general-setting-HO6zeum2.cjs} +1 -1
  53. package/dist/{project-seo-setting-b9jZC0dr.js → project-seo-setting-VIZWEMRk.js} +2 -2
  54. package/dist/{project-seo-setting-XHFqgtW9.cjs → project-seo-setting-gT9N1tnB.cjs} +1 -1
  55. package/dist/render.cjs +1 -1
  56. package/dist/render.d.ts +2 -1
  57. package/dist/render.js +82 -80
  58. package/dist/{single-page-detail-RG82dk4d.cjs → single-page-detail-To8TcpgJ.cjs} +1 -1
  59. package/dist/{single-page-detail-zHbO3vOI.js → single-page-detail-lQ8fujC5.js} +4 -4
  60. package/dist/studio.cjs +1 -1
  61. package/dist/studio.js +2 -2
  62. package/dist/ui.cjs +1 -1
  63. package/dist/ui.js +1 -1
  64. package/dist/{useCanvasSettings-2Wzyf2PK.cjs → useCanvasSettings-7BXlDuLG.cjs} +1 -1
  65. package/dist/{useCanvasSettings-L2pW5boY.js → useCanvasSettings-UzjYHFG5.js} +1 -1
  66. package/package.json +1 -1
  67. package/dist/CanvasArea-pQP-jR11.cjs +0 -57
  68. package/dist/functions-ge87TVcc.js +0 -30
  69. package/dist/functions-sBiIevFh.cjs +0 -1
@@ -1 +1 @@
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"),N=require("react");require("./core.cjs");const i2=require("@radix-ui/react-icons"),k=require("./ChaiBuilderEditor-74s7jELl.cjs"),a1=require("sonner"),u0=require("react-i18next"),h1=require("lodash-es"),s0=require("./html-to-json-VPWiWWGH.cjs"),S2=require("lucide-react");function p0(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=p0(N);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 V0(a,t){return typeof a=="function"?a(t):a}function s2(a){return typeof a=="number"&&a>=0&&a!==1/0}function t0(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 a0(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]=a0(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 h0(a){return new Promise(t=>{setTimeout(t,a)})}function E2(a){h0(0).then(a)}function V2(a,t,h){return typeof h.structuralSharing=="function"?h.structuralSharing(a,t):h.structuralSharing!==!1?a0(a,t):t}function f0(a,t,h=0){const n=[...a,t];return h&&n.length>h?n.slice(1):n}function m0(a,t,h=0){const n=[t,...a];return h&&n.length>h?n.slice(0,-1):n}var u1,e1,B1,U2,L0=(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 L0,I1,l1,G1,Q2,x0=(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 x0;function w0(a){return Math.min(1e3*2**a,3e4)}function M2(a){return(a??"online")==="online"?z2.isOnline():!0}var n0=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 n0}function c0(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 n0(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??w0,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),h0(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 B0(){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=B0(),s1,K2,v0=(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,U,i1,Q,S,K1,p1,S1,e2,$,c1,q2,I0=(q2=class extends v0{constructor(t){super();o(this,S1);o(this,$);o(this,C1,void 0);o(this,O1,void 0);o(this,U,void 0);o(this,i1,void 0);o(this,Q,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,U,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,e(this,C1,t.state||G0(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,U).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,Q))==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||!t0(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,Q))==null||h.continue()}onOnline(){var h;const t=c(this,S).find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,Q))==null||h.continue()}addObserver(t){c(this,S).includes(t)||(c(this,S).push(t),this.clearGcTimeout(),c(this,U).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,Q)&&(c(this,p1)?c(this,Q).cancel({revert:!0}):c(this,Q).cancelRetry()),this.scheduleGc()),c(this,U).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,Q))==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,U).config).onError)==null||B.call(V,H,this),(u=(g=c(this,U).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return e(this,Q,c0({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,U).config).onSuccess)==null||B.call(V,H,this),(u=(g=c(this,U).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,Q).promise),c(this,i1)}},C1=new WeakMap,O1=new WeakMap,U=new WeakMap,i1=new WeakMap,Q=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,U).notify({query:this,type:"updated",action:t})})},q2);function G0(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,C0=(_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 I0({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,T,A1,X,r1,$2,O0=($2=class extends v0{constructor(t){super();o(this,X);o(this,Y,void 0);o(this,q1,void 0);o(this,T,void 0);o(this,A1,void 0);this.mutationId=t.mutationId,e(this,q1,t.defaultOptions),e(this,T,t.mutationCache),e(this,Y,[]),this.state=t.state||r0(),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,T).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){e(this,Y,c(this,Y).filter(h=>h!==t)),this.scheduleGc(),c(this,T).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){c(this,Y).length||(this.state.status==="pending"?this.scheduleGc():c(this,T).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,c0({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,T).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,T).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,T).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,T).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,T).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,T=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,T).notify({mutation:this,type:"updated",action:t})})},$2);function r0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var K,_1,V1,J2,S0=(J2=class extends W1{constructor(t={}){super();o(this,K,void 0);o(this,_1,void 0);o(this,V1,void 0);this.config=t,e(this,K,[]),e(this,_1,0)}build(t,h,n){const v=new O0({mutationCache:this,mutationId:++r2(this,_1)._,options:t.defaultMutationOptions(h),state:n});return this.add(v),v}add(t){c(this,K).push(t),this.notify({type:"added",mutation:t})}remove(t){e(this,K,c(this,K).filter(h=>h!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{c(this,K).forEach(t=>{this.remove(t)})})}getAll(){return c(this,K)}find(t){const h={exact:!0,...t};return c(this,K).find(n=>F2(h,n))}findAll(t={}){return c(this,K).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,K).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)}},K=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function A0(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?m0:f0;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?y0: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 y0(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,b0=(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 C0),e(this,o1,a.mutationCache||new S0),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=V0(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=A0(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),E,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,e0,Y2,P0=(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,E,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,E,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,E).defaultQueryOptions(t),o2(n,this.options)||c(this,E).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,E).getQueryCache().build(c(this,E),t),n=this.createResult(h,t);return F0(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,E).defaultQueryOptions(t),n=c(this,E).getQueryCache().build(c(this,E),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,e0).call(this,{...v,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,x2).call(this)}},E=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=t0(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,E).getQueryCache().build(c(this,E),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,e0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(h=>{h(c(this,P))}),c(this,E).getQueryCache().notify({query:c(this,L),type:"observerResultsUpdated"})})},Y2);function R0(a,t){return t.enabled!==!1&&!a.state.dataUpdatedAt&&!(a.state.status==="error"&&t.retryOnMount===!1)}function N2(a,t){return R0(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 F0(a,t){return!o2(a.getCurrentResult(),t)}var M1,D,q,v1,T1,l2,n2,C2,X2,D0=(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,q,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,q),observer:this}),(n=c(this,q))==null||n.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,q))==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,q,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,q))==null||n.removeObserver(this),e(this,q,c(this,M1).getMutationCache().build(c(this,M1),this.options)),c(this,q).addObserver(this),c(this,q).execute(t)}},M1=new WeakMap,D=new WeakMap,q=new WeakMap,v1=new WeakMap,T1=new WeakSet,l2=function(){var h;const t=((h=c(this,q))==null?void 0:h.state)??r0();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 l0=A.createContext(void 0),W=a=>{const t=A.useContext(l0);if(a)return a;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},k0=({client:a,children:t})=>(A.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),A.createElement(l0.Provider,{value:a},t)),i0=A.createContext(!1),E0=()=>A.useContext(i0),I4=i0.Provider;function T0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var N0=A.createContext(T0()),W0=()=>A.useContext(N0);function o0(a,t){return typeof a=="function"?a(...t):!!a}var j0=(a,t)=>{(a.suspense||a.throwOnError)&&(t.isReset()||(a.retryOnMount=!1))},U0=a=>{A.useEffect(()=>{a.clearReset()},[a])},Q0=({result:a,errorResetBoundary:t,throwOnError:h,query:n})=>a.isError&&!t.isReset()&&!a.isFetching&&o0(h,[a.error,n]);var K0=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)};var q0=(a,t)=>(a==null?void 0:a.suspense)&&t.isPending,_0=(a,t,h)=>t.fetchOptimistic(a).catch(()=>{h.clearReset()});function $0(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=W(h),v=E0(),r=W0(),i=n.defaultQueryOptions(a);i._optimisticResults=v?"isRestoring":"optimistic",K0(i),j0(i,r),U0(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]),q0(i,s))throw _0(i,z,r);if(Q0({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 $0(a,P0,t)}function J(a,t){const h=W(t),[n]=A.useState(()=>new D0(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(J0)},[n]);if(v.error&&o0(n.options.throwOnError,[v.error]))throw v.error;return{...v,mutate:r,mutateAsync:v.mutate}}function J0(){}function R(){return W().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 Z0(a){const t={method:"GET",headers:{"x-chai-access-token":v2()}};return fetch(a,t)}function Y0(a,t){const h={method:"POST",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function X0(a,t){const h={method:"PUT",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function t4(a,t){const h={method:"DELETE",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}const j={get:Z0,post:Y0,put:X0,delete:t4},b2=()=>{const[a,t]=H1(),h=R();return c2({queryKey:["project"],queryFn:async()=>{const{data:n}=await j.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 j.get(`${a}/pages`).then(h=>h.json());return t||[]}})},d0=()=>{const[a]=H1(),t=R();return c2({queryKey:["page_data",a],queryFn:async()=>{const{data:h}=await j.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..."})]})}),z0=(a="Project updated successfully.")=>{const t=W(),h=R();return J({mutationFn:async n=>await j.put(`${h}/project`,n).then(v=>v.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),a1.toast.success(a)}})},g0=()=>{const[a]=["SAVED"],[t,h]=H1(),n=k.useBuilderReset(),{t:v}=u0.useTranslation();return r=>a!=="SAVED"?(a1.toast.error(v("You have unsaved changes. Please save before changing the page.")),!1):t===r.uuid?!1:(n(),setTimeout(()=>h(r.uuid),100),!0)},a4=()=>{const a=W(),t=g0(),h=R();return J({mutationFn:async n=>j.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.")}})},M0=()=>{const a=R(),[t]=H1(),h=W();return J({mutationFn:async n=>j.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.")}})},h4=()=>{const a=R(),{data:t}=P2(),[h]=H1(),{data:n}=b2(),v=W();return J({mutationFn:async()=>{const r=t.find(i=>i.uuid===h).slug;return await j.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})}})},n4=()=>{const a=W(),t=R();return J({mutationFn:async h=>j.delete(`${t}/page`,h).then(n=>n.json()),onSuccess:()=>{a1.toast.success("Page deleted successfully."),a.invalidateQueries({queryKey:["pages"]})}})},c4=()=>{const a=W(),t=R();return J({mutationFn:async h=>j.post(`${t}/take-control`,{uuid:h}).then(n=>n.json()),onSuccess:(h,n)=>{a.invalidateQueries({queryKey:["page_data",n]})}})},v4=()=>{const a=R();return J({mutationFn:async()=>{const{data:t}=await j.get(`${a}/library`).then(h=>h.json());return h1.sortBy(h1.filter(t,h=>!h1.has(h,"hidden")),"group")}})},r4=()=>{const a=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:h}=await j.get(`${a}/block?uuid=${t.uuid}&format=${t.format}`).then(async n=>t.format==="html"?s0.getBlocksFromHTML(await n.text()):await n.json());return h1.set(h,"0._name",h1.capitalize(t.group)),h||[]}catch{return[]}}})},e4=()=>{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 H0(a){return k.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 l4(a){return k.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 i4=()=>{const{mutate:a,isPending:t}=c4(),[h]=H1(),{data:n}=d0(),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(l4,{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(H0,{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(k.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"})]})},o4=()=>{const a=R(),t=W();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"})}})},d4=()=>{const a=R();return c2({queryKey:["verify"],queryFn:async()=>{const t=await j.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})}})},z4=()=>{const a=R(),t=W();return J({mutationFn:async()=>{const{result:h}=await j.post(`${a}/logout`).then(n=>n.json());if(h==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},g4=({children:a})=>{const t=z4();return l.jsxRuntimeExports.jsxs(k.AlertDialog,{children:[l.jsxRuntimeExports.jsx(k.AlertDialogTrigger,{asChild:!0,children:a}),l.jsxRuntimeExports.jsxs(k.AlertDialogContent,{children:[l.jsxRuntimeExports.jsxs(k.AlertDialogHeader,{children:[l.jsxRuntimeExports.jsxs(k.AlertDialogTitle,{children:["Are you sure, you want to ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),l.jsxRuntimeExports.jsx(k.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(k.AlertDialogFooter,{children:[l.jsxRuntimeExports.jsx(k.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"]})]})]})]})},M4=()=>l.jsxRuntimeExports.jsx(g4,{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"})})}),H4=N.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-1ZzPulaC.cjs"))),u4=N.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-QUIcKWwM.cjs"))),s4=N.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-UozVUoj8.cjs"))),p4=()=>l.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),V4=()=>{const{mutate:a}=h4();return k.useBuilderProp("editable",!0)?l.jsxRuntimeExports.jsx(k.Button,{onClick:a,className:"bg-blue-600 text-white",children:"Publish"}):null},f4=a=>{var f;const{data:t,isLoading:h}=b2(),{data:n,isLoading:v}=P2(),{data:r}=d0(),{mutate:i}=z0(),{mutate:z}=M0(),[s]=H1(),p=e4(),d=v4(),x=r4(),b=R(),H=N.useCallback(async m=>await p.mutateAsync(m),[p]),V=N.useCallback(async()=>await d.mutateAsync(),[d]),B=N.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=p4}=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:i4,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:[s4],right:[V4]},sideBarComponents:{top:[{icon:i2.FileTextIcon,name:"pages",panel:H4},{icon:i2.GearIcon,name:"settings",panel:u4},...((f=a.sideBarComponents)==null?void 0:f.top)||[]],bottom:[M4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>n};return l.jsxRuntimeExports.jsx(k.ChaiBuilderEditor,{...G})},m4=({logo:a})=>{const[t,h]=N.useState(!1),[n,v]=N.useState(""),[r,i]=N.useState(""),{mutate:z,isPending:s}=o4(),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(N.Suspense,{children:a?N.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(H0,{})}),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?"})})]})})})},L4=a=>{const{data:t,isLoading:h}=d4(),n=W();return N.useEffect(()=>{n.setQueryData(["apiBaseUrl"],a.apiBaseUrl||"/api/chaibuilder")},[a.apiBaseUrl,n]),h?l.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?l.jsxRuntimeExports.jsx(f4,{...a}):l.jsxRuntimeExports.jsx(m4,{logo:a.logo})},x4=new b0,w4=a=>l.jsxRuntimeExports.jsxs(k0,{client:x4,children:[l.jsxRuntimeExports.jsx(a1.Toaster,{richColors:!0}),l.jsxRuntimeExports.jsx(L4,{...a})]});exports.ChaiBuilderStudio=w4;exports.useAddPage=a4;exports.useChangePage=g0;exports.useCurrentPage=H1;exports.useDeletePage=n4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=W;exports.useUpdatePage=M0;exports.useUpdateProject=z0;
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"),N=require("react");require("./core.cjs");const i2=require("@radix-ui/react-icons"),k=require("./ChaiBuilderEditor-EtQOC5uy.cjs"),a1=require("sonner"),u0=require("react-i18next"),h1=require("lodash-es"),s0=require("./html-to-json-VPWiWWGH.cjs"),S2=require("lucide-react");function p0(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=p0(N);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 V0(a,t){return typeof a=="function"?a(t):a}function s2(a){return typeof a=="number"&&a>=0&&a!==1/0}function t0(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 a0(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]=a0(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 h0(a){return new Promise(t=>{setTimeout(t,a)})}function E2(a){h0(0).then(a)}function V2(a,t,h){return typeof h.structuralSharing=="function"?h.structuralSharing(a,t):h.structuralSharing!==!1?a0(a,t):t}function f0(a,t,h=0){const n=[...a,t];return h&&n.length>h?n.slice(1):n}function m0(a,t,h=0){const n=[t,...a];return h&&n.length>h?n.slice(0,-1):n}var u1,e1,B1,U2,L0=(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 L0,I1,l1,G1,Q2,x0=(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 x0;function w0(a){return Math.min(1e3*2**a,3e4)}function M2(a){return(a??"online")==="online"?z2.isOnline():!0}var n0=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 n0}function c0(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 n0(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??w0,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),h0(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 B0(){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=B0(),s1,K2,v0=(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,U,i1,Q,S,K1,p1,S1,e2,$,c1,q2,I0=(q2=class extends v0{constructor(t){super();o(this,S1);o(this,$);o(this,C1,void 0);o(this,O1,void 0);o(this,U,void 0);o(this,i1,void 0);o(this,Q,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,U,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,e(this,C1,t.state||G0(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,U).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,Q))==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||!t0(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,Q))==null||h.continue()}onOnline(){var h;const t=c(this,S).find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,Q))==null||h.continue()}addObserver(t){c(this,S).includes(t)||(c(this,S).push(t),this.clearGcTimeout(),c(this,U).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,Q)&&(c(this,p1)?c(this,Q).cancel({revert:!0}):c(this,Q).cancelRetry()),this.scheduleGc()),c(this,U).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,Q))==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,U).config).onError)==null||B.call(V,H,this),(u=(g=c(this,U).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return e(this,Q,c0({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,U).config).onSuccess)==null||B.call(V,H,this),(u=(g=c(this,U).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,Q).promise),c(this,i1)}},C1=new WeakMap,O1=new WeakMap,U=new WeakMap,i1=new WeakMap,Q=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,U).notify({query:this,type:"updated",action:t})})},q2);function G0(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,C0=(_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 I0({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,T,A1,X,r1,$2,O0=($2=class extends v0{constructor(t){super();o(this,X);o(this,Y,void 0);o(this,q1,void 0);o(this,T,void 0);o(this,A1,void 0);this.mutationId=t.mutationId,e(this,q1,t.defaultOptions),e(this,T,t.mutationCache),e(this,Y,[]),this.state=t.state||r0(),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,T).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){e(this,Y,c(this,Y).filter(h=>h!==t)),this.scheduleGc(),c(this,T).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){c(this,Y).length||(this.state.status==="pending"?this.scheduleGc():c(this,T).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,c0({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,T).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,T).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,T).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,T).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,T).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,T=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,T).notify({mutation:this,type:"updated",action:t})})},$2);function r0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var K,_1,V1,J2,S0=(J2=class extends W1{constructor(t={}){super();o(this,K,void 0);o(this,_1,void 0);o(this,V1,void 0);this.config=t,e(this,K,[]),e(this,_1,0)}build(t,h,n){const v=new O0({mutationCache:this,mutationId:++r2(this,_1)._,options:t.defaultMutationOptions(h),state:n});return this.add(v),v}add(t){c(this,K).push(t),this.notify({type:"added",mutation:t})}remove(t){e(this,K,c(this,K).filter(h=>h!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{c(this,K).forEach(t=>{this.remove(t)})})}getAll(){return c(this,K)}find(t){const h={exact:!0,...t};return c(this,K).find(n=>F2(h,n))}findAll(t={}){return c(this,K).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,K).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)}},K=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function A0(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?m0:f0;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?y0: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 y0(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,b0=(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 C0),e(this,o1,a.mutationCache||new S0),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=V0(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=A0(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),E,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,e0,Y2,P0=(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,E,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,E,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,E).defaultQueryOptions(t),o2(n,this.options)||c(this,E).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,E).getQueryCache().build(c(this,E),t),n=this.createResult(h,t);return F0(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,E).defaultQueryOptions(t),n=c(this,E).getQueryCache().build(c(this,E),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,e0).call(this,{...v,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,x2).call(this)}},E=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=t0(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,E).getQueryCache().build(c(this,E),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,e0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(h=>{h(c(this,P))}),c(this,E).getQueryCache().notify({query:c(this,L),type:"observerResultsUpdated"})})},Y2);function R0(a,t){return t.enabled!==!1&&!a.state.dataUpdatedAt&&!(a.state.status==="error"&&t.retryOnMount===!1)}function N2(a,t){return R0(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 F0(a,t){return!o2(a.getCurrentResult(),t)}var M1,D,q,v1,T1,l2,n2,C2,X2,D0=(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,q,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,q),observer:this}),(n=c(this,q))==null||n.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,q))==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,q,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,q))==null||n.removeObserver(this),e(this,q,c(this,M1).getMutationCache().build(c(this,M1),this.options)),c(this,q).addObserver(this),c(this,q).execute(t)}},M1=new WeakMap,D=new WeakMap,q=new WeakMap,v1=new WeakMap,T1=new WeakSet,l2=function(){var h;const t=((h=c(this,q))==null?void 0:h.state)??r0();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 l0=A.createContext(void 0),W=a=>{const t=A.useContext(l0);if(a)return a;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},k0=({client:a,children:t})=>(A.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),A.createElement(l0.Provider,{value:a},t)),i0=A.createContext(!1),E0=()=>A.useContext(i0),I4=i0.Provider;function T0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var N0=A.createContext(T0()),W0=()=>A.useContext(N0);function o0(a,t){return typeof a=="function"?a(...t):!!a}var j0=(a,t)=>{(a.suspense||a.throwOnError)&&(t.isReset()||(a.retryOnMount=!1))},U0=a=>{A.useEffect(()=>{a.clearReset()},[a])},Q0=({result:a,errorResetBoundary:t,throwOnError:h,query:n})=>a.isError&&!t.isReset()&&!a.isFetching&&o0(h,[a.error,n]);var K0=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)};var q0=(a,t)=>(a==null?void 0:a.suspense)&&t.isPending,_0=(a,t,h)=>t.fetchOptimistic(a).catch(()=>{h.clearReset()});function $0(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=W(h),v=E0(),r=W0(),i=n.defaultQueryOptions(a);i._optimisticResults=v?"isRestoring":"optimistic",K0(i),j0(i,r),U0(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]),q0(i,s))throw _0(i,z,r);if(Q0({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 $0(a,P0,t)}function J(a,t){const h=W(t),[n]=A.useState(()=>new D0(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(J0)},[n]);if(v.error&&o0(n.options.throwOnError,[v.error]))throw v.error;return{...v,mutate:r,mutateAsync:v.mutate}}function J0(){}function R(){return W().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 Z0(a){const t={method:"GET",headers:{"x-chai-access-token":v2()}};return fetch(a,t)}function Y0(a,t){const h={method:"POST",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function X0(a,t){const h={method:"PUT",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function t4(a,t){const h={method:"DELETE",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}const j={get:Z0,post:Y0,put:X0,delete:t4},b2=()=>{const[a,t]=H1(),h=R();return c2({queryKey:["project"],queryFn:async()=>{const{data:n}=await j.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 j.get(`${a}/pages`).then(h=>h.json());return t||[]}})},d0=()=>{const[a]=H1(),t=R();return c2({queryKey:["page_data",a],queryFn:async()=>{const{data:h}=await j.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..."})]})}),z0=(a="Project updated successfully.")=>{const t=W(),h=R();return J({mutationFn:async n=>await j.put(`${h}/project`,n).then(v=>v.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),a1.toast.success(a)}})},g0=()=>{const[a]=["SAVED"],[t,h]=H1(),n=k.useBuilderReset(),{t:v}=u0.useTranslation();return r=>a!=="SAVED"?(a1.toast.error(v("You have unsaved changes. Please save before changing the page.")),!1):t===r.uuid?!1:(n(),setTimeout(()=>h(r.uuid),100),!0)},a4=()=>{const a=W(),t=g0(),h=R();return J({mutationFn:async n=>j.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.")}})},M0=()=>{const a=R(),[t]=H1(),h=W();return J({mutationFn:async n=>j.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.")}})},h4=()=>{const a=R(),{data:t}=P2(),[h]=H1(),{data:n}=b2(),v=W();return J({mutationFn:async()=>{const r=t.find(i=>i.uuid===h).slug;return await j.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})}})},n4=()=>{const a=W(),t=R();return J({mutationFn:async h=>j.delete(`${t}/page`,h).then(n=>n.json()),onSuccess:()=>{a1.toast.success("Page deleted successfully."),a.invalidateQueries({queryKey:["pages"]})}})},c4=()=>{const a=W(),t=R();return J({mutationFn:async h=>j.post(`${t}/take-control`,{uuid:h}).then(n=>n.json()),onSuccess:(h,n)=>{a.invalidateQueries({queryKey:["page_data",n]})}})},v4=()=>{const a=R();return J({mutationFn:async()=>{const{data:t}=await j.get(`${a}/library`).then(h=>h.json());return h1.sortBy(h1.filter(t,h=>!h1.has(h,"hidden")),"group")}})},r4=()=>{const a=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:h}=await j.get(`${a}/block?uuid=${t.uuid}&format=${t.format}`).then(async n=>t.format==="html"?s0.getBlocksFromHTML(await n.text()):await n.json());return h1.set(h,"0._name",h1.capitalize(t.group)),h||[]}catch{return[]}}})},e4=()=>{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 H0(a){return k.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 l4(a){return k.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 i4=()=>{const{mutate:a,isPending:t}=c4(),[h]=H1(),{data:n}=d0(),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(l4,{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(H0,{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(k.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"})]})},o4=()=>{const a=R(),t=W();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"})}})},d4=()=>{const a=R();return c2({queryKey:["verify"],queryFn:async()=>{const t=await j.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})}})},z4=()=>{const a=R(),t=W();return J({mutationFn:async()=>{const{result:h}=await j.post(`${a}/logout`).then(n=>n.json());if(h==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},g4=({children:a})=>{const t=z4();return l.jsxRuntimeExports.jsxs(k.AlertDialog,{children:[l.jsxRuntimeExports.jsx(k.AlertDialogTrigger,{asChild:!0,children:a}),l.jsxRuntimeExports.jsxs(k.AlertDialogContent,{children:[l.jsxRuntimeExports.jsxs(k.AlertDialogHeader,{children:[l.jsxRuntimeExports.jsxs(k.AlertDialogTitle,{children:["Are you sure, you want to ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),l.jsxRuntimeExports.jsx(k.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(k.AlertDialogFooter,{children:[l.jsxRuntimeExports.jsx(k.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"]})]})]})]})},M4=()=>l.jsxRuntimeExports.jsx(g4,{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"})})}),H4=N.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-8Cd6UYsh.cjs"))),u4=N.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-KmnXPfxx.cjs"))),s4=N.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-9FijxWbn.cjs"))),p4=()=>l.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),V4=()=>{const{mutate:a}=h4();return k.useBuilderProp("editable",!0)?l.jsxRuntimeExports.jsx(k.Button,{onClick:a,className:"bg-blue-600 text-white",children:"Publish"}):null},f4=a=>{var f;const{data:t,isLoading:h}=b2(),{data:n,isLoading:v}=P2(),{data:r}=d0(),{mutate:i}=z0(),{mutate:z}=M0(),[s]=H1(),p=e4(),d=v4(),x=r4(),b=R(),H=N.useCallback(async m=>await p.mutateAsync(m),[p]),V=N.useCallback(async()=>await d.mutateAsync(),[d]),B=N.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=p4}=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:i4,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:[s4],right:[V4]},sideBarComponents:{top:[{icon:i2.FileTextIcon,name:"pages",panel:H4},{icon:i2.GearIcon,name:"settings",panel:u4},...((f=a.sideBarComponents)==null?void 0:f.top)||[]],bottom:[M4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>n};return l.jsxRuntimeExports.jsx(k.ChaiBuilderEditor,{...G})},m4=({logo:a})=>{const[t,h]=N.useState(!1),[n,v]=N.useState(""),[r,i]=N.useState(""),{mutate:z,isPending:s}=o4(),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(N.Suspense,{children:a?N.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(H0,{})}),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?"})})]})})})},L4=a=>{const{data:t,isLoading:h}=d4(),n=W();return N.useEffect(()=>{n.setQueryData(["apiBaseUrl"],a.apiBaseUrl||"/api/chaibuilder")},[a.apiBaseUrl,n]),h?l.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?l.jsxRuntimeExports.jsx(f4,{...a}):l.jsxRuntimeExports.jsx(m4,{logo:a.logo})},x4=new b0,w4=a=>l.jsxRuntimeExports.jsxs(k0,{client:x4,children:[l.jsxRuntimeExports.jsx(a1.Toaster,{richColors:!0}),l.jsxRuntimeExports.jsx(L4,{...a})]});exports.ChaiBuilderStudio=w4;exports.useAddPage=a4;exports.useChangePage=g0;exports.useCurrentPage=H1;exports.useDeletePage=n4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=W;exports.useUpdatePage=M0;exports.useUpdateProject=z0;
@@ -20,7 +20,7 @@ import * as b from "react";
20
20
  import H0, { lazy as A2, useCallback as g2, useState as M2, Suspense as u0, useEffect as s0 } from "react";
21
21
  import "./core.js";
22
22
  import { FileTextIcon as p0, GearIcon as V0, EyeClosedIcon as f0, EyeOpenIcon as m0 } from "@radix-ui/react-icons";
23
- import { u as L0, G as Y2, B as X2, A as x0, a as w0, b as B0, c as C0, d as O0, e as A0, f as S0, g as y0, h as b0, C as P0 } from "./ChaiBuilderEditor-wriVkIG1.js";
23
+ import { u as L0, G as Y2, B as X2, A as x0, a as w0, b as B0, c as C0, d as O0, e as A0, f as S0, g as y0, h as b0, C as P0 } from "./ChaiBuilderEditor-dKHRL-Es.js";
24
24
  import { toast as h1, Toaster as F0 } from "sonner";
25
25
  import { useTranslation as D0 } from "react-i18next";
26
26
  import { sortBy as R0, filter as k0, has as T0, set as E0, capitalize as N0, get as b2, omit as I0, size as P2 } from "lodash-es";
@@ -2043,7 +2043,7 @@ const k4 = () => {
2043
2043
  ] })
2044
2044
  ] })
2045
2045
  ] });
2046
- }, W4 = () => /* @__PURE__ */ i.jsx(I4, { children: /* @__PURE__ */ i.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ i.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-qatBt4Nf.js")), j4 = A2(() => import("./ProjectPanel-Vp-EZS_Y.js")), Q4 = A2(() => import("./CurrentPage--JhcSlGs.js")), K4 = () => /* @__PURE__ */ i.jsx("h2", { children: "Your Logo" }), G4 = () => {
2046
+ }, W4 = () => /* @__PURE__ */ i.jsx(I4, { children: /* @__PURE__ */ i.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ i.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-MsUBq9Xx.js")), j4 = A2(() => import("./ProjectPanel-hsZG_Btj.js")), Q4 = A2(() => import("./CurrentPage-U8ms8Hs7.js")), K4 = () => /* @__PURE__ */ i.jsx("h2", { children: "Your Logo" }), G4 = () => {
2047
2047
  const { mutate: a } = y4();
2048
2048
  return b0("editable", !0) ? /* @__PURE__ */ i.jsx(X2, { onClick: a, className: "bg-blue-600 text-white", children: "Publish" }) : null;
2049
2049
  }, q4 = (a) => {
package/dist/lib.cjs CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./utils-K3Zk762G.cjs"),k=require("./Functions-N3yhPYKY.cjs"),z=require("./html-to-json-VPWiWWGH.cjs"),r=require("lodash-es"),x=require("./functions-sBiIevFh.cjs"),_=require("@mhsdesign/jit-browser-tailwindcss"),v=require("./_commonjsHelpers-wDK0ZLPo.cjs"),E=require("@tailwindcss/forms"),D=require("@tailwindcss/typography"),O=require("@tailwindcss/aspect-ratio"),A=require("./STRINGS-gPz7CUOk.cjs"),L=require("tailwindcss-palette-generator");require("./MODIFIERS-YPHRtwrM.cjs");require("clsx");require("tailwind-merge");require("himalaya");const w={25:"1/4","33.33":"1/3",50:"1/2","66.67":"2/3",75:"3/4",20:"1/5",40:"2/5",60:"3/5",80:"4/5","16.67":"1/6","83.33":"5/6","8.33":"1/12","41.67":"5/12","58.33":"7/12","91.67":"11/12",100:"full"},U={0:"0",1:"px",2:"0.5",4:"1",6:"1.5",8:"2",10:"2.5",12:"3",14:"3.5",16:"4",20:"5",24:"6",28:"7",32:"8",36:"9",40:"10",44:"11",48:"12",56:"14",64:"16",80:"20",96:"24",112:"28",128:"32",144:"36",160:"40",176:"44",192:"48",208:"52",224:"56",240:"60",256:"64",288:"72",320:"80",384:"96"};const H=16,P=4;function R(e){return e.indexOf("rem")!==-1&&(e=`${parseFloat(e.replace("rem",""))*H}px`),e}const $=e=>{const o=e.match(/\[.*\]/);if(o===null)return e;const n=T.constructClassObject(e);if(n===null)return e;const{property:a}=n;let t=r.first(o).replace(/\]/i,"").replace(/\[/i,"");const s=e.replace(/\[.*\]/i,"");t=R(t);let i=e;switch(a){case"top":case"right":case"left":case"bottom":case"inset":case"insetX":case"insetY":case"gap":case"gapX":case"gapY":case"padding":case"paddingX":case"paddingY":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":case"margin":case"marginX":case"marginY":case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"flexBasis":case"width":case"height":case"maxHeight":case"textIndent":case"spaceX":case"spaceY":if(t.indexOf("px")!==-1){const p=r.map(r.keys(U),l=>`${l}px`);if(r.includes(p,t)){const l=r.parseInt(t.replace("px",""),10);l===1?i=`${s}px`:i=s+l/P}}if(t.indexOf("%")!==-1){const p=r.map(r.keys(w),l=>`${l}%`);if(r.includes(p,t)){const l=parseFloat(t.replace("%",""));i=s+r.get(w,l)}}t.indexOf("vw")!==-1&&parseFloat(t.replace("vw",""))===100&&(i=`${s}screen`),t.indexOf("vh")!==-1&&parseFloat(t.replace("vh",""))===100&&(i=`${s}screen`);break;case"minWidth":t.indexOf("%")!==-1&&parseFloat(t.replace("%",""))===100&&(i=`${s}full`),t==="0px"&&(i="min-w-0");break;case"maxWidth":t==="0px"&&(i="max-w-0");const c={"320px":"xs","384px":"sm","448px":"md","512px":"lg","576px":"xl","672px":"2xl","768px":"3xl","896px":"4xl","1024px":"5xl","1152px":"6xl","1280px":"7xl","100%":"full","65ch":"prose","640px":"screen-sm","1536px":"screen-2xl"};r.includes(r.keys(c),t)&&(i=`max-w-${c[t]}`);break;case"minHeight":t.indexOf("%")!==-1&&parseFloat(t.replace("%",""))===100&&(i=`${s}full`),t==="0px"&&(i="min-h-0"),t==="100vh"&&(i="min-h-screen");break;case"fontSize":const g={"12px":"xs","14px":"sm","16px":"base","18px":"lg","20px":"xl","24px":"2xl","30px":"3xl","36px":"4xl","48px":"5xl","60px":"6xl","72px":"7xl","96px":"8xl","128px":"9xl"};r.includes(r.keys(g),t)&&(i=s+g[t]);break;case"lineHeight":const m={"12px":"3","16px":"4","20px":"5","24px":"6","28px":"7","32px":"8","36px":"9","40px":"10",1:"none","1.25":"tight","1.375":"snug","1.5":"normal","1.625":"relaxed",2:"loose"};r.includes(r.keys(m),t)&&(i=s+m[t]);break;case"zIndex":i=["0","10","20","30","40","50"].indexOf(t)!==-1?`${s}${t}`:e;break;case"opacity":const y=["0","5","10","20","25","30","40","50","60","70","75","80","90","95","100"],d=parseFloat(t)*100;r.includes(y,d.toString())&&(i=`opacity-${d}`);break;default:break}return i};var S={},C={};(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"cloneDeep",{enumerable:!0,get:function(){return o}});function o(n){return Array.isArray(n)?n.map(a=>o(a)):typeof n=="object"&&n!==null?Object.fromEntries(Object.entries(n).map(([a,t])=>[a,o(t)])):n}})(C);var I={content:[],presets:[],darkMode:"media",theme:{accentColor:({theme:e})=>({...e("colors"),auto:"auto"}),animation:{none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},aria:{busy:'busy="true"',checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',hidden:'hidden="true"',pressed:'pressed="true"',readonly:'readonly="true"',required:'required="true"',selected:'selected="true"'},aspectRatio:{auto:"auto",square:"1 / 1",video:"16 / 9"},backdropBlur:({theme:e})=>e("blur"),backdropBrightness:({theme:e})=>e("brightness"),backdropContrast:({theme:e})=>e("contrast"),backdropGrayscale:({theme:e})=>e("grayscale"),backdropHueRotate:({theme:e})=>e("hueRotate"),backdropInvert:({theme:e})=>e("invert"),backdropOpacity:({theme:e})=>e("opacity"),backdropSaturate:({theme:e})=>e("saturate"),backdropSepia:({theme:e})=>e("sepia"),backgroundColor:({theme:e})=>e("colors"),backgroundImage:{none:"none","gradient-to-t":"linear-gradient(to top, var(--tw-gradient-stops))","gradient-to-tr":"linear-gradient(to top right, var(--tw-gradient-stops))","gradient-to-r":"linear-gradient(to right, var(--tw-gradient-stops))","gradient-to-br":"linear-gradient(to bottom right, var(--tw-gradient-stops))","gradient-to-b":"linear-gradient(to bottom, var(--tw-gradient-stops))","gradient-to-bl":"linear-gradient(to bottom left, var(--tw-gradient-stops))","gradient-to-l":"linear-gradient(to left, var(--tw-gradient-stops))","gradient-to-tl":"linear-gradient(to top left, var(--tw-gradient-stops))"},backgroundOpacity:({theme:e})=>e("opacity"),backgroundPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},backgroundSize:{auto:"auto",cover:"cover",contain:"contain"},blur:{0:"0",none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},borderColor:({theme:e})=>({...e("colors"),DEFAULT:e("colors.gray.200","currentColor")}),borderOpacity:({theme:e})=>e("opacity"),borderRadius:{none:"0px",sm:"0.125rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},borderSpacing:({theme:e})=>({...e("spacing")}),borderWidth:{DEFAULT:"1px",0:"0px",2:"2px",4:"4px",8:"8px"},boxShadow:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},boxShadowColor:({theme:e})=>e("colors"),brightness:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",200:"2"},caretColor:({theme:e})=>e("colors"),colors:({colors:e})=>({inherit:e.inherit,current:e.current,transparent:e.transparent,black:e.black,white:e.white,slate:e.slate,gray:e.gray,zinc:e.zinc,neutral:e.neutral,stone:e.stone,red:e.red,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,green:e.green,emerald:e.emerald,teal:e.teal,cyan:e.cyan,sky:e.sky,blue:e.blue,indigo:e.indigo,violet:e.violet,purple:e.purple,fuchsia:e.fuchsia,pink:e.pink,rose:e.rose}),columns:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12","3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},container:{},content:{none:"none"},contrast:{0:"0",50:".5",75:".75",100:"1",125:"1.25",150:"1.5",200:"2"},cursor:{auto:"auto",default:"default",pointer:"pointer",wait:"wait",text:"text",move:"move",help:"help","not-allowed":"not-allowed",none:"none","context-menu":"context-menu",progress:"progress",cell:"cell",crosshair:"crosshair","vertical-text":"vertical-text",alias:"alias",copy:"copy","no-drop":"no-drop",grab:"grab",grabbing:"grabbing","all-scroll":"all-scroll","col-resize":"col-resize","row-resize":"row-resize","n-resize":"n-resize","e-resize":"e-resize","s-resize":"s-resize","w-resize":"w-resize","ne-resize":"ne-resize","nw-resize":"nw-resize","se-resize":"se-resize","sw-resize":"sw-resize","ew-resize":"ew-resize","ns-resize":"ns-resize","nesw-resize":"nesw-resize","nwse-resize":"nwse-resize","zoom-in":"zoom-in","zoom-out":"zoom-out"},divideColor:({theme:e})=>e("borderColor"),divideOpacity:({theme:e})=>e("borderOpacity"),divideWidth:({theme:e})=>e("borderWidth"),dropShadow:{sm:"0 1px 1px rgb(0 0 0 / 0.05)",DEFAULT:["0 1px 2px rgb(0 0 0 / 0.1)","0 1px 1px rgb(0 0 0 / 0.06)"],md:["0 4px 3px rgb(0 0 0 / 0.07)","0 2px 2px rgb(0 0 0 / 0.06)"],lg:["0 10px 8px rgb(0 0 0 / 0.04)","0 4px 3px rgb(0 0 0 / 0.1)"],xl:["0 20px 13px rgb(0 0 0 / 0.03)","0 8px 5px rgb(0 0 0 / 0.08)"],"2xl":"0 25px 25px rgb(0 0 0 / 0.15)",none:"0 0 #0000"},fill:({theme:e})=>({none:"none",...e("colors")}),flex:{1:"1 1 0%",auto:"1 1 auto",initial:"0 1 auto",none:"none"},flexBasis:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%"}),flexGrow:{0:"0",DEFAULT:"1"},flexShrink:{0:"0",DEFAULT:"1"},fontFamily:{sans:["ui-sans-serif","system-ui","-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"',"sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],serif:["ui-serif","Georgia","Cambria",'"Times New Roman"',"Times","serif"],mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"]},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontWeight:{thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},gap:({theme:e})=>e("spacing"),gradientColorStops:({theme:e})=>e("colors"),gradientColorStopPositions:{"0%":"0%","5%":"5%","10%":"10%","15%":"15%","20%":"20%","25%":"25%","30%":"30%","35%":"35%","40%":"40%","45%":"45%","50%":"50%","55%":"55%","60%":"60%","65%":"65%","70%":"70%","75%":"75%","80%":"80%","85%":"85%","90%":"90%","95%":"95%","100%":"100%"},grayscale:{0:"0",DEFAULT:"100%"},gridAutoColumns:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridAutoRows:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridColumn:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridColumnEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridColumnStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridRow:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},gridRowEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7"},gridRowStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7"},gridTemplateColumns:{none:"none",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))"},gridTemplateRows:{none:"none",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))"},height:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%",full:"100%",screen:"100vh",min:"min-content",max:"max-content",fit:"fit-content"}),hueRotate:{0:"0deg",15:"15deg",30:"30deg",60:"60deg",90:"90deg",180:"180deg"},inset:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%"}),invert:{0:"0",DEFAULT:"100%"},keyframes:{spin:{to:{transform:"rotate(360deg)"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},pulse:{"50%":{opacity:".5"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}}},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},listStyleType:{none:"none",disc:"disc",decimal:"decimal"},listStyleImage:{none:"none"},margin:({theme:e})=>({auto:"auto",...e("spacing")}),lineClamp:{1:"1",2:"2",3:"3",4:"4",5:"5",6:"6"},maxHeight:({theme:e})=>({...e("spacing"),none:"none",full:"100%",screen:"100vh",min:"min-content",max:"max-content",fit:"fit-content"}),maxWidth:({theme:e,breakpoints:o})=>({none:"none",0:"0rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",prose:"65ch",...o(e("screens"))}),minHeight:{0:"0px",full:"100%",screen:"100vh",min:"min-content",max:"max-content",fit:"fit-content"},minWidth:{0:"0px",full:"100%",min:"min-content",max:"max-content",fit:"fit-content"},objectPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},opacity:{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},order:{first:"-9999",last:"9999",none:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12"},outlineColor:({theme:e})=>e("colors"),outlineOffset:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},outlineWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},padding:({theme:e})=>e("spacing"),placeholderColor:({theme:e})=>e("colors"),placeholderOpacity:({theme:e})=>e("opacity"),ringColor:({theme:e})=>({DEFAULT:e("colors.blue.500","#3b82f6"),...e("colors")}),ringOffsetColor:({theme:e})=>e("colors"),ringOffsetWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},ringOpacity:({theme:e})=>({DEFAULT:"0.5",...e("opacity")}),ringWidth:{DEFAULT:"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},rotate:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"},saturate:{0:"0",50:".5",100:"1",150:"1.5",200:"2"},scale:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},scrollMargin:({theme:e})=>({...e("spacing")}),scrollPadding:({theme:e})=>e("spacing"),sepia:{0:"0",DEFAULT:"100%"},skew:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg"},space:({theme:e})=>({...e("spacing")}),spacing:{px:"1px",0:"0px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},stroke:({theme:e})=>({none:"none",...e("colors")}),strokeWidth:{0:"0",1:"1",2:"2"},supports:{},data:{},textColor:({theme:e})=>e("colors"),textDecorationColor:({theme:e})=>e("colors"),textDecorationThickness:{auto:"auto","from-font":"from-font",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},textIndent:({theme:e})=>({...e("spacing")}),textOpacity:({theme:e})=>e("opacity"),textUnderlineOffset:{auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},transformOrigin:{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},transitionDelay:{0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"},transitionDuration:{DEFAULT:"150ms",0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"},transitionProperty:{none:"none",all:"all",DEFAULT:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",colors:"color, background-color, border-color, text-decoration-color, fill, stroke",opacity:"opacity",shadow:"box-shadow",transform:"transform"},transitionTimingFunction:{DEFAULT:"cubic-bezier(0.4, 0, 0.2, 1)",linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},translate:({theme:e})=>({...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%"}),width:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content"}),willChange:{auto:"auto",scroll:"scroll-position",contents:"contents",transform:"transform"},zIndex:{auto:"auto",0:"0",10:"10",20:"20",30:"30",40:"40",50:"50"}},plugins:[]};(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const o=C,n=a(I);function a(s){return s&&s.__esModule?s:{default:s}}const t=(0,o.cloneDeep)(n.default.theme)})(S);let u=S;var B=(u.__esModule?u:{default:u}).default;const f=v.getDefaultExportFromCjs(B);async function F(e,o,n=[],a="c-",t=!1){const s=r.get(e,"primaryColor","#000"),i=r.get(e,"secondaryColor","#ccc"),c=r.get(e,"headingFont","Inter"),g=r.get(e,"bodyFont","Inter"),m=r.get(e,"roundedCorners","0"),h=L([{color:s,name:"primary"},{color:i,name:"secondary"}]);return`${await _.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{fontFamily:{heading:[c,...f.fontFamily.sans],body:[g,...f.fontFamily.sans]},extend:{borderRadius:{global:`${m||"0"}px`},colors:h}},plugins:[E,D,O],corePlugins:{preflight:t},...a?{prefix:`${a}`}:{}}}).generateStylesFromContent(` ${t?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./utils-K3Zk762G.cjs"),C=require("./Functions-N3yhPYKY.cjs"),P=require("./html-to-json-VPWiWWGH.cjs"),n=require("lodash-es"),g=require("./functions-yvRwasT2.cjs"),L=require("@mhsdesign/jit-browser-tailwindcss"),F=require("./_commonjsHelpers-wDK0ZLPo.cjs"),U=require("@tailwindcss/forms"),H=require("@tailwindcss/typography"),M=require("@tailwindcss/aspect-ratio"),R=require("./STRINGS-gPz7CUOk.cjs"),I=require("tailwindcss-palette-generator");require("./MODIFIERS-YPHRtwrM.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("lodash");const T={25:"1/4","33.33":"1/3",50:"1/2","66.67":"2/3",75:"3/4",20:"1/5",40:"2/5",60:"3/5",80:"4/5","16.67":"1/6","83.33":"5/6","8.33":"1/12","41.67":"5/12","58.33":"7/12","91.67":"11/12",100:"full"},B={0:"0",1:"px",2:"0.5",4:"1",6:"1.5",8:"2",10:"2.5",12:"3",14:"3.5",16:"4",20:"5",24:"6",28:"7",32:"8",36:"9",40:"10",44:"11",48:"12",56:"14",64:"16",80:"20",96:"24",112:"28",128:"32",144:"36",160:"40",176:"44",192:"48",208:"52",224:"56",240:"60",256:"64",288:"72",320:"80",384:"96"};const $=16,j=4;function q(e){return e.indexOf("rem")!==-1&&(e=`${parseFloat(e.replace("rem",""))*$}px`),e}const W=e=>{const a=e.match(/\[.*\]/);if(a===null)return e;const r=k.constructClassObject(e);if(r===null)return e;const{property:o}=r;let t=n.first(a).replace(/\]/i,"").replace(/\[/i,"");const s=e.replace(/\[.*\]/i,"");t=q(t);let i=e;switch(o){case"top":case"right":case"left":case"bottom":case"inset":case"insetX":case"insetY":case"gap":case"gapX":case"gapY":case"padding":case"paddingX":case"paddingY":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":case"margin":case"marginX":case"marginY":case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"flexBasis":case"width":case"height":case"maxHeight":case"textIndent":case"spaceX":case"spaceY":if(t.indexOf("px")!==-1){const p=n.map(n.keys(B),l=>`${l}px`);if(n.includes(p,t)){const l=n.parseInt(t.replace("px",""),10);l===1?i=`${s}px`:i=s+l/j}}if(t.indexOf("%")!==-1){const p=n.map(n.keys(T),l=>`${l}%`);if(n.includes(p,t)){const l=parseFloat(t.replace("%",""));i=s+n.get(T,l)}}t.indexOf("vw")!==-1&&parseFloat(t.replace("vw",""))===100&&(i=`${s}screen`),t.indexOf("vh")!==-1&&parseFloat(t.replace("vh",""))===100&&(i=`${s}screen`);break;case"minWidth":t.indexOf("%")!==-1&&parseFloat(t.replace("%",""))===100&&(i=`${s}full`),t==="0px"&&(i="min-w-0");break;case"maxWidth":t==="0px"&&(i="max-w-0");const x={"320px":"xs","384px":"sm","448px":"md","512px":"lg","576px":"xl","672px":"2xl","768px":"3xl","896px":"4xl","1024px":"5xl","1152px":"6xl","1280px":"7xl","100%":"full","65ch":"prose","640px":"screen-sm","1536px":"screen-2xl"};n.includes(n.keys(x),t)&&(i=`max-w-${x[t]}`);break;case"minHeight":t.indexOf("%")!==-1&&parseFloat(t.replace("%",""))===100&&(i=`${s}full`),t==="0px"&&(i="min-h-0"),t==="100vh"&&(i="min-h-screen");break;case"fontSize":const d={"12px":"xs","14px":"sm","16px":"base","18px":"lg","20px":"xl","24px":"2xl","30px":"3xl","36px":"4xl","48px":"5xl","60px":"6xl","72px":"7xl","96px":"8xl","128px":"9xl"};n.includes(n.keys(d),t)&&(i=s+d[t]);break;case"lineHeight":const m={"12px":"3","16px":"4","20px":"5","24px":"6","28px":"7","32px":"8","36px":"9","40px":"10",1:"none","1.25":"tight","1.375":"snug","1.5":"normal","1.625":"relaxed",2:"loose"};n.includes(n.keys(m),t)&&(i=s+m[t]);break;case"zIndex":i=["0","10","20","30","40","50"].indexOf(t)!==-1?`${s}${t}`:e;break;case"opacity":const f=["0","5","10","20","25","30","40","50","60","70","75","80","90","95","100"],u=parseFloat(t)*100;n.includes(f,u.toString())&&(i=`opacity-${u}`);break;default:break}return i};var S={},D={};(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"cloneDeep",{enumerable:!0,get:function(){return a}});function a(r){return Array.isArray(r)?r.map(o=>a(o)):typeof r=="object"&&r!==null?Object.fromEntries(Object.entries(r).map(([o,t])=>[o,a(t)])):r}})(D);var V={content:[],presets:[],darkMode:"media",theme:{accentColor:({theme:e})=>({...e("colors"),auto:"auto"}),animation:{none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},aria:{busy:'busy="true"',checked:'checked="true"',disabled:'disabled="true"',expanded:'expanded="true"',hidden:'hidden="true"',pressed:'pressed="true"',readonly:'readonly="true"',required:'required="true"',selected:'selected="true"'},aspectRatio:{auto:"auto",square:"1 / 1",video:"16 / 9"},backdropBlur:({theme:e})=>e("blur"),backdropBrightness:({theme:e})=>e("brightness"),backdropContrast:({theme:e})=>e("contrast"),backdropGrayscale:({theme:e})=>e("grayscale"),backdropHueRotate:({theme:e})=>e("hueRotate"),backdropInvert:({theme:e})=>e("invert"),backdropOpacity:({theme:e})=>e("opacity"),backdropSaturate:({theme:e})=>e("saturate"),backdropSepia:({theme:e})=>e("sepia"),backgroundColor:({theme:e})=>e("colors"),backgroundImage:{none:"none","gradient-to-t":"linear-gradient(to top, var(--tw-gradient-stops))","gradient-to-tr":"linear-gradient(to top right, var(--tw-gradient-stops))","gradient-to-r":"linear-gradient(to right, var(--tw-gradient-stops))","gradient-to-br":"linear-gradient(to bottom right, var(--tw-gradient-stops))","gradient-to-b":"linear-gradient(to bottom, var(--tw-gradient-stops))","gradient-to-bl":"linear-gradient(to bottom left, var(--tw-gradient-stops))","gradient-to-l":"linear-gradient(to left, var(--tw-gradient-stops))","gradient-to-tl":"linear-gradient(to top left, var(--tw-gradient-stops))"},backgroundOpacity:({theme:e})=>e("opacity"),backgroundPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},backgroundSize:{auto:"auto",cover:"cover",contain:"contain"},blur:{0:"0",none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},borderColor:({theme:e})=>({...e("colors"),DEFAULT:e("colors.gray.200","currentColor")}),borderOpacity:({theme:e})=>e("opacity"),borderRadius:{none:"0px",sm:"0.125rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},borderSpacing:({theme:e})=>({...e("spacing")}),borderWidth:{DEFAULT:"1px",0:"0px",2:"2px",4:"4px",8:"8px"},boxShadow:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},boxShadowColor:({theme:e})=>e("colors"),brightness:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5",200:"2"},caretColor:({theme:e})=>e("colors"),colors:({colors:e})=>({inherit:e.inherit,current:e.current,transparent:e.transparent,black:e.black,white:e.white,slate:e.slate,gray:e.gray,zinc:e.zinc,neutral:e.neutral,stone:e.stone,red:e.red,orange:e.orange,amber:e.amber,yellow:e.yellow,lime:e.lime,green:e.green,emerald:e.emerald,teal:e.teal,cyan:e.cyan,sky:e.sky,blue:e.blue,indigo:e.indigo,violet:e.violet,purple:e.purple,fuchsia:e.fuchsia,pink:e.pink,rose:e.rose}),columns:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12","3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},container:{},content:{none:"none"},contrast:{0:"0",50:".5",75:".75",100:"1",125:"1.25",150:"1.5",200:"2"},cursor:{auto:"auto",default:"default",pointer:"pointer",wait:"wait",text:"text",move:"move",help:"help","not-allowed":"not-allowed",none:"none","context-menu":"context-menu",progress:"progress",cell:"cell",crosshair:"crosshair","vertical-text":"vertical-text",alias:"alias",copy:"copy","no-drop":"no-drop",grab:"grab",grabbing:"grabbing","all-scroll":"all-scroll","col-resize":"col-resize","row-resize":"row-resize","n-resize":"n-resize","e-resize":"e-resize","s-resize":"s-resize","w-resize":"w-resize","ne-resize":"ne-resize","nw-resize":"nw-resize","se-resize":"se-resize","sw-resize":"sw-resize","ew-resize":"ew-resize","ns-resize":"ns-resize","nesw-resize":"nesw-resize","nwse-resize":"nwse-resize","zoom-in":"zoom-in","zoom-out":"zoom-out"},divideColor:({theme:e})=>e("borderColor"),divideOpacity:({theme:e})=>e("borderOpacity"),divideWidth:({theme:e})=>e("borderWidth"),dropShadow:{sm:"0 1px 1px rgb(0 0 0 / 0.05)",DEFAULT:["0 1px 2px rgb(0 0 0 / 0.1)","0 1px 1px rgb(0 0 0 / 0.06)"],md:["0 4px 3px rgb(0 0 0 / 0.07)","0 2px 2px rgb(0 0 0 / 0.06)"],lg:["0 10px 8px rgb(0 0 0 / 0.04)","0 4px 3px rgb(0 0 0 / 0.1)"],xl:["0 20px 13px rgb(0 0 0 / 0.03)","0 8px 5px rgb(0 0 0 / 0.08)"],"2xl":"0 25px 25px rgb(0 0 0 / 0.15)",none:"0 0 #0000"},fill:({theme:e})=>({none:"none",...e("colors")}),flex:{1:"1 1 0%",auto:"1 1 auto",initial:"0 1 auto",none:"none"},flexBasis:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%"}),flexGrow:{0:"0",DEFAULT:"1"},flexShrink:{0:"0",DEFAULT:"1"},fontFamily:{sans:["ui-sans-serif","system-ui","-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto",'"Helvetica Neue"',"Arial",'"Noto Sans"',"sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],serif:["ui-serif","Georgia","Cambria",'"Times New Roman"',"Times","serif"],mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas",'"Liberation Mono"','"Courier New"',"monospace"]},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontWeight:{thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},gap:({theme:e})=>e("spacing"),gradientColorStops:({theme:e})=>e("colors"),gradientColorStopPositions:{"0%":"0%","5%":"5%","10%":"10%","15%":"15%","20%":"20%","25%":"25%","30%":"30%","35%":"35%","40%":"40%","45%":"45%","50%":"50%","55%":"55%","60%":"60%","65%":"65%","70%":"70%","75%":"75%","80%":"80%","85%":"85%","90%":"90%","95%":"95%","100%":"100%"},grayscale:{0:"0",DEFAULT:"100%"},gridAutoColumns:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridAutoRows:{auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},gridColumn:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},gridColumnEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridColumnStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12",13:"13"},gridRow:{auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},gridRowEnd:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7"},gridRowStart:{auto:"auto",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7"},gridTemplateColumns:{none:"none",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))",7:"repeat(7, minmax(0, 1fr))",8:"repeat(8, minmax(0, 1fr))",9:"repeat(9, minmax(0, 1fr))",10:"repeat(10, minmax(0, 1fr))",11:"repeat(11, minmax(0, 1fr))",12:"repeat(12, minmax(0, 1fr))"},gridTemplateRows:{none:"none",1:"repeat(1, minmax(0, 1fr))",2:"repeat(2, minmax(0, 1fr))",3:"repeat(3, minmax(0, 1fr))",4:"repeat(4, minmax(0, 1fr))",5:"repeat(5, minmax(0, 1fr))",6:"repeat(6, minmax(0, 1fr))"},height:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%",full:"100%",screen:"100vh",min:"min-content",max:"max-content",fit:"fit-content"}),hueRotate:{0:"0deg",15:"15deg",30:"30deg",60:"60deg",90:"90deg",180:"180deg"},inset:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%"}),invert:{0:"0",DEFAULT:"100%"},keyframes:{spin:{to:{transform:"rotate(360deg)"}},ping:{"75%, 100%":{transform:"scale(2)",opacity:"0"}},pulse:{"50%":{opacity:".5"}},bounce:{"0%, 100%":{transform:"translateY(-25%)",animationTimingFunction:"cubic-bezier(0.8,0,1,1)"},"50%":{transform:"none",animationTimingFunction:"cubic-bezier(0,0,0.2,1)"}}},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},listStyleType:{none:"none",disc:"disc",decimal:"decimal"},listStyleImage:{none:"none"},margin:({theme:e})=>({auto:"auto",...e("spacing")}),lineClamp:{1:"1",2:"2",3:"3",4:"4",5:"5",6:"6"},maxHeight:({theme:e})=>({...e("spacing"),none:"none",full:"100%",screen:"100vh",min:"min-content",max:"max-content",fit:"fit-content"}),maxWidth:({theme:e,breakpoints:a})=>({none:"none",0:"0rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",prose:"65ch",...a(e("screens"))}),minHeight:{0:"0px",full:"100%",screen:"100vh",min:"min-content",max:"max-content",fit:"fit-content"},minWidth:{0:"0px",full:"100%",min:"min-content",max:"max-content",fit:"fit-content"},objectPosition:{bottom:"bottom",center:"center",left:"left","left-bottom":"left bottom","left-top":"left top",right:"right","right-bottom":"right bottom","right-top":"right top",top:"top"},opacity:{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},order:{first:"-9999",last:"9999",none:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",10:"10",11:"11",12:"12"},outlineColor:({theme:e})=>e("colors"),outlineOffset:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},outlineWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},padding:({theme:e})=>e("spacing"),placeholderColor:({theme:e})=>e("colors"),placeholderOpacity:({theme:e})=>e("opacity"),ringColor:({theme:e})=>({DEFAULT:e("colors.blue.500","#3b82f6"),...e("colors")}),ringOffsetColor:({theme:e})=>e("colors"),ringOffsetWidth:{0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},ringOpacity:({theme:e})=>({DEFAULT:"0.5",...e("opacity")}),ringWidth:{DEFAULT:"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},rotate:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg",45:"45deg",90:"90deg",180:"180deg"},saturate:{0:"0",50:".5",100:"1",150:"1.5",200:"2"},scale:{0:"0",50:".5",75:".75",90:".9",95:".95",100:"1",105:"1.05",110:"1.1",125:"1.25",150:"1.5"},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},scrollMargin:({theme:e})=>({...e("spacing")}),scrollPadding:({theme:e})=>e("spacing"),sepia:{0:"0",DEFAULT:"100%"},skew:{0:"0deg",1:"1deg",2:"2deg",3:"3deg",6:"6deg",12:"12deg"},space:({theme:e})=>({...e("spacing")}),spacing:{px:"1px",0:"0px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},stroke:({theme:e})=>({none:"none",...e("colors")}),strokeWidth:{0:"0",1:"1",2:"2"},supports:{},data:{},textColor:({theme:e})=>e("colors"),textDecorationColor:({theme:e})=>e("colors"),textDecorationThickness:{auto:"auto","from-font":"from-font",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},textIndent:({theme:e})=>({...e("spacing")}),textOpacity:({theme:e})=>e("opacity"),textUnderlineOffset:{auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"},transformOrigin:{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},transitionDelay:{0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"},transitionDuration:{DEFAULT:"150ms",0:"0s",75:"75ms",100:"100ms",150:"150ms",200:"200ms",300:"300ms",500:"500ms",700:"700ms",1e3:"1000ms"},transitionProperty:{none:"none",all:"all",DEFAULT:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",colors:"color, background-color, border-color, text-decoration-color, fill, stroke",opacity:"opacity",shadow:"box-shadow",transform:"transform"},transitionTimingFunction:{DEFAULT:"cubic-bezier(0.4, 0, 0.2, 1)",linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},translate:({theme:e})=>({...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%",full:"100%"}),width:({theme:e})=>({auto:"auto",...e("spacing"),"1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%","1/12":"8.333333%","2/12":"16.666667%","3/12":"25%","4/12":"33.333333%","5/12":"41.666667%","6/12":"50%","7/12":"58.333333%","8/12":"66.666667%","9/12":"75%","10/12":"83.333333%","11/12":"91.666667%",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content"}),willChange:{auto:"auto",scroll:"scroll-position",contents:"contents",transform:"transform"},zIndex:{auto:"auto",0:"0",10:"10",20:"20",30:"30",40:"40",50:"50"}},plugins:[]};(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const a=D,r=o(V);function o(s){return s&&s.__esModule?s:{default:s}}const t=(0,a.cloneDeep)(r.default.theme)})(S);let b=S;var X=(b.__esModule?b:{default:b}).default;const _=F.getDefaultExportFromCjs(X);var E={},O={};(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});function a(o,t){return{handler:o,config:t}}a.withOptions=function(o,t=()=>({})){const s=function(i){return{__options:i,handler:o(i),config:t(i)}};return s.__isOptionsFunction=!0,s.__pluginFunction=o,s.__configFunction=t,s};const r=a})(O);(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const a=r(O);function r(t){return t&&t.__esModule?t:{default:t}}const o=a.default})(E);let h=E;var G=(h.__esModule?h:{default:h}).default;const Y=F.getDefaultExportFromCjs(G);async function z(e,a,r=[],o="c-",t=!1){const s=n.get(e,"primaryColor","#000"),i=n.get(e,"secondaryColor","#ccc"),x=n.get(e,"headingFont","Inter"),d=n.get(e,"bodyFont","Inter"),m=n.get(e,"roundedCorners","0"),w=n.get(e,"bodyBgLightColor","#fff"),f=n.get(e,"bodyBgDarkColor","#000"),u=n.get(e,"bodyTextDarkColor","#000"),p=n.get(e,"bodyTextLightColor","#fff"),l={"bg-light":w,"bg-dark":f,"text-dark":u,"text-light":p},v=I([{color:s,name:"primary"},{color:i,name:"secondary"}]);return await L.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[x,..._.fontFamily.sans],body:[d,..._.fontFamily.sans]},extend:{borderRadius:{DEFAULT:`${m||"0px"}px`},colors:{...l,...v}}},plugins:[U,H,M,Y(function({addBase:A,theme:c}){A({"h1,h2,h3,h4,h5,h6":{fontFamily:c("fontFamily.heading")},body:{fontFamily:c("fontFamily.body"),color:c("colors.text-light"),backgroundColor:c("colors.bg-light")},".dark body":{color:c("colors.text-dark"),backgroundColor:c("colors.bg-dark")}})})],corePlugins:{preflight:t},...o?{prefix:`${o}`}:{}}}).generateStylesFromContent(` ${t?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,o)}
4
- .${a}bg-clip-text{background-clip: text;-webkit-background-clip: text;} h1,h2,h3,h4,h5,h6{font-family: "${c}",${f.fontFamily.sans.join(", ")};}`}const M=(e,o)=>e.map(n=>{const a={};return Object.keys(n).forEach(t=>{r.startsWith(n[t],A.STYLES_KEY)&&(a[t]=x.addPrefixToClasses(n[t],o))}),a}),b=(e,o,n="c-",a=!1)=>{const t=x.getBrandingClasses(o,n);return F(o,[r.replace(JSON.stringify(M(e,n)),/#styles:/g,"")],t.split(" ").concat(`${n}inline-block`,`${n}w-full`,`${n}h-full`),n,a)},W=async(e,o="c-",n=!1)=>{const a=e.page.blocks;return await b(a,e.project.brandingOptions,o,n)},j=async(e,o,n="c-",a=!1)=>await b(e,o,n,a);exports.cn=T.cn;exports.generateUUID=k.generateUUID;exports.getBreakpointValue=k.getBreakpointValue;exports.getBlocksFromHTML=z.getBlocksFromHTML;exports.addPrefixToClasses=x.addPrefixToClasses;exports.convertToBlocks=x.convertToBlocks;exports.getBrandingClasses=x.getBrandingClasses;exports.convertArbitraryToTailwindClass=$;exports.getBlocksTailwindCSS=b;exports.getStylesForBlocks=j;exports.getStylesForPageData=W;exports.getTailwindCSS=F;
3
+ @tailwind utilities;`,a)}const K=(e,a)=>e.map(r=>{const o={};return Object.keys(r).forEach(t=>{n.startsWith(r[t],R.STYLES_KEY)&&(o[t]=g.addPrefixToClasses(r[t],a))}),o}),y=(e,a,r="",o=!1)=>z(a,[n.replace(JSON.stringify(K(e,r)),/#styles:/g,"")],[],r,o),N=async(e,a="",r=!1)=>{const o=e.page.blocks;return await y(o,e.project.brandingOptions,a,r)},J=async(e,a,r="",o=!0)=>await y(e,a,r,o);exports.cn=k.cn;exports.generateUUID=C.generateUUID;exports.getBreakpointValue=C.getBreakpointValue;exports.getBlocksFromHTML=P.getBlocksFromHTML;exports.addPrefixToClasses=g.addPrefixToClasses;exports.convertToBlocks=g.convertToBlocks;exports.getBrandingClasses=g.getBrandingClasses;exports.convertArbitraryToTailwindClass=W;exports.getBlocksTailwindCSS=y;exports.getStylesForBlocks=J;exports.getStylesForPageData=N;exports.getTailwindCSS=z;
package/dist/lib.d.ts CHANGED
@@ -2,13 +2,6 @@ import { ClassValue } from 'clsx';
2
2
 
3
3
  export declare const addPrefixToClasses: (classes: string, prefix?: string) => string;
4
4
 
5
- declare type BrandingOptions = {
6
- bodyTextLightColor?: string;
7
- bodyTextDarkColor?: string;
8
- bodyBgLightColor?: string;
9
- bodyBgDarkColor?: string;
10
- };
11
-
12
5
  declare type ChaiBlock = {
13
6
  _id: string;
14
7
  _type: string;
@@ -65,16 +58,23 @@ export declare function generateUUID(length?: number, chars?: string): string;
65
58
  */
66
59
  export declare const getBlocksFromHTML: (html: string) => ChaiBlock[];
67
60
 
68
- export declare const getBlocksTailwindCSS: (blocks: ChaiBlock[], brandingOptions: any, prefix?: string, includeBaseStyles?: boolean) => Promise<string>;
61
+ export declare const getBlocksTailwindCSS: (blocks: ChaiBlock[], theme: any, prefix?: string, includeBaseStyles?: boolean) => Promise<string>;
69
62
 
70
- export declare const getBrandingClasses: (brandingOptions: BrandingOptions, prefix?: string) => string;
63
+ export declare const getBrandingClasses: (brandingOptions: ThemeConfiguration, prefix?: string) => string;
71
64
 
72
65
  export declare const getBreakpointValue: (width: number) => "2XL" | "XL" | "LG" | "MD" | "SM" | "XS";
73
66
 
74
- export declare const getStylesForBlocks: (blocks: ChaiBlock[], brandingOptions: BrandingOptions, classPrefix?: string, includeBaseStyles?: boolean) => Promise<string>;
67
+ export declare const getStylesForBlocks: (blocks: ChaiBlock[], theme: ThemeConfiguration, classPrefix?: string, includeBaseStyles?: boolean) => Promise<string>;
75
68
 
76
69
  export declare const getStylesForPageData: (pageData: ChaiPageData, classPrefix?: string, includeBaseStyles?: boolean) => Promise<string>;
77
70
 
78
- export declare function getTailwindCSS(options: any, markupString: string[], safelist?: string[], prefix?: string, includeBaseStyles?: boolean): Promise<string>;
71
+ export declare function getTailwindCSS(customTheme: any, markupString: string[], safelist?: string[], prefix?: string, includeBaseStyles?: boolean): Promise<string>;
72
+
73
+ declare type ThemeConfiguration = {
74
+ bodyTextLightColor?: string;
75
+ bodyTextDarkColor?: string;
76
+ bodyBgLightColor?: string;
77
+ bodyBgDarkColor?: string;
78
+ };
79
79
 
80
80
  export { }