@fuma-content/studio 1.0.0 → 1.0.1

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 (614) hide show
  1. package/build/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  2. package/build/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  3. package/build/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  4. package/build/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  5. package/build/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  6. package/build/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  7. package/build/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  8. package/build/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  9. package/build/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  10. package/build/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  11. package/build/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  12. package/build/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  13. package/build/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  14. package/build/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  15. package/build/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  16. package/build/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  17. package/build/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  18. package/build/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  19. package/build/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  20. package/build/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  21. package/build/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  22. package/build/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  23. package/build/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  24. package/build/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  25. package/build/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  26. package/build/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  27. package/build/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  28. package/build/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  29. package/build/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  30. package/build/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  31. package/build/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  32. package/build/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  33. package/build/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  34. package/build/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  35. package/build/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  36. package/build/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  37. package/build/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  38. package/build/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  39. package/build/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  40. package/build/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  41. package/build/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  42. package/build/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  43. package/build/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  44. package/build/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  45. package/build/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  46. package/build/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  47. package/build/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  48. package/build/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  49. package/build/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  50. package/build/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  51. package/build/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  52. package/build/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  53. package/build/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  54. package/build/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  55. package/build/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  56. package/build/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  57. package/build/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  58. package/build/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  59. package/build/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  60. package/build/client/assets/QueryClientProvider-DqiXnN2L.js +1 -0
  61. package/build/client/assets/actions-DkbV2Z0p.js +1 -0
  62. package/build/client/assets/actions-DpkI7OTF.js +1 -0
  63. package/build/client/assets/badge-CZkdLoIP.js +1 -0
  64. package/build/client/assets/button-Bm94vje1.js +41 -0
  65. package/build/client/assets/client-BWBqEatf.js +1 -0
  66. package/build/client/assets/client-Crg-pMcu.js +1 -0
  67. package/build/client/assets/client-DVneG3Rq.css +1 -0
  68. package/build/client/assets/client-OSVRoCKH.js +569 -0
  69. package/build/client/assets/dropdown-menu-EF-sTINr.js +1 -0
  70. package/build/client/assets/entry.rsc-D51PwnQL.js +1 -0
  71. package/build/client/assets/index-BdrDVoE8.js +1 -0
  72. package/build/client/assets/index-BpILsqFO.js +1 -0
  73. package/build/client/assets/index-Bx93mXy1.js +11 -0
  74. package/build/client/assets/index-CQRgqbuL.js +1 -0
  75. package/build/client/assets/index-DOs5iMXj.js +1 -0
  76. package/build/client/assets/index-DTzAH5JX.js +1 -0
  77. package/build/client/assets/layout-CnpYRqF0.js +1 -0
  78. package/build/client/assets/mdx-BNErtsK6.js +1 -0
  79. package/build/client/assets/page-DOzl4Kpa.js +1 -0
  80. package/build/client/assets/page-uNpJU_rv.js +1 -0
  81. package/build/client/assets/query-z9oLNeTD.js +1 -0
  82. package/build/client/assets/react-B8--K7an.js +10 -0
  83. package/build/client/assets/root-B_CXTQpA.js +1 -0
  84. package/build/client/assets/root-D3NoAGI1.js +1 -0
  85. package/build/client/assets/root-z8crlXSh.css +1 -0
  86. package/build/client/assets/route-DVneG3Rq.css +1 -0
  87. package/build/client/assets/router-a9jyj9wf.js +10 -0
  88. package/build/client/assets/separator-tWFpvpUX.js +1 -0
  89. package/build/client/assets/sidebar-BBYit8gY.js +12 -0
  90. package/build/client/assets/site-header-DQkKe-WA.js +1 -0
  91. package/build/client/assets/spinner-BdPhtfsc.js +1 -0
  92. package/build/client/assets/tooltip-Dvh-iHDG.js +16 -0
  93. package/build/client/assets/use-sync-ZgcwUdu_.js +9 -0
  94. package/build/client/assets/yaml-Cloe7OVn.js +32 -0
  95. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +268 -0
  96. package/build/server/__ssr_build/assets/QueryClientProvider-DlvBH3OQ.js +30 -0
  97. package/build/server/__ssr_build/assets/actions-B50-3n-a.js +63 -0
  98. package/build/server/__ssr_build/assets/actions-BFtCTvOL.js +21 -0
  99. package/{src/components/ui/badge.tsx → build/server/__ssr_build/assets/badge-DYFvBSp8.js} +23 -28
  100. package/build/server/__ssr_build/assets/button-C_-b_vqm.js +4098 -0
  101. package/build/server/__ssr_build/assets/client--HXec13w.js +130 -0
  102. package/build/server/__ssr_build/assets/client-BqW9rGyi.js +116885 -0
  103. package/build/server/__ssr_build/assets/client-CU90j0R8.js +154 -0
  104. package/build/server/__ssr_build/assets/dropdown-menu-D2YyT3lP.js +1312 -0
  105. package/build/server/__ssr_build/assets/entry.rsc-Cg_DxYkh.js +12 -0
  106. package/build/server/__ssr_build/assets/index-B-gno69w.js +58 -0
  107. package/build/server/__ssr_build/assets/index-DBc0nhEL.js +288 -0
  108. package/build/server/__ssr_build/assets/index-Dtw6X3NW.js +1092 -0
  109. package/build/server/__ssr_build/assets/index-DvVNShHF.js +86 -0
  110. package/build/server/__ssr_build/assets/index-PpqpVA51.js +612 -0
  111. package/build/server/__ssr_build/assets/layout-CPnSx9PI.js +454 -0
  112. package/build/server/__ssr_build/assets/mdx-bmeV1kyx.js +44 -0
  113. package/build/server/__ssr_build/assets/page-BwoghW3K.js +38 -0
  114. package/build/server/__ssr_build/assets/page-HxttullC.js +89 -0
  115. package/build/server/__ssr_build/assets/query-C1_xUNXy.js +1975 -0
  116. package/build/server/__ssr_build/assets/root-CS7F-km4.js +16 -0
  117. package/build/server/__ssr_build/assets/root-D-Y-rGw5.js +73 -0
  118. package/build/server/__ssr_build/assets/separator-8UA_ceSq.js +49 -0
  119. package/build/server/__ssr_build/assets/sidebar-BzNOZeBO.js +13194 -0
  120. package/build/server/__ssr_build/assets/site-header-CXHKSzqk.js +13 -0
  121. package/build/server/__ssr_build/assets/spinner-BXcLlTNs.js +1291 -0
  122. package/build/server/__ssr_build/assets/tooltip-DZ4WdJt-.js +9553 -0
  123. package/build/server/__ssr_build/assets/use-sync-TRS0zL-Y.js +3404 -0
  124. package/build/server/__ssr_build/assets/yaml-BEdFfhvc.js +63 -0
  125. package/build/server/__ssr_build/index.js +36076 -0
  126. package/build/server/__vite_rsc_assets_manifest.js +268 -0
  127. package/build/server/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  128. package/build/server/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  129. package/build/server/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  130. package/build/server/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  131. package/build/server/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  132. package/build/server/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  133. package/build/server/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  134. package/build/server/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  135. package/build/server/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  136. package/build/server/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  137. package/build/server/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  138. package/build/server/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  139. package/build/server/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  140. package/build/server/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  141. package/build/server/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  142. package/build/server/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  143. package/build/server/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  144. package/build/server/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  145. package/build/server/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  146. package/build/server/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  147. package/build/server/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  148. package/build/server/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  149. package/build/server/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  150. package/build/server/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  151. package/build/server/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  152. package/build/server/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  153. package/build/server/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  154. package/build/server/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  155. package/build/server/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  156. package/build/server/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  157. package/build/server/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  158. package/build/server/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  159. package/build/server/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  160. package/build/server/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  161. package/build/server/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  162. package/build/server/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  163. package/build/server/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  164. package/build/server/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  165. package/build/server/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  166. package/build/server/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  167. package/build/server/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  168. package/build/server/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  169. package/build/server/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  170. package/build/server/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  171. package/build/server/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  172. package/build/server/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  173. package/build/server/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  174. package/build/server/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  175. package/build/server/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  176. package/build/server/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  177. package/build/server/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  178. package/build/server/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  179. package/build/server/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  180. package/build/server/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  181. package/build/server/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  182. package/build/server/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  183. package/build/server/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  184. package/build/server/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  185. package/build/server/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  186. package/build/server/assets/actions-C92yn6jE.js +61 -0
  187. package/build/server/assets/actions-CWWFIcb1.js +46 -0
  188. package/build/server/assets/actions-DZdN0IBq.js +73 -0
  189. package/build/server/assets/client-BdxXy6rH.js +13 -0
  190. package/build/server/assets/client-DLzFPnCR.js +13 -0
  191. package/build/server/assets/config-Cb909uq6.js +257 -0
  192. package/build/server/assets/index-X49ifkk3.js +9 -0
  193. package/build/server/assets/jsx-runtime.react-server-D3We4JeM.js +324 -0
  194. package/build/server/assets/layout-CRw_6FCt.js +2071 -0
  195. package/build/server/assets/page-BcrsPZbM.js +9 -0
  196. package/build/server/assets/page-zlF_Ew1s.js +72 -0
  197. package/build/server/assets/root-CVOXO6T9.js +23 -0
  198. package/build/server/assets/root-dGb6ch_9.js +38 -0
  199. package/build/server/assets/root-z8crlXSh.css +1 -0
  200. package/build/server/assets/route-DVneG3Rq.css +1 -0
  201. package/build/server/assets/route-Ds0B4hTo.js +44 -0
  202. package/build/server/assets/route-DvwlfKZg.js +21 -0
  203. package/build/server/assets/route-o-6k10r9.js +70774 -0
  204. package/build/server/index.js +17032 -0
  205. package/dist/bin.mjs +10 -38
  206. package/dist/package.mjs +1 -1
  207. package/package.json +30 -32
  208. package/dist/index.d.mts +0 -52
  209. package/dist/index.mjs +0 -67
  210. package/dist/mdx/actions.mjs +0 -32
  211. package/dist/mdx/client.mjs +0 -167
  212. package/dist/src/components/code-editor/mdx.lazy.mjs +0 -19
  213. package/dist/src/components/code-editor/mdx.mjs +0 -44
  214. package/dist/src/components/code-editor/yaml.lazy.mjs +0 -22
  215. package/dist/src/components/code-editor/yaml.mjs +0 -63
  216. package/dist/src/components/editor/editor-base-kit.mjs +0 -41
  217. package/dist/src/components/editor/editor-kit.mjs +0 -73
  218. package/dist/src/components/editor/md.mjs +0 -42
  219. package/dist/src/components/editor/plugins/ai-kit.mjs +0 -68
  220. package/dist/src/components/editor/plugins/align-base-kit.mjs +0 -28
  221. package/dist/src/components/editor/plugins/align-kit.mjs +0 -30
  222. package/dist/src/components/editor/plugins/autoformat-kit.mjs +0 -214
  223. package/dist/src/components/editor/plugins/basic-blocks-base-kit.mjs +0 -22
  224. package/dist/src/components/editor/plugins/basic-blocks-kit.mjs +0 -51
  225. package/dist/src/components/editor/plugins/basic-marks-base-kit.mjs +0 -20
  226. package/dist/src/components/editor/plugins/basic-marks-kit.mjs +0 -28
  227. package/dist/src/components/editor/plugins/block-menu-kit.mjs +0 -11
  228. package/dist/src/components/editor/plugins/block-placeholder-kit.mjs +0 -14
  229. package/dist/src/components/editor/plugins/block-selection-kit.mjs +0 -48
  230. package/dist/src/components/editor/plugins/callout-base-kit.mjs +0 -8
  231. package/dist/src/components/editor/plugins/callout-kit.mjs +0 -10
  232. package/dist/src/components/editor/plugins/code-block-base-kit.mjs +0 -16
  233. package/dist/src/components/editor/plugins/code-block-kit.mjs +0 -19
  234. package/dist/src/components/editor/plugins/column-base-kit.mjs +0 -8
  235. package/dist/src/components/editor/plugins/column-kit.mjs +0 -10
  236. package/dist/src/components/editor/plugins/comment-base-kit.mjs +0 -8
  237. package/dist/src/components/editor/plugins/comment-kit.mjs +0 -53
  238. package/dist/src/components/editor/plugins/copilot-kit.mjs +0 -49
  239. package/dist/src/components/editor/plugins/cursor-overlay-kit.mjs +0 -11
  240. package/dist/src/components/editor/plugins/date-base-kit.mjs +0 -8
  241. package/dist/src/components/editor/plugins/date-kit.mjs +0 -10
  242. package/dist/src/components/editor/plugins/discussion-kit.mjs +0 -94
  243. package/dist/src/components/editor/plugins/dnd-kit.mjs +0 -31
  244. package/dist/src/components/editor/plugins/emoji-kit.mjs +0 -11
  245. package/dist/src/components/editor/plugins/exit-break-kit.mjs +0 -12
  246. package/dist/src/components/editor/plugins/fixed-toolbar-kit.mjs +0 -15
  247. package/dist/src/components/editor/plugins/floating-toolbar-kit.mjs +0 -15
  248. package/dist/src/components/editor/plugins/font-base-kit.mjs +0 -14
  249. package/dist/src/components/editor/plugins/font-kit.mjs +0 -19
  250. package/dist/src/components/editor/plugins/indent-base-kit.mjs +0 -17
  251. package/dist/src/components/editor/plugins/indent-kit.mjs +0 -20
  252. package/dist/src/components/editor/plugins/line-height-base-kit.mjs +0 -20
  253. package/dist/src/components/editor/plugins/line-height-kit.mjs +0 -22
  254. package/dist/src/components/editor/plugins/link-base-kit.mjs +0 -8
  255. package/dist/src/components/editor/plugins/link-kit.mjs +0 -15
  256. package/dist/src/components/editor/plugins/list-base-kit.mjs +0 -19
  257. package/dist/src/components/editor/plugins/list-kit.mjs +0 -22
  258. package/dist/src/components/editor/plugins/markdown-kit.mjs +0 -17
  259. package/dist/src/components/editor/plugins/math-base-kit.mjs +0 -8
  260. package/dist/src/components/editor/plugins/math-kit.mjs +0 -10
  261. package/dist/src/components/editor/plugins/media-base-kit.mjs +0 -23
  262. package/dist/src/components/editor/plugins/media-kit.mjs +0 -37
  263. package/dist/src/components/editor/plugins/slash-kit.mjs +0 -11
  264. package/dist/src/components/editor/plugins/suggestion-base-kit.mjs +0 -8
  265. package/dist/src/components/editor/plugins/suggestion-kit.mjs +0 -50
  266. package/dist/src/components/editor/plugins/table-base-kit.mjs +0 -13
  267. package/dist/src/components/editor/plugins/table-kit.mjs +0 -15
  268. package/dist/src/components/editor/transforms.mjs +0 -125
  269. package/dist/src/components/editor/ui/ai-chat-editor.mjs +0 -21
  270. package/dist/src/components/editor/ui/ai-menu.mjs +0 -488
  271. package/dist/src/components/editor/ui/ai-node.mjs +0 -24
  272. package/dist/src/components/editor/ui/ai-toolbar-button.mjs +0 -23
  273. package/dist/src/components/editor/ui/align-toolbar-button.mjs +0 -71
  274. package/dist/src/components/editor/ui/block-context-menu.mjs +0 -130
  275. package/dist/src/components/editor/ui/block-discussion.mjs +0 -200
  276. package/dist/src/components/editor/ui/block-draggable.mjs +0 -265
  277. package/dist/src/components/editor/ui/block-list-static.mjs +0 -48
  278. package/dist/src/components/editor/ui/block-list.mjs +0 -47
  279. package/dist/src/components/editor/ui/block-selection.mjs +0 -28
  280. package/dist/src/components/editor/ui/block-suggestion.mjs +0 -319
  281. package/dist/src/components/editor/ui/blockquote-node-static.mjs +0 -14
  282. package/dist/src/components/editor/ui/blockquote-node.mjs +0 -16
  283. package/dist/src/components/editor/ui/callout-node-static.mjs +0 -29
  284. package/dist/src/components/editor/ui/callout-node.mjs +0 -50
  285. package/dist/src/components/editor/ui/caption.mjs +0 -39
  286. package/dist/src/components/editor/ui/code-block-node-static.mjs +0 -30
  287. package/dist/src/components/editor/ui/code-block-node.mjs +0 -121
  288. package/dist/src/components/editor/ui/code-node-static.mjs +0 -15
  289. package/dist/src/components/editor/ui/code-node.mjs +0 -17
  290. package/dist/src/components/editor/ui/column-node-static.mjs +0 -32
  291. package/dist/src/components/editor/ui/column-node.mjs +0 -229
  292. package/dist/src/components/editor/ui/comment-node-static.mjs +0 -14
  293. package/dist/src/components/editor/ui/comment-node.mjs +0 -33
  294. package/dist/src/components/editor/ui/comment-toolbar-button.mjs +0 -23
  295. package/dist/src/components/editor/ui/comment.mjs +0 -422
  296. package/dist/src/components/editor/ui/cursor-overlay.mjs +0 -36
  297. package/dist/src/components/editor/ui/date-node-static.mjs +0 -32
  298. package/dist/src/components/editor/ui/date-node.mjs +0 -60
  299. package/dist/src/components/editor/ui/editor-static.mjs +0 -31
  300. package/dist/src/components/editor/ui/editor.mjs +0 -60
  301. package/dist/src/components/editor/ui/emoji-node.mjs +0 -46
  302. package/dist/src/components/editor/ui/emoji-toolbar-button.mjs +0 -415
  303. package/dist/src/components/editor/ui/equation-node-static.mjs +0 -65
  304. package/dist/src/components/editor/ui/equation-node.mjs +0 -159
  305. package/dist/src/components/editor/ui/equation-toolbar-button.mjs +0 -23
  306. package/dist/src/components/editor/ui/fixed-toolbar-buttons.mjs +0 -109
  307. package/dist/src/components/editor/ui/fixed-toolbar.mjs +0 -16
  308. package/dist/src/components/editor/ui/floating-toolbar-buttons.mjs +0 -54
  309. package/dist/src/components/editor/ui/floating-toolbar.mjs +0 -51
  310. package/dist/src/components/editor/ui/font-color-toolbar-button.mjs +0 -637
  311. package/dist/src/components/editor/ui/font-size-toolbar-button.mjs +0 -83
  312. package/dist/src/components/editor/ui/ghost-text.mjs +0 -22
  313. package/dist/src/components/editor/ui/heading-node-static.mjs +0 -60
  314. package/dist/src/components/editor/ui/heading-node.mjs +0 -62
  315. package/dist/src/components/editor/ui/highlight-node-static.mjs +0 -15
  316. package/dist/src/components/editor/ui/highlight-node.mjs +0 -17
  317. package/dist/src/components/editor/ui/history-toolbar-button.mjs +0 -35
  318. package/dist/src/components/editor/ui/hr-node-static.mjs +0 -18
  319. package/dist/src/components/editor/ui/hr-node.mjs +0 -23
  320. package/dist/src/components/editor/ui/indent-toolbar-button.mjs +0 -29
  321. package/dist/src/components/editor/ui/inline-combobox.mjs +0 -148
  322. package/dist/src/components/editor/ui/insert-toolbar-button.mjs +0 -199
  323. package/dist/src/components/editor/ui/kbd-node-static.mjs +0 -15
  324. package/dist/src/components/editor/ui/kbd-node.mjs +0 -17
  325. package/dist/src/components/editor/ui/line-height-toolbar-button.mjs +0 -56
  326. package/dist/src/components/editor/ui/link-node-static.mjs +0 -20
  327. package/dist/src/components/editor/ui/link-node.mjs +0 -28
  328. package/dist/src/components/editor/ui/link-toolbar-button.mjs +0 -21
  329. package/dist/src/components/editor/ui/link-toolbar.mjs +0 -141
  330. package/dist/src/components/editor/ui/list-toolbar-button.mjs +0 -131
  331. package/dist/src/components/editor/ui/mark-toolbar-button.mjs +0 -20
  332. package/dist/src/components/editor/ui/media-image-node-static.mjs +0 -32
  333. package/dist/src/components/editor/ui/media-image-node.mjs +0 -64
  334. package/dist/src/components/editor/ui/media-placeholder-node.mjs +0 -184
  335. package/dist/src/components/editor/ui/media-preview-dialog.mjs +0 -113
  336. package/dist/src/components/editor/ui/media-toolbar-button.mjs +0 -156
  337. package/dist/src/components/editor/ui/media-toolbar.mjs +0 -80
  338. package/dist/src/components/editor/ui/media-upload-toast.mjs +0 -39
  339. package/dist/src/components/editor/ui/media-video-node-static.mjs +0 -27
  340. package/dist/src/components/editor/ui/mode-toolbar-button.mjs +0 -112
  341. package/dist/src/components/editor/ui/paragraph-node-static.mjs +0 -15
  342. package/dist/src/components/editor/ui/paragraph-node.mjs +0 -17
  343. package/dist/src/components/editor/ui/resize-handle.mjs +0 -43
  344. package/dist/src/components/editor/ui/slash-node.mjs +0 -228
  345. package/dist/src/components/editor/ui/suggestion-node-static.mjs +0 -24
  346. package/dist/src/components/editor/ui/suggestion-node.mjs +0 -111
  347. package/dist/src/components/editor/ui/suggestion-toolbar-button.mjs +0 -24
  348. package/dist/src/components/editor/ui/table-icons.mjs +0 -1310
  349. package/dist/src/components/editor/ui/table-node-static.mjs +0 -68
  350. package/dist/src/components/editor/ui/table-node.mjs +0 -375
  351. package/dist/src/components/editor/ui/table-toolbar-button.mjs +0 -190
  352. package/dist/src/components/editor/ui/turn-into-toolbar-button.mjs +0 -168
  353. package/dist/src/components/editor/use-chat.mjs +0 -80
  354. package/dist/src/components/json-schema-editor/client.mjs +0 -46
  355. package/dist/src/components/json-schema-editor/components/inputs.mjs +0 -438
  356. package/dist/src/components/json-schema-editor/get-default-values.mjs +0 -23
  357. package/dist/src/components/json-schema-editor/schema.mjs +0 -131
  358. package/dist/src/components/json-schema-editor/utils/merge-schema.mjs +0 -134
  359. package/dist/src/components/json-schema-editor/utils/schema-to-string.mjs +0 -53
  360. package/dist/src/components/ui/alert-dialog.mjs +0 -90
  361. package/dist/src/components/ui/avatar.mjs +0 -32
  362. package/dist/src/components/ui/button.mjs +0 -48
  363. package/dist/src/components/ui/calendar.mjs +0 -108
  364. package/dist/src/components/ui/checkbox.mjs +0 -23
  365. package/dist/src/components/ui/combobox.mjs +0 -53
  366. package/dist/src/components/ui/command.mjs +0 -42
  367. package/dist/src/components/ui/context-menu.mjs +0 -67
  368. package/dist/src/components/ui/dialog.mjs +0 -9
  369. package/dist/src/components/ui/dropdown-menu.mjs +0 -122
  370. package/dist/src/components/ui/input-group.mjs +0 -31
  371. package/dist/src/components/ui/input.mjs +0 -15
  372. package/dist/src/components/ui/label.mjs +0 -19
  373. package/dist/src/components/ui/popover.mjs +0 -37
  374. package/dist/src/components/ui/select.mjs +0 -80
  375. package/dist/src/components/ui/separator.mjs +0 -19
  376. package/dist/src/components/ui/spinner.mjs +0 -16
  377. package/dist/src/components/ui/tabs.mjs +0 -39
  378. package/dist/src/components/ui/textarea.mjs +0 -14
  379. package/dist/src/components/ui/toolbar.mjs +0 -183
  380. package/dist/src/components/ui/tooltip.mjs +0 -38
  381. package/dist/src/hooks/editor/use-is-creator.mjs +0 -19
  382. package/dist/src/hooks/use-upload-file.mjs +0 -73
  383. package/dist/src/lib/config.mjs +0 -34
  384. package/dist/src/lib/data/store.d.mts +0 -15
  385. package/dist/src/lib/lowlight.mjs +0 -7
  386. package/dist/src/lib/utils/deep-equal.mjs +0 -18
  387. package/dist/src/lib/utils/remove-undefined.mjs +0 -18
  388. package/dist/src/lib/utils.mjs +0 -10
  389. package/next.config.ts +0 -23
  390. package/postcss.config.mjs +0 -7
  391. package/src/app/(dashboard)/collection/[name]/[...slug]/page.client.tsx +0 -26
  392. package/src/app/(dashboard)/collection/[name]/[...slug]/page.tsx +0 -18
  393. package/src/app/(dashboard)/collection/[name]/page.client.tsx +0 -82
  394. package/src/app/(dashboard)/collection/[name]/page.tsx +0 -11
  395. package/src/app/(dashboard)/layout.tsx +0 -34
  396. package/src/app/(dashboard)/page.tsx +0 -38
  397. package/src/app/api/ai/command/prompts.ts +0 -313
  398. package/src/app/api/ai/command/route.ts +0 -203
  399. package/src/app/api/ai/command/utils.ts +0 -242
  400. package/src/app/api/ai/copilot/route.ts +0 -33
  401. package/src/app/api/uploadthing/route.ts +0 -5
  402. package/src/app/codeblock/LICENSE +0 -21
  403. package/src/app/codeblock/styles.css +0 -289
  404. package/src/app/favicon.ico +0 -0
  405. package/src/app/globals.css +0 -223
  406. package/src/app/layout.client.tsx +0 -15
  407. package/src/app/layout.tsx +0 -30
  408. package/src/components/app-sidebar.tsx +0 -162
  409. package/src/components/code-editor/mdx.lazy.tsx +0 -18
  410. package/src/components/code-editor/mdx.tsx +0 -48
  411. package/src/components/code-editor/yaml.lazy.tsx +0 -20
  412. package/src/components/code-editor/yaml.tsx +0 -71
  413. package/src/components/collection/actions.tsx +0 -41
  414. package/src/components/collection/client.tsx +0 -63
  415. package/src/components/collection/context.tsx +0 -24
  416. package/src/components/collection/document/actions.tsx +0 -83
  417. package/src/components/editor/editor-base-kit.tsx +0 -37
  418. package/src/components/editor/editor-kit.tsx +0 -87
  419. package/src/components/editor/md.tsx +0 -60
  420. package/src/components/editor/plugins/ai-kit.tsx +0 -102
  421. package/src/components/editor/plugins/align-base-kit.tsx +0 -16
  422. package/src/components/editor/plugins/align-kit.tsx +0 -18
  423. package/src/components/editor/plugins/autoformat-kit.tsx +0 -236
  424. package/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -34
  425. package/src/components/editor/plugins/basic-blocks-kit.tsx +0 -87
  426. package/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -26
  427. package/src/components/editor/plugins/basic-marks-kit.tsx +0 -40
  428. package/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
  429. package/src/components/editor/plugins/block-menu-kit.tsx +0 -14
  430. package/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
  431. package/src/components/editor/plugins/block-selection-kit.tsx +0 -54
  432. package/src/components/editor/plugins/callout-base-kit.tsx +0 -5
  433. package/src/components/editor/plugins/callout-kit.tsx +0 -7
  434. package/src/components/editor/plugins/code-block-base-kit.tsx +0 -16
  435. package/src/components/editor/plugins/code-block-kit.tsx +0 -19
  436. package/src/components/editor/plugins/column-base-kit.tsx +0 -11
  437. package/src/components/editor/plugins/column-kit.tsx +0 -10
  438. package/src/components/editor/plugins/comment-base-kit.tsx +0 -5
  439. package/src/components/editor/plugins/comment-kit.tsx +0 -92
  440. package/src/components/editor/plugins/copilot-kit.tsx +0 -70
  441. package/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
  442. package/src/components/editor/plugins/date-base-kit.tsx +0 -5
  443. package/src/components/editor/plugins/date-kit.tsx +0 -7
  444. package/src/components/editor/plugins/discussion-kit.tsx +0 -142
  445. package/src/components/editor/plugins/dnd-kit.tsx +0 -25
  446. package/src/components/editor/plugins/emoji-kit.tsx +0 -13
  447. package/src/components/editor/plugins/exit-break-kit.tsx +0 -12
  448. package/src/components/editor/plugins/fixed-toolbar-kit.tsx +0 -19
  449. package/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
  450. package/src/components/editor/plugins/font-base-kit.tsx +0 -20
  451. package/src/components/editor/plugins/font-kit.tsx +0 -29
  452. package/src/components/editor/plugins/indent-base-kit.tsx +0 -13
  453. package/src/components/editor/plugins/indent-kit.tsx +0 -22
  454. package/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
  455. package/src/components/editor/plugins/line-height-kit.tsx +0 -16
  456. package/src/components/editor/plugins/link-base-kit.tsx +0 -5
  457. package/src/components/editor/plugins/link-kit.tsx +0 -15
  458. package/src/components/editor/plugins/list-base-kit.tsx +0 -17
  459. package/src/components/editor/plugins/list-kit.tsx +0 -26
  460. package/src/components/editor/plugins/markdown-kit.tsx +0 -13
  461. package/src/components/editor/plugins/math-base-kit.tsx +0 -11
  462. package/src/components/editor/plugins/math-kit.tsx +0 -10
  463. package/src/components/editor/plugins/media-base-kit.tsx +0 -25
  464. package/src/components/editor/plugins/media-kit.tsx +0 -28
  465. package/src/components/editor/plugins/slash-kit.tsx +0 -18
  466. package/src/components/editor/plugins/suggestion-base-kit.tsx +0 -5
  467. package/src/components/editor/plugins/suggestion-kit.tsx +0 -83
  468. package/src/components/editor/plugins/table-base-kit.tsx +0 -20
  469. package/src/components/editor/plugins/table-kit.tsx +0 -22
  470. package/src/components/editor/settings-dialog.tsx +0 -418
  471. package/src/components/editor/transforms.ts +0 -193
  472. package/src/components/editor/types.ts +0 -149
  473. package/src/components/editor/ui/ai-chat-editor.tsx +0 -20
  474. package/src/components/editor/ui/ai-menu.tsx +0 -663
  475. package/src/components/editor/ui/ai-node.tsx +0 -40
  476. package/src/components/editor/ui/ai-toolbar-button.tsx +0 -23
  477. package/src/components/editor/ui/align-toolbar-button.tsx +0 -78
  478. package/src/components/editor/ui/block-context-menu.tsx +0 -154
  479. package/src/components/editor/ui/block-discussion.tsx +0 -318
  480. package/src/components/editor/ui/block-draggable.tsx +0 -464
  481. package/src/components/editor/ui/block-list-static.tsx +0 -75
  482. package/src/components/editor/ui/block-list.tsx +0 -72
  483. package/src/components/editor/ui/block-selection.tsx +0 -37
  484. package/src/components/editor/ui/block-suggestion.tsx +0 -438
  485. package/src/components/editor/ui/blockquote-node-static.tsx +0 -5
  486. package/src/components/editor/ui/blockquote-node.tsx +0 -7
  487. package/src/components/editor/ui/callout-node-static.tsx +0 -30
  488. package/src/components/editor/ui/callout-node.tsx +0 -64
  489. package/src/components/editor/ui/caption.tsx +0 -55
  490. package/src/components/editor/ui/code-block-node-static.tsx +0 -33
  491. package/src/components/editor/ui/code-block-node.tsx +0 -161
  492. package/src/components/editor/ui/code-node-static.tsx +0 -15
  493. package/src/components/editor/ui/code-node.tsx +0 -17
  494. package/src/components/editor/ui/column-node-static.tsx +0 -27
  495. package/src/components/editor/ui/column-node.tsx +0 -285
  496. package/src/components/editor/ui/comment-node-static.tsx +0 -12
  497. package/src/components/editor/ui/comment-node.tsx +0 -43
  498. package/src/components/editor/ui/comment-toolbar-button.tsx +0 -24
  499. package/src/components/editor/ui/comment.tsx +0 -577
  500. package/src/components/editor/ui/cursor-overlay.tsx +0 -66
  501. package/src/components/editor/ui/date-node-static.tsx +0 -45
  502. package/src/components/editor/ui/date-node.tsx +0 -86
  503. package/src/components/editor/ui/editor-static.tsx +0 -47
  504. package/src/components/editor/ui/editor.tsx +0 -120
  505. package/src/components/editor/ui/emoji-node.tsx +0 -65
  506. package/src/components/editor/ui/emoji-toolbar-button.tsx +0 -582
  507. package/src/components/editor/ui/equation-node-static.tsx +0 -94
  508. package/src/components/editor/ui/equation-node.tsx +0 -218
  509. package/src/components/editor/ui/equation-toolbar-button.tsx +0 -24
  510. package/src/components/editor/ui/fixed-toolbar-buttons.tsx +0 -135
  511. package/src/components/editor/ui/fixed-toolbar.tsx +0 -17
  512. package/src/components/editor/ui/floating-toolbar-buttons.tsx +0 -72
  513. package/src/components/editor/ui/floating-toolbar.tsx +0 -76
  514. package/src/components/editor/ui/font-color-toolbar-button.tsx +0 -804
  515. package/src/components/editor/ui/font-size-toolbar-button.tsx +0 -102
  516. package/src/components/editor/ui/ghost-text.tsx +0 -27
  517. package/src/components/editor/ui/heading-node-static.tsx +0 -54
  518. package/src/components/editor/ui/heading-node.tsx +0 -54
  519. package/src/components/editor/ui/highlight-node-static.tsx +0 -11
  520. package/src/components/editor/ui/highlight-node.tsx +0 -13
  521. package/src/components/editor/ui/history-toolbar-button.tsx +0 -41
  522. package/src/components/editor/ui/hr-node-static.tsx +0 -16
  523. package/src/components/editor/ui/hr-node.tsx +0 -28
  524. package/src/components/editor/ui/indent-toolbar-button.tsx +0 -27
  525. package/src/components/editor/ui/inline-combobox.tsx +0 -251
  526. package/src/components/editor/ui/insert-toolbar-button.tsx +0 -242
  527. package/src/components/editor/ui/kbd-node-static.tsx +0 -15
  528. package/src/components/editor/ui/kbd-node.tsx +0 -17
  529. package/src/components/editor/ui/line-height-toolbar-button.tsx +0 -66
  530. package/src/components/editor/ui/link-node-static.tsx +0 -21
  531. package/src/components/editor/ui/link-node.tsx +0 -37
  532. package/src/components/editor/ui/link-toolbar-button.tsx +0 -18
  533. package/src/components/editor/ui/link-toolbar.tsx +0 -196
  534. package/src/components/editor/ui/list-toolbar-button.tsx +0 -195
  535. package/src/components/editor/ui/mark-toolbar-button.tsx +0 -20
  536. package/src/components/editor/ui/media-image-node-static.tsx +0 -33
  537. package/src/components/editor/ui/media-image-node.tsx +0 -75
  538. package/src/components/editor/ui/media-placeholder-node.tsx +0 -235
  539. package/src/components/editor/ui/media-preview-dialog.tsx +0 -145
  540. package/src/components/editor/ui/media-toolbar-button.tsx +0 -202
  541. package/src/components/editor/ui/media-toolbar.tsx +0 -100
  542. package/src/components/editor/ui/media-upload-toast.tsx +0 -59
  543. package/src/components/editor/ui/media-video-node-static.tsx +0 -23
  544. package/src/components/editor/ui/mode-toolbar-button.tsx +0 -121
  545. package/src/components/editor/ui/paragraph-node-static.tsx +0 -13
  546. package/src/components/editor/ui/paragraph-node.tsx +0 -15
  547. package/src/components/editor/ui/resize-handle.tsx +0 -79
  548. package/src/components/editor/ui/slash-node.tsx +0 -274
  549. package/src/components/editor/ui/suggestion-node-static.tsx +0 -30
  550. package/src/components/editor/ui/suggestion-node.tsx +0 -157
  551. package/src/components/editor/ui/suggestion-toolbar-button.tsx +0 -25
  552. package/src/components/editor/ui/table-icons.tsx +0 -685
  553. package/src/components/editor/ui/table-node-static.tsx +0 -86
  554. package/src/components/editor/ui/table-node.tsx +0 -569
  555. package/src/components/editor/ui/table-toolbar-button.tsx +0 -260
  556. package/src/components/editor/ui/turn-into-toolbar-button.tsx +0 -176
  557. package/src/components/editor/use-chat.ts +0 -120
  558. package/src/components/icons/logo.tsx +0 -37
  559. package/src/components/json-schema-editor/client.tsx +0 -55
  560. package/src/components/json-schema-editor/components/inputs.tsx +0 -612
  561. package/src/components/json-schema-editor/get-default-values.ts +0 -29
  562. package/src/components/json-schema-editor/schema.tsx +0 -206
  563. package/src/components/json-schema-editor/utils/merge-schema.ts +0 -167
  564. package/src/components/json-schema-editor/utils/schema-to-string.ts +0 -87
  565. package/src/components/nav-user.tsx +0 -102
  566. package/src/components/site-header.tsx +0 -13
  567. package/src/components/ui/alert-dialog.tsx +0 -182
  568. package/src/components/ui/avatar.tsx +0 -96
  569. package/src/components/ui/button.tsx +0 -65
  570. package/src/components/ui/calendar.tsx +0 -186
  571. package/src/components/ui/checkbox.tsx +0 -29
  572. package/src/components/ui/combobox.tsx +0 -267
  573. package/src/components/ui/command.tsx +0 -180
  574. package/src/components/ui/context-menu.tsx +0 -161
  575. package/src/components/ui/dialog.tsx +0 -142
  576. package/src/components/ui/drawer.tsx +0 -120
  577. package/src/components/ui/dropdown-menu.tsx +0 -239
  578. package/src/components/ui/field.tsx +0 -224
  579. package/src/components/ui/input-group.tsx +0 -144
  580. package/src/components/ui/input.tsx +0 -19
  581. package/src/components/ui/label.tsx +0 -18
  582. package/src/components/ui/popover.tsx +0 -76
  583. package/src/components/ui/select.tsx +0 -182
  584. package/src/components/ui/separator.tsx +0 -28
  585. package/src/components/ui/sheet.tsx +0 -130
  586. package/src/components/ui/sidebar.tsx +0 -608
  587. package/src/components/ui/sonner.tsx +0 -45
  588. package/src/components/ui/spinner.tsx +0 -15
  589. package/src/components/ui/table.tsx +0 -89
  590. package/src/components/ui/tabs.tsx +0 -60
  591. package/src/components/ui/textarea.tsx +0 -18
  592. package/src/components/ui/toggle-group.tsx +0 -86
  593. package/src/components/ui/toggle.tsx +0 -45
  594. package/src/components/ui/toolbar.tsx +0 -365
  595. package/src/components/ui/tooltip.tsx +0 -57
  596. package/src/hooks/editor/use-is-creator.ts +0 -21
  597. package/src/hooks/use-mobile.ts +0 -19
  598. package/src/hooks/use-mounted.ts +0 -11
  599. package/src/hooks/use-upload-file.ts +0 -121
  600. package/src/lib/ai/markdown-joiner-transform.ts +0 -235
  601. package/src/lib/config.ts +0 -42
  602. package/src/lib/data/actions.ts +0 -46
  603. package/src/lib/data/boundary.client.tsx +0 -22
  604. package/src/lib/data/boundary.tsx +0 -22
  605. package/src/lib/data/query.ts +0 -9
  606. package/src/lib/data/store.ts +0 -52
  607. package/src/lib/lowlight.ts +0 -3
  608. package/src/lib/uploadthing.ts +0 -19
  609. package/src/lib/utils/deep-equal.ts +0 -37
  610. package/src/lib/utils/remove-undefined.ts +0 -21
  611. package/src/lib/utils/urls.ts +0 -6
  612. package/src/lib/utils.ts +0 -6
  613. package/tsconfig.build.json +0 -24
  614. package/tsconfig.json +0 -37
@@ -0,0 +1,2071 @@
1
+ import { g as getCore, s as studioHook } from "./config-Cb909uq6.js";
2
+ import { getCollectionItems, getDocumentItems } from "./actions-CWWFIcb1.js";
3
+ import { r as registerClientReference } from "../index.js";
4
+ import "fuma-content/collections";
5
+ import "fuma-content/collections/mdx";
6
+ import "./jsx-runtime.react-server-D3We4JeM.js";
7
+ import "node:fs/promises";
8
+ import "node:path";
9
+ import "gray-matter";
10
+ import "fuma-content";
11
+ import "fuma-content/collections/data";
12
+ import "js-yaml";
13
+ import "fuma-content/dynamic";
14
+ import "node:async_hooks";
15
+ import "../__vite_rsc_assets_manifest.js";
16
+ var Subscribable = class {
17
+ constructor() {
18
+ this.listeners = /* @__PURE__ */ new Set();
19
+ this.subscribe = this.subscribe.bind(this);
20
+ }
21
+ subscribe(listener) {
22
+ this.listeners.add(listener);
23
+ this.onSubscribe();
24
+ return () => {
25
+ this.listeners.delete(listener);
26
+ this.onUnsubscribe();
27
+ };
28
+ }
29
+ hasListeners() {
30
+ return this.listeners.size > 0;
31
+ }
32
+ onSubscribe() {
33
+ }
34
+ onUnsubscribe() {
35
+ }
36
+ };
37
+ var defaultTimeoutProvider = {
38
+ // We need the wrapper function syntax below instead of direct references to
39
+ // global setTimeout etc.
40
+ //
41
+ // BAD: `setTimeout: setTimeout`
42
+ // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
43
+ //
44
+ // If we use direct references here, then anything that wants to spy on or
45
+ // replace the global setTimeout (like tests) won't work since we'll already
46
+ // have a hard reference to the original implementation at the time when this
47
+ // file was imported.
48
+ setTimeout: (callback, delay) => setTimeout(callback, delay),
49
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId),
50
+ setInterval: (callback, delay) => setInterval(callback, delay),
51
+ clearInterval: (intervalId) => clearInterval(intervalId)
52
+ };
53
+ var TimeoutManager = class {
54
+ // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
55
+ // type at app boot; and if we leave that type, then any new timer provider
56
+ // would need to support ReturnType<typeof setTimeout>, which is infeasible.
57
+ //
58
+ // We settle for type safety for the TimeoutProvider type, and accept that
59
+ // this class is unsafe internally to allow for extension.
60
+ #provider = defaultTimeoutProvider;
61
+ #providerCalled = false;
62
+ setTimeoutProvider(provider) {
63
+ if (process.env.NODE_ENV !== "production") {
64
+ if (this.#providerCalled && provider !== this.#provider) {
65
+ console.error(
66
+ `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
67
+ { previous: this.#provider, provider }
68
+ );
69
+ }
70
+ }
71
+ this.#provider = provider;
72
+ if (process.env.NODE_ENV !== "production") {
73
+ this.#providerCalled = false;
74
+ }
75
+ }
76
+ setTimeout(callback, delay) {
77
+ if (process.env.NODE_ENV !== "production") {
78
+ this.#providerCalled = true;
79
+ }
80
+ return this.#provider.setTimeout(callback, delay);
81
+ }
82
+ clearTimeout(timeoutId) {
83
+ this.#provider.clearTimeout(timeoutId);
84
+ }
85
+ setInterval(callback, delay) {
86
+ if (process.env.NODE_ENV !== "production") {
87
+ this.#providerCalled = true;
88
+ }
89
+ return this.#provider.setInterval(callback, delay);
90
+ }
91
+ clearInterval(intervalId) {
92
+ this.#provider.clearInterval(intervalId);
93
+ }
94
+ };
95
+ var timeoutManager = new TimeoutManager();
96
+ function systemSetTimeoutZero(callback) {
97
+ setTimeout(callback, 0);
98
+ }
99
+ var isServer = typeof window === "undefined" || "Deno" in globalThis;
100
+ function noop() {
101
+ }
102
+ function functionalUpdate(updater, input) {
103
+ return typeof updater === "function" ? updater(input) : updater;
104
+ }
105
+ function isValidTimeout(value) {
106
+ return typeof value === "number" && value >= 0 && value !== Infinity;
107
+ }
108
+ function timeUntilStale(updatedAt, staleTime) {
109
+ return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
110
+ }
111
+ function resolveStaleTime(staleTime, query) {
112
+ return typeof staleTime === "function" ? staleTime(query) : staleTime;
113
+ }
114
+ function resolveEnabled(enabled, query) {
115
+ return typeof enabled === "function" ? enabled(query) : enabled;
116
+ }
117
+ function matchQuery(filters, query) {
118
+ const {
119
+ type = "all",
120
+ exact,
121
+ fetchStatus,
122
+ predicate,
123
+ queryKey,
124
+ stale
125
+ } = filters;
126
+ if (queryKey) {
127
+ if (exact) {
128
+ if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
129
+ return false;
130
+ }
131
+ } else if (!partialMatchKey(query.queryKey, queryKey)) {
132
+ return false;
133
+ }
134
+ }
135
+ if (type !== "all") {
136
+ const isActive = query.isActive();
137
+ if (type === "active" && !isActive) {
138
+ return false;
139
+ }
140
+ if (type === "inactive" && isActive) {
141
+ return false;
142
+ }
143
+ }
144
+ if (typeof stale === "boolean" && query.isStale() !== stale) {
145
+ return false;
146
+ }
147
+ if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
148
+ return false;
149
+ }
150
+ if (predicate && !predicate(query)) {
151
+ return false;
152
+ }
153
+ return true;
154
+ }
155
+ function matchMutation(filters, mutation) {
156
+ const { exact, status, predicate, mutationKey } = filters;
157
+ if (mutationKey) {
158
+ if (!mutation.options.mutationKey) {
159
+ return false;
160
+ }
161
+ if (exact) {
162
+ if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
163
+ return false;
164
+ }
165
+ } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
166
+ return false;
167
+ }
168
+ }
169
+ if (status && mutation.state.status !== status) {
170
+ return false;
171
+ }
172
+ if (predicate && !predicate(mutation)) {
173
+ return false;
174
+ }
175
+ return true;
176
+ }
177
+ function hashQueryKeyByOptions(queryKey, options) {
178
+ const hashFn = options?.queryKeyHashFn || hashKey;
179
+ return hashFn(queryKey);
180
+ }
181
+ function hashKey(queryKey) {
182
+ return JSON.stringify(
183
+ queryKey,
184
+ (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
185
+ result[key] = val[key];
186
+ return result;
187
+ }, {}) : val
188
+ );
189
+ }
190
+ function partialMatchKey(a, b) {
191
+ if (a === b) {
192
+ return true;
193
+ }
194
+ if (typeof a !== typeof b) {
195
+ return false;
196
+ }
197
+ if (a && b && typeof a === "object" && typeof b === "object") {
198
+ return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
199
+ }
200
+ return false;
201
+ }
202
+ var hasOwn = Object.prototype.hasOwnProperty;
203
+ function replaceEqualDeep(a, b, depth = 0) {
204
+ if (a === b) {
205
+ return a;
206
+ }
207
+ if (depth > 500) return b;
208
+ const array = isPlainArray(a) && isPlainArray(b);
209
+ if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
210
+ const aItems = array ? a : Object.keys(a);
211
+ const aSize = aItems.length;
212
+ const bItems = array ? b : Object.keys(b);
213
+ const bSize = bItems.length;
214
+ const copy = array ? new Array(bSize) : {};
215
+ let equalItems = 0;
216
+ for (let i = 0; i < bSize; i++) {
217
+ const key = array ? i : bItems[i];
218
+ const aItem = a[key];
219
+ const bItem = b[key];
220
+ if (aItem === bItem) {
221
+ copy[key] = aItem;
222
+ if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
223
+ continue;
224
+ }
225
+ if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
226
+ copy[key] = bItem;
227
+ continue;
228
+ }
229
+ const v = replaceEqualDeep(aItem, bItem, depth + 1);
230
+ copy[key] = v;
231
+ if (v === aItem) equalItems++;
232
+ }
233
+ return aSize === bSize && equalItems === aSize ? a : copy;
234
+ }
235
+ function isPlainArray(value) {
236
+ return Array.isArray(value) && value.length === Object.keys(value).length;
237
+ }
238
+ function isPlainObject(o) {
239
+ if (!hasObjectPrototype(o)) {
240
+ return false;
241
+ }
242
+ const ctor = o.constructor;
243
+ if (ctor === void 0) {
244
+ return true;
245
+ }
246
+ const prot = ctor.prototype;
247
+ if (!hasObjectPrototype(prot)) {
248
+ return false;
249
+ }
250
+ if (!prot.hasOwnProperty("isPrototypeOf")) {
251
+ return false;
252
+ }
253
+ if (Object.getPrototypeOf(o) !== Object.prototype) {
254
+ return false;
255
+ }
256
+ return true;
257
+ }
258
+ function hasObjectPrototype(o) {
259
+ return Object.prototype.toString.call(o) === "[object Object]";
260
+ }
261
+ function sleep(timeout) {
262
+ return new Promise((resolve) => {
263
+ timeoutManager.setTimeout(resolve, timeout);
264
+ });
265
+ }
266
+ function replaceData(prevData, data, options) {
267
+ if (typeof options.structuralSharing === "function") {
268
+ return options.structuralSharing(prevData, data);
269
+ } else if (options.structuralSharing !== false) {
270
+ if (process.env.NODE_ENV !== "production") {
271
+ try {
272
+ return replaceEqualDeep(prevData, data);
273
+ } catch (error) {
274
+ console.error(
275
+ `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
276
+ );
277
+ throw error;
278
+ }
279
+ }
280
+ return replaceEqualDeep(prevData, data);
281
+ }
282
+ return data;
283
+ }
284
+ function addToEnd(items, item, max = 0) {
285
+ const newItems = [...items, item];
286
+ return max && newItems.length > max ? newItems.slice(1) : newItems;
287
+ }
288
+ function addToStart(items, item, max = 0) {
289
+ const newItems = [item, ...items];
290
+ return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
291
+ }
292
+ var skipToken = /* @__PURE__ */ Symbol();
293
+ function ensureQueryFn(options, fetchOptions) {
294
+ if (process.env.NODE_ENV !== "production") {
295
+ if (options.queryFn === skipToken) {
296
+ console.error(
297
+ `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
298
+ );
299
+ }
300
+ }
301
+ if (!options.queryFn && fetchOptions?.initialPromise) {
302
+ return () => fetchOptions.initialPromise;
303
+ }
304
+ if (!options.queryFn || options.queryFn === skipToken) {
305
+ return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
306
+ }
307
+ return options.queryFn;
308
+ }
309
+ function addConsumeAwareSignal(object, getSignal, onCancelled) {
310
+ let consumed = false;
311
+ let signal;
312
+ Object.defineProperty(object, "signal", {
313
+ enumerable: true,
314
+ get: () => {
315
+ signal ??= getSignal();
316
+ if (consumed) {
317
+ return signal;
318
+ }
319
+ consumed = true;
320
+ if (signal.aborted) {
321
+ onCancelled();
322
+ } else {
323
+ signal.addEventListener("abort", onCancelled, { once: true });
324
+ }
325
+ return signal;
326
+ }
327
+ });
328
+ return object;
329
+ }
330
+ var FocusManager = class extends Subscribable {
331
+ #focused;
332
+ #cleanup;
333
+ #setup;
334
+ constructor() {
335
+ super();
336
+ this.#setup = (onFocus) => {
337
+ if (!isServer && window.addEventListener) {
338
+ const listener = () => onFocus();
339
+ window.addEventListener("visibilitychange", listener, false);
340
+ return () => {
341
+ window.removeEventListener("visibilitychange", listener);
342
+ };
343
+ }
344
+ return;
345
+ };
346
+ }
347
+ onSubscribe() {
348
+ if (!this.#cleanup) {
349
+ this.setEventListener(this.#setup);
350
+ }
351
+ }
352
+ onUnsubscribe() {
353
+ if (!this.hasListeners()) {
354
+ this.#cleanup?.();
355
+ this.#cleanup = void 0;
356
+ }
357
+ }
358
+ setEventListener(setup) {
359
+ this.#setup = setup;
360
+ this.#cleanup?.();
361
+ this.#cleanup = setup((focused) => {
362
+ if (typeof focused === "boolean") {
363
+ this.setFocused(focused);
364
+ } else {
365
+ this.onFocus();
366
+ }
367
+ });
368
+ }
369
+ setFocused(focused) {
370
+ const changed = this.#focused !== focused;
371
+ if (changed) {
372
+ this.#focused = focused;
373
+ this.onFocus();
374
+ }
375
+ }
376
+ onFocus() {
377
+ const isFocused = this.isFocused();
378
+ this.listeners.forEach((listener) => {
379
+ listener(isFocused);
380
+ });
381
+ }
382
+ isFocused() {
383
+ if (typeof this.#focused === "boolean") {
384
+ return this.#focused;
385
+ }
386
+ return globalThis.document?.visibilityState !== "hidden";
387
+ }
388
+ };
389
+ var focusManager = new FocusManager();
390
+ function pendingThenable() {
391
+ let resolve;
392
+ let reject;
393
+ const thenable = new Promise((_resolve, _reject) => {
394
+ resolve = _resolve;
395
+ reject = _reject;
396
+ });
397
+ thenable.status = "pending";
398
+ thenable.catch(() => {
399
+ });
400
+ function finalize(data) {
401
+ Object.assign(thenable, data);
402
+ delete thenable.resolve;
403
+ delete thenable.reject;
404
+ }
405
+ thenable.resolve = (value) => {
406
+ finalize({
407
+ status: "fulfilled",
408
+ value
409
+ });
410
+ resolve(value);
411
+ };
412
+ thenable.reject = (reason) => {
413
+ finalize({
414
+ status: "rejected",
415
+ reason
416
+ });
417
+ reject(reason);
418
+ };
419
+ return thenable;
420
+ }
421
+ function defaultTransformerFn(data) {
422
+ return data;
423
+ }
424
+ function dehydrateMutation(mutation) {
425
+ return {
426
+ mutationKey: mutation.options.mutationKey,
427
+ state: mutation.state,
428
+ ...mutation.options.scope && { scope: mutation.options.scope },
429
+ ...mutation.meta && { meta: mutation.meta }
430
+ };
431
+ }
432
+ function dehydrateQuery(query, serializeData, shouldRedactErrors) {
433
+ const dehydratePromise = () => {
434
+ const promise = query.promise?.then(serializeData).catch((error) => {
435
+ if (!shouldRedactErrors(error)) {
436
+ return Promise.reject(error);
437
+ }
438
+ if (process.env.NODE_ENV !== "production") {
439
+ console.error(
440
+ `A query that was dehydrated as pending ended up rejecting. [${query.queryHash}]: ${error}; The error will be redacted in production builds`
441
+ );
442
+ }
443
+ return Promise.reject(new Error("redacted"));
444
+ });
445
+ promise?.catch(noop);
446
+ return promise;
447
+ };
448
+ return {
449
+ dehydratedAt: Date.now(),
450
+ state: {
451
+ ...query.state,
452
+ ...query.state.data !== void 0 && {
453
+ data: serializeData(query.state.data)
454
+ }
455
+ },
456
+ queryKey: query.queryKey,
457
+ queryHash: query.queryHash,
458
+ ...query.state.status === "pending" && {
459
+ promise: dehydratePromise()
460
+ },
461
+ ...query.meta && { meta: query.meta }
462
+ };
463
+ }
464
+ function defaultShouldDehydrateMutation(mutation) {
465
+ return mutation.state.isPaused;
466
+ }
467
+ function defaultShouldDehydrateQuery(query) {
468
+ return query.state.status === "success";
469
+ }
470
+ function defaultShouldRedactErrors(_) {
471
+ return true;
472
+ }
473
+ function dehydrate(client, options = {}) {
474
+ const filterMutation = options.shouldDehydrateMutation ?? client.getDefaultOptions().dehydrate?.shouldDehydrateMutation ?? defaultShouldDehydrateMutation;
475
+ const mutations = client.getMutationCache().getAll().flatMap(
476
+ (mutation) => filterMutation(mutation) ? [dehydrateMutation(mutation)] : []
477
+ );
478
+ const filterQuery = options.shouldDehydrateQuery ?? client.getDefaultOptions().dehydrate?.shouldDehydrateQuery ?? defaultShouldDehydrateQuery;
479
+ const shouldRedactErrors = options.shouldRedactErrors ?? client.getDefaultOptions().dehydrate?.shouldRedactErrors ?? defaultShouldRedactErrors;
480
+ const serializeData = options.serializeData ?? client.getDefaultOptions().dehydrate?.serializeData ?? defaultTransformerFn;
481
+ const queries = client.getQueryCache().getAll().flatMap(
482
+ (query) => filterQuery(query) ? [dehydrateQuery(query, serializeData, shouldRedactErrors)] : []
483
+ );
484
+ return { mutations, queries };
485
+ }
486
+ var defaultScheduler = systemSetTimeoutZero;
487
+ function createNotifyManager() {
488
+ let queue = [];
489
+ let transactions = 0;
490
+ let notifyFn = (callback) => {
491
+ callback();
492
+ };
493
+ let batchNotifyFn = (callback) => {
494
+ callback();
495
+ };
496
+ let scheduleFn = defaultScheduler;
497
+ const schedule = (callback) => {
498
+ if (transactions) {
499
+ queue.push(callback);
500
+ } else {
501
+ scheduleFn(() => {
502
+ notifyFn(callback);
503
+ });
504
+ }
505
+ };
506
+ const flush = () => {
507
+ const originalQueue = queue;
508
+ queue = [];
509
+ if (originalQueue.length) {
510
+ scheduleFn(() => {
511
+ batchNotifyFn(() => {
512
+ originalQueue.forEach((callback) => {
513
+ notifyFn(callback);
514
+ });
515
+ });
516
+ });
517
+ }
518
+ };
519
+ return {
520
+ batch: (callback) => {
521
+ let result;
522
+ transactions++;
523
+ try {
524
+ result = callback();
525
+ } finally {
526
+ transactions--;
527
+ if (!transactions) {
528
+ flush();
529
+ }
530
+ }
531
+ return result;
532
+ },
533
+ /**
534
+ * All calls to the wrapped function will be batched.
535
+ */
536
+ batchCalls: (callback) => {
537
+ return (...args) => {
538
+ schedule(() => {
539
+ callback(...args);
540
+ });
541
+ };
542
+ },
543
+ schedule,
544
+ /**
545
+ * Use this method to set a custom notify function.
546
+ * This can be used to for example wrap notifications with `React.act` while running tests.
547
+ */
548
+ setNotifyFunction: (fn) => {
549
+ notifyFn = fn;
550
+ },
551
+ /**
552
+ * Use this method to set a custom function to batch notifications together into a single tick.
553
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
554
+ */
555
+ setBatchNotifyFunction: (fn) => {
556
+ batchNotifyFn = fn;
557
+ },
558
+ setScheduler: (fn) => {
559
+ scheduleFn = fn;
560
+ }
561
+ };
562
+ }
563
+ var notifyManager = createNotifyManager();
564
+ var OnlineManager = class extends Subscribable {
565
+ #online = true;
566
+ #cleanup;
567
+ #setup;
568
+ constructor() {
569
+ super();
570
+ this.#setup = (onOnline) => {
571
+ if (!isServer && window.addEventListener) {
572
+ const onlineListener = () => onOnline(true);
573
+ const offlineListener = () => onOnline(false);
574
+ window.addEventListener("online", onlineListener, false);
575
+ window.addEventListener("offline", offlineListener, false);
576
+ return () => {
577
+ window.removeEventListener("online", onlineListener);
578
+ window.removeEventListener("offline", offlineListener);
579
+ };
580
+ }
581
+ return;
582
+ };
583
+ }
584
+ onSubscribe() {
585
+ if (!this.#cleanup) {
586
+ this.setEventListener(this.#setup);
587
+ }
588
+ }
589
+ onUnsubscribe() {
590
+ if (!this.hasListeners()) {
591
+ this.#cleanup?.();
592
+ this.#cleanup = void 0;
593
+ }
594
+ }
595
+ setEventListener(setup) {
596
+ this.#setup = setup;
597
+ this.#cleanup?.();
598
+ this.#cleanup = setup(this.setOnline.bind(this));
599
+ }
600
+ setOnline(online) {
601
+ const changed = this.#online !== online;
602
+ if (changed) {
603
+ this.#online = online;
604
+ this.listeners.forEach((listener) => {
605
+ listener(online);
606
+ });
607
+ }
608
+ }
609
+ isOnline() {
610
+ return this.#online;
611
+ }
612
+ };
613
+ var onlineManager = new OnlineManager();
614
+ function defaultRetryDelay(failureCount) {
615
+ return Math.min(1e3 * 2 ** failureCount, 3e4);
616
+ }
617
+ function canFetch(networkMode) {
618
+ return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
619
+ }
620
+ var CancelledError = class extends Error {
621
+ constructor(options) {
622
+ super("CancelledError");
623
+ this.revert = options?.revert;
624
+ this.silent = options?.silent;
625
+ }
626
+ };
627
+ function createRetryer(config) {
628
+ let isRetryCancelled = false;
629
+ let failureCount = 0;
630
+ let continueFn;
631
+ const thenable = pendingThenable();
632
+ const isResolved = () => thenable.status !== "pending";
633
+ const cancel = (cancelOptions) => {
634
+ if (!isResolved()) {
635
+ const error = new CancelledError(cancelOptions);
636
+ reject(error);
637
+ config.onCancel?.(error);
638
+ }
639
+ };
640
+ const cancelRetry = () => {
641
+ isRetryCancelled = true;
642
+ };
643
+ const continueRetry = () => {
644
+ isRetryCancelled = false;
645
+ };
646
+ const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
647
+ const canStart = () => canFetch(config.networkMode) && config.canRun();
648
+ const resolve = (value) => {
649
+ if (!isResolved()) {
650
+ continueFn?.();
651
+ thenable.resolve(value);
652
+ }
653
+ };
654
+ const reject = (value) => {
655
+ if (!isResolved()) {
656
+ continueFn?.();
657
+ thenable.reject(value);
658
+ }
659
+ };
660
+ const pause = () => {
661
+ return new Promise((continueResolve) => {
662
+ continueFn = (value) => {
663
+ if (isResolved() || canContinue()) {
664
+ continueResolve(value);
665
+ }
666
+ };
667
+ config.onPause?.();
668
+ }).then(() => {
669
+ continueFn = void 0;
670
+ if (!isResolved()) {
671
+ config.onContinue?.();
672
+ }
673
+ });
674
+ };
675
+ const run = () => {
676
+ if (isResolved()) {
677
+ return;
678
+ }
679
+ let promiseOrValue;
680
+ const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
681
+ try {
682
+ promiseOrValue = initialPromise ?? config.fn();
683
+ } catch (error) {
684
+ promiseOrValue = Promise.reject(error);
685
+ }
686
+ Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
687
+ if (isResolved()) {
688
+ return;
689
+ }
690
+ const retry = config.retry ?? (isServer ? 0 : 3);
691
+ const retryDelay = config.retryDelay ?? defaultRetryDelay;
692
+ const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
693
+ const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
694
+ if (isRetryCancelled || !shouldRetry) {
695
+ reject(error);
696
+ return;
697
+ }
698
+ failureCount++;
699
+ config.onFail?.(failureCount, error);
700
+ sleep(delay).then(() => {
701
+ return canContinue() ? void 0 : pause();
702
+ }).then(() => {
703
+ if (isRetryCancelled) {
704
+ reject(error);
705
+ } else {
706
+ run();
707
+ }
708
+ });
709
+ });
710
+ };
711
+ return {
712
+ promise: thenable,
713
+ status: () => thenable.status,
714
+ cancel,
715
+ continue: () => {
716
+ continueFn?.();
717
+ return thenable;
718
+ },
719
+ cancelRetry,
720
+ continueRetry,
721
+ canStart,
722
+ start: () => {
723
+ if (canStart()) {
724
+ run();
725
+ } else {
726
+ pause().then(run);
727
+ }
728
+ return thenable;
729
+ }
730
+ };
731
+ }
732
+ var Removable = class {
733
+ #gcTimeout;
734
+ destroy() {
735
+ this.clearGcTimeout();
736
+ }
737
+ scheduleGc() {
738
+ this.clearGcTimeout();
739
+ if (isValidTimeout(this.gcTime)) {
740
+ this.#gcTimeout = timeoutManager.setTimeout(() => {
741
+ this.optionalRemove();
742
+ }, this.gcTime);
743
+ }
744
+ }
745
+ updateGcTime(newGcTime) {
746
+ this.gcTime = Math.max(
747
+ this.gcTime || 0,
748
+ newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
749
+ );
750
+ }
751
+ clearGcTimeout() {
752
+ if (this.#gcTimeout) {
753
+ timeoutManager.clearTimeout(this.#gcTimeout);
754
+ this.#gcTimeout = void 0;
755
+ }
756
+ }
757
+ };
758
+ var Query = class extends Removable {
759
+ #initialState;
760
+ #revertState;
761
+ #cache;
762
+ #client;
763
+ #retryer;
764
+ #defaultOptions;
765
+ #abortSignalConsumed;
766
+ constructor(config) {
767
+ super();
768
+ this.#abortSignalConsumed = false;
769
+ this.#defaultOptions = config.defaultOptions;
770
+ this.setOptions(config.options);
771
+ this.observers = [];
772
+ this.#client = config.client;
773
+ this.#cache = this.#client.getQueryCache();
774
+ this.queryKey = config.queryKey;
775
+ this.queryHash = config.queryHash;
776
+ this.#initialState = getDefaultState$1(this.options);
777
+ this.state = config.state ?? this.#initialState;
778
+ this.scheduleGc();
779
+ }
780
+ get meta() {
781
+ return this.options.meta;
782
+ }
783
+ get promise() {
784
+ return this.#retryer?.promise;
785
+ }
786
+ setOptions(options) {
787
+ this.options = { ...this.#defaultOptions, ...options };
788
+ this.updateGcTime(this.options.gcTime);
789
+ if (this.state && this.state.data === void 0) {
790
+ const defaultState = getDefaultState$1(this.options);
791
+ if (defaultState.data !== void 0) {
792
+ this.setState(
793
+ successState(defaultState.data, defaultState.dataUpdatedAt)
794
+ );
795
+ this.#initialState = defaultState;
796
+ }
797
+ }
798
+ }
799
+ optionalRemove() {
800
+ if (!this.observers.length && this.state.fetchStatus === "idle") {
801
+ this.#cache.remove(this);
802
+ }
803
+ }
804
+ setData(newData, options) {
805
+ const data = replaceData(this.state.data, newData, this.options);
806
+ this.#dispatch({
807
+ data,
808
+ type: "success",
809
+ dataUpdatedAt: options?.updatedAt,
810
+ manual: options?.manual
811
+ });
812
+ return data;
813
+ }
814
+ setState(state, setStateOptions) {
815
+ this.#dispatch({ type: "setState", state, setStateOptions });
816
+ }
817
+ cancel(options) {
818
+ const promise = this.#retryer?.promise;
819
+ this.#retryer?.cancel(options);
820
+ return promise ? promise.then(noop).catch(noop) : Promise.resolve();
821
+ }
822
+ destroy() {
823
+ super.destroy();
824
+ this.cancel({ silent: true });
825
+ }
826
+ reset() {
827
+ this.destroy();
828
+ this.setState(this.#initialState);
829
+ }
830
+ isActive() {
831
+ return this.observers.some(
832
+ (observer) => resolveEnabled(observer.options.enabled, this) !== false
833
+ );
834
+ }
835
+ isDisabled() {
836
+ if (this.getObserversCount() > 0) {
837
+ return !this.isActive();
838
+ }
839
+ return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
840
+ }
841
+ isStatic() {
842
+ if (this.getObserversCount() > 0) {
843
+ return this.observers.some(
844
+ (observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
845
+ );
846
+ }
847
+ return false;
848
+ }
849
+ isStale() {
850
+ if (this.getObserversCount() > 0) {
851
+ return this.observers.some(
852
+ (observer) => observer.getCurrentResult().isStale
853
+ );
854
+ }
855
+ return this.state.data === void 0 || this.state.isInvalidated;
856
+ }
857
+ isStaleByTime(staleTime = 0) {
858
+ if (this.state.data === void 0) {
859
+ return true;
860
+ }
861
+ if (staleTime === "static") {
862
+ return false;
863
+ }
864
+ if (this.state.isInvalidated) {
865
+ return true;
866
+ }
867
+ return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
868
+ }
869
+ onFocus() {
870
+ const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
871
+ observer?.refetch({ cancelRefetch: false });
872
+ this.#retryer?.continue();
873
+ }
874
+ onOnline() {
875
+ const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
876
+ observer?.refetch({ cancelRefetch: false });
877
+ this.#retryer?.continue();
878
+ }
879
+ addObserver(observer) {
880
+ if (!this.observers.includes(observer)) {
881
+ this.observers.push(observer);
882
+ this.clearGcTimeout();
883
+ this.#cache.notify({ type: "observerAdded", query: this, observer });
884
+ }
885
+ }
886
+ removeObserver(observer) {
887
+ if (this.observers.includes(observer)) {
888
+ this.observers = this.observers.filter((x) => x !== observer);
889
+ if (!this.observers.length) {
890
+ if (this.#retryer) {
891
+ if (this.#abortSignalConsumed) {
892
+ this.#retryer.cancel({ revert: true });
893
+ } else {
894
+ this.#retryer.cancelRetry();
895
+ }
896
+ }
897
+ this.scheduleGc();
898
+ }
899
+ this.#cache.notify({ type: "observerRemoved", query: this, observer });
900
+ }
901
+ }
902
+ getObserversCount() {
903
+ return this.observers.length;
904
+ }
905
+ invalidate() {
906
+ if (!this.state.isInvalidated) {
907
+ this.#dispatch({ type: "invalidate" });
908
+ }
909
+ }
910
+ async fetch(options, fetchOptions) {
911
+ if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
912
+ // re-start the fetch; there is a chance that the query is still in a
913
+ // pending state when that happens
914
+ this.#retryer?.status() !== "rejected") {
915
+ if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
916
+ this.cancel({ silent: true });
917
+ } else if (this.#retryer) {
918
+ this.#retryer.continueRetry();
919
+ return this.#retryer.promise;
920
+ }
921
+ }
922
+ if (options) {
923
+ this.setOptions(options);
924
+ }
925
+ if (!this.options.queryFn) {
926
+ const observer = this.observers.find((x) => x.options.queryFn);
927
+ if (observer) {
928
+ this.setOptions(observer.options);
929
+ }
930
+ }
931
+ if (process.env.NODE_ENV !== "production") {
932
+ if (!Array.isArray(this.options.queryKey)) {
933
+ console.error(
934
+ `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']`
935
+ );
936
+ }
937
+ }
938
+ const abortController = new AbortController();
939
+ const addSignalProperty = (object) => {
940
+ Object.defineProperty(object, "signal", {
941
+ enumerable: true,
942
+ get: () => {
943
+ this.#abortSignalConsumed = true;
944
+ return abortController.signal;
945
+ }
946
+ });
947
+ };
948
+ const fetchFn = () => {
949
+ const queryFn = ensureQueryFn(this.options, fetchOptions);
950
+ const createQueryFnContext = () => {
951
+ const queryFnContext2 = {
952
+ client: this.#client,
953
+ queryKey: this.queryKey,
954
+ meta: this.meta
955
+ };
956
+ addSignalProperty(queryFnContext2);
957
+ return queryFnContext2;
958
+ };
959
+ const queryFnContext = createQueryFnContext();
960
+ this.#abortSignalConsumed = false;
961
+ if (this.options.persister) {
962
+ return this.options.persister(
963
+ queryFn,
964
+ queryFnContext,
965
+ this
966
+ );
967
+ }
968
+ return queryFn(queryFnContext);
969
+ };
970
+ const createFetchContext = () => {
971
+ const context2 = {
972
+ fetchOptions,
973
+ options: this.options,
974
+ queryKey: this.queryKey,
975
+ client: this.#client,
976
+ state: this.state,
977
+ fetchFn
978
+ };
979
+ addSignalProperty(context2);
980
+ return context2;
981
+ };
982
+ const context = createFetchContext();
983
+ this.options.behavior?.onFetch(context, this);
984
+ this.#revertState = this.state;
985
+ if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
986
+ this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
987
+ }
988
+ this.#retryer = createRetryer({
989
+ initialPromise: fetchOptions?.initialPromise,
990
+ fn: context.fetchFn,
991
+ onCancel: (error) => {
992
+ if (error instanceof CancelledError && error.revert) {
993
+ this.setState({
994
+ ...this.#revertState,
995
+ fetchStatus: "idle"
996
+ });
997
+ }
998
+ abortController.abort();
999
+ },
1000
+ onFail: (failureCount, error) => {
1001
+ this.#dispatch({ type: "failed", failureCount, error });
1002
+ },
1003
+ onPause: () => {
1004
+ this.#dispatch({ type: "pause" });
1005
+ },
1006
+ onContinue: () => {
1007
+ this.#dispatch({ type: "continue" });
1008
+ },
1009
+ retry: context.options.retry,
1010
+ retryDelay: context.options.retryDelay,
1011
+ networkMode: context.options.networkMode,
1012
+ canRun: () => true
1013
+ });
1014
+ try {
1015
+ const data = await this.#retryer.start();
1016
+ if (data === void 0) {
1017
+ if (process.env.NODE_ENV !== "production") {
1018
+ console.error(
1019
+ `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
1020
+ );
1021
+ }
1022
+ throw new Error(`${this.queryHash} data is undefined`);
1023
+ }
1024
+ this.setData(data);
1025
+ this.#cache.config.onSuccess?.(data, this);
1026
+ this.#cache.config.onSettled?.(
1027
+ data,
1028
+ this.state.error,
1029
+ this
1030
+ );
1031
+ return data;
1032
+ } catch (error) {
1033
+ if (error instanceof CancelledError) {
1034
+ if (error.silent) {
1035
+ return this.#retryer.promise;
1036
+ } else if (error.revert) {
1037
+ if (this.state.data === void 0) {
1038
+ throw error;
1039
+ }
1040
+ return this.state.data;
1041
+ }
1042
+ }
1043
+ this.#dispatch({
1044
+ type: "error",
1045
+ error
1046
+ });
1047
+ this.#cache.config.onError?.(
1048
+ error,
1049
+ this
1050
+ );
1051
+ this.#cache.config.onSettled?.(
1052
+ this.state.data,
1053
+ error,
1054
+ this
1055
+ );
1056
+ throw error;
1057
+ } finally {
1058
+ this.scheduleGc();
1059
+ }
1060
+ }
1061
+ #dispatch(action) {
1062
+ const reducer = (state) => {
1063
+ switch (action.type) {
1064
+ case "failed":
1065
+ return {
1066
+ ...state,
1067
+ fetchFailureCount: action.failureCount,
1068
+ fetchFailureReason: action.error
1069
+ };
1070
+ case "pause":
1071
+ return {
1072
+ ...state,
1073
+ fetchStatus: "paused"
1074
+ };
1075
+ case "continue":
1076
+ return {
1077
+ ...state,
1078
+ fetchStatus: "fetching"
1079
+ };
1080
+ case "fetch":
1081
+ return {
1082
+ ...state,
1083
+ ...fetchState(state.data, this.options),
1084
+ fetchMeta: action.meta ?? null
1085
+ };
1086
+ case "success":
1087
+ const newState = {
1088
+ ...state,
1089
+ ...successState(action.data, action.dataUpdatedAt),
1090
+ dataUpdateCount: state.dataUpdateCount + 1,
1091
+ ...!action.manual && {
1092
+ fetchStatus: "idle",
1093
+ fetchFailureCount: 0,
1094
+ fetchFailureReason: null
1095
+ }
1096
+ };
1097
+ this.#revertState = action.manual ? newState : void 0;
1098
+ return newState;
1099
+ case "error":
1100
+ const error = action.error;
1101
+ return {
1102
+ ...state,
1103
+ error,
1104
+ errorUpdateCount: state.errorUpdateCount + 1,
1105
+ errorUpdatedAt: Date.now(),
1106
+ fetchFailureCount: state.fetchFailureCount + 1,
1107
+ fetchFailureReason: error,
1108
+ fetchStatus: "idle",
1109
+ status: "error",
1110
+ // flag existing data as invalidated if we get a background error
1111
+ // note that "no data" always means stale so we can set unconditionally here
1112
+ isInvalidated: true
1113
+ };
1114
+ case "invalidate":
1115
+ return {
1116
+ ...state,
1117
+ isInvalidated: true
1118
+ };
1119
+ case "setState":
1120
+ return {
1121
+ ...state,
1122
+ ...action.state
1123
+ };
1124
+ }
1125
+ };
1126
+ this.state = reducer(this.state);
1127
+ notifyManager.batch(() => {
1128
+ this.observers.forEach((observer) => {
1129
+ observer.onQueryUpdate();
1130
+ });
1131
+ this.#cache.notify({ query: this, type: "updated", action });
1132
+ });
1133
+ }
1134
+ };
1135
+ function fetchState(data, options) {
1136
+ return {
1137
+ fetchFailureCount: 0,
1138
+ fetchFailureReason: null,
1139
+ fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
1140
+ ...data === void 0 && {
1141
+ error: null,
1142
+ status: "pending"
1143
+ }
1144
+ };
1145
+ }
1146
+ function successState(data, dataUpdatedAt) {
1147
+ return {
1148
+ data,
1149
+ dataUpdatedAt: dataUpdatedAt ?? Date.now(),
1150
+ error: null,
1151
+ isInvalidated: false,
1152
+ status: "success"
1153
+ };
1154
+ }
1155
+ function getDefaultState$1(options) {
1156
+ const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
1157
+ const hasData = data !== void 0;
1158
+ const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
1159
+ return {
1160
+ data,
1161
+ dataUpdateCount: 0,
1162
+ dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
1163
+ error: null,
1164
+ errorUpdateCount: 0,
1165
+ errorUpdatedAt: 0,
1166
+ fetchFailureCount: 0,
1167
+ fetchFailureReason: null,
1168
+ fetchMeta: null,
1169
+ isInvalidated: false,
1170
+ status: hasData ? "success" : "pending",
1171
+ fetchStatus: "idle"
1172
+ };
1173
+ }
1174
+ function infiniteQueryBehavior(pages) {
1175
+ return {
1176
+ onFetch: (context, query) => {
1177
+ const options = context.options;
1178
+ const direction = context.fetchOptions?.meta?.fetchMore?.direction;
1179
+ const oldPages = context.state.data?.pages || [];
1180
+ const oldPageParams = context.state.data?.pageParams || [];
1181
+ let result = { pages: [], pageParams: [] };
1182
+ let currentPage = 0;
1183
+ const fetchFn = async () => {
1184
+ let cancelled = false;
1185
+ const addSignalProperty = (object) => {
1186
+ addConsumeAwareSignal(
1187
+ object,
1188
+ () => context.signal,
1189
+ () => cancelled = true
1190
+ );
1191
+ };
1192
+ const queryFn = ensureQueryFn(context.options, context.fetchOptions);
1193
+ const fetchPage = async (data, param, previous) => {
1194
+ if (cancelled) {
1195
+ return Promise.reject();
1196
+ }
1197
+ if (param == null && data.pages.length) {
1198
+ return Promise.resolve(data);
1199
+ }
1200
+ const createQueryFnContext = () => {
1201
+ const queryFnContext2 = {
1202
+ client: context.client,
1203
+ queryKey: context.queryKey,
1204
+ pageParam: param,
1205
+ direction: previous ? "backward" : "forward",
1206
+ meta: context.options.meta
1207
+ };
1208
+ addSignalProperty(queryFnContext2);
1209
+ return queryFnContext2;
1210
+ };
1211
+ const queryFnContext = createQueryFnContext();
1212
+ const page = await queryFn(queryFnContext);
1213
+ const { maxPages } = context.options;
1214
+ const addTo = previous ? addToStart : addToEnd;
1215
+ return {
1216
+ pages: addTo(data.pages, page, maxPages),
1217
+ pageParams: addTo(data.pageParams, param, maxPages)
1218
+ };
1219
+ };
1220
+ if (direction && oldPages.length) {
1221
+ const previous = direction === "backward";
1222
+ const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
1223
+ const oldData = {
1224
+ pages: oldPages,
1225
+ pageParams: oldPageParams
1226
+ };
1227
+ const param = pageParamFn(options, oldData);
1228
+ result = await fetchPage(oldData, param, previous);
1229
+ } else {
1230
+ const remainingPages = pages ?? oldPages.length;
1231
+ do {
1232
+ const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
1233
+ if (currentPage > 0 && param == null) {
1234
+ break;
1235
+ }
1236
+ result = await fetchPage(result, param);
1237
+ currentPage++;
1238
+ } while (currentPage < remainingPages);
1239
+ }
1240
+ return result;
1241
+ };
1242
+ if (context.options.persister) {
1243
+ context.fetchFn = () => {
1244
+ return context.options.persister?.(
1245
+ fetchFn,
1246
+ {
1247
+ client: context.client,
1248
+ queryKey: context.queryKey,
1249
+ meta: context.options.meta,
1250
+ signal: context.signal
1251
+ },
1252
+ query
1253
+ );
1254
+ };
1255
+ } else {
1256
+ context.fetchFn = fetchFn;
1257
+ }
1258
+ }
1259
+ };
1260
+ }
1261
+ function getNextPageParam(options, { pages, pageParams }) {
1262
+ const lastIndex = pages.length - 1;
1263
+ return pages.length > 0 ? options.getNextPageParam(
1264
+ pages[lastIndex],
1265
+ pages,
1266
+ pageParams[lastIndex],
1267
+ pageParams
1268
+ ) : void 0;
1269
+ }
1270
+ function getPreviousPageParam(options, { pages, pageParams }) {
1271
+ return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
1272
+ }
1273
+ var Mutation = class extends Removable {
1274
+ #client;
1275
+ #observers;
1276
+ #mutationCache;
1277
+ #retryer;
1278
+ constructor(config) {
1279
+ super();
1280
+ this.#client = config.client;
1281
+ this.mutationId = config.mutationId;
1282
+ this.#mutationCache = config.mutationCache;
1283
+ this.#observers = [];
1284
+ this.state = config.state || getDefaultState();
1285
+ this.setOptions(config.options);
1286
+ this.scheduleGc();
1287
+ }
1288
+ setOptions(options) {
1289
+ this.options = options;
1290
+ this.updateGcTime(this.options.gcTime);
1291
+ }
1292
+ get meta() {
1293
+ return this.options.meta;
1294
+ }
1295
+ addObserver(observer) {
1296
+ if (!this.#observers.includes(observer)) {
1297
+ this.#observers.push(observer);
1298
+ this.clearGcTimeout();
1299
+ this.#mutationCache.notify({
1300
+ type: "observerAdded",
1301
+ mutation: this,
1302
+ observer
1303
+ });
1304
+ }
1305
+ }
1306
+ removeObserver(observer) {
1307
+ this.#observers = this.#observers.filter((x) => x !== observer);
1308
+ this.scheduleGc();
1309
+ this.#mutationCache.notify({
1310
+ type: "observerRemoved",
1311
+ mutation: this,
1312
+ observer
1313
+ });
1314
+ }
1315
+ optionalRemove() {
1316
+ if (!this.#observers.length) {
1317
+ if (this.state.status === "pending") {
1318
+ this.scheduleGc();
1319
+ } else {
1320
+ this.#mutationCache.remove(this);
1321
+ }
1322
+ }
1323
+ }
1324
+ continue() {
1325
+ return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
1326
+ this.execute(this.state.variables);
1327
+ }
1328
+ async execute(variables) {
1329
+ const onContinue = () => {
1330
+ this.#dispatch({ type: "continue" });
1331
+ };
1332
+ const mutationFnContext = {
1333
+ client: this.#client,
1334
+ meta: this.options.meta,
1335
+ mutationKey: this.options.mutationKey
1336
+ };
1337
+ this.#retryer = createRetryer({
1338
+ fn: () => {
1339
+ if (!this.options.mutationFn) {
1340
+ return Promise.reject(new Error("No mutationFn found"));
1341
+ }
1342
+ return this.options.mutationFn(variables, mutationFnContext);
1343
+ },
1344
+ onFail: (failureCount, error) => {
1345
+ this.#dispatch({ type: "failed", failureCount, error });
1346
+ },
1347
+ onPause: () => {
1348
+ this.#dispatch({ type: "pause" });
1349
+ },
1350
+ onContinue,
1351
+ retry: this.options.retry ?? 0,
1352
+ retryDelay: this.options.retryDelay,
1353
+ networkMode: this.options.networkMode,
1354
+ canRun: () => this.#mutationCache.canRun(this)
1355
+ });
1356
+ const restored = this.state.status === "pending";
1357
+ const isPaused = !this.#retryer.canStart();
1358
+ try {
1359
+ if (restored) {
1360
+ onContinue();
1361
+ } else {
1362
+ this.#dispatch({ type: "pending", variables, isPaused });
1363
+ if (this.#mutationCache.config.onMutate) {
1364
+ await this.#mutationCache.config.onMutate(
1365
+ variables,
1366
+ this,
1367
+ mutationFnContext
1368
+ );
1369
+ }
1370
+ const context = await this.options.onMutate?.(
1371
+ variables,
1372
+ mutationFnContext
1373
+ );
1374
+ if (context !== this.state.context) {
1375
+ this.#dispatch({
1376
+ type: "pending",
1377
+ context,
1378
+ variables,
1379
+ isPaused
1380
+ });
1381
+ }
1382
+ }
1383
+ const data = await this.#retryer.start();
1384
+ await this.#mutationCache.config.onSuccess?.(
1385
+ data,
1386
+ variables,
1387
+ this.state.context,
1388
+ this,
1389
+ mutationFnContext
1390
+ );
1391
+ await this.options.onSuccess?.(
1392
+ data,
1393
+ variables,
1394
+ this.state.context,
1395
+ mutationFnContext
1396
+ );
1397
+ await this.#mutationCache.config.onSettled?.(
1398
+ data,
1399
+ null,
1400
+ this.state.variables,
1401
+ this.state.context,
1402
+ this,
1403
+ mutationFnContext
1404
+ );
1405
+ await this.options.onSettled?.(
1406
+ data,
1407
+ null,
1408
+ variables,
1409
+ this.state.context,
1410
+ mutationFnContext
1411
+ );
1412
+ this.#dispatch({ type: "success", data });
1413
+ return data;
1414
+ } catch (error) {
1415
+ try {
1416
+ await this.#mutationCache.config.onError?.(
1417
+ error,
1418
+ variables,
1419
+ this.state.context,
1420
+ this,
1421
+ mutationFnContext
1422
+ );
1423
+ } catch (e) {
1424
+ void Promise.reject(e);
1425
+ }
1426
+ try {
1427
+ await this.options.onError?.(
1428
+ error,
1429
+ variables,
1430
+ this.state.context,
1431
+ mutationFnContext
1432
+ );
1433
+ } catch (e) {
1434
+ void Promise.reject(e);
1435
+ }
1436
+ try {
1437
+ await this.#mutationCache.config.onSettled?.(
1438
+ void 0,
1439
+ error,
1440
+ this.state.variables,
1441
+ this.state.context,
1442
+ this,
1443
+ mutationFnContext
1444
+ );
1445
+ } catch (e) {
1446
+ void Promise.reject(e);
1447
+ }
1448
+ try {
1449
+ await this.options.onSettled?.(
1450
+ void 0,
1451
+ error,
1452
+ variables,
1453
+ this.state.context,
1454
+ mutationFnContext
1455
+ );
1456
+ } catch (e) {
1457
+ void Promise.reject(e);
1458
+ }
1459
+ this.#dispatch({ type: "error", error });
1460
+ throw error;
1461
+ } finally {
1462
+ this.#mutationCache.runNext(this);
1463
+ }
1464
+ }
1465
+ #dispatch(action) {
1466
+ const reducer = (state) => {
1467
+ switch (action.type) {
1468
+ case "failed":
1469
+ return {
1470
+ ...state,
1471
+ failureCount: action.failureCount,
1472
+ failureReason: action.error
1473
+ };
1474
+ case "pause":
1475
+ return {
1476
+ ...state,
1477
+ isPaused: true
1478
+ };
1479
+ case "continue":
1480
+ return {
1481
+ ...state,
1482
+ isPaused: false
1483
+ };
1484
+ case "pending":
1485
+ return {
1486
+ ...state,
1487
+ context: action.context,
1488
+ data: void 0,
1489
+ failureCount: 0,
1490
+ failureReason: null,
1491
+ error: null,
1492
+ isPaused: action.isPaused,
1493
+ status: "pending",
1494
+ variables: action.variables,
1495
+ submittedAt: Date.now()
1496
+ };
1497
+ case "success":
1498
+ return {
1499
+ ...state,
1500
+ data: action.data,
1501
+ failureCount: 0,
1502
+ failureReason: null,
1503
+ error: null,
1504
+ status: "success",
1505
+ isPaused: false
1506
+ };
1507
+ case "error":
1508
+ return {
1509
+ ...state,
1510
+ data: void 0,
1511
+ error: action.error,
1512
+ failureCount: state.failureCount + 1,
1513
+ failureReason: action.error,
1514
+ isPaused: false,
1515
+ status: "error"
1516
+ };
1517
+ }
1518
+ };
1519
+ this.state = reducer(this.state);
1520
+ notifyManager.batch(() => {
1521
+ this.#observers.forEach((observer) => {
1522
+ observer.onMutationUpdate(action);
1523
+ });
1524
+ this.#mutationCache.notify({
1525
+ mutation: this,
1526
+ type: "updated",
1527
+ action
1528
+ });
1529
+ });
1530
+ }
1531
+ };
1532
+ function getDefaultState() {
1533
+ return {
1534
+ context: void 0,
1535
+ data: void 0,
1536
+ error: null,
1537
+ failureCount: 0,
1538
+ failureReason: null,
1539
+ isPaused: false,
1540
+ status: "idle",
1541
+ variables: void 0,
1542
+ submittedAt: 0
1543
+ };
1544
+ }
1545
+ var MutationCache = class extends Subscribable {
1546
+ constructor(config = {}) {
1547
+ super();
1548
+ this.config = config;
1549
+ this.#mutations = /* @__PURE__ */ new Set();
1550
+ this.#scopes = /* @__PURE__ */ new Map();
1551
+ this.#mutationId = 0;
1552
+ }
1553
+ #mutations;
1554
+ #scopes;
1555
+ #mutationId;
1556
+ build(client, options, state) {
1557
+ const mutation = new Mutation({
1558
+ client,
1559
+ mutationCache: this,
1560
+ mutationId: ++this.#mutationId,
1561
+ options: client.defaultMutationOptions(options),
1562
+ state
1563
+ });
1564
+ this.add(mutation);
1565
+ return mutation;
1566
+ }
1567
+ add(mutation) {
1568
+ this.#mutations.add(mutation);
1569
+ const scope = scopeFor(mutation);
1570
+ if (typeof scope === "string") {
1571
+ const scopedMutations = this.#scopes.get(scope);
1572
+ if (scopedMutations) {
1573
+ scopedMutations.push(mutation);
1574
+ } else {
1575
+ this.#scopes.set(scope, [mutation]);
1576
+ }
1577
+ }
1578
+ this.notify({ type: "added", mutation });
1579
+ }
1580
+ remove(mutation) {
1581
+ if (this.#mutations.delete(mutation)) {
1582
+ const scope = scopeFor(mutation);
1583
+ if (typeof scope === "string") {
1584
+ const scopedMutations = this.#scopes.get(scope);
1585
+ if (scopedMutations) {
1586
+ if (scopedMutations.length > 1) {
1587
+ const index = scopedMutations.indexOf(mutation);
1588
+ if (index !== -1) {
1589
+ scopedMutations.splice(index, 1);
1590
+ }
1591
+ } else if (scopedMutations[0] === mutation) {
1592
+ this.#scopes.delete(scope);
1593
+ }
1594
+ }
1595
+ }
1596
+ }
1597
+ this.notify({ type: "removed", mutation });
1598
+ }
1599
+ canRun(mutation) {
1600
+ const scope = scopeFor(mutation);
1601
+ if (typeof scope === "string") {
1602
+ const mutationsWithSameScope = this.#scopes.get(scope);
1603
+ const firstPendingMutation = mutationsWithSameScope?.find(
1604
+ (m) => m.state.status === "pending"
1605
+ );
1606
+ return !firstPendingMutation || firstPendingMutation === mutation;
1607
+ } else {
1608
+ return true;
1609
+ }
1610
+ }
1611
+ runNext(mutation) {
1612
+ const scope = scopeFor(mutation);
1613
+ if (typeof scope === "string") {
1614
+ const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);
1615
+ return foundMutation?.continue() ?? Promise.resolve();
1616
+ } else {
1617
+ return Promise.resolve();
1618
+ }
1619
+ }
1620
+ clear() {
1621
+ notifyManager.batch(() => {
1622
+ this.#mutations.forEach((mutation) => {
1623
+ this.notify({ type: "removed", mutation });
1624
+ });
1625
+ this.#mutations.clear();
1626
+ this.#scopes.clear();
1627
+ });
1628
+ }
1629
+ getAll() {
1630
+ return Array.from(this.#mutations);
1631
+ }
1632
+ find(filters) {
1633
+ const defaultedFilters = { exact: true, ...filters };
1634
+ return this.getAll().find(
1635
+ (mutation) => matchMutation(defaultedFilters, mutation)
1636
+ );
1637
+ }
1638
+ findAll(filters = {}) {
1639
+ return this.getAll().filter((mutation) => matchMutation(filters, mutation));
1640
+ }
1641
+ notify(event) {
1642
+ notifyManager.batch(() => {
1643
+ this.listeners.forEach((listener) => {
1644
+ listener(event);
1645
+ });
1646
+ });
1647
+ }
1648
+ resumePausedMutations() {
1649
+ const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
1650
+ return notifyManager.batch(
1651
+ () => Promise.all(
1652
+ pausedMutations.map((mutation) => mutation.continue().catch(noop))
1653
+ )
1654
+ );
1655
+ }
1656
+ };
1657
+ function scopeFor(mutation) {
1658
+ return mutation.options.scope?.id;
1659
+ }
1660
+ var QueryCache = class extends Subscribable {
1661
+ constructor(config = {}) {
1662
+ super();
1663
+ this.config = config;
1664
+ this.#queries = /* @__PURE__ */ new Map();
1665
+ }
1666
+ #queries;
1667
+ build(client, options, state) {
1668
+ const queryKey = options.queryKey;
1669
+ const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
1670
+ let query = this.get(queryHash);
1671
+ if (!query) {
1672
+ query = new Query({
1673
+ client,
1674
+ queryKey,
1675
+ queryHash,
1676
+ options: client.defaultQueryOptions(options),
1677
+ state,
1678
+ defaultOptions: client.getQueryDefaults(queryKey)
1679
+ });
1680
+ this.add(query);
1681
+ }
1682
+ return query;
1683
+ }
1684
+ add(query) {
1685
+ if (!this.#queries.has(query.queryHash)) {
1686
+ this.#queries.set(query.queryHash, query);
1687
+ this.notify({
1688
+ type: "added",
1689
+ query
1690
+ });
1691
+ }
1692
+ }
1693
+ remove(query) {
1694
+ const queryInMap = this.#queries.get(query.queryHash);
1695
+ if (queryInMap) {
1696
+ query.destroy();
1697
+ if (queryInMap === query) {
1698
+ this.#queries.delete(query.queryHash);
1699
+ }
1700
+ this.notify({ type: "removed", query });
1701
+ }
1702
+ }
1703
+ clear() {
1704
+ notifyManager.batch(() => {
1705
+ this.getAll().forEach((query) => {
1706
+ this.remove(query);
1707
+ });
1708
+ });
1709
+ }
1710
+ get(queryHash) {
1711
+ return this.#queries.get(queryHash);
1712
+ }
1713
+ getAll() {
1714
+ return [...this.#queries.values()];
1715
+ }
1716
+ find(filters) {
1717
+ const defaultedFilters = { exact: true, ...filters };
1718
+ return this.getAll().find(
1719
+ (query) => matchQuery(defaultedFilters, query)
1720
+ );
1721
+ }
1722
+ findAll(filters = {}) {
1723
+ const queries = this.getAll();
1724
+ return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
1725
+ }
1726
+ notify(event) {
1727
+ notifyManager.batch(() => {
1728
+ this.listeners.forEach((listener) => {
1729
+ listener(event);
1730
+ });
1731
+ });
1732
+ }
1733
+ onFocus() {
1734
+ notifyManager.batch(() => {
1735
+ this.getAll().forEach((query) => {
1736
+ query.onFocus();
1737
+ });
1738
+ });
1739
+ }
1740
+ onOnline() {
1741
+ notifyManager.batch(() => {
1742
+ this.getAll().forEach((query) => {
1743
+ query.onOnline();
1744
+ });
1745
+ });
1746
+ }
1747
+ };
1748
+ var QueryClient = class {
1749
+ #queryCache;
1750
+ #mutationCache;
1751
+ #defaultOptions;
1752
+ #queryDefaults;
1753
+ #mutationDefaults;
1754
+ #mountCount;
1755
+ #unsubscribeFocus;
1756
+ #unsubscribeOnline;
1757
+ constructor(config = {}) {
1758
+ this.#queryCache = config.queryCache || new QueryCache();
1759
+ this.#mutationCache = config.mutationCache || new MutationCache();
1760
+ this.#defaultOptions = config.defaultOptions || {};
1761
+ this.#queryDefaults = /* @__PURE__ */ new Map();
1762
+ this.#mutationDefaults = /* @__PURE__ */ new Map();
1763
+ this.#mountCount = 0;
1764
+ }
1765
+ mount() {
1766
+ this.#mountCount++;
1767
+ if (this.#mountCount !== 1) return;
1768
+ this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
1769
+ if (focused) {
1770
+ await this.resumePausedMutations();
1771
+ this.#queryCache.onFocus();
1772
+ }
1773
+ });
1774
+ this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
1775
+ if (online) {
1776
+ await this.resumePausedMutations();
1777
+ this.#queryCache.onOnline();
1778
+ }
1779
+ });
1780
+ }
1781
+ unmount() {
1782
+ this.#mountCount--;
1783
+ if (this.#mountCount !== 0) return;
1784
+ this.#unsubscribeFocus?.();
1785
+ this.#unsubscribeFocus = void 0;
1786
+ this.#unsubscribeOnline?.();
1787
+ this.#unsubscribeOnline = void 0;
1788
+ }
1789
+ isFetching(filters) {
1790
+ return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
1791
+ }
1792
+ isMutating(filters) {
1793
+ return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
1794
+ }
1795
+ /**
1796
+ * Imperative (non-reactive) way to retrieve data for a QueryKey.
1797
+ * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
1798
+ *
1799
+ * Hint: Do not use this function inside a component, because it won't receive updates.
1800
+ * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
1801
+ */
1802
+ getQueryData(queryKey) {
1803
+ const options = this.defaultQueryOptions({ queryKey });
1804
+ return this.#queryCache.get(options.queryHash)?.state.data;
1805
+ }
1806
+ ensureQueryData(options) {
1807
+ const defaultedOptions = this.defaultQueryOptions(options);
1808
+ const query = this.#queryCache.build(this, defaultedOptions);
1809
+ const cachedData = query.state.data;
1810
+ if (cachedData === void 0) {
1811
+ return this.fetchQuery(options);
1812
+ }
1813
+ if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
1814
+ void this.prefetchQuery(defaultedOptions);
1815
+ }
1816
+ return Promise.resolve(cachedData);
1817
+ }
1818
+ getQueriesData(filters) {
1819
+ return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
1820
+ const data = state.data;
1821
+ return [queryKey, data];
1822
+ });
1823
+ }
1824
+ setQueryData(queryKey, updater, options) {
1825
+ const defaultedOptions = this.defaultQueryOptions({ queryKey });
1826
+ const query = this.#queryCache.get(
1827
+ defaultedOptions.queryHash
1828
+ );
1829
+ const prevData = query?.state.data;
1830
+ const data = functionalUpdate(updater, prevData);
1831
+ if (data === void 0) {
1832
+ return void 0;
1833
+ }
1834
+ return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
1835
+ }
1836
+ setQueriesData(filters, updater, options) {
1837
+ return notifyManager.batch(
1838
+ () => this.#queryCache.findAll(filters).map(({ queryKey }) => [
1839
+ queryKey,
1840
+ this.setQueryData(queryKey, updater, options)
1841
+ ])
1842
+ );
1843
+ }
1844
+ getQueryState(queryKey) {
1845
+ const options = this.defaultQueryOptions({ queryKey });
1846
+ return this.#queryCache.get(
1847
+ options.queryHash
1848
+ )?.state;
1849
+ }
1850
+ removeQueries(filters) {
1851
+ const queryCache = this.#queryCache;
1852
+ notifyManager.batch(() => {
1853
+ queryCache.findAll(filters).forEach((query) => {
1854
+ queryCache.remove(query);
1855
+ });
1856
+ });
1857
+ }
1858
+ resetQueries(filters, options) {
1859
+ const queryCache = this.#queryCache;
1860
+ return notifyManager.batch(() => {
1861
+ queryCache.findAll(filters).forEach((query) => {
1862
+ query.reset();
1863
+ });
1864
+ return this.refetchQueries(
1865
+ {
1866
+ type: "active",
1867
+ ...filters
1868
+ },
1869
+ options
1870
+ );
1871
+ });
1872
+ }
1873
+ cancelQueries(filters, cancelOptions = {}) {
1874
+ const defaultedCancelOptions = { revert: true, ...cancelOptions };
1875
+ const promises = notifyManager.batch(
1876
+ () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
1877
+ );
1878
+ return Promise.all(promises).then(noop).catch(noop);
1879
+ }
1880
+ invalidateQueries(filters, options = {}) {
1881
+ return notifyManager.batch(() => {
1882
+ this.#queryCache.findAll(filters).forEach((query) => {
1883
+ query.invalidate();
1884
+ });
1885
+ if (filters?.refetchType === "none") {
1886
+ return Promise.resolve();
1887
+ }
1888
+ return this.refetchQueries(
1889
+ {
1890
+ ...filters,
1891
+ type: filters?.refetchType ?? filters?.type ?? "active"
1892
+ },
1893
+ options
1894
+ );
1895
+ });
1896
+ }
1897
+ refetchQueries(filters, options = {}) {
1898
+ const fetchOptions = {
1899
+ ...options,
1900
+ cancelRefetch: options.cancelRefetch ?? true
1901
+ };
1902
+ const promises = notifyManager.batch(
1903
+ () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
1904
+ let promise = query.fetch(void 0, fetchOptions);
1905
+ if (!fetchOptions.throwOnError) {
1906
+ promise = promise.catch(noop);
1907
+ }
1908
+ return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
1909
+ })
1910
+ );
1911
+ return Promise.all(promises).then(noop);
1912
+ }
1913
+ fetchQuery(options) {
1914
+ const defaultedOptions = this.defaultQueryOptions(options);
1915
+ if (defaultedOptions.retry === void 0) {
1916
+ defaultedOptions.retry = false;
1917
+ }
1918
+ const query = this.#queryCache.build(this, defaultedOptions);
1919
+ return query.isStaleByTime(
1920
+ resolveStaleTime(defaultedOptions.staleTime, query)
1921
+ ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
1922
+ }
1923
+ prefetchQuery(options) {
1924
+ return this.fetchQuery(options).then(noop).catch(noop);
1925
+ }
1926
+ fetchInfiniteQuery(options) {
1927
+ options.behavior = infiniteQueryBehavior(options.pages);
1928
+ return this.fetchQuery(options);
1929
+ }
1930
+ prefetchInfiniteQuery(options) {
1931
+ return this.fetchInfiniteQuery(options).then(noop).catch(noop);
1932
+ }
1933
+ ensureInfiniteQueryData(options) {
1934
+ options.behavior = infiniteQueryBehavior(options.pages);
1935
+ return this.ensureQueryData(options);
1936
+ }
1937
+ resumePausedMutations() {
1938
+ if (onlineManager.isOnline()) {
1939
+ return this.#mutationCache.resumePausedMutations();
1940
+ }
1941
+ return Promise.resolve();
1942
+ }
1943
+ getQueryCache() {
1944
+ return this.#queryCache;
1945
+ }
1946
+ getMutationCache() {
1947
+ return this.#mutationCache;
1948
+ }
1949
+ getDefaultOptions() {
1950
+ return this.#defaultOptions;
1951
+ }
1952
+ setDefaultOptions(options) {
1953
+ this.#defaultOptions = options;
1954
+ }
1955
+ setQueryDefaults(queryKey, options) {
1956
+ this.#queryDefaults.set(hashKey(queryKey), {
1957
+ queryKey,
1958
+ defaultOptions: options
1959
+ });
1960
+ }
1961
+ getQueryDefaults(queryKey) {
1962
+ const defaults = [...this.#queryDefaults.values()];
1963
+ const result = {};
1964
+ defaults.forEach((queryDefault) => {
1965
+ if (partialMatchKey(queryKey, queryDefault.queryKey)) {
1966
+ Object.assign(result, queryDefault.defaultOptions);
1967
+ }
1968
+ });
1969
+ return result;
1970
+ }
1971
+ setMutationDefaults(mutationKey, options) {
1972
+ this.#mutationDefaults.set(hashKey(mutationKey), {
1973
+ mutationKey,
1974
+ defaultOptions: options
1975
+ });
1976
+ }
1977
+ getMutationDefaults(mutationKey) {
1978
+ const defaults = [...this.#mutationDefaults.values()];
1979
+ const result = {};
1980
+ defaults.forEach((queryDefault) => {
1981
+ if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
1982
+ Object.assign(result, queryDefault.defaultOptions);
1983
+ }
1984
+ });
1985
+ return result;
1986
+ }
1987
+ defaultQueryOptions(options) {
1988
+ if (options._defaulted) {
1989
+ return options;
1990
+ }
1991
+ const defaultedOptions = {
1992
+ ...this.#defaultOptions.queries,
1993
+ ...this.getQueryDefaults(options.queryKey),
1994
+ ...options,
1995
+ _defaulted: true
1996
+ };
1997
+ if (!defaultedOptions.queryHash) {
1998
+ defaultedOptions.queryHash = hashQueryKeyByOptions(
1999
+ defaultedOptions.queryKey,
2000
+ defaultedOptions
2001
+ );
2002
+ }
2003
+ if (defaultedOptions.refetchOnReconnect === void 0) {
2004
+ defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
2005
+ }
2006
+ if (defaultedOptions.throwOnError === void 0) {
2007
+ defaultedOptions.throwOnError = !!defaultedOptions.suspense;
2008
+ }
2009
+ if (!defaultedOptions.networkMode && defaultedOptions.persister) {
2010
+ defaultedOptions.networkMode = "offlineFirst";
2011
+ }
2012
+ if (defaultedOptions.queryFn === skipToken) {
2013
+ defaultedOptions.enabled = false;
2014
+ }
2015
+ return defaultedOptions;
2016
+ }
2017
+ defaultMutationOptions(options) {
2018
+ if (options?._defaulted) {
2019
+ return options;
2020
+ }
2021
+ return {
2022
+ ...this.#defaultOptions.mutations,
2023
+ ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
2024
+ ...options,
2025
+ _defaulted: true
2026
+ };
2027
+ }
2028
+ clear() {
2029
+ this.#queryCache.clear();
2030
+ this.#mutationCache.clear();
2031
+ }
2032
+ };
2033
+ const queryClient = new QueryClient({
2034
+ defaultOptions: {
2035
+ queries: {
2036
+ staleTime: 5 * 1e3
2037
+ }
2038
+ }
2039
+ });
2040
+ const layout = /* @__PURE__ */ registerClientReference(() => {
2041
+ throw new Error("Unexpectedly client reference export 'default' is called on server");
2042
+ }, "5d6b9f3494e7", "default");
2043
+ async function loader() {
2044
+ const core = await getCore();
2045
+ const collections = core.getCollections(true);
2046
+ const clientContexts = /* @__PURE__ */ new Map();
2047
+ for (const collection of collections) {
2048
+ const {
2049
+ client
2050
+ } = collection.pluginHook(studioHook);
2051
+ if (client) {
2052
+ clientContexts.set(collection.name, await client());
2053
+ }
2054
+ }
2055
+ await queryClient.prefetchQuery({
2056
+ queryKey: ["collections"],
2057
+ queryFn: () => getCollectionItems()
2058
+ });
2059
+ await queryClient.prefetchQuery({
2060
+ queryKey: ["documents"],
2061
+ queryFn: () => getDocumentItems()
2062
+ });
2063
+ return {
2064
+ clientContexts,
2065
+ queryState: dehydrate(queryClient)
2066
+ };
2067
+ }
2068
+ export {
2069
+ layout as default,
2070
+ loader
2071
+ };