@chaibuilder/sdk 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +123 -21
  3. package/dist/AddBlocks-7ACJv8LW.cjs +3 -0
  4. package/dist/{AddBlocks-d10b7b87.js → AddBlocks-H7BZYHUC.js} +43 -40
  5. package/dist/BrandingOptions-5j-XszLM.cjs +1 -0
  6. package/dist/{BrandingOptions-f4ab5d9f.js → BrandingOptions-PAgY-kvj.js} +19 -22
  7. package/dist/CanvasArea-Dnm-yeus.cjs +46 -0
  8. package/dist/{CanvasArea-10356200.js → CanvasArea-zn2ox-5h.js} +492 -503
  9. package/dist/ChaiBuilderEditor-BoE-sArB.cjs +163 -0
  10. package/dist/{index-aa42febc.js → ChaiBuilderEditor-hEuUONQ3.js} +11215 -15404
  11. package/dist/Class-_uCzl5v1.cjs +1 -0
  12. package/dist/{html-to-json-45e0e3b5.js → Class-l7qYbuoN.js} +185 -366
  13. package/dist/{CurrentPage-35e14043.js → CurrentPage-6Jp4xAWK.js} +27 -24
  14. package/dist/CurrentPage-YMpqOqx7.cjs +1 -0
  15. package/dist/{ImagesPanel-8b7a989d.cjs → ImagesPanel-6us7hiLN.cjs} +1 -1
  16. package/dist/{ImagesPanel-47ac13c3.js → ImagesPanel-oaHOD-Ex.js} +4 -4
  17. package/dist/Layers-EzOZdWvd.cjs +1 -0
  18. package/dist/{Layers-c3dd4fc8.js → Layers-WkZ48AUm.js} +43 -42
  19. package/dist/{MarkAsGlobalBlock-505ae793.js → MarkAsGlobalBlock-0HubcRkY.js} +18 -21
  20. package/dist/MarkAsGlobalBlock-HmeIyLCP.cjs +1 -0
  21. package/dist/{PagesPanel-bafc506f.js → PagesPanel-6JuwBLFQ.js} +17 -14
  22. package/dist/PagesPanel-zJq8p1ja.cjs +1 -0
  23. package/dist/ProjectPanel-Zml2F8b9.cjs +1 -0
  24. package/dist/{ProjectPanel-6113f394.js → ProjectPanel-cu2QSDW9.js} +23 -20
  25. package/dist/{Settings-1c41c514.js → Settings-fH8fZKpm.js} +266 -264
  26. package/dist/Settings-lc9PfnmG.cjs +1 -0
  27. package/dist/SidePanels-VH72zFE2.cjs +1 -0
  28. package/dist/{SidePanels-c13f87dc.js → SidePanels-w8ZHKJaR.js} +34 -42
  29. package/dist/{Topbar-b38d5d50.js → Topbar-hm1D_5sb.js} +34 -36
  30. package/dist/Topbar-vQPo9xSY.cjs +1 -0
  31. package/dist/UnsplashImages-BoBBSi1a.cjs +1 -0
  32. package/dist/{UnsplashImages-4edb97e7.js → UnsplashImages-gPcBLjgB.js} +13 -14
  33. package/dist/UploadImages-T6kW0s3G.cjs +1 -0
  34. package/dist/{UploadImages-52181c3e.js → UploadImages-_ZyUU66E.js} +11 -12
  35. package/dist/{accordion-c0176dc5.js → accordion-oPUeqPCZ.js} +2 -2
  36. package/dist/{accordion-0afd8143.cjs → accordion-ynvFtV_p.cjs} +1 -1
  37. package/dist/add-page-modal--qZSwJuB.cjs +1 -0
  38. package/dist/{add-page-modal-08a19915.js → add-page-modal-bj7qbZuK.js} +27 -23
  39. package/dist/alert-dialog-GNfnpqFB.js +64 -0
  40. package/dist/alert-dialog-Mv0-wAvS.cjs +1 -0
  41. package/dist/{command-b1103666.cjs → command-ThdTuUxt.cjs} +1 -1
  42. package/dist/{command-6f260f61.js → command-VHca6CcN.js} +3 -3
  43. package/dist/confirm-alert-8EHe0OOd.cjs +1 -0
  44. package/dist/confirm-alert-b0e_BLhF.js +36 -0
  45. package/dist/{context-menu-e1c240ce.js → context-menu-8dC9uGXj.js} +2 -2
  46. package/dist/{context-menu-fec580f2.cjs → context-menu-IgLbIuth.cjs} +1 -1
  47. package/dist/controls-Ni5kEzLz.js +103 -0
  48. package/dist/controls-W97-POR_.cjs +1 -0
  49. package/dist/controls-enQY7NI8.js +118 -0
  50. package/dist/controls-xUKa23ic.cjs +1 -0
  51. package/dist/core.cjs +1 -1
  52. package/dist/core.d.ts +1 -10
  53. package/dist/core.js +117 -70
  54. package/dist/delete-page-modal-2LuDLEiP.cjs +1 -0
  55. package/dist/{delete-page-modal-9b37665b.js → delete-page-modal-cnrR8tWH.js} +26 -23
  56. package/dist/{dialog-170eaad9.cjs → dialog-S_QbL1iq.cjs} +1 -1
  57. package/dist/{dialog-18207bef.js → dialog-jrw9DF1f.js} +2 -2
  58. package/dist/{dropdown-menu-ae3ed09b.js → dropdown-menu-S03K_fNs.js} +2 -2
  59. package/dist/{dropdown-menu-84b2439e.cjs → dropdown-menu-sMXR59cB.cjs} +1 -1
  60. package/dist/{form-25e1af37.js → form-dVpOAyRl.js} +2 -2
  61. package/dist/{form-ea21db6c.cjs → form-nRAvKPQj.cjs} +1 -1
  62. package/dist/{functions-83b1de8d.js → functions-nNTuSTsR.js} +1 -1
  63. package/dist/functions-pcUZhFJM.js +12 -0
  64. package/dist/{functions-f84d5e2a.cjs → functions-sCuB7nvZ.cjs} +1 -1
  65. package/dist/functions-uw7QP2kT.cjs +1 -0
  66. package/dist/html-to-json-P6GpbcQX.cjs +1 -0
  67. package/dist/html-to-json-pdHQfRkN.js +178 -0
  68. package/dist/index-HAue58ea.cjs +1 -0
  69. package/dist/index-T4_wfKl5.js +2256 -0
  70. package/dist/index-X9ZgD09V.cjs +1 -0
  71. package/dist/index-ehKdBRUK.js +18 -0
  72. package/dist/{label-e770a087.js → label-KaP7MRrs.js} +2 -2
  73. package/dist/{label-167415e5.cjs → label-tFm8HZdb.cjs} +1 -1
  74. package/dist/lib.cjs +1 -1
  75. package/dist/lib.d.ts +20 -13
  76. package/dist/lib.js +24 -23
  77. package/dist/{link-57de608a.js → link-6o6n2Tnd.js} +4 -4
  78. package/dist/link-ece8dZGH.cjs +1 -0
  79. package/dist/page-viewer-IARz6OSp.cjs +1 -0
  80. package/dist/{page-viewer-5c733179.js → page-viewer-Y4YiaZ_m.js} +30 -27
  81. package/dist/{popover-f7addcf4.js → popover-a84pbVhQ.js} +2 -2
  82. package/dist/{popover-7cb9079b.cjs → popover-fKjgcRUx.cjs} +1 -1
  83. package/dist/{project-general-setting-d9736056.js → project-general-setting-U4S_KlhU.js} +29 -25
  84. package/dist/project-general-setting-eSl3t-VH.cjs +1 -0
  85. package/dist/{project-seo-setting-d81fc1e3.js → project-seo-setting-Ga9v_ECU.js} +18 -19
  86. package/dist/project-seo-setting-rankm1z3.cjs +1 -0
  87. package/dist/render.cjs +1 -1
  88. package/dist/render.d.ts +7 -7
  89. package/dist/render.js +36 -36
  90. package/dist/{scroll-area-bb343b86.cjs → scroll-area-FiHvy-TZ.cjs} +1 -1
  91. package/dist/{scroll-area-83bd9e8f.js → scroll-area-ewXbxc3n.js} +2 -2
  92. package/dist/{select-0e32300c.cjs → select-7bjg-rr9.cjs} +1 -1
  93. package/dist/{select-7fddd7c3.js → select-POGdEDHT.js} +2 -2
  94. package/dist/{separator-a597dba7.cjs → separator-3Civ-6hb.cjs} +1 -1
  95. package/dist/{separator-a80d065b.js → separator-SctTn0Qi.js} +2 -2
  96. package/dist/server.cjs +1 -1
  97. package/dist/server.d.ts +7 -10
  98. package/dist/server.js +1 -4
  99. package/dist/{single-page-detail-04410e64.js → single-page-detail-pAxCy_Pe.js} +69 -65
  100. package/dist/single-page-detail-yPgnu2AI.cjs +1 -0
  101. package/dist/skeleton-CU_FIbg3.js +239 -0
  102. package/dist/skeleton-JHP9zwL2.cjs +1 -0
  103. package/dist/studio.cjs +1 -0
  104. package/dist/studio.d.ts +13 -0
  105. package/dist/studio.js +39 -0
  106. package/dist/{tabs-85caa1e8.js → tabs-Gb9v5dVb.js} +2 -2
  107. package/dist/{tabs-860e37aa.cjs → tabs-iWeaaVrg.cjs} +1 -1
  108. package/dist/{textarea-a338ede6.cjs → textarea-1kZEh7ki.cjs} +1 -1
  109. package/dist/{textarea-0750bcd2.js → textarea-b2QvVhrK.js} +2 -2
  110. package/dist/{toggle-00c9d11e.js → toggle-ASJRAaGP.js} +2 -2
  111. package/dist/{toggle-b90fed97.cjs → toggle-ehNIPmme.cjs} +1 -1
  112. package/dist/ui.cjs +1 -1
  113. package/dist/ui.d.ts +72 -7
  114. package/dist/ui.js +272 -212
  115. package/dist/useAddBlock-WJc3OgG8.js +86 -0
  116. package/dist/useAddBlock-dCKRFPRU.cjs +1 -0
  117. package/dist/useAllBlocks-6hvuNuyw.cjs +1 -0
  118. package/dist/useAllBlocks-PQKYvs-e.js +20 -0
  119. package/dist/useChaiExternalData-4K9WxANa.js +6 -0
  120. package/dist/useChaiExternalData-DkyBJ81C.cjs +1 -0
  121. package/dist/useDarkMode-ZKCO_gkt.js +23 -0
  122. package/dist/useDarkMode-dV6FM6l-.cjs +1 -0
  123. package/dist/useFeatureSupport-OLwNgEZb.js +16 -0
  124. package/dist/useFeatureSupport-c9IgPW2t.cjs +1 -0
  125. package/dist/useHiddenBlocks-3MsGOJ1s.js +15 -0
  126. package/dist/useHiddenBlocks-oJuQDmTy.cjs +1 -0
  127. package/dist/useLanguage-NKKKaxVM.cjs +1 -0
  128. package/dist/useLanguage-gVC5rxO5.js +216 -0
  129. package/dist/useMarkAsGlobalBlock-X73Vny8u.js +25 -0
  130. package/dist/useMarkAsGlobalBlock-ebBVGHg4.cjs +1 -0
  131. package/dist/useUiLibraries-4hPOi8DI.js +12 -0
  132. package/dist/useUiLibraries-9FhQCpKo.cjs +1 -0
  133. package/package.json +20 -6
  134. package/dist/AddBlocks-76275943.cjs +0 -3
  135. package/dist/BrandingOptions-d3b3309a.cjs +0 -1
  136. package/dist/CanvasArea-9f94cd28.cjs +0 -46
  137. package/dist/CurrentPage-edb509db.cjs +0 -1
  138. package/dist/Layers-ecba52c1.cjs +0 -1
  139. package/dist/MarkAsGlobalBlock-3a06a159.cjs +0 -1
  140. package/dist/PagesPanel-f4329082.cjs +0 -1
  141. package/dist/ProjectPanel-ce3116d3.cjs +0 -1
  142. package/dist/Settings-b6a2bef6.cjs +0 -1
  143. package/dist/SidePanels-2cc72c0b.cjs +0 -1
  144. package/dist/Topbar-3b9db9f3.cjs +0 -1
  145. package/dist/UnsplashImages-98c085c2.cjs +0 -1
  146. package/dist/UploadImages-61ef83ad.cjs +0 -1
  147. package/dist/add-page-modal-7f9ff733.cjs +0 -1
  148. package/dist/confirm-alert-c1fdf1e4.js +0 -35
  149. package/dist/confirm-alert-e1ea5110.cjs +0 -1
  150. package/dist/delete-page-modal-7066b01f.cjs +0 -1
  151. package/dist/html-to-json-aadcbf66.cjs +0 -1
  152. package/dist/index-c535cc95.cjs +0 -164
  153. package/dist/link-24679521.cjs +0 -1
  154. package/dist/page-viewer-da99c71e.cjs +0 -1
  155. package/dist/project-general-setting-90f8416d.cjs +0 -1
  156. package/dist/project-seo-setting-6eef8387.cjs +0 -1
  157. package/dist/single-page-detail-90f49d7a.cjs +0 -1
  158. package/dist/useBuilderProp-21feb2da.js +0 -296
  159. package/dist/useBuilderProp-adacf42f.cjs +0 -1
  160. package/dist/useChaiExternalData-192c7896.js +0 -5
  161. package/dist/useChaiExternalData-a90e8aac.cjs +0 -1
  162. /package/dist/{MODIFIERS-2f19c314.js → MODIFIERS-DsEzQ3aH.js} +0 -0
  163. /package/dist/{MODIFIERS-4716c669.cjs → MODIFIERS-Fx6WAZcw.cjs} +0 -0
  164. /package/dist/{jsx-runtime-5c3ac4f7.cjs → jsx-runtime-JYMCiFoE.cjs} +0 -0
  165. /package/dist/{jsx-runtime-944c88e2.js → jsx-runtime-Sp0orL4X.js} +0 -0
  166. /package/dist/{utils-ac68b2c8.js → utils-dze1SGvB.js} +0 -0
  167. /package/dist/{utils-3c452dd0.cjs → utils-qK_SjzzV.cjs} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";var mt=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var n=(t,e,s)=>(mt(t,e,"read from private field"),s?s.call(t):e.get(t)),l=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},o=(t,e,s,r)=>(mt(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s);var ot=(t,e,s,r)=>({set _(i){o(t,e,i,s)},get _(){return n(t,e,r)}}),p=(t,e,s)=>(mt(t,e,"access private method"),s);const u=require("./jsx-runtime-JYMCiFoE.cjs"),C=require("react"),rs=require("./ChaiBuilderEditor-BoE-sArB.cjs");require("react-i18next");const xt=require("./skeleton-JHP9zwL2.cjs"),lt=require("@radix-ui/react-icons"),ee=require("sonner"),Es=require("./html-to-json-P6GpbcQX.cjs"),te=require("lodash"),kt=require("lucide-react"),ie=require("./alert-dialog-Mv0-wAvS.cjs");function Rs(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const q=Rs(C);var _e=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Be=typeof window>"u"||"Deno"in window;function G(){}function Ps(t,e){return typeof t=="function"?t(e):t}function bt(t){return typeof t=="number"&&t>=0&&t!==1/0}function ns(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Nt(t,e){const{type:s="all",exact:r,fetchStatus:i,predicate:a,queryKey:c,stale:d}=t;if(c){if(r){if(e.queryHash!==Mt(c,e.options))return!1}else if(!He(e.queryKey,c))return!1}if(s!=="all"){const y=e.isActive();if(s==="active"&&!y||s==="inactive"&&y)return!1}return!(typeof d=="boolean"&&e.isStale()!==d||typeof i<"u"&&i!==e.state.fetchStatus||a&&!a(e))}function Tt(t,e){const{exact:s,status:r,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(ze(e.options.mutationKey)!==ze(a))return!1}else if(!He(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Mt(t,e){return((e==null?void 0:e.queryKeyHashFn)||ze)(t)}function ze(t){return JSON.stringify(t,(e,s)=>vt(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}function He(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(s=>!He(t[s],e[s])):!1}function is(t,e){if(t===e)return t;const s=It(t)&&It(e);if(s||vt(t)&&vt(e)){const r=s?t.length:Object.keys(t).length,i=s?e:Object.keys(e),a=i.length,c=s?[]:{};let d=0;for(let y=0;y<a;y++){const x=s?y:i[y];c[x]=is(t[x],e[x]),c[x]===t[x]&&d++}return r===a&&d===r?t:c}return e}function ht(t,e){if(t&&!e||e&&!t)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function It(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function vt(t){if(!Lt(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const s=e.prototype;return!(!Lt(s)||!s.hasOwnProperty("isPrototypeOf"))}function Lt(t){return Object.prototype.toString.call(t)==="[object Object]"}function as(t){return new Promise(e=>{setTimeout(e,t)})}function Kt(t){as(0).then(t)}function jt(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?is(t,e):e}function Cs(t,e,s=0){const r=[...t,e];return s&&r.length>s?r.slice(1):r}function Os(t,e,s=0){const r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var ge,oe,Ce,Gt,Ss=(Gt=class extends _e{constructor(){super();l(this,ge,void 0);l(this,oe,void 0);l(this,Ce,void 0);o(this,Ce,e=>{if(!Be&&window.addEventListener){const s=()=>e();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){n(this,oe)||this.setEventListener(n(this,Ce))}onUnsubscribe(){var e;this.hasListeners()||((e=n(this,oe))==null||e.call(this),o(this,oe,void 0))}setEventListener(e){var s;o(this,Ce,e),(s=n(this,oe))==null||s.call(this),o(this,oe,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){n(this,ge)!==e&&(o(this,ge,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof n(this,ge)=="boolean"?n(this,ge):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ge=new WeakMap,oe=new WeakMap,Ce=new WeakMap,Gt),dt=new Ss,Oe,ue,Se,Vt,Fs=(Vt=class extends _e{constructor(){super();l(this,Oe,!0);l(this,ue,void 0);l(this,Se,void 0);o(this,Se,e=>{if(!Be&&window.addEventListener){const s=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){n(this,ue)||this.setEventListener(n(this,Se))}onUnsubscribe(){var e;this.hasListeners()||((e=n(this,ue))==null||e.call(this),o(this,ue,void 0))}setEventListener(e){var s;o(this,Se,e),(s=n(this,ue))==null||s.call(this),o(this,ue,e(this.setOnline.bind(this)))}setOnline(e){n(this,Oe)!==e&&(o(this,Oe,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return n(this,Oe)}},Oe=new WeakMap,ue=new WeakMap,Se=new WeakMap,Vt),ft=new Fs;function As(t){return Math.min(1e3*2**t,3e4)}function yt(t){return(t??"online")==="online"?ft.isOnline():!0}var os=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function gt(t){return t instanceof os}function us(t){let e=!1,s=0,r=!1,i,a,c;const d=new Promise((f,g)=>{a=f,c=g}),y=f=>{var g;r||(m(new os(f)),(g=t.abort)==null||g.call(t))},x=()=>{e=!0},h=()=>{e=!1},E=()=>!dt.isFocused()||t.networkMode!=="always"&&!ft.isOnline(),M=f=>{var g;r||(r=!0,(g=t.onSuccess)==null||g.call(t,f),i==null||i(),a(f))},m=f=>{var g;r||(r=!0,(g=t.onError)==null||g.call(t,f),i==null||i(),c(f))},b=()=>new Promise(f=>{var g;i=j=>{const v=r||!E();return v&&f(j),v},(g=t.onPause)==null||g.call(t)}).then(()=>{var f;i=void 0,r||(f=t.onContinue)==null||f.call(t)}),P=()=>{if(r)return;let f;try{f=t.fn()}catch(g){f=Promise.reject(g)}Promise.resolve(f).then(M).catch(g=>{var I;if(r)return;const j=t.retry??(Be?0:3),v=t.retryDelay??As,F=typeof v=="function"?v(s,g):v,Q=j===!0||typeof j=="number"&&s<j||typeof j=="function"&&j(s,g);if(e||!Q){m(g);return}s++,(I=t.onFail)==null||I.call(t,s,g),as(F).then(()=>{if(E())return b()}).then(()=>{e?m(g):P()})})};return yt(t.networkMode)?P():b().then(P),{promise:d,cancel:y,continue:()=>(i==null?void 0:i())?d:Promise.resolve(),cancelRetry:x,continueRetry:h}}function qs(){let t=[],e=0,s=h=>{h()},r=h=>{h()};const i=h=>{let E;e++;try{E=h()}finally{e--,e||d()}return E},a=h=>{e?t.push(h):Kt(()=>{s(h)})},c=h=>(...E)=>{a(()=>{h(...E)})},d=()=>{const h=t;t=[],h.length&&Kt(()=>{r(()=>{h.forEach(E=>{s(E)})})})};return{batch:i,batchCalls:c,schedule:a,setNotifyFunction:h=>{s=h},setBatchNotifyFunction:h=>{r=h}}}var S=qs(),xe,Jt,cs=(Jt=class{constructor(){l(this,xe,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bt(this.gcTime)&&o(this,xe,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Be?1/0:5*60*1e3))}clearGcTimeout(){n(this,xe)&&(clearTimeout(n(this,xe)),o(this,xe,void 0))}},xe=new WeakMap,Jt),Fe,Ae,_,ce,$,A,Ge,be,qe,ut,V,re,Wt,ks=(Wt=class extends cs{constructor(e){super();l(this,qe);l(this,V);l(this,Fe,void 0);l(this,Ae,void 0);l(this,_,void 0);l(this,ce,void 0);l(this,$,void 0);l(this,A,void 0);l(this,Ge,void 0);l(this,be,void 0);o(this,be,!1),o(this,Ge,e.defaultOptions),p(this,qe,ut).call(this,e.options),o(this,A,[]),o(this,_,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,o(this,Fe,e.state||Ms(this.options)),this.state=n(this,Fe),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!n(this,A).length&&this.state.fetchStatus==="idle"&&n(this,_).remove(this)}setData(e,s){const r=jt(this.state.data,e,this.options);return p(this,V,re).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(e,s){p(this,V,re).call(this,{type:"setState",state:e,setStateOptions:s})}cancel(e){var r;const s=n(this,ce);return(r=n(this,$))==null||r.cancel(e),s?s.then(G).catch(G):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(n(this,Fe))}isActive(){return n(this,A).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||n(this,A).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!ns(this.state.dataUpdatedAt,e)}onFocus(){var s;const e=n(this,A).find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(s=n(this,$))==null||s.continue()}onOnline(){var s;const e=n(this,A).find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(s=n(this,$))==null||s.continue()}addObserver(e){n(this,A).includes(e)||(n(this,A).push(e),this.clearGcTimeout(),n(this,_).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){n(this,A).includes(e)&&(o(this,A,n(this,A).filter(s=>s!==e)),n(this,A).length||(n(this,$)&&(n(this,be)?n(this,$).cancel({revert:!0}):n(this,$).cancelRetry()),this.scheduleGc()),n(this,_).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return n(this,A).length}invalidate(){this.state.isInvalidated||p(this,V,re).call(this,{type:"invalidate"})}fetch(e,s){var x,h,E,M;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(n(this,ce))return(x=n(this,$))==null||x.continueRetry(),n(this,ce)}if(e&&p(this,qe,ut).call(this,e),!this.options.queryFn){const m=n(this,A).find(b=>b.options.queryFn);m&&p(this,qe,ut).call(this,m.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 r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},a=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(o(this,be,!0),r.signal)})};a(i);const c=()=>this.options.queryFn?(o(this,be,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),d={fetchOptions:s,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:c};a(d),(h=this.options.behavior)==null||h.onFetch(d,this),o(this,Ae,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((E=d.fetchOptions)==null?void 0:E.meta))&&p(this,V,re).call(this,{type:"fetch",meta:(M=d.fetchOptions)==null?void 0:M.meta});const y=m=>{var b,P,f,g;gt(m)&&m.silent||p(this,V,re).call(this,{type:"error",error:m}),gt(m)||((P=(b=n(this,_).config).onError)==null||P.call(b,m,this),(g=(f=n(this,_).config).onSettled)==null||g.call(f,this.state.data,m,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return o(this,$,us({fn:d.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var b,P,f,g;if(typeof m>"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}`),y(new Error(`${this.queryHash} data is undefined`));return}this.setData(m),(P=(b=n(this,_).config).onSuccess)==null||P.call(b,m,this),(g=(f=n(this,_).config).onSettled)==null||g.call(f,m,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:y,onFail:(m,b)=>{p(this,V,re).call(this,{type:"failed",failureCount:m,error:b})},onPause:()=>{p(this,V,re).call(this,{type:"pause"})},onContinue:()=>{p(this,V,re).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode})),o(this,ce,n(this,$).promise),n(this,ce)}},Fe=new WeakMap,Ae=new WeakMap,_=new WeakMap,ce=new WeakMap,$=new WeakMap,A=new WeakMap,Ge=new WeakMap,be=new WeakMap,qe=new WeakSet,ut=function(e){this.options={...n(this,Ge),...e},this.updateGcTime(this.options.gcTime)},V=new WeakSet,re=function(e){const s=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:yt(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return gt(i)&&i.revert&&n(this,Ae)?{...n(this,Ae),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=s(this.state),S.batch(()=>{n(this,A).forEach(r=>{r.onQueryUpdate()}),n(this,_).notify({query:this,type:"updated",action:e})})},Wt);function Ms(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=typeof e<"u",r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var W,Yt,Us=(Yt=class extends _e{constructor(e={}){super();l(this,W,void 0);this.config=e,o(this,W,new Map)}build(e,s,r){const i=s.queryKey,a=s.queryHash??Mt(i,s);let c=this.get(a);return c||(c=new ks({cache:this,queryKey:i,queryHash:a,options:e.defaultQueryOptions(s),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(c)),c}add(e){n(this,W).has(e.queryHash)||(n(this,W).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const s=n(this,W).get(e.queryHash);s&&(e.destroy(),s===e&&n(this,W).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){S.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return n(this,W).get(e)}getAll(){return[...n(this,W).values()]}find(e){const s={exact:!0,...e};return this.getAll().find(r=>Nt(s,r))}findAll(e={}){const s=this.getAll();return Object.keys(e).length>0?s.filter(r=>Nt(e,r)):s}notify(e){S.batch(()=>{this.listeners.forEach(s=>{s(e)})})}onFocus(){S.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){S.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},W=new WeakMap,Yt),Y,Ve,L,ke,X,ae,Xt,Ds=(Xt=class extends cs{constructor(e){super();l(this,X);l(this,Y,void 0);l(this,Ve,void 0);l(this,L,void 0);l(this,ke,void 0);this.mutationId=e.mutationId,o(this,Ve,e.defaultOptions),o(this,L,e.mutationCache),o(this,Y,[]),this.state=e.state||ls(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...n(this,Ve),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){n(this,Y).includes(e)||(n(this,Y).push(e),this.clearGcTimeout(),n(this,L).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){o(this,Y,n(this,Y).filter(s=>s!==e)),this.scheduleGc(),n(this,L).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){n(this,Y).length||(this.state.status==="pending"?this.scheduleGc():n(this,L).remove(this))}continue(){var e;return((e=n(this,ke))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,a,c,d,y,x,h,E,M,m,b,P,f,g,j,v,F,Q,I,k;const s=()=>(o(this,ke,us({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(R,se)=>{p(this,X,ae).call(this,{type:"failed",failureCount:R,error:se})},onPause:()=>{p(this,X,ae).call(this,{type:"pause"})},onContinue:()=>{p(this,X,ae).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),n(this,ke).promise),r=this.state.status==="pending";try{if(!r){p(this,X,ae).call(this,{type:"pending",variables:e}),await((a=(i=n(this,L).config).onMutate)==null?void 0:a.call(i,e,this));const se=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,e));se!==this.state.context&&p(this,X,ae).call(this,{type:"pending",context:se,variables:e})}const R=await s();return await((x=(y=n(this,L).config).onSuccess)==null?void 0:x.call(y,R,e,this.state.context,this)),await((E=(h=this.options).onSuccess)==null?void 0:E.call(h,R,e,this.state.context)),await((m=(M=n(this,L).config).onSettled)==null?void 0:m.call(M,R,null,this.state.variables,this.state.context,this)),await((P=(b=this.options).onSettled)==null?void 0:P.call(b,R,null,e,this.state.context)),p(this,X,ae).call(this,{type:"success",data:R}),R}catch(R){try{throw await((g=(f=n(this,L).config).onError)==null?void 0:g.call(f,R,e,this.state.context,this)),await((v=(j=this.options).onError)==null?void 0:v.call(j,R,e,this.state.context)),await((Q=(F=n(this,L).config).onSettled)==null?void 0:Q.call(F,void 0,R,this.state.variables,this.state.context,this)),await((k=(I=this.options).onSettled)==null?void 0:k.call(I,void 0,R,e,this.state.context)),R}finally{p(this,X,ae).call(this,{type:"error",error:R})}}}},Y=new WeakMap,Ve=new WeakMap,L=new WeakMap,ke=new WeakMap,X=new WeakSet,ae=function(e){const s=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!yt(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=s(this.state),S.batch(()=>{n(this,Y).forEach(r=>{r.onMutationUpdate(e)}),n(this,L).notify({mutation:this,type:"updated",action:e})})},Xt);function ls(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var z,Je,ve,Zt,Qs=(Zt=class extends _e{constructor(e={}){super();l(this,z,void 0);l(this,Je,void 0);l(this,ve,void 0);this.config=e,o(this,z,[]),o(this,Je,0)}build(e,s,r){const i=new Ds({mutationCache:this,mutationId:++ot(this,Je)._,options:e.defaultMutationOptions(s),state:r});return this.add(i),i}add(e){n(this,z).push(e),this.notify({type:"added",mutation:e})}remove(e){o(this,z,n(this,z).filter(s=>s!==e)),this.notify({type:"removed",mutation:e})}clear(){S.batch(()=>{n(this,z).forEach(e=>{this.remove(e)})})}getAll(){return n(this,z)}find(e){const s={exact:!0,...e};return n(this,z).find(r=>Tt(s,r))}findAll(e={}){return n(this,z).filter(s=>Tt(e,s))}notify(e){S.batch(()=>{this.listeners.forEach(s=>{s(e)})})}resumePausedMutations(){return o(this,ve,(n(this,ve)??Promise.resolve()).then(()=>{const e=n(this,z).filter(s=>s.state.isPaused);return S.batch(()=>e.reduce((s,r)=>s.then(()=>r.continue().catch(G)),Promise.resolve()))}).then(()=>{o(this,ve,void 0)})),n(this,ve)}},z=new WeakMap,Je=new WeakMap,ve=new WeakMap,Zt);function Ns(t){return{onFetch:(e,s)=>{const r=async()=>{var b,P,f,g,j;const i=e.options,a=(f=(P=(b=e.fetchOptions)==null?void 0:b.meta)==null?void 0:P.fetchMore)==null?void 0:f.direction,c=((g=e.state.data)==null?void 0:g.pages)||[],d=((j=e.state.data)==null?void 0:j.pageParams)||[],y={pages:[],pageParams:[]};let x=!1;const h=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(e.signal.aborted?x=!0:e.signal.addEventListener("abort",()=>{x=!0}),e.signal)})},E=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),M=async(v,F,Q)=>{if(x)return Promise.reject();if(F==null&&v.pages.length)return Promise.resolve(v);const I={queryKey:e.queryKey,pageParam:F,direction:Q?"backward":"forward",meta:e.options.meta};h(I);const k=await E(I),{maxPages:R}=e.options,se=Q?Os:Cs;return{pages:se(v.pages,k,R),pageParams:se(v.pageParams,F,R)}};let m;if(a&&c.length){const v=a==="backward",F=v?Ts:Bt,Q={pages:c,pageParams:d},I=F(i,Q);m=await M(Q,I,v)}else{m=await M(y,d[0]??i.initialPageParam);const v=t??c.length;for(let F=1;F<v;F++){const Q=Bt(i,m);m=await M(m,Q)}}return m};e.options.persister?e.fetchFn=()=>{var i,a;return(a=(i=e.options).persister)==null?void 0:a.call(i,r,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s)}:e.fetchFn=r}}}function Bt(t,{pages:e,pageParams:s}){const r=e.length-1;return t.getNextPageParam(e[r],e,s[r],s)}function Ts(t,{pages:e,pageParams:s}){var r;return(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,s[0],s)}var O,le,he,Me,Ue,de,De,Qe,es,Is=(es=class{constructor(t={}){l(this,O,void 0);l(this,le,void 0);l(this,he,void 0);l(this,Me,void 0);l(this,Ue,void 0);l(this,de,void 0);l(this,De,void 0);l(this,Qe,void 0);o(this,O,t.queryCache||new Us),o(this,le,t.mutationCache||new Qs),o(this,he,t.defaultOptions||{}),o(this,Me,new Map),o(this,Ue,new Map),o(this,de,0)}mount(){ot(this,de)._++,n(this,de)===1&&(o(this,De,dt.subscribe(()=>{dt.isFocused()&&(this.resumePausedMutations(),n(this,O).onFocus())})),o(this,Qe,ft.subscribe(()=>{ft.isOnline()&&(this.resumePausedMutations(),n(this,O).onOnline())})))}unmount(){var t,e;ot(this,de)._--,n(this,de)===0&&((t=n(this,De))==null||t.call(this),o(this,De,void 0),(e=n(this,Qe))==null||e.call(this),o(this,Qe,void 0))}isFetching(t){return n(this,O).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return n(this,le).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=n(this,O).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e!==void 0?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:s})=>{const r=s.data;return[e,r]})}setQueryData(t,e,s){const r=n(this,O).find({queryKey:t}),i=r==null?void 0:r.state.data,a=Ps(e,i);if(typeof a>"u")return;const c=this.defaultQueryOptions({queryKey:t});return n(this,O).build(this,c).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return S.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){var e;return(e=n(this,O).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=n(this,O);S.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=n(this,O),r={type:"active",...t};return S.batch(()=>(s.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const s={revert:!0,...e},r=S.batch(()=>n(this,O).findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(G).catch(G)}invalidateQueries(t={},e={}){return S.batch(()=>{if(n(this,O).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const s={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(s,e)})}refetchQueries(t={},e){const s={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=S.batch(()=>n(this,O).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let a=i.fetch(void 0,s);return s.throwOnError||(a=a.catch(G)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(G)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const s=n(this,O).build(this,e);return s.isStaleByTime(e.staleTime)?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(G).catch(G)}fetchInfiniteQuery(t){return t.behavior=Ns(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(G).catch(G)}resumePausedMutations(){return n(this,le).resumePausedMutations()}getQueryCache(){return n(this,O)}getMutationCache(){return n(this,le)}getDefaultOptions(){return n(this,he)}setDefaultOptions(t){o(this,he,t)}setQueryDefaults(t,e){n(this,Me).set(ze(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...n(this,Me).values()];let s={};return e.forEach(r=>{He(t,r.queryKey)&&(s={...s,...r.defaultOptions})}),s}setMutationDefaults(t,e){n(this,Ue).set(ze(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...n(this,Ue).values()];let s={};return e.forEach(r=>{He(t,r.mutationKey)&&(s={...s,...r.defaultOptions})}),s}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...n(this,he).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Mt(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...n(this,he).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){n(this,O).clear(),n(this,le).clear()}},O=new WeakMap,le=new WeakMap,he=new WeakMap,Me=new WeakMap,Ue=new WeakMap,de=new WeakMap,De=new WeakMap,Qe=new WeakMap,es),T,w,Ne,U,je,Te,Z,We,Ie,Le,we,Ee,fe,Re,Pe,$e,Ye,wt,Xe,Et,Ze,Rt,et,Pt,tt,Ct,st,Ot,rt,St,pt,hs,ts,Ls=(ts=class extends _e{constructor(e,s){super();l(this,Pe);l(this,Ye);l(this,Xe);l(this,Ze);l(this,et);l(this,tt);l(this,st);l(this,rt);l(this,pt);l(this,T,void 0);l(this,w,void 0);l(this,Ne,void 0);l(this,U,void 0);l(this,je,void 0);l(this,Te,void 0);l(this,Z,void 0);l(this,We,void 0);l(this,Ie,void 0);l(this,Le,void 0);l(this,we,void 0);l(this,Ee,void 0);l(this,fe,void 0);l(this,Re,void 0);o(this,w,void 0),o(this,Ne,void 0),o(this,U,void 0),o(this,Re,new Set),o(this,T,e),this.options=s,o(this,Z,null),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(n(this,w).addObserver(this),_t(n(this,w),this.options)?p(this,Pe,$e).call(this):this.updateResult(),p(this,et,Pt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ft(n(this,w),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ft(n(this,w),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,tt,Ct).call(this),p(this,st,Ot).call(this),n(this,w).removeObserver(this)}setOptions(e,s){const r=this.options,i=n(this,w);if(this.options=n(this,T).defaultQueryOptions(e),ht(r,this.options)||n(this,T).getQueryCache().notify({type:"observerOptionsUpdated",query:n(this,w),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=r.queryKey),p(this,rt,St).call(this);const a=this.hasListeners();a&&$t(n(this,w),i,this.options,r)&&p(this,Pe,$e).call(this),this.updateResult(s),a&&(n(this,w)!==i||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&p(this,Ye,wt).call(this);const c=p(this,Xe,Et).call(this);a&&(n(this,w)!==i||this.options.enabled!==r.enabled||c!==n(this,fe))&&p(this,Ze,Rt).call(this,c)}getOptimisticResult(e){const s=n(this,T).getQueryCache().build(n(this,T),e),r=this.createResult(s,e);return Bs(this,r)&&(o(this,U,r),o(this,Te,this.options),o(this,je,n(this,w).state)),r}getCurrentResult(){return n(this,U)}trackResult(e){const s={};return Object.keys(e).forEach(r=>{Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:()=>(n(this,Re).add(r),e[r])})}),s}getCurrentQuery(){return n(this,w)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const s=n(this,T).defaultQueryOptions(e),r=n(this,T).getQueryCache().build(n(this,T),s);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,s))}fetch(e){return p(this,Pe,$e).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),n(this,U)))}createResult(e,s){var I;const r=n(this,w),i=this.options,a=n(this,U),c=n(this,je),d=n(this,Te),x=e!==r?e.state:n(this,Ne),{state:h}=e;let{error:E,errorUpdatedAt:M,fetchStatus:m,status:b}=h,P=!1,f;if(s._optimisticResults){const k=this.hasListeners(),R=!k&&_t(e,s),se=k&&$t(e,r,s,i);(R||se)&&(m=yt(e.options.networkMode)?"fetching":"paused",h.dataUpdatedAt||(b="pending")),s._optimisticResults==="isRestoring"&&(m="idle")}if(s.select&&typeof h.data<"u")if(a&&h.data===(c==null?void 0:c.data)&&s.select===n(this,We))f=n(this,Ie);else try{o(this,We,s.select),f=s.select(h.data),f=jt(a==null?void 0:a.data,f,s),o(this,Ie,f),o(this,Z,null)}catch(k){o(this,Z,k)}else f=h.data;if(typeof s.placeholderData<"u"&&typeof f>"u"&&b==="pending"){let k;if(a!=null&&a.isPlaceholderData&&s.placeholderData===(d==null?void 0:d.placeholderData))k=a.data;else if(k=typeof s.placeholderData=="function"?s.placeholderData((I=n(this,Le))==null?void 0:I.state.data,n(this,Le)):s.placeholderData,s.select&&typeof k<"u")try{k=s.select(k),o(this,Z,null)}catch(R){o(this,Z,R)}typeof k<"u"&&(b="success",f=jt(a==null?void 0:a.data,k,s),P=!0)}n(this,Z)&&(E=n(this,Z),f=n(this,Ie),M=Date.now(),b="error");const g=m==="fetching",j=b==="pending",v=b==="error",F=j&&g;return{status:b,fetchStatus:m,isPending:j,isSuccess:b==="success",isError:v,isInitialLoading:F,isLoading:F,data:f,dataUpdatedAt:h.dataUpdatedAt,error:E,errorUpdatedAt:M,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>x.dataUpdateCount||h.errorUpdateCount>x.errorUpdateCount,isFetching:g,isRefetching:g&&!j,isLoadingError:v&&h.dataUpdatedAt===0,isPaused:m==="paused",isPlaceholderData:P,isRefetchError:v&&h.dataUpdatedAt!==0,isStale:Ut(e,s),refetch:this.refetch}}updateResult(e){const s=n(this,U),r=this.createResult(n(this,w),this.options);if(o(this,je,n(this,w).state),o(this,Te,this.options),n(this,je).data!==void 0&&o(this,Le,n(this,w)),ht(r,s))return;o(this,U,r);const i={},a=()=>{if(!s)return!0;const{notifyOnChangeProps:c}=this.options,d=typeof c=="function"?c():c;if(d==="all"||!d&&!n(this,Re).size)return!0;const y=new Set(d??n(this,Re));return this.options.throwOnError&&y.add("error"),Object.keys(n(this,U)).some(x=>{const h=x;return n(this,U)[h]!==s[h]&&y.has(h)})};(e==null?void 0:e.listeners)!==!1&&a()&&(i.listeners=!0),p(this,pt,hs).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,et,Pt).call(this)}},T=new WeakMap,w=new WeakMap,Ne=new WeakMap,U=new WeakMap,je=new WeakMap,Te=new WeakMap,Z=new WeakMap,We=new WeakMap,Ie=new WeakMap,Le=new WeakMap,we=new WeakMap,Ee=new WeakMap,fe=new WeakMap,Re=new WeakMap,Pe=new WeakSet,$e=function(e){p(this,rt,St).call(this);let s=n(this,w).fetch(this.options,e);return e!=null&&e.throwOnError||(s=s.catch(G)),s},Ye=new WeakSet,wt=function(){if(p(this,tt,Ct).call(this),Be||n(this,U).isStale||!bt(this.options.staleTime))return;const s=ns(n(this,U).dataUpdatedAt,this.options.staleTime)+1;o(this,we,setTimeout(()=>{n(this,U).isStale||this.updateResult()},s))},Xe=new WeakSet,Et=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(n(this,w)):this.options.refetchInterval)??!1},Ze=new WeakSet,Rt=function(e){p(this,st,Ot).call(this),o(this,fe,e),!(Be||this.options.enabled===!1||!bt(n(this,fe))||n(this,fe)===0)&&o(this,Ee,setInterval(()=>{(this.options.refetchIntervalInBackground||dt.isFocused())&&p(this,Pe,$e).call(this)},n(this,fe)))},et=new WeakSet,Pt=function(){p(this,Ye,wt).call(this),p(this,Ze,Rt).call(this,p(this,Xe,Et).call(this))},tt=new WeakSet,Ct=function(){n(this,we)&&(clearTimeout(n(this,we)),o(this,we,void 0))},st=new WeakSet,Ot=function(){n(this,Ee)&&(clearInterval(n(this,Ee)),o(this,Ee,void 0))},rt=new WeakSet,St=function(){const e=n(this,T).getQueryCache().build(n(this,T),this.options);if(e===n(this,w))return;const s=n(this,w);o(this,w,e),o(this,Ne,e.state),this.hasListeners()&&(s==null||s.removeObserver(this),e.addObserver(this))},pt=new WeakSet,hs=function(e){S.batch(()=>{e.listeners&&this.listeners.forEach(s=>{s(n(this,U))}),n(this,T).getQueryCache().notify({query:n(this,w),type:"observerResultsUpdated"})})},ts);function Ks(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function _t(t,e){return Ks(t,e)||t.state.dataUpdatedAt>0&&Ft(t,e,e.refetchOnMount)}function Ft(t,e,s){if(e.enabled!==!1){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Ut(t,e)}return!1}function $t(t,e,s,r){return s.enabled!==!1&&(t!==e||r.enabled===!1)&&(!s.suspense||t.state.status!=="error")&&Ut(t,s)}function Ut(t,e){return t.isStaleByTime(e.staleTime)}function Bs(t,e){return!ht(t.getCurrentResult(),e)}var pe,N,H,ne,Ke,ct,nt,At,ss,_s=(ss=class extends _e{constructor(e,s){super();l(this,Ke);l(this,nt);l(this,pe,void 0);l(this,N,void 0);l(this,H,void 0);l(this,ne,void 0);o(this,N,void 0),o(this,pe,e),this.setOptions(s),this.bindMethods(),p(this,Ke,ct).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var r;const s=this.options;this.options=n(this,pe).defaultMutationOptions(e),ht(s,this.options)||n(this,pe).getMutationCache().notify({type:"observerOptionsUpdated",mutation:n(this,H),observer:this}),(r=n(this,H))==null||r.setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=n(this,H))==null||e.removeObserver(this)}onMutationUpdate(e){p(this,Ke,ct).call(this),p(this,nt,At).call(this,e)}getCurrentResult(){return n(this,N)}reset(){o(this,H,void 0),p(this,Ke,ct).call(this),p(this,nt,At).call(this)}mutate(e,s){var r;return o(this,ne,s),(r=n(this,H))==null||r.removeObserver(this),o(this,H,n(this,pe).getMutationCache().build(n(this,pe),this.options)),n(this,H).addObserver(this),n(this,H).execute(e)}},pe=new WeakMap,N=new WeakMap,H=new WeakMap,ne=new WeakMap,Ke=new WeakSet,ct=function(){var s;const e=((s=n(this,H))==null?void 0:s.state)??ls();o(this,N,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},nt=new WeakSet,At=function(e){S.batch(()=>{var s,r,i,a,c,d,y,x;n(this,ne)&&this.hasListeners()&&((e==null?void 0:e.type)==="success"?((r=(s=n(this,ne)).onSuccess)==null||r.call(s,e.data,n(this,N).variables,n(this,N).context),(a=(i=n(this,ne)).onSettled)==null||a.call(i,e.data,null,n(this,N).variables,n(this,N).context)):(e==null?void 0:e.type)==="error"&&((d=(c=n(this,ne)).onError)==null||d.call(c,e.error,n(this,N).variables,n(this,N).context),(x=(y=n(this,ne)).onSettled)==null||x.call(y,void 0,e.error,n(this,N).variables,n(this,N).context))),this.listeners.forEach(h=>{h(n(this,N))})})},ss),ds=q.createContext(void 0),K=t=>{const e=q.useContext(ds);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$s=({client:t,children:e})=>(q.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),q.createElement(ds.Provider,{value:t},e)),fs=q.createContext(!1),zs=()=>q.useContext(fs);fs.Provider;function Hs(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Gs=q.createContext(Hs()),Vs=()=>q.useContext(Gs);function ps(t,e){return typeof t=="function"?t(...e):!!t}var Js=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},Ws=t=>{q.useEffect(()=>{t.clearReset()},[t])},Ys=({result:t,errorResetBoundary:e,throwOnError:s,query:r})=>t.isError&&!e.isReset()&&!t.isFetching&&ps(s,[t.error,r]),Xs=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)},Zs=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,er=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tr(t,e,s){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))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 r=K(s),i=zs(),a=Vs(),c=r.defaultQueryOptions(t);c._optimisticResults=i?"isRestoring":"optimistic",Xs(c),Js(c,a),Ws(a);const[d]=q.useState(()=>new e(r,c)),y=d.getOptimisticResult(c);if(q.useSyncExternalStore(q.useCallback(x=>{const h=i?()=>{}:d.subscribe(S.batchCalls(x));return d.updateResult(),h},[d,i]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),q.useEffect(()=>{d.setOptions(c,{listeners:!1})},[c,d]),Zs(c,y))throw er(c,d,a);if(Ys({result:y,errorResetBoundary:a,throwOnError:c.throwOnError,query:d.getCurrentQuery()}))throw y.error;return c.notifyOnChangeProps?y:d.trackResult(y)}function it(t,e){return tr(t,Ls,e)}function J(t,e){const s=K(e),[r]=q.useState(()=>new _s(s,t));q.useEffect(()=>{r.setOptions(t)},[r,t]);const i=q.useSyncExternalStore(q.useCallback(c=>r.subscribe(S.batchCalls(c)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((c,d)=>{r.mutate(c,d).catch(sr)},[r]);if(i.error&&ps(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function sr(){}function D(){return K().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const me=()=>{const{data:t,refetch:e}=it({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[t,s=>{s&&(localStorage.setItem("currentPage",s||""),e())}]};let zt="";const at=()=>(zt=localStorage.getItem("__chai_at"),zt);function rr(t){const e={method:"GET",headers:{"x-chai-access-token":at()}};return fetch(t,e)}function nr(t,e){const s={method:"POST",headers:{"x-chai-access-token":at()},body:JSON.stringify(e)};return fetch(t,s)}function ir(t,e){const s={method:"PUT",headers:{"x-chai-access-token":at()},body:JSON.stringify(e)};return fetch(t,s)}function ar(t,e){const s={method:"DELETE",headers:{"x-chai-access-token":at()},body:JSON.stringify(e)};return fetch(t,s)}const B={get:rr,post:nr,put:ir,delete:ar},Dt=()=>{const[t,e]=me(),s=D();return it({queryKey:["project"],queryFn:async()=>{const{data:r}=await B.get(`${s}/project`).then(i=>i.json());if(!t&&r){const i=localStorage.getItem("currentPage");e(i||(r==null?void 0:r.homepage))}return r}})},Qt=()=>{const t=D();return it({queryKey:["pages"],queryFn:async()=>{const{data:e}=await B.get(`${t}/pages`).then(s=>s.json());return e||[]}})},ys=()=>{const[t]=me(),e=D();return it({queryKey:["page_data",t],queryFn:async()=>{const{data:s}=await B.get(`${e}/page?uuid=${t}`).then(r=>r.json());return s},enabled:!!t,staleTime:3e3})},qt=()=>u.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:u.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[u.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),u.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),ms=(t="Project updated successfully.")=>{const e=K(),s=D();return J({mutationFn:async r=>await B.put(`${s}/project`,r).then(i=>i.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["project"]}),ee.toast.success(t)}})},gs=()=>{const[t]=["SAVED"],[e,s]=me(),r=rs.useBuilderReset();return i=>t!=="SAVED"?(ee.toast.error("You have unsaved changes. Please save before changing the page."),!1):e===i.uuid?!1:(r(),setTimeout(()=>{s(i.uuid)},100),!0)},or=()=>{const t=K(),e=gs(),s=D();return J({mutationFn:async r=>B.post(`${s}/pages`,r).then(i=>i.json()),onSuccess:r=>{t.invalidateQueries({queryKey:["pages"]}),e({uuid:r.uuid,slug:r.slug}),ee.toast.success("Page added successfully.")}})},xs=()=>{const t=D(),[e]=me(),s=K();return J({mutationFn:async r=>B.put(`${t}/page`,r).then(i=>i.json()),onSuccess:async r=>{var i;if(r.result==="error"&&((i=r.error)==null?void 0:i.code)=="PAGE_LOCKED"){s.invalidateQueries({queryKey:["page_data",e]});return}ee.toast.success("Page saved successfully.")}})},ur=()=>{const t=D(),{data:e}=Qt(),[s]=me(),{data:r}=Dt(),i=K();return J({mutationFn:async()=>{const a=e.find(c=>c.uuid===s).slug;return await B.post(`${t}/publish`,{slug:a,uuid:s,isHomepage:(r==null?void 0:r.homepage)===s}).then(c=>c.json())},onSuccess:async a=>{var c;if(a.result==="error"&&((c=a.error)==null?void 0:c.code)=="PAGE_LOCKED"){i.invalidateQueries({queryKey:["page_data",s]});return}ee.toast.success("Page published successfully.",{position:"top-right",duration:2e3})}})},cr=()=>{const t=K(),e=D();return J({mutationFn:async s=>B.delete(`${e}/page`,s).then(r=>r.json()),onSuccess:()=>{ee.toast.success("Page deleted successfully."),t.invalidateQueries({queryKey:["pages"]})}})},lr=()=>{const t=K(),e=D();return J({mutationFn:async s=>B.post(`${e}/take-control`,{uuid:s}).then(r=>r.json()),onSuccess:(s,r)=>{t.invalidateQueries({queryKey:["page_data",r]})}})},hr=()=>{const t=D();return J({mutationFn:async()=>{const{data:e}=await B.get(`${t}/library`).then(s=>s.json());return te.sortBy(te.filter(e,s=>!te.has(s,"hidden")),"group")}})},dr=()=>{const t=D();return J({mutationFn:async e=>{if(!e||!e.uuid)return[];try{const{data:s}=await B.get(`${t}/block?uuid=${e.uuid}&format=${e.format}`).then(async r=>e.format==="html"?Es.getBlocksFromHTML(await r.text()):await r.json());return te.set(s,"0._name",te.capitalize(e.group)),s||[]}catch{return[]}}})},fr=()=>{const t=D();return J({mutationFn:async e=>{const s=new FormData;s.append("file",e);const{data:r}=await fetch(`${t}/upload`,{method:"POST",headers:{"x-chai-access-token":at()},body:s}).then(i=>i.json());return r}})};var bs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ht=C.createContext&&C.createContext(bs),ye=function(){return ye=Object.assign||function(t){for(var e,s=1,r=arguments.length;s<r;s++){e=arguments[s];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ye.apply(this,arguments)},pr=function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(s[r[i]]=t[r[i]]);return s};function vs(t){return t&&t.map(function(e,s){return C.createElement(e.tag,ye({key:s},e.attr),vs(e.child))})}function js(t){return function(e){return C.createElement(yr,ye({attr:ye({},t.attr)},e),vs(t.child))}}function yr(t){var e=function(s){var r=t.attr,i=t.size,a=t.title,c=pr(t,["attr","size","title"]),d=i||s.size||"1em",y;return s.className&&(y=s.className),t.className&&(y=(y?y+" ":"")+t.className),C.createElement("svg",ye({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,r,c,{className:y,style:ye(ye({color:t.color||s.color},s.style),t.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),a&&C.createElement("title",null,a),t.children)};return Ht!==void 0?C.createElement(Ht.Consumer,null,function(s){return e(s)}):e(bs)}function ws(t){return js({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"}}]})(t)}function mr(t){return js({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"}}]})(t)}const gr=()=>{const{mutate:t,isPending:e}=lr(),[s]=me(),{data:r}=ys(),i=te.get(r,"lockedBy.name",""),a=te.get(r,"lockedBy.email","");return u.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:[u.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),u.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",u.jsxRuntimeExports.jsx("br",{}),u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[u.jsxRuntimeExports.jsx(mr,{className:"w-4 h-4 text-gray-500"})," ",i]}),u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[u.jsxRuntimeExports.jsx(ws,{className:"w-4 h-4 text-gray-500"})," ",a]})]}),u.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",i," will be ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),u.jsxRuntimeExports.jsx(xt.Button,{disabled:e,onClick:()=>t(s),className:`w-36 ${e?"bg-transparent shadow-none hover:bg-transparent":""}`,children:e?u.jsxRuntimeExports.jsx(kt.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},xr=()=>{const t=D(),e=K();return J({mutationFn:async s=>{const r=await fetch(`${t}/login`,{method:"POST",body:JSON.stringify(s)});if(r.ok)return await r.json();throw r.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:s=>{const{data:r}=s;if(!r.accessToken){ee.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",r.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(te.omit(r,["accessToken"]))),e.invalidateQueries({queryKey:["verify"]}),ee.toast.success("Logged in successfully.")},onError:()=>{ee.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},br=()=>{const t=D();return it({queryKey:["verify"],queryFn:async()=>{const e=await B.get(`${t}/verify`);return e.ok?(await e.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},vr=()=>{const t=D(),e=K();return J({mutationFn:async()=>{const{result:s}=await B.post(`${t}/logout`).then(r=>r.json());if(s==="success")return localStorage.clear(),e.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},jr=({children:t})=>{const e=vr();return u.jsxRuntimeExports.jsxs(ie.AlertDialog,{children:[u.jsxRuntimeExports.jsx(ie.AlertDialogTrigger,{asChild:!0,children:t}),u.jsxRuntimeExports.jsxs(ie.AlertDialogContent,{children:[u.jsxRuntimeExports.jsxs(ie.AlertDialogHeader,{children:[u.jsxRuntimeExports.jsxs(ie.AlertDialogTitle,{children:["Are you sure, you want to ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),u.jsxRuntimeExports.jsx(ie.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"})]}),u.jsxRuntimeExports.jsxs(ie.AlertDialogFooter,{children:[u.jsxRuntimeExports.jsx(ie.AlertDialogCancel,{disabled:e.isPending,children:"Cancel"}),u.jsxRuntimeExports.jsxs("button",{disabled:e.isPending,onClick:()=>e.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:[e.isPending&&u.jsxRuntimeExports.jsx(kt.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},wr=()=>u.jsxRuntimeExports.jsx(jr,{children:u.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:u.jsxRuntimeExports.jsx(kt.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),Er=wr,Rr=C.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-zJq8p1ja.cjs"))),Pr=C.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-Zml2F8b9.cjs"))),Cr=C.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-YMpqOqx7.cjs"))),Or=()=>u.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),Sr=()=>{const{mutate:t}=ur();return xt.useBuilderProp("editable",!0)?u.jsxRuntimeExports.jsx(xt.Button,{onClick:t,className:"bg-blue-600 text-white",children:"Publish"}):null},Fr=t=>{const{data:e,isLoading:s}=Dt(),{data:r,isLoading:i}=Qt(),{data:a}=ys(),{mutate:c}=ms(),{mutate:d}=xs(),[y]=me(),x=fr(),h=hr(),E=dr(),M=D(),m=C.useCallback(async j=>await x.mutateAsync(j),[x]),b=C.useCallback(async()=>await h.mutateAsync(),[h]),P=C.useCallback(async j=>await E.mutateAsync(j),[E]),f=async(j=20,v=0)=>{const F=`limit=${j}&offset=${v}`;return await fetch(`${M}/assets?${F}`).then(Q=>Q.json())},{logo:g=Or}=t;return s||!e?u.jsxRuntimeExports.jsx(qt,{}):i||!r?u.jsxRuntimeExports.jsx(qt,{}):u.jsxRuntimeExports.jsx("div",{className:"bg-background text-foreground",children:u.jsxRuntimeExports.jsx(rs.ChaiBuilderEditor,{editable:a!=null&&a.lockedBy?a==null?void 0:a.lockedBy.self:!0,nonEditableComponent:gr,blocks:(a==null?void 0:a.blocks)||[],brandingOptions:e.brandingOptions,darkMode:t.darkMode||!1,dataProviders:(a==null?void 0:a.providers)||[],onSavePage:async({blocks:j,providers:v})=>(await d({blocks:j,providers:v,uuid:y}),!0),onSaveBrandingOptions:async j=>(await c({brandingOptions:j}),!0),topBarComponents:{left:[g],center:[Cr],right:[Sr]},sideBarComponents:{top:[{icon:lt.FileTextIcon,name:"pages",panel:Rr},{icon:lt.GearIcon,name:"settings",panel:Pr}],bottom:[Er]},uploadMediaCallback:m,fetchMediaCallback:f,getUILibraryBlocks:b,getExternalPredefinedBlock:P,getPages:()=>r,unsplashAccessKey:t.unsplashAccessKey||""})})},Ar=({logo:t})=>{const[e,s]=C.useState(!1),[r,i]=C.useState(""),[a,c]=C.useState(""),{mutate:d,isPending:y}=xr(),x=h=>{h.preventDefault(),d({email:r,password:a})};return u.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:u.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:u.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[u.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[u.jsxRuntimeExports.jsx(C.Suspense,{children:t?C.createElement(t):""}),u.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"})]}),u.jsxRuntimeExports.jsx("div",{className:"mt-8",children:u.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:x,className:"space-y-5",children:[u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[u.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:u.jsxRuntimeExports.jsx(ws,{})}),u.jsxRuntimeExports.jsx("input",{value:r,onChange:h=>i(h.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"})]})}),u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[u.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:u.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:u.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"})})}),u.jsxRuntimeExports.jsx("input",{value:a,onChange:h=>c(h.target.value),type:e?"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"}),u.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>s(!e),children:e?u.jsxRuntimeExports.jsx(lt.EyeClosedIcon,{}):u.jsxRuntimeExports.jsx(lt.EyeOpenIcon,{})})]})}),u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsx("button",{disabled:y||te.size(r)<2||te.size(a)<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:y?"Signing in...":"Login"})})]})}),u.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:u.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},qr=t=>{const{data:e,isLoading:s}=br(),r=K();return C.useEffect(()=>{r.setQueryData(["apiBaseUrl"],t.apiBaseUrl||"/api/chaibuilder")},[t.apiBaseUrl,r]),s?u.jsxRuntimeExports.jsx(qt,{}):e!=null&&e.valid?u.jsxRuntimeExports.jsx(Fr,{...t}):u.jsxRuntimeExports.jsx(Ar,{logo:t.logo})},kr=new Is,Mr=t=>u.jsxRuntimeExports.jsxs($s,{client:kr,children:[u.jsxRuntimeExports.jsx(ee.Toaster,{richColors:!0}),u.jsxRuntimeExports.jsx(qr,{...t})]});exports.ChaiBuilderStudio=Mr;exports.useAddPage=or;exports.useChangePage=gs;exports.useCurrentPage=me;exports.useDeletePage=cr;exports.usePages=Qt;exports.useProject=Dt;exports.useQueryClient=K;exports.useUpdatePage=xs;exports.useUpdateProject=ms;
@@ -0,0 +1,18 @@
1
+ import { get as s, values as _, pick as a, keys as i, pickBy as o, endsWith as u, mapValues as y } from "lodash";
2
+ const r = {}, f = () => r, k = (t) => s(r, t, null), l = (t) => y(r[t].props, "default"), g = (t) => t.map((p) => {
3
+ if (r[p._type]) {
4
+ const e = l(p._type);
5
+ return {
6
+ ...e,
7
+ ...a(p, [...i(e), "_type", "_id", "_name", "_parent", "_bindings"]),
8
+ ...o(p, (c, n) => u(n, "_attrs"))
9
+ };
10
+ }
11
+ return p;
12
+ }), m = {}, h = () => _(m);
13
+ export {
14
+ h as A,
15
+ f as C,
16
+ g as P,
17
+ k as h
18
+ };
@@ -1,8 +1,8 @@
1
- import { j as t } from "./jsx-runtime-944c88e2.js";
1
+ import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
2
  import * as s from "react";
3
3
  import * as o from "@radix-ui/react-label";
4
4
  import { cva as m } from "class-variance-authority";
5
- import { c as i } from "./utils-ac68b2c8.js";
5
+ import { c as i } from "./utils-dze1SGvB.js";
6
6
  const l = m("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"), p = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ t.jsx(o.Root, { ref: r, className: i(l(), a), ...e }));
7
7
  p.displayName = o.Root.displayName;
8
8
  export {
@@ -1 +1 @@
1
- "use strict";const i=require("./jsx-runtime-5c3ac4f7.cjs"),c=require("react"),l=require("@radix-ui/react-label"),u=require("class-variance-authority"),d=require("./utils-3c452dd0.cjs");function n(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const m=n(c),o=n(l),b=u.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),s=m.forwardRef(({className:e,...a},t)=>i.jsxRuntimeExports.jsx(o.Root,{ref:t,className:d.cn(b(),e),...a}));s.displayName=o.Root.displayName;exports.Label=s;
1
+ "use strict";const i=require("./jsx-runtime-JYMCiFoE.cjs"),c=require("react"),l=require("@radix-ui/react-label"),u=require("class-variance-authority"),d=require("./utils-qK_SjzzV.cjs");function n(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const m=n(c),o=n(l),b=u.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),s=m.forwardRef(({className:e,...a},t)=>i.jsxRuntimeExports.jsx(o.Root,{ref:t,className:d.cn(b(),e),...a}));s.displayName=o.Root.displayName;exports.Label=s;
package/dist/lib.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./utils-3c452dd0.cjs"),r=require("./html-to-json-aadcbf66.cjs"),n=require("lodash"),l=require("./functions-f84d5e2a.cjs");require("clsx");require("tailwind-merge");require("./MODIFIERS-4716c669.cjs");require("himalaya");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");const f={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"},k={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"},b=16,S=4;function y(s){return s.indexOf("rem")!==-1&&(s=`${parseFloat(s.replace("rem",""))*b}px`),s}const V=s=>{const p=s.match(/\[.*\]/);if(p===null)return s;const o=r.constructClassObject(s);if(o===null)return s;const{property:m}=o;let e=n.first(p).replace(/\]/i,"").replace(/\[/i,"");const i=s.replace(/\[.*\]/i,"");e=y(e);let a=s;switch(m){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(e.indexOf("px")!==-1){const c=n.map(n.keys(k),t=>`${t}px`);if(n.includes(c,e)){const t=n.parseInt(e.replace("px",""),10);t===1?a=`${i}px`:a=i+t/S}}if(e.indexOf("%")!==-1){const c=n.map(n.keys(f),t=>`${t}%`);if(n.includes(c,e)){const t=parseFloat(e.replace("%",""));a=i+n.get(f,t)}}e.indexOf("vw")!==-1&&parseFloat(e.replace("vw",""))===100&&(a=`${i}screen`),e.indexOf("vh")!==-1&&parseFloat(e.replace("vh",""))===100&&(a=`${i}screen`);break;case"minWidth":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(a=`${i}full`),e==="0px"&&(a="min-w-0");break;case"maxWidth":e==="0px"&&(a="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),e)&&(a=`max-w-${x[e]}`);break;case"minHeight":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(a=`${i}full`),e==="0px"&&(a="min-h-0"),e==="100vh"&&(a="min-h-screen");break;case"fontSize":const u={"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(u),e)&&(a=i+u[e]);break;case"lineHeight":const d={"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(d),e)&&(a=i+d[e]);break;case"zIndex":a=["0","10","20","30","40","50"].indexOf(e)!==-1?`${i}${e}`:s;break;case"opacity":const h=["0","5","10","20","25","30","40","50","60","70","75","80","90","95","100"],g=parseFloat(e)*100;n.includes(h,g.toString())&&(a=`opacity-${g}`);break}return a},q=s=>({...s}),w=s=>({...s});exports.cn=T.cn;exports.generateUUID=r.generateUUID;exports.getBlocksFromHTML=r.getBlocksFromHTML;exports.getBreakpointValue=r.getBreakpointValue;exports.addPrefixToClasses=l.addPrefixToClasses;exports.getBlocksTailwindCSS=l.getBlocksTailwindCSS;exports.getBrandingClasses=l.getBrandingClasses;exports.getStylesForPageData=l.getStylesForPageData;exports.convertArbitraryToTailwindClass=V;exports.enableStyling=w;exports.setBlockProps=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("./utils-qK_SjzzV.cjs"),f=require("./functions-uw7QP2kT.cjs"),k=require("./html-to-json-P6GpbcQX.cjs"),n=require("lodash"),b=require("./Class-_uCzl5v1.cjs"),r=require("./functions-sCuB7nvZ.cjs");require("clsx");require("tailwind-merge");require("himalaya");require("./MODIFIERS-Fx6WAZcw.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");const g={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"},q={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"},y=16,S=4;function V(a){return a.indexOf("rem")!==-1&&(a=`${parseFloat(a.replace("rem",""))*y}px`),a}const w=a=>{const l=a.match(/\[.*\]/);if(l===null)return a;const p=b.constructClassObject(a);if(p===null)return a;const{property:m}=p;let e=n.first(l).replace(/\]/i,"").replace(/\[/i,"");const i=a.replace(/\[.*\]/i,"");e=V(e);let s=a;switch(m){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(e.indexOf("px")!==-1){const c=n.map(n.keys(q),t=>`${t}px`);if(n.includes(c,e)){const t=n.parseInt(e.replace("px",""),10);t===1?s=`${i}px`:s=i+t/S}}if(e.indexOf("%")!==-1){const c=n.map(n.keys(g),t=>`${t}%`);if(n.includes(c,e)){const t=parseFloat(e.replace("%",""));s=i+n.get(g,t)}}e.indexOf("vw")!==-1&&parseFloat(e.replace("vw",""))===100&&(s=`${i}screen`),e.indexOf("vh")!==-1&&parseFloat(e.replace("vh",""))===100&&(s=`${i}screen`);break;case"minWidth":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(s=`${i}full`),e==="0px"&&(s="min-w-0");break;case"maxWidth":e==="0px"&&(s="max-w-0");const o={"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(o),e)&&(s=`max-w-${o[e]}`);break;case"minHeight":e.indexOf("%")!==-1&&parseFloat(e.replace("%",""))===100&&(s=`${i}full`),e==="0px"&&(s="min-h-0"),e==="100vh"&&(s="min-h-screen");break;case"fontSize":const x={"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(x),e)&&(s=i+x[e]);break;case"lineHeight":const u={"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(u),e)&&(s=i+u[e]);break;case"zIndex":s=["0","10","20","30","40","50"].indexOf(e)!==-1?`${i}${e}`:a;break;case"opacity":const h=["0","5","10","20","25","30","40","50","60","70","75","80","90","95","100"],d=parseFloat(e)*100;n.includes(h,d.toString())&&(s=`opacity-${d}`);break}return s},O=a=>({...a}),C=a=>({...a});exports.cn=T.cn;exports.generateUUID=f.generateUUID;exports.getBreakpointValue=f.getBreakpointValue;exports.getBlocksFromHTML=k.getBlocksFromHTML;exports.addPrefixToClasses=r.addPrefixToClasses;exports.getBlocksTailwindCSS=r.getBlocksTailwindCSS;exports.getBrandingClasses=r.getBrandingClasses;exports.getStylesForPageData=r.getStylesForPageData;exports.convertArbitraryToTailwindClass=w;exports.selectable=O;exports.styling=C;
package/dist/lib.d.ts CHANGED
@@ -2,6 +2,13 @@ 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
+
5
12
  declare type ChaiBlock = {
6
13
  _id: string;
7
14
  _name?: string;
@@ -15,8 +22,8 @@ export declare type ChaiPageData = {
15
22
  blocks: ChaiBlock[];
16
23
  seoData?: Record<string, string>;
17
24
  slug?: string;
18
- name: string;
19
- providers: {
25
+ name?: string;
26
+ providers?: {
20
27
  providerKey: string;
21
28
  args: Record<string, any>;
22
29
  }[];
@@ -30,13 +37,13 @@ export declare type ChaiPageData = {
30
37
  }[];
31
38
  }[];
32
39
  project: {
33
- name: string;
34
- favicon: string;
40
+ name?: string;
41
+ favicon?: string;
35
42
  brandingOptions: Record<string, string | number>;
36
43
  seoData?: Record<string, string>;
37
- primaryLanguage: string;
38
- languages: string[];
39
- homepage: string;
44
+ primaryLanguage?: string;
45
+ languages?: string[];
46
+ homepage?: string;
40
47
  };
41
48
  };
42
49
 
@@ -44,10 +51,6 @@ export declare const cn: (...inputs: ClassValue[]) => string;
44
51
 
45
52
  export declare const convertArbitraryToTailwindClass: (className: string) => string;
46
53
 
47
- export declare const enableStyling: (attrs: Record<string, string>) => {
48
- [x: string]: string;
49
- };
50
-
51
54
  /**
52
55
  * Get the unique uuid
53
56
  */
@@ -62,13 +65,17 @@ export declare const getBlocksFromHTML: (html: string) => ChaiBlock[];
62
65
 
63
66
  export declare const getBlocksTailwindCSS: (blocks: ChaiBlock[], brandingOptions: any, prefix?: string) => Promise<string>;
64
67
 
65
- export declare const getBrandingClasses: (brandingOptions: any, prefix?: string) => string;
68
+ export declare const getBrandingClasses: (brandingOptions: BrandingOptions, prefix?: string) => string;
66
69
 
67
70
  export declare const getBreakpointValue: (width: number) => "2XL" | "XL" | "LG" | "MD" | "SM" | "XS";
68
71
 
69
72
  export declare const getStylesForPageData: (pageData: ChaiPageData, classPrefix?: string) => Promise<string>;
70
73
 
71
- export declare const setBlockProps: (attrs: Record<string, string>) => {
74
+ export declare const selectable: (attrs: Record<string, string>) => {
75
+ [x: string]: string;
76
+ };
77
+
78
+ export declare const styling: (attrs: Record<string, string>) => {
72
79
  [x: string]: string;
73
80
  };
74
81
 
package/dist/lib.js CHANGED
@@ -1,12 +1,13 @@
1
- import { c as D } from "./utils-ac68b2c8.js";
2
- import { c as b } from "./html-to-json-45e0e3b5.js";
3
- import { g as j, b as K, a as q } from "./html-to-json-45e0e3b5.js";
4
- import { first as T, includes as c, keys as p, map as g, parseInt as V, get as k } from "lodash";
5
- import { a as J, b as Q, g as Z, c as N } from "./functions-83b1de8d.js";
1
+ import { c as D } from "./utils-dze1SGvB.js";
2
+ import { g as j, a as K } from "./functions-pcUZhFJM.js";
3
+ import { g as G } from "./html-to-json-pdHQfRkN.js";
4
+ import { first as T, includes as c, keys as p, map as g, parseInt as b, get as V } from "lodash";
5
+ import { c as O } from "./Class-l7qYbuoN.js";
6
+ import { a as Q, b as Z, g as N, c as ee } from "./functions-nNTuSTsR.js";
6
7
  import "clsx";
7
8
  import "tailwind-merge";
8
- import "./MODIFIERS-2f19c314.js";
9
9
  import "himalaya";
10
+ import "./MODIFIERS-DsEzQ3aH.js";
10
11
  import "@mhsdesign/jit-browser-tailwindcss";
11
12
  import "@bobthered/tailwindcss-palette-generator";
12
13
  import "@tailwindcss/forms";
@@ -30,7 +31,7 @@ const d = {
30
31
  "58.33": "7/12",
31
32
  "91.67": "11/12",
32
33
  100: "full"
33
- }, O = {
34
+ }, k = {
34
35
  0: "0",
35
36
  1: "px",
36
37
  2: "0.5",
@@ -66,21 +67,21 @@ const d = {
66
67
  288: "72",
67
68
  320: "80",
68
69
  384: "96"
69
- }, w = 16, S = 4;
70
- function _(s) {
70
+ }, w = 16, _ = 4;
71
+ function $(s) {
71
72
  return s.indexOf("rem") !== -1 && (s = `${parseFloat(s.replace("rem", "")) * w}px`), s;
72
73
  }
73
74
  const z = (s) => {
74
75
  const r = s.match(/\[.*\]/);
75
76
  if (r === null)
76
77
  return s;
77
- const o = b(s);
78
+ const o = O(s);
78
79
  if (o === null)
79
80
  return s;
80
81
  const { property: u } = o;
81
82
  let e = T(r).replace(/\]/i, "").replace(/\[/i, "");
82
83
  const t = s.replace(/\[.*\]/i, "");
83
- e = _(e);
84
+ e = $(e);
84
85
  let a = s;
85
86
  switch (u) {
86
87
  case "top":
@@ -115,17 +116,17 @@ const z = (s) => {
115
116
  case "spaceX":
116
117
  case "spaceY":
117
118
  if (e.indexOf("px") !== -1) {
118
- const n = g(p(O), (i) => `${i}px`);
119
+ const n = g(p(k), (i) => `${i}px`);
119
120
  if (c(n, e)) {
120
- const i = V(e.replace("px", ""), 10);
121
- i === 1 ? a = `${t}px` : a = t + i / S;
121
+ const i = b(e.replace("px", ""), 10);
122
+ i === 1 ? a = `${t}px` : a = t + i / _;
122
123
  }
123
124
  }
124
125
  if (e.indexOf("%") !== -1) {
125
126
  const n = g(p(d), (i) => `${i}%`);
126
127
  if (c(n, e)) {
127
128
  const i = parseFloat(e.replace("%", ""));
128
- a = t + k(d, i);
129
+ a = t + V(d, i);
129
130
  }
130
131
  }
131
132
  e.indexOf("vw") !== -1 && parseFloat(e.replace("vw", "")) === 100 && (a = `${t}screen`), e.indexOf("vh") !== -1 && parseFloat(e.replace("vh", "")) === 100 && (a = `${t}screen`);
@@ -221,15 +222,15 @@ const z = (s) => {
221
222
  return a;
222
223
  }, H = (s) => ({ ...s }), M = (s) => ({ ...s });
223
224
  export {
224
- J as addPrefixToClasses,
225
+ Q as addPrefixToClasses,
225
226
  D as cn,
226
227
  z as convertArbitraryToTailwindClass,
227
- M as enableStyling,
228
228
  j as generateUUID,
229
- K as getBlocksFromHTML,
230
- Q as getBlocksTailwindCSS,
231
- Z as getBrandingClasses,
232
- q as getBreakpointValue,
233
- N as getStylesForPageData,
234
- H as setBlockProps
229
+ G as getBlocksFromHTML,
230
+ Z as getBlocksTailwindCSS,
231
+ N as getBrandingClasses,
232
+ K as getBreakpointValue,
233
+ ee as getStylesForPageData,
234
+ H as selectable,
235
+ M as styling
235
236
  };
@@ -1,13 +1,13 @@
1
- import { j as e } from "./jsx-runtime-944c88e2.js";
1
+ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
2
  import m, { IconPickerItem as g } from "react-icons-picker";
3
3
  import x from "react-dom";
4
4
  import { isEmpty as h, map as f } from "lodash";
5
5
  import { useState as u, useEffect as b } from "react";
6
- import { D as j, a as v, b as k } from "./dialog-18207bef.js";
7
- import y from "./ImagesPanel-47ac13c3.js";
6
+ import { D as j, a as v, b as k } from "./dialog-jrw9DF1f.js";
7
+ import y from "./ImagesPanel-oaHOD-Ex.js";
8
8
  import w from "react-quill";
9
9
  import "react-i18next";
10
- import { u as N } from "./useBuilderProp-21feb2da.js";
10
+ import { u as N } from "./skeleton-CU_FIbg3.js";
11
11
  const B = (t) => {
12
12
  try {
13
13
  const r = document.getElementById("icon-picker-field"), s = document.createElement("div");
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./jsx-runtime-JYMCiFoE.cjs"),m=require("react-icons-picker"),h=require("react-dom"),g=require("lodash"),d=require("react"),x=require("./dialog-S_QbL1iq.cjs"),j=require("./ImagesPanel-6us7hiLN.cjs"),E=require("react-quill");require("react-i18next");const R=require("./skeleton-JHP9zwL2.cjs"),f=t=>{try{const s=document.getElementById("icon-picker-field"),r=document.createElement("div");h.render(e.jsxRuntimeExports.jsx(m.IconPickerItem,{value:t}),r),s.appendChild(r),r.hidden=!0;let l=r.innerHTML;setTimeout(()=>s.removeChild(r),1e3);const o=new DOMParser().parseFromString(l,"image/svg+xml"),n=o.querySelector("svg");return n&&(n.removeAttribute("width"),n.removeAttribute("height")),new XMLSerializer().serializeToString(o)}catch{return""}},b=({value:t,onChange:s,onBlur:r,id:l})=>{const a=o=>{s("<svg />");const n=f(o);s(n),r(l,n)};return e.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative h-12 w-12 group",children:[e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t==null?void 0:t.replace("<svg",'<svg class="h-5 w-5"')},className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white z-0"}),e.jsxRuntimeExports.jsx(m,{value:t?"BiSolidGrid":null,onChange:a,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),e.jsxRuntimeExports.jsx("textarea",{value:t,onChange:o=>s(o.target.value),className:"h-full border w-full rounded-sm border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},k=({children:t,onSelect:s})=>{const[r,l]=d.useState(!1),a=(...o)=>{s.call(void 0,...o),l(!1)};return e.jsxRuntimeExports.jsxs(x.Dialog,{open:r,onOpenChange:o=>l(o),children:[e.jsxRuntimeExports.jsx(x.DialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsx(x.DialogContent,{className:"flex h-3/4 max-w-5xl",children:e.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:e.jsxRuntimeExports.jsx(j.default,{isModalView:!0,onSelect:a})})})]})},p=k,v=({value:t,onChange:s,id:r,onBlur:l})=>e.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?e.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):e.jsxRuntimeExports.jsx(p,{onSelect:s,children:e.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[e.jsxRuntimeExports.jsx(p,{onSelect:s,children:e.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:t||!g.isEmpty(t)?"Replace Image":"Choose Image"})}),e.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"}),e.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:a}})=>l(r,a),onChange:a=>s(a.target.value)})]})]}),y=({id:t,placeholder:s,value:r,onChange:l,onBlur:a})=>{const o={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},n=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:e.jsxRuntimeExports.jsx(E,{id:t,value:r,onBlur:c=>a(t,c),onChange:c=>l(c),modules:o,formats:n,placeholder:s,className:"mt-1 rounded-md"})},w=({schema:t,formData:s,onChange:r})=>{const[l,a]=d.useState([]),o=R.useBuilderProp("getPages",()=>[]),{type:n="page",href:c="",target:u="self"}=s;return d.useEffect(()=>{(async()=>{const i=await o();a(i||[])})()},[o]),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[e.jsxRuntimeExports.jsx("select",{name:"type",defaultValue:"page",value:n,onChange:i=>r({...s,type:i.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(i=>e.jsxRuntimeExports.jsx("option",{value:i.const,children:i.title},i.const))}),n==="page"?e.jsxRuntimeExports.jsxs("select",{name:"href",defaultValue:"",placeholder:"Choose Page",value:c,onChange:i=>r({...s,href:i.target.value}),children:[e.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),g.map(l,i=>e.jsxRuntimeExports.jsx("option",{value:i.slug,children:i.name},i.uuid))]}):e.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:c,onChange:i=>r({...s,href:i.target.value}),placeholder:n==="page"||n==="url"?"Enter URL":n==="scroll"?"#ElementID":"Enter detail"}),(n==="page"||n==="url")&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:u==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>r({...s,target:u==="_blank"?"_self":"_blank"})}),e.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})};exports.IconPickerField=b;exports.ImagePickerField=v;exports.LinkField=w;exports.RichTextEditorField=y;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./popover-fKjgcRUx.cjs"),x=require("./index-X9ZgD09V.cjs");require("@radix-ui/react-popover");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("./ChaiBuilderEditor-BoE-sArB.cjs");require("./MODIFIERS-Fx6WAZcw.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./skeleton-JHP9zwL2.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./functions-uw7QP2kT.cjs");require("redux-undo");require("@react-hookz/web");require("./index-HAue58ea.cjs");require("sonner");require("./html-to-json-P6GpbcQX.cjs");require("himalaya");require("lucide-react");require("./alert-dialog-Mv0-wAvS.cjs");require("@radix-ui/react-alert-dialog");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-yPgnu2AI.cjs"))),j=({pageData:s})=>{const[r,t]=u.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:i=>{t(r==="PENDING"?"ALERT":i?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:i=>{i.stopPropagation(),t("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(n.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(n.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(m,{pageData:s,open:r,setOpen:t})})})]})},p=s=>{const[r]=x.useCurrentPage(),{data:t}=x.useProject(),i=x.useChangePage(),l=(t==null?void 0:t.homepage)===s.uuid,a=r===s.uuid,c=()=>i(s);return t?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${a?"bg-blue-200 ":""}`,onClick:c,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex text-sm items-center gap-x-1.5",children:[l?e.jsxRuntimeExports.jsx(n.HomeIcon,{}):e.jsxRuntimeExports.jsx(n.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(j,{pageData:s})]}):null},d=({pages:s,isLoading:r})=>r?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):s.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:u.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(p,{...t})))});exports.default=d;
@@ -1,13 +1,14 @@
1
- import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import o, { useState as m, Suspense as c } from "react";
3
- import { HomeIcon as p, FileTextIcon as u, ChevronRightIcon as d, GearIcon as x } from "@radix-ui/react-icons";
4
- import { P as g, a as h, b as f } from "./popover-f7addcf4.js";
5
- import { U as j, R as N, T as b } from "./index-aa42febc.js";
1
+ import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
+ import o, { useState as m, Suspense as p } from "react";
3
+ import { HomeIcon as c, FileTextIcon as u, ChevronRightIcon as d, GearIcon as x } from "@radix-ui/react-icons";
4
+ import { P as g, a as h, b as f } from "./popover-a84pbVhQ.js";
5
+ import { d as j, a as N, c as b } from "./index-T4_wfKl5.js";
6
6
  import "@radix-ui/react-popover";
7
- import "./utils-ac68b2c8.js";
7
+ import "./utils-dze1SGvB.js";
8
8
  import "clsx";
9
9
  import "tailwind-merge";
10
- import "./MODIFIERS-2f19c314.js";
10
+ import "./ChaiBuilderEditor-hEuUONQ3.js";
11
+ import "./MODIFIERS-DsEzQ3aH.js";
11
12
  import "@radix-ui/react-scroll-area";
12
13
  import "react-dom";
13
14
  import "@floating-ui/react-dom";
@@ -18,29 +19,31 @@ import "flagged";
18
19
  import "react-dnd";
19
20
  import "lodash";
20
21
  import "@minoru/react-dnd-treeview";
21
- import "./useBuilderProp-21feb2da.js";
22
- import "@radix-ui/react-alert-dialog";
22
+ import "./skeleton-CU_FIbg3.js";
23
23
  import "@radix-ui/react-slot";
24
24
  import "class-variance-authority";
25
25
  import "@radix-ui/react-tooltip";
26
26
  import "@radix-ui/react-toast";
27
27
  import "react-hotkeys-hook";
28
28
  import "flat-to-nested";
29
- import "./html-to-json-45e0e3b5.js";
30
- import "himalaya";
29
+ import "./functions-pcUZhFJM.js";
31
30
  import "redux-undo";
32
31
  import "@react-hookz/web";
33
- import "@chaibuilder/blocks";
32
+ import "./index-ehKdBRUK.js";
34
33
  import "sonner";
34
+ import "./html-to-json-pdHQfRkN.js";
35
+ import "himalaya";
35
36
  import "lucide-react";
36
- const P = o.lazy(() => import("./single-page-detail-04410e64.js")), v = ({ pageData: s }) => {
37
- const [t, r] = m("CLOSE");
37
+ import "./alert-dialog-GNfnpqFB.js";
38
+ import "@radix-ui/react-alert-dialog";
39
+ const P = o.lazy(() => import("./single-page-detail-pAxCy_Pe.js")), v = ({ pageData: r }) => {
40
+ const [t, s] = m("CLOSE");
38
41
  return /* @__PURE__ */ e.jsxs(
39
42
  g,
40
43
  {
41
44
  open: t === "OPEN" || t === "ALERT" || t === "PENDING",
42
45
  onOpenChange: (i) => {
43
- r(t === "PENDING" ? "ALERT" : i ? "OPEN" : "CLOSE");
46
+ s(t === "PENDING" ? "ALERT" : i ? "OPEN" : "CLOSE");
44
47
  },
45
48
  children: [
46
49
  /* @__PURE__ */ e.jsx(
@@ -48,28 +51,28 @@ const P = o.lazy(() => import("./single-page-detail-04410e64.js")), v = ({ pageD
48
51
  {
49
52
  asChild: !0,
50
53
  onClick: (i) => {
51
- i.stopPropagation(), r("OPEN");
54
+ i.stopPropagation(), s("OPEN");
52
55
  },
53
56
  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between", children: t === "OPEN" || t === "ALERT" || t === "PENDING" ? /* @__PURE__ */ e.jsx(d, {}) : /* @__PURE__ */ e.jsx("div", { className: "hidden hover:text-blue-600 group-hover:flex", children: /* @__PURE__ */ e.jsx(x, {}) }) })
54
57
  }
55
58
  ),
56
59
  /* @__PURE__ */ e.jsx(f, { side: "right", align: "start", alignOffset: -35, className: "h-screen w-96", children: /* @__PURE__ */ e.jsx(
57
- c,
60
+ p,
58
61
  {
59
62
  fallback: /* @__PURE__ */ e.jsxs("div", { className: "flex w-full animate-pulse flex-col gap-y-3", children: [
60
63
  /* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-6 w-1/2" }),
61
64
  /* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-20 w-full" }),
62
65
  /* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-20 w-full" })
63
66
  ] }),
64
- children: /* @__PURE__ */ e.jsx(P, { pageData: s, open: t, setOpen: r })
67
+ children: /* @__PURE__ */ e.jsx(P, { pageData: r, open: t, setOpen: s })
65
68
  }
66
69
  ) })
67
70
  ]
68
71
  }
69
72
  );
70
- }, E = (s) => {
71
- const [t] = j(), { data: r } = N(), i = b(), a = (r == null ? void 0 : r.homepage) === s.uuid, n = t === s.uuid, l = () => i(s);
72
- return r ? /* @__PURE__ */ e.jsxs(
73
+ }, E = (r) => {
74
+ const [t] = j(), { data: s } = N(), i = b(), a = (s == null ? void 0 : s.homepage) === r.uuid, n = t === r.uuid, l = () => i(r);
75
+ return s ? /* @__PURE__ */ e.jsxs(
73
76
  "button",
74
77
  {
75
78
  className: `group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${n ? "bg-blue-200 " : ""}`,
@@ -77,19 +80,19 @@ const P = o.lazy(() => import("./single-page-detail-04410e64.js")), v = ({ pageD
77
80
  type: "button",
78
81
  children: [
79
82
  /* @__PURE__ */ e.jsxs("div", { className: "flex text-sm items-center gap-x-1.5", children: [
80
- a ? /* @__PURE__ */ e.jsx(p, {}) : /* @__PURE__ */ e.jsx(u, {}),
83
+ a ? /* @__PURE__ */ e.jsx(c, {}) : /* @__PURE__ */ e.jsx(u, {}),
81
84
  " ",
82
- s.name
85
+ r.name
83
86
  ] }),
84
- /* @__PURE__ */ e.jsx(v, { pageData: s })
87
+ /* @__PURE__ */ e.jsx(v, { pageData: r })
85
88
  ]
86
89
  }
87
90
  ) : null;
88
- }, oe = ({ pages: s, isLoading: t }) => t ? /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-1 px-2.5 pt-2", children: [
91
+ }, le = ({ pages: r, isLoading: t }) => t ? /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-1 px-2.5 pt-2", children: [
89
92
  /* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
90
93
  /* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
91
94
  /* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" })
92
- ] }) : s.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "px-2.5 pb-2 pt-4", children: "No pages" }) : /* @__PURE__ */ e.jsx("div", { className: "-mb-2", children: o.Children.toArray(s.map((r) => /* @__PURE__ */ e.jsx(E, { ...r }))) });
95
+ ] }) : r.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "px-2.5 pb-2 pt-4", children: "No pages" }) : /* @__PURE__ */ e.jsx("div", { className: "-mb-2", children: o.Children.toArray(r.map((s) => /* @__PURE__ */ e.jsx(E, { ...s }))) });
93
96
  export {
94
- oe as default
97
+ le as default
95
98
  };
@@ -1,7 +1,7 @@
1
- import { j as t } from "./jsx-runtime-944c88e2.js";
1
+ import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
2
  import * as i from "react";
3
3
  import * as o from "@radix-ui/react-popover";
4
- import { c as n } from "./utils-ac68b2c8.js";
4
+ import { c as n } from "./utils-dze1SGvB.js";
5
5
  const l = o.Root, c = o.Trigger, m = i.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, ...s }, d) => /* @__PURE__ */ t.jsx(o.Portal, { children: /* @__PURE__ */ t.jsx(
6
6
  o.Content,
7
7
  {
@@ -1 +1 @@
1
- "use strict";const n=require("./jsx-runtime-5c3ac4f7.cjs"),c=require("react"),p=require("@radix-ui/react-popover"),l=require("./utils-3c452dd0.cjs");function i(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const m=i(c),r=i(p),u=r.Root,f=r.Trigger,s=m.forwardRef(({className:e,align:o="center",sideOffset:t=4,...a},d)=>n.jsxRuntimeExports.jsx(r.Portal,{children:n.jsxRuntimeExports.jsx(r.Content,{ref:d,align:o,sideOffset:t,className:l.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));s.displayName=r.Content.displayName;exports.Popover=u;exports.PopoverContent=s;exports.PopoverTrigger=f;
1
+ "use strict";const n=require("./jsx-runtime-JYMCiFoE.cjs"),c=require("react"),p=require("@radix-ui/react-popover"),l=require("./utils-qK_SjzzV.cjs");function i(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const m=i(c),r=i(p),u=r.Root,f=r.Trigger,s=m.forwardRef(({className:e,align:o="center",sideOffset:t=4,...a},d)=>n.jsxRuntimeExports.jsx(r.Portal,{children:n.jsxRuntimeExports.jsx(r.Content,{ref:d,align:o,sideOffset:t,className:l.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));s.displayName=r.Content.displayName;exports.Popover=u;exports.PopoverContent=s;exports.PopoverTrigger=f;