drizzle-cube 0.4.28 → 0.4.30

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 (382) hide show
  1. package/dist/adapters/anthropic-BIva8k1r.cjs +1 -0
  2. package/dist/adapters/anthropic-B_rg0BhK.js +140 -0
  3. package/dist/adapters/dist-Boc63-1q.cjs +2 -0
  4. package/dist/adapters/dist-De5fzUEM.js +581 -0
  5. package/dist/adapters/express/index.cjs +2 -10
  6. package/dist/adapters/express/index.js +232 -342
  7. package/dist/adapters/fastify/index.cjs +2 -10
  8. package/dist/adapters/fastify/index.js +275 -424
  9. package/dist/adapters/google-CT4kgmBf.js +154 -0
  10. package/dist/adapters/google-Dgo9-Kb5.cjs +2 -0
  11. package/dist/adapters/handler-B8vuFQYP.cjs +25 -0
  12. package/dist/adapters/handler-D-2-6uLM.js +2951 -0
  13. package/dist/adapters/hono/index.cjs +2 -10
  14. package/dist/adapters/hono/index.js +307 -402
  15. package/dist/adapters/mcp-prompts-BAutSQYA.js +344 -0
  16. package/dist/adapters/mcp-prompts-DsAkafVn.cjs +5 -0
  17. package/dist/adapters/mcp-transport-CuugoG8t.js +7821 -0
  18. package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +253 -0
  19. package/dist/adapters/nextjs/index.cjs +1 -9
  20. package/dist/adapters/nextjs/index.js +377 -600
  21. package/dist/adapters/openai-CjBvA6mK.js +4114 -0
  22. package/dist/adapters/openai-DhLE0A9Z.cjs +1 -0
  23. package/dist/adapters/openai-Zjw4Zo4R.js +153 -0
  24. package/dist/adapters/openai-eJBw3LfQ.cjs +16 -0
  25. package/dist/adapters/types.cjs +0 -1
  26. package/dist/adapters/types.js +0 -1
  27. package/dist/adapters/utils-ChhNGUOF.js +5396 -0
  28. package/dist/adapters/utils-CwJplXR5.cjs +15 -0
  29. package/dist/adapters/utils.cjs +1 -19
  30. package/dist/adapters/utils.js +2 -21333
  31. package/dist/client/charts.js +15 -186
  32. package/dist/client/chunks/DashboardEditModal-C076pscL.js +6678 -0
  33. package/dist/client/chunks/DashboardEditModal-C076pscL.js.map +1 -0
  34. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js +2631 -0
  35. package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js.map +1 -0
  36. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js +270 -0
  37. package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js.map +1 -0
  38. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +56 -0
  39. package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +1 -0
  40. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js +193 -0
  41. package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js.map +1 -0
  42. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +25 -0
  43. package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +1 -0
  44. package/dist/client/chunks/analysis-builder-DF0XntqC.js +6111 -0
  45. package/dist/client/chunks/analysis-builder-DF0XntqC.js.map +1 -0
  46. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js +3114 -0
  47. package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +1 -0
  48. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js +803 -0
  49. package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +1 -0
  50. package/dist/client/chunks/chart-area-CRJc3KOu.js +449 -0
  51. package/dist/client/chunks/chart-area-CRJc3KOu.js.map +1 -0
  52. package/dist/client/chunks/chart-bar-DD2PjJ5n.js +270 -0
  53. package/dist/client/chunks/chart-bar-DD2PjJ5n.js.map +1 -0
  54. package/dist/client/chunks/chart-box-plot-BcqleldJ.js +377 -0
  55. package/dist/client/chunks/chart-box-plot-BcqleldJ.js.map +1 -0
  56. package/dist/client/chunks/chart-bubble-BmQkVk4K.js +273 -0
  57. package/dist/client/chunks/chart-bubble-BmQkVk4K.js.map +1 -0
  58. package/dist/client/chunks/chart-candlestick-C3Rep469.js +306 -0
  59. package/dist/client/chunks/chart-candlestick-C3Rep469.js.map +1 -0
  60. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js +51 -0
  61. package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js.map +1 -0
  62. package/dist/client/chunks/chart-config-area-D_ZufYzg.js +93 -0
  63. package/dist/client/chunks/chart-config-area-D_ZufYzg.js.map +1 -0
  64. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js +87 -0
  65. package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js.map +1 -0
  66. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js +35 -0
  67. package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js.map +1 -0
  68. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js +82 -0
  69. package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js.map +1 -0
  70. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js +72 -0
  71. package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js.map +1 -0
  72. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js +30 -0
  73. package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js.map +1 -0
  74. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js +93 -0
  75. package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js.map +1 -0
  76. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js +64 -0
  77. package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js.map +1 -0
  78. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js +91 -0
  79. package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js.map +1 -0
  80. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js +94 -0
  81. package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js.map +1 -0
  82. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js +75 -0
  83. package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js.map +1 -0
  84. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js +47 -0
  85. package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js.map +1 -0
  86. package/dist/client/chunks/chart-config-line-B3NgLF7K.js +104 -0
  87. package/dist/client/chunks/chart-config-line-B3NgLF7K.js.map +1 -0
  88. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js +117 -0
  89. package/dist/client/chunks/chart-config-markdown-tlfivQTt.js.map +1 -0
  90. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js +82 -0
  91. package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js.map +1 -0
  92. package/dist/client/chunks/chart-config-pie-wY0B52PC.js +68 -0
  93. package/dist/client/chunks/chart-config-pie-wY0B52PC.js.map +1 -0
  94. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js +49 -0
  95. package/dist/client/chunks/chart-config-radar-DRpJBy1M.js.map +1 -0
  96. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js +38 -0
  97. package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js.map +1 -0
  98. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js +66 -0
  99. package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js.map +1 -0
  100. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js +61 -0
  101. package/dist/client/chunks/chart-config-scatter-B2su_x8f.js.map +1 -0
  102. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js +45 -0
  103. package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js.map +1 -0
  104. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js +51 -0
  105. package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js.map +1 -0
  106. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js +59 -0
  107. package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js.map +1 -0
  108. package/dist/client/chunks/chart-data-table-DehW1C1G.js +4088 -0
  109. package/dist/client/chunks/chart-data-table-DehW1C1G.js.map +1 -0
  110. package/dist/client/chunks/chart-funnel-BjkpnG5g.js +447 -0
  111. package/dist/client/chunks/chart-funnel-BjkpnG5g.js.map +1 -0
  112. package/dist/client/chunks/chart-gauge-BWW_HEfg.js +424 -0
  113. package/dist/client/chunks/chart-gauge-BWW_HEfg.js.map +1 -0
  114. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js +236 -0
  115. package/dist/client/chunks/chart-heat-map-BWuOuDcm.js.map +1 -0
  116. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js +343 -0
  117. package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js.map +1 -0
  118. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js +326 -0
  119. package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js.map +1 -0
  120. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js +149 -0
  121. package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js.map +1 -0
  122. package/dist/client/chunks/chart-line-DOIMkP0b.js +431 -0
  123. package/dist/client/chunks/chart-line-DOIMkP0b.js.map +1 -0
  124. package/dist/client/chunks/chart-markdown-DXxc43w1.js +3457 -0
  125. package/dist/client/chunks/chart-markdown-DXxc43w1.js.map +1 -0
  126. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js +179 -0
  127. package/dist/client/chunks/chart-measure-profile-C6wrr9il.js.map +1 -0
  128. package/dist/client/chunks/chart-pie-BU_FgwDc.js +172 -0
  129. package/dist/client/chunks/chart-pie-BU_FgwDc.js.map +1 -0
  130. package/dist/client/chunks/chart-radar-DlufwnAX.js +154 -0
  131. package/dist/client/chunks/chart-radar-DlufwnAX.js.map +1 -0
  132. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js +148 -0
  133. package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js.map +1 -0
  134. package/dist/client/chunks/chart-sankey-FChb26UX.js +222 -0
  135. package/dist/client/chunks/chart-sankey-FChb26UX.js.map +1 -0
  136. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js +255 -0
  137. package/dist/client/chunks/chart-scatter-DW0cAZ2H.js.map +1 -0
  138. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js +221 -0
  139. package/dist/client/chunks/chart-sunburst-Clf-6WxW.js.map +1 -0
  140. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js +298 -0
  141. package/dist/client/chunks/chart-tree-map-p_VwUJPF.js.map +1 -0
  142. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js +237 -0
  143. package/dist/client/chunks/chart-waterfall-jt44IQ-w.js.map +1 -0
  144. package/dist/client/chunks/charts-core-CUVzf4cV.js +215 -0
  145. package/dist/client/chunks/charts-core-CUVzf4cV.js.map +1 -0
  146. package/dist/client/chunks/charts-loader-AGpph8_I.js +259 -0
  147. package/dist/client/chunks/charts-loader-AGpph8_I.js.map +1 -0
  148. package/dist/client/chunks/core-D1TOj17W.js +845 -0
  149. package/dist/client/chunks/core-D1TOj17W.js.map +1 -0
  150. package/dist/client/chunks/dist-DDBeV_JI.js +847 -0
  151. package/dist/client/chunks/dist-DDBeV_JI.js.map +1 -0
  152. package/dist/client/chunks/javascript-BBwTSo6e.js +438 -0
  153. package/dist/client/chunks/javascript-BBwTSo6e.js.map +1 -0
  154. package/dist/client/chunks/json-BpTrLZSh.js +38 -0
  155. package/dist/client/chunks/json-BpTrLZSh.js.map +1 -0
  156. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +149 -0
  157. package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +1 -0
  158. package/dist/client/chunks/providers-DX3Vw5kc.js +7 -0
  159. package/dist/client/chunks/providers-DX3Vw5kc.js.map +1 -0
  160. package/dist/client/chunks/retention-UEXlSdZ-.js +132 -0
  161. package/dist/client/chunks/retention-UEXlSdZ-.js.map +1 -0
  162. package/dist/client/chunks/rolldown-runtime-lc2dmIiU.js +20 -0
  163. package/dist/client/chunks/schema-visualization-ZugB4Io9.js +1073 -0
  164. package/dist/client/chunks/schema-visualization-ZugB4Io9.js.map +1 -0
  165. package/dist/client/chunks/sql-B0chxcEK.js +120 -0
  166. package/dist/client/chunks/sql-B0chxcEK.js.map +1 -0
  167. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js +30 -0
  168. package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js.map +1 -0
  169. package/dist/client/chunks/useDebounce-BQjNWndQ.js +1394 -0
  170. package/dist/client/chunks/useDebounce-BQjNWndQ.js.map +1 -0
  171. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js +66 -0
  172. package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js.map +1 -0
  173. package/dist/client/chunks/useExplainAI-c_bHxZe5.js +203 -0
  174. package/dist/client/chunks/useExplainAI-c_bHxZe5.js.map +1 -0
  175. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js +37 -0
  176. package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js.map +1 -0
  177. package/dist/client/chunks/utils-A54Ny29G.js +128 -0
  178. package/dist/client/chunks/utils-A54Ny29G.js.map +1 -0
  179. package/dist/client/chunks/vendor-CoPBRumI.js +828 -0
  180. package/dist/client/chunks/vendor-CoPBRumI.js.map +1 -0
  181. package/dist/client/components.js +4 -18
  182. package/dist/client/hooks.js +6 -58
  183. package/dist/client/icons.js +2 -15
  184. package/dist/client/index.js +1061 -1295
  185. package/dist/client/index.js.map +1 -1
  186. package/dist/client/providers.js +3 -9
  187. package/dist/client/styles.css +2 -1
  188. package/dist/client/types.d.ts +1 -0
  189. package/dist/client/utils.js +7 -74
  190. package/dist/client-bundle-stats.html +1 -1
  191. package/dist/server/anthropic-BsNspi1r.js +140 -0
  192. package/dist/server/anthropic-DsCEX6Fm.cjs +1 -0
  193. package/dist/server/dist-CMWZC51B.js +581 -0
  194. package/dist/server/dist-DxegvyZF.cjs +2 -0
  195. package/dist/server/google-BXwMolCu.js +154 -0
  196. package/dist/server/google-DzQWXFwF.cjs +2 -0
  197. package/dist/server/index.cjs +109 -127
  198. package/dist/server/index.d.ts +13 -4
  199. package/dist/server/index.js +15089 -34349
  200. package/dist/server/openai-BPhmb8mi.js +4114 -0
  201. package/dist/server/openai-CLsoLaue.cjs +1 -0
  202. package/dist/server/openai-D1kZ5sdM.js +153 -0
  203. package/dist/server/openai-DkOKbVLC.cjs +16 -0
  204. package/package.json +5 -5
  205. package/dist/adapters/anthropic-BTkjgFpT.cjs +0 -1
  206. package/dist/adapters/anthropic-CTu9E801.js +0 -126
  207. package/dist/adapters/google-BAK9pnQf.cjs +0 -2
  208. package/dist/adapters/google-DficVAsJ.js +0 -146
  209. package/dist/adapters/handler-BV2_dul8.js +0 -2713
  210. package/dist/adapters/handler-LMRPeTNJ.cjs +0 -39
  211. package/dist/adapters/index-BgCeQBuN.cjs +0 -2
  212. package/dist/adapters/index-C3PskWTr.js +0 -5353
  213. package/dist/adapters/index-C45_meK_.js +0 -719
  214. package/dist/adapters/index-ht4NPca9.cjs +0 -23
  215. package/dist/adapters/mcp-transport-B6ZudTSk.js +0 -11010
  216. package/dist/adapters/mcp-transport-DCiSGtp1.cjs +0 -257
  217. package/dist/adapters/openai-BvA6eLs8.cjs +0 -1
  218. package/dist/adapters/openai-mcE24du8.js +0 -131
  219. package/dist/client/charts.js.map +0 -1
  220. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js +0 -256
  221. package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js.map +0 -1
  222. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js +0 -48
  223. package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +0 -1
  224. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js +0 -178
  225. package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js.map +0 -1
  226. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js +0 -29
  227. package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +0 -1
  228. package/dist/client/chunks/analysis-builder-DMFoAkjT.js +0 -6203
  229. package/dist/client/chunks/analysis-builder-DMFoAkjT.js.map +0 -1
  230. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js +0 -3140
  231. package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js.map +0 -1
  232. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js +0 -347
  233. package/dist/client/chunks/chart-activity-grid-DCznpK6N.js.map +0 -1
  234. package/dist/client/chunks/chart-area-CqKRIUpj.js +0 -234
  235. package/dist/client/chunks/chart-area-CqKRIUpj.js.map +0 -1
  236. package/dist/client/chunks/chart-bar-Bl5jvrU_.js +0 -267
  237. package/dist/client/chunks/chart-bar-Bl5jvrU_.js.map +0 -1
  238. package/dist/client/chunks/chart-box-plot-CzMb00z_.js +0 -322
  239. package/dist/client/chunks/chart-box-plot-CzMb00z_.js.map +0 -1
  240. package/dist/client/chunks/chart-bubble-BF8Z52eW.js +0 -249
  241. package/dist/client/chunks/chart-bubble-BF8Z52eW.js.map +0 -1
  242. package/dist/client/chunks/chart-candlestick-ByWS945g.js +0 -269
  243. package/dist/client/chunks/chart-candlestick-ByWS945g.js.map +0 -1
  244. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js +0 -50
  245. package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +0 -1
  246. package/dist/client/chunks/chart-config-area-CK_GVApT.js +0 -77
  247. package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +0 -1
  248. package/dist/client/chunks/chart-config-bar-C8uzktxl.js +0 -71
  249. package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +0 -1
  250. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +0 -38
  251. package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +0 -1
  252. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js +0 -71
  253. package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +0 -1
  254. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +0 -70
  255. package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +0 -1
  256. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js +0 -28
  257. package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +0 -1
  258. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js +0 -92
  259. package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +0 -1
  260. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +0 -64
  261. package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +0 -1
  262. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js +0 -77
  263. package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +0 -1
  264. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js +0 -97
  265. package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +0 -1
  266. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js +0 -75
  267. package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +0 -1
  268. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js +0 -47
  269. package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +0 -1
  270. package/dist/client/chunks/chart-config-line-JNagi9tf.js +0 -88
  271. package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +0 -1
  272. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js +0 -97
  273. package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +0 -1
  274. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +0 -70
  275. package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +0 -1
  276. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js +0 -39
  277. package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +0 -1
  278. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js +0 -44
  279. package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +0 -1
  280. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js +0 -37
  281. package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +0 -1
  282. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js +0 -61
  283. package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +0 -1
  284. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js +0 -53
  285. package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +0 -1
  286. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js +0 -50
  287. package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +0 -1
  288. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js +0 -47
  289. package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +0 -1
  290. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +0 -60
  291. package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +0 -1
  292. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js +0 -293
  293. package/dist/client/chunks/chart-data-table-HwfF-Ujv.js.map +0 -1
  294. package/dist/client/chunks/chart-funnel-WmuoWlCq.js +0 -259
  295. package/dist/client/chunks/chart-funnel-WmuoWlCq.js.map +0 -1
  296. package/dist/client/chunks/chart-gauge-Cot4By-w.js +0 -374
  297. package/dist/client/chunks/chart-gauge-Cot4By-w.js.map +0 -1
  298. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js +0 -231
  299. package/dist/client/chunks/chart-heat-map-bGNtsZMr.js.map +0 -1
  300. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js +0 -351
  301. package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js.map +0 -1
  302. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js +0 -476
  303. package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js.map +0 -1
  304. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js +0 -165
  305. package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js.map +0 -1
  306. package/dist/client/chunks/chart-line-3Nf-EPqJ.js +0 -450
  307. package/dist/client/chunks/chart-line-3Nf-EPqJ.js.map +0 -1
  308. package/dist/client/chunks/chart-markdown-BT_-MBq1.js +0 -2721
  309. package/dist/client/chunks/chart-markdown-BT_-MBq1.js.map +0 -1
  310. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js +0 -114
  311. package/dist/client/chunks/chart-measure-profile-BVjUonqU.js.map +0 -1
  312. package/dist/client/chunks/chart-pie-DblG6w7g.js +0 -137
  313. package/dist/client/chunks/chart-pie-DblG6w7g.js.map +0 -1
  314. package/dist/client/chunks/chart-radar-BHZbeeTg.js +0 -129
  315. package/dist/client/chunks/chart-radar-BHZbeeTg.js.map +0 -1
  316. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js +0 -119
  317. package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js.map +0 -1
  318. package/dist/client/chunks/chart-sankey-E8vYKjQF.js +0 -189
  319. package/dist/client/chunks/chart-sankey-E8vYKjQF.js.map +0 -1
  320. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js +0 -202
  321. package/dist/client/chunks/chart-scatter-Bbxqi0iw.js.map +0 -1
  322. package/dist/client/chunks/chart-sunburst-BgnTKolT.js +0 -188
  323. package/dist/client/chunks/chart-sunburst-BgnTKolT.js.map +0 -1
  324. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js +0 -284
  325. package/dist/client/chunks/chart-tree-map-i9LGCLwl.js.map +0 -1
  326. package/dist/client/chunks/chart-waterfall-BeIhCm83.js +0 -191
  327. package/dist/client/chunks/chart-waterfall-BeIhCm83.js.map +0 -1
  328. package/dist/client/chunks/charts-core-BUUO36OM.js +0 -692
  329. package/dist/client/chunks/charts-core-BUUO36OM.js.map +0 -1
  330. package/dist/client/chunks/charts-loader-goTYnavu.js +0 -258
  331. package/dist/client/chunks/charts-loader-goTYnavu.js.map +0 -1
  332. package/dist/client/chunks/components-BFgYvFq6.js +0 -10066
  333. package/dist/client/chunks/components-BFgYvFq6.js.map +0 -1
  334. package/dist/client/chunks/core-Y9e-sNfb.js +0 -1068
  335. package/dist/client/chunks/core-Y9e-sNfb.js.map +0 -1
  336. package/dist/client/chunks/flow-utils-CjQZG5qq.js +0 -16
  337. package/dist/client/chunks/flow-utils-CjQZG5qq.js.map +0 -1
  338. package/dist/client/chunks/funnel-utils-CyonoNeC.js +0 -135
  339. package/dist/client/chunks/funnel-utils-CyonoNeC.js.map +0 -1
  340. package/dist/client/chunks/icons-CwvgmdIP.js +0 -1636
  341. package/dist/client/chunks/icons-CwvgmdIP.js.map +0 -1
  342. package/dist/client/chunks/index-CApFCBF9.js +0 -81
  343. package/dist/client/chunks/index-CApFCBF9.js.map +0 -1
  344. package/dist/client/chunks/index-_2PSgbkC.js +0 -1046
  345. package/dist/client/chunks/index-_2PSgbkC.js.map +0 -1
  346. package/dist/client/chunks/javascript-DII1YQGr.js +0 -659
  347. package/dist/client/chunks/javascript-DII1YQGr.js.map +0 -1
  348. package/dist/client/chunks/json-C_6Prymp.js +0 -39
  349. package/dist/client/chunks/json-C_6Prymp.js.map +0 -1
  350. package/dist/client/chunks/providers-Ds7DRmnO.js +0 -554
  351. package/dist/client/chunks/providers-Ds7DRmnO.js.map +0 -1
  352. package/dist/client/chunks/retention-CzCo8262.js +0 -120
  353. package/dist/client/chunks/retention-CzCo8262.js.map +0 -1
  354. package/dist/client/chunks/schema-visualization-B97a1Ybu.js +0 -772
  355. package/dist/client/chunks/schema-visualization-B97a1Ybu.js.map +0 -1
  356. package/dist/client/chunks/sql-IeKX8fQ8.js +0 -616
  357. package/dist/client/chunks/sql-IeKX8fQ8.js.map +0 -1
  358. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js +0 -34
  359. package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js.map +0 -1
  360. package/dist/client/chunks/theme-Dp3hFed1.js +0 -112
  361. package/dist/client/chunks/theme-Dp3hFed1.js.map +0 -1
  362. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js +0 -1231
  363. package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js.map +0 -1
  364. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js +0 -182
  365. package/dist/client/chunks/useExplainAI-CfQ_JmF1.js.map +0 -1
  366. package/dist/client/chunks/vendor-B2EH3V58.js +0 -2892
  367. package/dist/client/chunks/vendor-B2EH3V58.js.map +0 -1
  368. package/dist/client/components.js.map +0 -1
  369. package/dist/client/hooks.js.map +0 -1
  370. package/dist/client/icons.js.map +0 -1
  371. package/dist/client/providers.js.map +0 -1
  372. package/dist/client/utils.js.map +0 -1
  373. package/dist/server/anthropic-BTkjgFpT.cjs +0 -1
  374. package/dist/server/anthropic-CTu9E801.js +0 -126
  375. package/dist/server/google-BAK9pnQf.cjs +0 -2
  376. package/dist/server/google-DficVAsJ.js +0 -146
  377. package/dist/server/index-BgCeQBuN.cjs +0 -2
  378. package/dist/server/index-C3PskWTr.js +0 -5353
  379. package/dist/server/index-C45_meK_.js +0 -719
  380. package/dist/server/index-ht4NPca9.cjs +0 -23
  381. package/dist/server/openai-BvA6eLs8.cjs +0 -1
  382. package/dist/server/openai-mcE24du8.js +0 -131
@@ -1,2892 +0,0 @@
1
- import * as C from "react";
2
- import D from "react";
3
- import { jsx as Gt } from "react/jsx-runtime";
4
- var V = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new WeakMap(), dt = 0, Jt;
5
- function Wt(t) {
6
- return t ? (H.has(t) || (dt += 1, H.set(t, dt.toString())), H.get(t)) : "0";
7
- }
8
- function $t(t) {
9
- return Object.keys(t).sort().filter(
10
- (e) => t[e] !== void 0
11
- ).map((e) => `${e}_${e === "root" ? Wt(t.root) : t[e]}`).toString();
12
- }
13
- function Vt(t) {
14
- const e = $t(t);
15
- let s = V.get(e);
16
- if (!s) {
17
- const r = /* @__PURE__ */ new Map();
18
- let i;
19
- const o = new IntersectionObserver((c) => {
20
- c.forEach((n) => {
21
- var u;
22
- const h = n.isIntersecting && i.some((a) => n.intersectionRatio >= a);
23
- t.trackVisibility && typeof n.isVisible > "u" && (n.isVisible = h), [...(u = r.get(n.target)) != null ? u : []].forEach((a) => {
24
- a(h, n);
25
- });
26
- });
27
- }, t);
28
- i = o.thresholds || (Array.isArray(t.threshold) ? t.threshold : [t.threshold || 0]), s = {
29
- id: e,
30
- observer: o,
31
- elements: r
32
- }, V.set(e, s);
33
- }
34
- return s;
35
- }
36
- function Zt(t, e, s = {}, r = Jt) {
37
- if (typeof window.IntersectionObserver > "u" && r !== void 0) {
38
- const u = t.getBoundingClientRect();
39
- return e(r, {
40
- isIntersecting: r,
41
- target: t,
42
- intersectionRatio: typeof s.threshold == "number" ? s.threshold : 0,
43
- time: 0,
44
- boundingClientRect: u,
45
- intersectionRect: u,
46
- rootBounds: u
47
- }), () => {
48
- };
49
- }
50
- const { id: i, observer: o, elements: c } = Vt(s), n = c.get(t) || [];
51
- return c.has(t) || c.set(t, n), n.push(e), o.observe(t), function() {
52
- n.splice(n.indexOf(e), 1), n.length === 0 && (c.delete(t), o.unobserve(t)), c.size === 0 && (o.disconnect(), V.delete(i));
53
- };
54
- }
55
- function Ne({
56
- threshold: t,
57
- delay: e,
58
- trackVisibility: s,
59
- rootMargin: r,
60
- root: i,
61
- triggerOnce: o,
62
- skip: c,
63
- initialInView: n,
64
- fallbackInView: u,
65
- onChange: h
66
- } = {}) {
67
- var a;
68
- const [l, f] = C.useState(null), m = C.useRef(h), O = C.useRef(n), [y, v] = C.useState({
69
- inView: !!n,
70
- entry: void 0
71
- });
72
- m.current = h, C.useEffect(
73
- () => {
74
- if (O.current === void 0 && (O.current = n), c || !l) return;
75
- let S;
76
- return S = Zt(
77
- l,
78
- (R, d) => {
79
- const b = O.current;
80
- O.current = R, !(b === void 0 && !R) && (v({
81
- inView: R,
82
- entry: d
83
- }), m.current && m.current(R, d), d.isIntersecting && o && S && (S(), S = void 0));
84
- },
85
- {
86
- root: i,
87
- rootMargin: r,
88
- threshold: t,
89
- // @ts-expect-error
90
- trackVisibility: s,
91
- delay: e
92
- },
93
- u
94
- ), () => {
95
- S && S();
96
- };
97
- },
98
- // We break the rule here, because we aren't including the actual `threshold` variable
99
- // eslint-disable-next-line react-hooks/exhaustive-deps
100
- [
101
- // If the threshold is an array, convert it to a string, so it won't change between renders.
102
- Array.isArray(t) ? t.toString() : t,
103
- l,
104
- i,
105
- r,
106
- o,
107
- c,
108
- s,
109
- u,
110
- e
111
- ]
112
- );
113
- const p = (a = y.entry) == null ? void 0 : a.target, w = C.useRef(void 0);
114
- !l && p && !o && !c && w.current !== p && (w.current = p, v({
115
- inView: !!n,
116
- entry: void 0
117
- }), O.current = n);
118
- const E = [f, y.inView, y.entry];
119
- return E.ref = E[0], E.inView = E[1], E.entry = E[2], E;
120
- }
121
- var x = class {
122
- constructor() {
123
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
124
- }
125
- subscribe(t) {
126
- return this.listeners.add(t), this.onSubscribe(), () => {
127
- this.listeners.delete(t), this.onUnsubscribe();
128
- };
129
- }
130
- hasListeners() {
131
- return this.listeners.size > 0;
132
- }
133
- onSubscribe() {
134
- }
135
- onUnsubscribe() {
136
- }
137
- }, Xt = {
138
- // We need the wrapper function syntax below instead of direct references to
139
- // global setTimeout etc.
140
- //
141
- // BAD: `setTimeout: setTimeout`
142
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
143
- //
144
- // If we use direct references here, then anything that wants to spy on or
145
- // replace the global setTimeout (like tests) won't work since we'll already
146
- // have a hard reference to the original implementation at the time when this
147
- // file was imported.
148
- setTimeout: (t, e) => setTimeout(t, e),
149
- clearTimeout: (t) => clearTimeout(t),
150
- setInterval: (t, e) => setInterval(t, e),
151
- clearInterval: (t) => clearInterval(t)
152
- }, Yt = class {
153
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
154
- // type at app boot; and if we leave that type, then any new timer provider
155
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
156
- //
157
- // We settle for type safety for the TimeoutProvider type, and accept that
158
- // this class is unsafe internally to allow for extension.
159
- #e = Xt;
160
- #t = !1;
161
- setTimeoutProvider(t) {
162
- process.env.NODE_ENV !== "production" && this.#t && t !== this.#e && console.error(
163
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
164
- { previous: this.#e, provider: t }
165
- ), this.#e = t, process.env.NODE_ENV !== "production" && (this.#t = !1);
166
- }
167
- setTimeout(t, e) {
168
- return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(t, e);
169
- }
170
- clearTimeout(t) {
171
- this.#e.clearTimeout(t);
172
- }
173
- setInterval(t, e) {
174
- return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(t, e);
175
- }
176
- clearInterval(t) {
177
- this.#e.clearInterval(t);
178
- }
179
- }, _ = new Yt();
180
- function te(t) {
181
- setTimeout(t, 0);
182
- }
183
- var I = typeof window > "u" || "Deno" in globalThis;
184
- function P() {
185
- }
186
- function ee(t, e) {
187
- return typeof t == "function" ? t(e) : t;
188
- }
189
- function Z(t) {
190
- return typeof t == "number" && t >= 0 && t !== 1 / 0;
191
- }
192
- function Qt(t, e) {
193
- return Math.max(t + (e || 0) - Date.now(), 0);
194
- }
195
- function T(t, e) {
196
- return typeof t == "function" ? t(e) : t;
197
- }
198
- function F(t, e) {
199
- return typeof t == "function" ? t(e) : t;
200
- }
201
- function pt(t, e) {
202
- const {
203
- type: s = "all",
204
- exact: r,
205
- fetchStatus: i,
206
- predicate: o,
207
- queryKey: c,
208
- stale: n
209
- } = t;
210
- if (c) {
211
- if (r) {
212
- if (e.queryHash !== ot(c, e.options))
213
- return !1;
214
- } else if (!j(e.queryKey, c))
215
- return !1;
216
- }
217
- if (s !== "all") {
218
- const u = e.isActive();
219
- if (s === "active" && !u || s === "inactive" && u)
220
- return !1;
221
- }
222
- return !(typeof n == "boolean" && e.isStale() !== n || i && i !== e.state.fetchStatus || o && !o(e));
223
- }
224
- function yt(t, e) {
225
- const { exact: s, status: r, predicate: i, mutationKey: o } = t;
226
- if (o) {
227
- if (!e.options.mutationKey)
228
- return !1;
229
- if (s) {
230
- if (Q(e.options.mutationKey) !== Q(o))
231
- return !1;
232
- } else if (!j(e.options.mutationKey, o))
233
- return !1;
234
- }
235
- return !(r && e.state.status !== r || i && !i(e));
236
- }
237
- function ot(t, e) {
238
- return (e?.queryKeyHashFn || Q)(t);
239
- }
240
- function Q(t) {
241
- return JSON.stringify(
242
- t,
243
- (e, s) => X(s) ? Object.keys(s).sort().reduce((r, i) => (r[i] = s[i], r), {}) : s
244
- );
245
- }
246
- function j(t, e) {
247
- return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? Object.keys(e).every((s) => j(t[s], e[s])) : !1;
248
- }
249
- var se = Object.prototype.hasOwnProperty;
250
- function B(t, e, s = 0) {
251
- if (t === e)
252
- return t;
253
- if (s > 500) return e;
254
- const r = vt(t) && vt(e);
255
- if (!r && !(X(t) && X(e))) return e;
256
- const o = (r ? t : Object.keys(t)).length, c = r ? e : Object.keys(e), n = c.length, u = r ? new Array(n) : {};
257
- let h = 0;
258
- for (let a = 0; a < n; a++) {
259
- const l = r ? a : c[a], f = t[l], m = e[l];
260
- if (f === m) {
261
- u[l] = f, (r ? a < o : se.call(t, l)) && h++;
262
- continue;
263
- }
264
- if (f === null || m === null || typeof f != "object" || typeof m != "object") {
265
- u[l] = m;
266
- continue;
267
- }
268
- const O = B(f, m, s + 1);
269
- u[l] = O, O === f && h++;
270
- }
271
- return o === n && h === o ? t : u;
272
- }
273
- function q(t, e) {
274
- if (!e || Object.keys(t).length !== Object.keys(e).length)
275
- return !1;
276
- for (const s in t)
277
- if (t[s] !== e[s])
278
- return !1;
279
- return !0;
280
- }
281
- function vt(t) {
282
- return Array.isArray(t) && t.length === Object.keys(t).length;
283
- }
284
- function X(t) {
285
- if (!mt(t))
286
- return !1;
287
- const e = t.constructor;
288
- if (e === void 0)
289
- return !0;
290
- const s = e.prototype;
291
- return !(!mt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
292
- }
293
- function mt(t) {
294
- return Object.prototype.toString.call(t) === "[object Object]";
295
- }
296
- function re(t) {
297
- return new Promise((e) => {
298
- _.setTimeout(e, t);
299
- });
300
- }
301
- function Y(t, e, s) {
302
- if (typeof s.structuralSharing == "function")
303
- return s.structuralSharing(t, e);
304
- if (s.structuralSharing !== !1) {
305
- if (process.env.NODE_ENV !== "production")
306
- try {
307
- return B(t, e);
308
- } catch (r) {
309
- throw console.error(
310
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${r}`
311
- ), r;
312
- }
313
- return B(t, e);
314
- }
315
- return e;
316
- }
317
- function ie(t, e, s = 0) {
318
- const r = [...t, e];
319
- return s && r.length > s ? r.slice(1) : r;
320
- }
321
- function ne(t, e, s = 0) {
322
- const r = [e, ...t];
323
- return s && r.length > s ? r.slice(0, -1) : r;
324
- }
325
- var G = /* @__PURE__ */ Symbol();
326
- function xt(t, e) {
327
- return process.env.NODE_ENV !== "production" && t.queryFn === G && console.error(
328
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
329
- ), !t.queryFn && e?.initialPromise ? () => e.initialPromise : !t.queryFn || t.queryFn === G ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
330
- }
331
- function at(t, e) {
332
- return typeof t == "function" ? t(...e) : !!t;
333
- }
334
- function oe(t, e, s) {
335
- let r = !1, i;
336
- return Object.defineProperty(t, "signal", {
337
- enumerable: !0,
338
- get: () => (i ??= e(), r || (r = !0, i.aborted ? s() : i.addEventListener("abort", s, { once: !0 })), i)
339
- }), t;
340
- }
341
- var ae = class extends x {
342
- #e;
343
- #t;
344
- #s;
345
- constructor() {
346
- super(), this.#s = (t) => {
347
- if (!I && window.addEventListener) {
348
- const e = () => t();
349
- return window.addEventListener("visibilitychange", e, !1), () => {
350
- window.removeEventListener("visibilitychange", e);
351
- };
352
- }
353
- };
354
- }
355
- onSubscribe() {
356
- this.#t || this.setEventListener(this.#s);
357
- }
358
- onUnsubscribe() {
359
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
360
- }
361
- setEventListener(t) {
362
- this.#s = t, this.#t?.(), this.#t = t((e) => {
363
- typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
364
- });
365
- }
366
- setFocused(t) {
367
- this.#e !== t && (this.#e = t, this.onFocus());
368
- }
369
- onFocus() {
370
- const t = this.isFocused();
371
- this.listeners.forEach((e) => {
372
- e(t);
373
- });
374
- }
375
- isFocused() {
376
- return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
377
- }
378
- }, ut = new ae();
379
- function tt() {
380
- let t, e;
381
- const s = new Promise((i, o) => {
382
- t = i, e = o;
383
- });
384
- s.status = "pending", s.catch(() => {
385
- });
386
- function r(i) {
387
- Object.assign(s, i), delete s.resolve, delete s.reject;
388
- }
389
- return s.resolve = (i) => {
390
- r({
391
- status: "fulfilled",
392
- value: i
393
- }), t(i);
394
- }, s.reject = (i) => {
395
- r({
396
- status: "rejected",
397
- reason: i
398
- }), e(i);
399
- }, s;
400
- }
401
- var ue = te;
402
- function ce() {
403
- let t = [], e = 0, s = (n) => {
404
- n();
405
- }, r = (n) => {
406
- n();
407
- }, i = ue;
408
- const o = (n) => {
409
- e ? t.push(n) : i(() => {
410
- s(n);
411
- });
412
- }, c = () => {
413
- const n = t;
414
- t = [], n.length && i(() => {
415
- r(() => {
416
- n.forEach((u) => {
417
- s(u);
418
- });
419
- });
420
- });
421
- };
422
- return {
423
- batch: (n) => {
424
- let u;
425
- e++;
426
- try {
427
- u = n();
428
- } finally {
429
- e--, e || c();
430
- }
431
- return u;
432
- },
433
- /**
434
- * All calls to the wrapped function will be batched.
435
- */
436
- batchCalls: (n) => (...u) => {
437
- o(() => {
438
- n(...u);
439
- });
440
- },
441
- schedule: o,
442
- /**
443
- * Use this method to set a custom notify function.
444
- * This can be used to for example wrap notifications with `React.act` while running tests.
445
- */
446
- setNotifyFunction: (n) => {
447
- s = n;
448
- },
449
- /**
450
- * Use this method to set a custom function to batch notifications together into a single tick.
451
- * By default React Query will use the batch function provided by ReactDOM or React Native.
452
- */
453
- setBatchNotifyFunction: (n) => {
454
- r = n;
455
- },
456
- setScheduler: (n) => {
457
- i = n;
458
- }
459
- };
460
- }
461
- var M = ce(), he = class extends x {
462
- #e = !0;
463
- #t;
464
- #s;
465
- constructor() {
466
- super(), this.#s = (t) => {
467
- if (!I && window.addEventListener) {
468
- const e = () => t(!0), s = () => t(!1);
469
- return window.addEventListener("online", e, !1), window.addEventListener("offline", s, !1), () => {
470
- window.removeEventListener("online", e), window.removeEventListener("offline", s);
471
- };
472
- }
473
- };
474
- }
475
- onSubscribe() {
476
- this.#t || this.setEventListener(this.#s);
477
- }
478
- onUnsubscribe() {
479
- this.hasListeners() || (this.#t?.(), this.#t = void 0);
480
- }
481
- setEventListener(t) {
482
- this.#s = t, this.#t?.(), this.#t = t(this.setOnline.bind(this));
483
- }
484
- setOnline(t) {
485
- this.#e !== t && (this.#e = t, this.listeners.forEach((s) => {
486
- s(t);
487
- }));
488
- }
489
- isOnline() {
490
- return this.#e;
491
- }
492
- }, J = new he();
493
- function le(t) {
494
- return Math.min(1e3 * 2 ** t, 3e4);
495
- }
496
- function At(t) {
497
- return (t ?? "online") === "online" ? J.isOnline() : !0;
498
- }
499
- var et = class extends Error {
500
- constructor(t) {
501
- super("CancelledError"), this.revert = t?.revert, this.silent = t?.silent;
502
- }
503
- };
504
- function Dt(t) {
505
- let e = !1, s = 0, r;
506
- const i = tt(), o = () => i.status !== "pending", c = (y) => {
507
- if (!o()) {
508
- const v = new et(y);
509
- f(v), t.onCancel?.(v);
510
- }
511
- }, n = () => {
512
- e = !0;
513
- }, u = () => {
514
- e = !1;
515
- }, h = () => ut.isFocused() && (t.networkMode === "always" || J.isOnline()) && t.canRun(), a = () => At(t.networkMode) && t.canRun(), l = (y) => {
516
- o() || (r?.(), i.resolve(y));
517
- }, f = (y) => {
518
- o() || (r?.(), i.reject(y));
519
- }, m = () => new Promise((y) => {
520
- r = (v) => {
521
- (o() || h()) && y(v);
522
- }, t.onPause?.();
523
- }).then(() => {
524
- r = void 0, o() || t.onContinue?.();
525
- }), O = () => {
526
- if (o())
527
- return;
528
- let y;
529
- const v = s === 0 ? t.initialPromise : void 0;
530
- try {
531
- y = v ?? t.fn();
532
- } catch (p) {
533
- y = Promise.reject(p);
534
- }
535
- Promise.resolve(y).then(l).catch((p) => {
536
- if (o())
537
- return;
538
- const w = t.retry ?? (I ? 0 : 3), E = t.retryDelay ?? le, S = typeof E == "function" ? E(s, p) : E, R = w === !0 || typeof w == "number" && s < w || typeof w == "function" && w(s, p);
539
- if (e || !R) {
540
- f(p);
541
- return;
542
- }
543
- s++, t.onFail?.(s, p), re(S).then(() => h() ? void 0 : m()).then(() => {
544
- e ? f(p) : O();
545
- });
546
- });
547
- };
548
- return {
549
- promise: i,
550
- status: () => i.status,
551
- cancel: c,
552
- continue: () => (r?.(), i),
553
- cancelRetry: n,
554
- continueRetry: u,
555
- canStart: a,
556
- start: () => (a() ? O() : m().then(O), i)
557
- };
558
- }
559
- var jt = class {
560
- #e;
561
- destroy() {
562
- this.clearGcTimeout();
563
- }
564
- scheduleGc() {
565
- this.clearGcTimeout(), Z(this.gcTime) && (this.#e = _.setTimeout(() => {
566
- this.optionalRemove();
567
- }, this.gcTime));
568
- }
569
- updateGcTime(t) {
570
- this.gcTime = Math.max(
571
- this.gcTime || 0,
572
- t ?? (I ? 1 / 0 : 300 * 1e3)
573
- );
574
- }
575
- clearGcTimeout() {
576
- this.#e && (_.clearTimeout(this.#e), this.#e = void 0);
577
- }
578
- }, fe = class extends jt {
579
- #e;
580
- #t;
581
- #s;
582
- #i;
583
- #r;
584
- #n;
585
- #a;
586
- constructor(t) {
587
- super(), this.#a = !1, this.#n = t.defaultOptions, this.setOptions(t.options), this.observers = [], this.#i = t.client, this.#s = this.#i.getQueryCache(), this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#e = bt(this.options), this.state = t.state ?? this.#e, this.scheduleGc();
588
- }
589
- get meta() {
590
- return this.options.meta;
591
- }
592
- get promise() {
593
- return this.#r?.promise;
594
- }
595
- setOptions(t) {
596
- if (this.options = { ...this.#n, ...t }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
597
- const e = bt(this.options);
598
- e.data !== void 0 && (this.setState(
599
- gt(e.data, e.dataUpdatedAt)
600
- ), this.#e = e);
601
- }
602
- }
603
- optionalRemove() {
604
- !this.observers.length && this.state.fetchStatus === "idle" && this.#s.remove(this);
605
- }
606
- setData(t, e) {
607
- const s = Y(this.state.data, t, this.options);
608
- return this.#o({
609
- data: s,
610
- type: "success",
611
- dataUpdatedAt: e?.updatedAt,
612
- manual: e?.manual
613
- }), s;
614
- }
615
- setState(t, e) {
616
- this.#o({ type: "setState", state: t, setStateOptions: e });
617
- }
618
- cancel(t) {
619
- const e = this.#r?.promise;
620
- return this.#r?.cancel(t), e ? e.then(P).catch(P) : Promise.resolve();
621
- }
622
- destroy() {
623
- super.destroy(), this.cancel({ silent: !0 });
624
- }
625
- reset() {
626
- this.destroy(), this.setState(this.#e);
627
- }
628
- isActive() {
629
- return this.observers.some(
630
- (t) => F(t.options.enabled, this) !== !1
631
- );
632
- }
633
- isDisabled() {
634
- return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === G || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
635
- }
636
- isStatic() {
637
- return this.getObserversCount() > 0 ? this.observers.some(
638
- (t) => T(t.options.staleTime, this) === "static"
639
- ) : !1;
640
- }
641
- isStale() {
642
- return this.getObserversCount() > 0 ? this.observers.some(
643
- (t) => t.getCurrentResult().isStale
644
- ) : this.state.data === void 0 || this.state.isInvalidated;
645
- }
646
- isStaleByTime(t = 0) {
647
- return this.state.data === void 0 ? !0 : t === "static" ? !1 : this.state.isInvalidated ? !0 : !Qt(this.state.dataUpdatedAt, t);
648
- }
649
- onFocus() {
650
- this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
651
- }
652
- onOnline() {
653
- this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
654
- }
655
- addObserver(t) {
656
- this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), this.#s.notify({ type: "observerAdded", query: this, observer: t }));
657
- }
658
- removeObserver(t) {
659
- this.observers.includes(t) && (this.observers = this.observers.filter((e) => e !== t), this.observers.length || (this.#r && (this.#a ? this.#r.cancel({ revert: !0 }) : this.#r.cancelRetry()), this.scheduleGc()), this.#s.notify({ type: "observerRemoved", query: this, observer: t }));
660
- }
661
- getObserversCount() {
662
- return this.observers.length;
663
- }
664
- invalidate() {
665
- this.state.isInvalidated || this.#o({ type: "invalidate" });
666
- }
667
- async fetch(t, e) {
668
- if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
669
- // re-start the fetch; there is a chance that the query is still in a
670
- // pending state when that happens
671
- this.#r?.status() !== "rejected") {
672
- if (this.state.data !== void 0 && e?.cancelRefetch)
673
- this.cancel({ silent: !0 });
674
- else if (this.#r)
675
- return this.#r.continueRetry(), this.#r.promise;
676
- }
677
- if (t && this.setOptions(t), !this.options.queryFn) {
678
- const n = this.observers.find((u) => u.options.queryFn);
679
- n && this.setOptions(n.options);
680
- }
681
- process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
682
- "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']"
683
- ));
684
- const s = new AbortController(), r = (n) => {
685
- Object.defineProperty(n, "signal", {
686
- enumerable: !0,
687
- get: () => (this.#a = !0, s.signal)
688
- });
689
- }, i = () => {
690
- const n = xt(this.options, e), h = (() => {
691
- const a = {
692
- client: this.#i,
693
- queryKey: this.queryKey,
694
- meta: this.meta
695
- };
696
- return r(a), a;
697
- })();
698
- return this.#a = !1, this.options.persister ? this.options.persister(
699
- n,
700
- h,
701
- this
702
- ) : n(h);
703
- }, c = (() => {
704
- const n = {
705
- fetchOptions: e,
706
- options: this.options,
707
- queryKey: this.queryKey,
708
- client: this.#i,
709
- state: this.state,
710
- fetchFn: i
711
- };
712
- return r(n), n;
713
- })();
714
- this.options.behavior?.onFetch(c, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== c.fetchOptions?.meta) && this.#o({ type: "fetch", meta: c.fetchOptions?.meta }), this.#r = Dt({
715
- initialPromise: e?.initialPromise,
716
- fn: c.fetchFn,
717
- onCancel: (n) => {
718
- n instanceof et && n.revert && this.setState({
719
- ...this.#t,
720
- fetchStatus: "idle"
721
- }), s.abort();
722
- },
723
- onFail: (n, u) => {
724
- this.#o({ type: "failed", failureCount: n, error: u });
725
- },
726
- onPause: () => {
727
- this.#o({ type: "pause" });
728
- },
729
- onContinue: () => {
730
- this.#o({ type: "continue" });
731
- },
732
- retry: c.options.retry,
733
- retryDelay: c.options.retryDelay,
734
- networkMode: c.options.networkMode,
735
- canRun: () => !0
736
- });
737
- try {
738
- const n = await this.#r.start();
739
- if (n === void 0)
740
- throw process.env.NODE_ENV !== "production" && console.error(
741
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
742
- ), new Error(`${this.queryHash} data is undefined`);
743
- return this.setData(n), this.#s.config.onSuccess?.(n, this), this.#s.config.onSettled?.(
744
- n,
745
- this.state.error,
746
- this
747
- ), n;
748
- } catch (n) {
749
- if (n instanceof et) {
750
- if (n.silent)
751
- return this.#r.promise;
752
- if (n.revert) {
753
- if (this.state.data === void 0)
754
- throw n;
755
- return this.state.data;
756
- }
757
- }
758
- throw this.#o({
759
- type: "error",
760
- error: n
761
- }), this.#s.config.onError?.(
762
- n,
763
- this
764
- ), this.#s.config.onSettled?.(
765
- this.state.data,
766
- n,
767
- this
768
- ), n;
769
- } finally {
770
- this.scheduleGc();
771
- }
772
- }
773
- #o(t) {
774
- const e = (s) => {
775
- switch (t.type) {
776
- case "failed":
777
- return {
778
- ...s,
779
- fetchFailureCount: t.failureCount,
780
- fetchFailureReason: t.error
781
- };
782
- case "pause":
783
- return {
784
- ...s,
785
- fetchStatus: "paused"
786
- };
787
- case "continue":
788
- return {
789
- ...s,
790
- fetchStatus: "fetching"
791
- };
792
- case "fetch":
793
- return {
794
- ...s,
795
- ...qt(s.data, this.options),
796
- fetchMeta: t.meta ?? null
797
- };
798
- case "success":
799
- const r = {
800
- ...s,
801
- ...gt(t.data, t.dataUpdatedAt),
802
- dataUpdateCount: s.dataUpdateCount + 1,
803
- ...!t.manual && {
804
- fetchStatus: "idle",
805
- fetchFailureCount: 0,
806
- fetchFailureReason: null
807
- }
808
- };
809
- return this.#t = t.manual ? r : void 0, r;
810
- case "error":
811
- const i = t.error;
812
- return {
813
- ...s,
814
- error: i,
815
- errorUpdateCount: s.errorUpdateCount + 1,
816
- errorUpdatedAt: Date.now(),
817
- fetchFailureCount: s.fetchFailureCount + 1,
818
- fetchFailureReason: i,
819
- fetchStatus: "idle",
820
- status: "error",
821
- // flag existing data as invalidated if we get a background error
822
- // note that "no data" always means stale so we can set unconditionally here
823
- isInvalidated: !0
824
- };
825
- case "invalidate":
826
- return {
827
- ...s,
828
- isInvalidated: !0
829
- };
830
- case "setState":
831
- return {
832
- ...s,
833
- ...t.state
834
- };
835
- }
836
- };
837
- this.state = e(this.state), M.batch(() => {
838
- this.observers.forEach((s) => {
839
- s.onQueryUpdate();
840
- }), this.#s.notify({ query: this, type: "updated", action: t });
841
- });
842
- }
843
- };
844
- function qt(t, e) {
845
- return {
846
- fetchFailureCount: 0,
847
- fetchFailureReason: null,
848
- fetchStatus: At(e.networkMode) ? "fetching" : "paused",
849
- ...t === void 0 && {
850
- error: null,
851
- status: "pending"
852
- }
853
- };
854
- }
855
- function gt(t, e) {
856
- return {
857
- data: t,
858
- dataUpdatedAt: e ?? Date.now(),
859
- error: null,
860
- isInvalidated: !1,
861
- status: "success"
862
- };
863
- }
864
- function bt(t) {
865
- const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, r = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
866
- return {
867
- data: e,
868
- dataUpdateCount: 0,
869
- dataUpdatedAt: s ? r ?? Date.now() : 0,
870
- error: null,
871
- errorUpdateCount: 0,
872
- errorUpdatedAt: 0,
873
- fetchFailureCount: 0,
874
- fetchFailureReason: null,
875
- fetchMeta: null,
876
- isInvalidated: !1,
877
- status: s ? "success" : "pending",
878
- fetchStatus: "idle"
879
- };
880
- }
881
- var ct = class extends x {
882
- constructor(t, e) {
883
- super(), this.options = e, this.#e = t, this.#o = null, this.#a = tt(), this.bindMethods(), this.setOptions(e);
884
- }
885
- #e;
886
- #t = void 0;
887
- #s = void 0;
888
- #i = void 0;
889
- #r;
890
- #n;
891
- #a;
892
- #o;
893
- #p;
894
- #l;
895
- // This property keeps track of the last query with defined data.
896
- // It will be used to pass the previous data and query to the placeholder function between renders.
897
- #f;
898
- #c;
899
- #h;
900
- #u;
901
- #d = /* @__PURE__ */ new Set();
902
- bindMethods() {
903
- this.refetch = this.refetch.bind(this);
904
- }
905
- onSubscribe() {
906
- this.listeners.size === 1 && (this.#t.addObserver(this), St(this.#t, this.options) ? this.#y() : this.updateResult(), this.#b());
907
- }
908
- onUnsubscribe() {
909
- this.hasListeners() || this.destroy();
910
- }
911
- shouldFetchOnReconnect() {
912
- return st(
913
- this.#t,
914
- this.options,
915
- this.options.refetchOnReconnect
916
- );
917
- }
918
- shouldFetchOnWindowFocus() {
919
- return st(
920
- this.#t,
921
- this.options,
922
- this.options.refetchOnWindowFocus
923
- );
924
- }
925
- destroy() {
926
- this.listeners = /* @__PURE__ */ new Set(), this.#S(), this.#O(), this.#t.removeObserver(this);
927
- }
928
- setOptions(t) {
929
- const e = this.options, s = this.#t;
930
- if (this.options = this.#e.defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof F(this.options.enabled, this.#t) != "boolean")
931
- throw new Error(
932
- "Expected enabled to be a boolean or a callback that returns a boolean"
933
- );
934
- this.#w(), this.#t.setOptions(this.options), e._defaulted && !q(this.options, e) && this.#e.getQueryCache().notify({
935
- type: "observerOptionsUpdated",
936
- query: this.#t,
937
- observer: this
938
- });
939
- const r = this.hasListeners();
940
- r && Ot(
941
- this.#t,
942
- s,
943
- this.options,
944
- e
945
- ) && this.#y(), this.updateResult(), r && (this.#t !== s || F(this.options.enabled, this.#t) !== F(e.enabled, this.#t) || T(this.options.staleTime, this.#t) !== T(e.staleTime, this.#t)) && this.#v();
946
- const i = this.#m();
947
- r && (this.#t !== s || F(this.options.enabled, this.#t) !== F(e.enabled, this.#t) || i !== this.#u) && this.#g(i);
948
- }
949
- getOptimisticResult(t) {
950
- const e = this.#e.getQueryCache().build(this.#e, t), s = this.createResult(e, t);
951
- return pe(this, s) && (this.#i = s, this.#n = this.options, this.#r = this.#t.state), s;
952
- }
953
- getCurrentResult() {
954
- return this.#i;
955
- }
956
- trackResult(t, e) {
957
- return new Proxy(t, {
958
- get: (s, r) => (this.trackProp(r), e?.(r), r === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#a.status === "pending" && this.#a.reject(
959
- new Error(
960
- "experimental_prefetchInRender feature flag is not enabled"
961
- )
962
- )), Reflect.get(s, r))
963
- });
964
- }
965
- trackProp(t) {
966
- this.#d.add(t);
967
- }
968
- getCurrentQuery() {
969
- return this.#t;
970
- }
971
- refetch({ ...t } = {}) {
972
- return this.fetch({
973
- ...t
974
- });
975
- }
976
- fetchOptimistic(t) {
977
- const e = this.#e.defaultQueryOptions(t), s = this.#e.getQueryCache().build(this.#e, e);
978
- return s.fetch().then(() => this.createResult(s, e));
979
- }
980
- fetch(t) {
981
- return this.#y({
982
- ...t,
983
- cancelRefetch: t.cancelRefetch ?? !0
984
- }).then(() => (this.updateResult(), this.#i));
985
- }
986
- #y(t) {
987
- this.#w();
988
- let e = this.#t.fetch(
989
- this.options,
990
- t
991
- );
992
- return t?.throwOnError || (e = e.catch(P)), e;
993
- }
994
- #v() {
995
- this.#S();
996
- const t = T(
997
- this.options.staleTime,
998
- this.#t
999
- );
1000
- if (I || this.#i.isStale || !Z(t))
1001
- return;
1002
- const s = Qt(this.#i.dataUpdatedAt, t) + 1;
1003
- this.#c = _.setTimeout(() => {
1004
- this.#i.isStale || this.updateResult();
1005
- }, s);
1006
- }
1007
- #m() {
1008
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
1009
- }
1010
- #g(t) {
1011
- this.#O(), this.#u = t, !(I || F(this.options.enabled, this.#t) === !1 || !Z(this.#u) || this.#u === 0) && (this.#h = _.setInterval(() => {
1012
- (this.options.refetchIntervalInBackground || ut.isFocused()) && this.#y();
1013
- }, this.#u));
1014
- }
1015
- #b() {
1016
- this.#v(), this.#g(this.#m());
1017
- }
1018
- #S() {
1019
- this.#c && (_.clearTimeout(this.#c), this.#c = void 0);
1020
- }
1021
- #O() {
1022
- this.#h && (_.clearInterval(this.#h), this.#h = void 0);
1023
- }
1024
- createResult(t, e) {
1025
- const s = this.#t, r = this.options, i = this.#i, o = this.#r, c = this.#n, u = t !== s ? t.state : this.#s, { state: h } = t;
1026
- let a = { ...h }, l = !1, f;
1027
- if (e._optimisticResults) {
1028
- const g = this.hasListeners(), A = !g && St(t, e), U = g && Ot(t, s, e, r);
1029
- (A || U) && (a = {
1030
- ...a,
1031
- ...qt(h.data, t.options)
1032
- }), e._optimisticResults === "isRestoring" && (a.fetchStatus = "idle");
1033
- }
1034
- let { error: m, errorUpdatedAt: O, status: y } = a;
1035
- f = a.data;
1036
- let v = !1;
1037
- if (e.placeholderData !== void 0 && f === void 0 && y === "pending") {
1038
- let g;
1039
- i?.isPlaceholderData && e.placeholderData === c?.placeholderData ? (g = i.data, v = !0) : g = typeof e.placeholderData == "function" ? e.placeholderData(
1040
- this.#f?.state.data,
1041
- this.#f
1042
- ) : e.placeholderData, g !== void 0 && (y = "success", f = Y(
1043
- i?.data,
1044
- g,
1045
- e
1046
- ), l = !0);
1047
- }
1048
- if (e.select && f !== void 0 && !v)
1049
- if (i && f === o?.data && e.select === this.#p)
1050
- f = this.#l;
1051
- else
1052
- try {
1053
- this.#p = e.select, f = e.select(f), f = Y(i?.data, f, e), this.#l = f, this.#o = null;
1054
- } catch (g) {
1055
- this.#o = g;
1056
- }
1057
- this.#o && (m = this.#o, f = this.#l, O = Date.now(), y = "error");
1058
- const p = a.fetchStatus === "fetching", w = y === "pending", E = y === "error", S = w && p, R = f !== void 0, b = {
1059
- status: y,
1060
- fetchStatus: a.fetchStatus,
1061
- isPending: w,
1062
- isSuccess: y === "success",
1063
- isError: E,
1064
- isInitialLoading: S,
1065
- isLoading: S,
1066
- data: f,
1067
- dataUpdatedAt: a.dataUpdatedAt,
1068
- error: m,
1069
- errorUpdatedAt: O,
1070
- failureCount: a.fetchFailureCount,
1071
- failureReason: a.fetchFailureReason,
1072
- errorUpdateCount: a.errorUpdateCount,
1073
- isFetched: a.dataUpdateCount > 0 || a.errorUpdateCount > 0,
1074
- isFetchedAfterMount: a.dataUpdateCount > u.dataUpdateCount || a.errorUpdateCount > u.errorUpdateCount,
1075
- isFetching: p,
1076
- isRefetching: p && !w,
1077
- isLoadingError: E && !R,
1078
- isPaused: a.fetchStatus === "paused",
1079
- isPlaceholderData: l,
1080
- isRefetchError: E && R,
1081
- isStale: ht(t, e),
1082
- refetch: this.refetch,
1083
- promise: this.#a,
1084
- isEnabled: F(e.enabled, t) !== !1
1085
- };
1086
- if (this.options.experimental_prefetchInRender) {
1087
- const g = b.data !== void 0, A = b.status === "error" && !g, U = (L) => {
1088
- A ? L.reject(b.error) : g && L.resolve(b.data);
1089
- }, ft = () => {
1090
- const L = this.#a = b.promise = tt();
1091
- U(L);
1092
- }, N = this.#a;
1093
- switch (N.status) {
1094
- case "pending":
1095
- t.queryHash === s.queryHash && U(N);
1096
- break;
1097
- case "fulfilled":
1098
- (A || b.data !== N.value) && ft();
1099
- break;
1100
- case "rejected":
1101
- (!A || b.error !== N.reason) && ft();
1102
- break;
1103
- }
1104
- }
1105
- return b;
1106
- }
1107
- updateResult() {
1108
- const t = this.#i, e = this.createResult(this.#t, this.options);
1109
- if (this.#r = this.#t.state, this.#n = this.options, this.#r.data !== void 0 && (this.#f = this.#t), q(e, t))
1110
- return;
1111
- this.#i = e;
1112
- const s = () => {
1113
- if (!t)
1114
- return !0;
1115
- const { notifyOnChangeProps: r } = this.options, i = typeof r == "function" ? r() : r;
1116
- if (i === "all" || !i && !this.#d.size)
1117
- return !0;
1118
- const o = new Set(
1119
- i ?? this.#d
1120
- );
1121
- return this.options.throwOnError && o.add("error"), Object.keys(this.#i).some((c) => {
1122
- const n = c;
1123
- return this.#i[n] !== t[n] && o.has(n);
1124
- });
1125
- };
1126
- this.#R({ listeners: s() });
1127
- }
1128
- #w() {
1129
- const t = this.#e.getQueryCache().build(this.#e, this.options);
1130
- if (t === this.#t)
1131
- return;
1132
- const e = this.#t;
1133
- this.#t = t, this.#s = t.state, this.hasListeners() && (e?.removeObserver(this), t.addObserver(this));
1134
- }
1135
- onQueryUpdate() {
1136
- this.updateResult(), this.hasListeners() && this.#b();
1137
- }
1138
- #R(t) {
1139
- M.batch(() => {
1140
- t.listeners && this.listeners.forEach((e) => {
1141
- e(this.#i);
1142
- }), this.#e.getQueryCache().notify({
1143
- query: this.#t,
1144
- type: "observerResultsUpdated"
1145
- });
1146
- });
1147
- }
1148
- };
1149
- function de(t, e) {
1150
- return F(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
1151
- }
1152
- function St(t, e) {
1153
- return de(t, e) || t.state.data !== void 0 && st(t, e, e.refetchOnMount);
1154
- }
1155
- function st(t, e, s) {
1156
- if (F(e.enabled, t) !== !1 && T(e.staleTime, t) !== "static") {
1157
- const r = typeof s == "function" ? s(t) : s;
1158
- return r === "always" || r !== !1 && ht(t, e);
1159
- }
1160
- return !1;
1161
- }
1162
- function Ot(t, e, s, r) {
1163
- return (t !== e || F(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && ht(t, s);
1164
- }
1165
- function ht(t, e) {
1166
- return F(e.enabled, t) !== !1 && t.isStaleByTime(T(e.staleTime, t));
1167
- }
1168
- function pe(t, e) {
1169
- return !q(t.getCurrentResult(), e);
1170
- }
1171
- function wt(t) {
1172
- return {
1173
- onFetch: (e, s) => {
1174
- const r = e.options, i = e.fetchOptions?.meta?.fetchMore?.direction, o = e.state.data?.pages || [], c = e.state.data?.pageParams || [];
1175
- let n = { pages: [], pageParams: [] }, u = 0;
1176
- const h = async () => {
1177
- let a = !1;
1178
- const l = (O) => {
1179
- oe(
1180
- O,
1181
- () => e.signal,
1182
- () => a = !0
1183
- );
1184
- }, f = xt(e.options, e.fetchOptions), m = async (O, y, v) => {
1185
- if (a)
1186
- return Promise.reject();
1187
- if (y == null && O.pages.length)
1188
- return Promise.resolve(O);
1189
- const w = (() => {
1190
- const d = {
1191
- client: e.client,
1192
- queryKey: e.queryKey,
1193
- pageParam: y,
1194
- direction: v ? "backward" : "forward",
1195
- meta: e.options.meta
1196
- };
1197
- return l(d), d;
1198
- })(), E = await f(w), { maxPages: S } = e.options, R = v ? ne : ie;
1199
- return {
1200
- pages: R(O.pages, E, S),
1201
- pageParams: R(O.pageParams, y, S)
1202
- };
1203
- };
1204
- if (i && o.length) {
1205
- const O = i === "backward", y = O ? ye : Rt, v = {
1206
- pages: o,
1207
- pageParams: c
1208
- }, p = y(r, v);
1209
- n = await m(v, p, O);
1210
- } else {
1211
- const O = t ?? o.length;
1212
- do {
1213
- const y = u === 0 ? c[0] ?? r.initialPageParam : Rt(r, n);
1214
- if (u > 0 && y == null)
1215
- break;
1216
- n = await m(n, y), u++;
1217
- } while (u < O);
1218
- }
1219
- return n;
1220
- };
1221
- e.options.persister ? e.fetchFn = () => e.options.persister?.(
1222
- h,
1223
- {
1224
- client: e.client,
1225
- queryKey: e.queryKey,
1226
- meta: e.options.meta,
1227
- signal: e.signal
1228
- },
1229
- s
1230
- ) : e.fetchFn = h;
1231
- }
1232
- };
1233
- }
1234
- function Rt(t, { pages: e, pageParams: s }) {
1235
- const r = e.length - 1;
1236
- return e.length > 0 ? t.getNextPageParam(
1237
- e[r],
1238
- e,
1239
- s[r],
1240
- s
1241
- ) : void 0;
1242
- }
1243
- function ye(t, { pages: e, pageParams: s }) {
1244
- return e.length > 0 ? t.getPreviousPageParam?.(e[0], e, s[0], s) : void 0;
1245
- }
1246
- var ve = class extends jt {
1247
- #e;
1248
- #t;
1249
- #s;
1250
- #i;
1251
- constructor(t) {
1252
- super(), this.#e = t.client, this.mutationId = t.mutationId, this.#s = t.mutationCache, this.#t = [], this.state = t.state || kt(), this.setOptions(t.options), this.scheduleGc();
1253
- }
1254
- setOptions(t) {
1255
- this.options = t, this.updateGcTime(this.options.gcTime);
1256
- }
1257
- get meta() {
1258
- return this.options.meta;
1259
- }
1260
- addObserver(t) {
1261
- this.#t.includes(t) || (this.#t.push(t), this.clearGcTimeout(), this.#s.notify({
1262
- type: "observerAdded",
1263
- mutation: this,
1264
- observer: t
1265
- }));
1266
- }
1267
- removeObserver(t) {
1268
- this.#t = this.#t.filter((e) => e !== t), this.scheduleGc(), this.#s.notify({
1269
- type: "observerRemoved",
1270
- mutation: this,
1271
- observer: t
1272
- });
1273
- }
1274
- optionalRemove() {
1275
- this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#s.remove(this));
1276
- }
1277
- continue() {
1278
- return this.#i?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
1279
- this.execute(this.state.variables);
1280
- }
1281
- async execute(t) {
1282
- const e = () => {
1283
- this.#r({ type: "continue" });
1284
- }, s = {
1285
- client: this.#e,
1286
- meta: this.options.meta,
1287
- mutationKey: this.options.mutationKey
1288
- };
1289
- this.#i = Dt({
1290
- fn: () => this.options.mutationFn ? this.options.mutationFn(t, s) : Promise.reject(new Error("No mutationFn found")),
1291
- onFail: (o, c) => {
1292
- this.#r({ type: "failed", failureCount: o, error: c });
1293
- },
1294
- onPause: () => {
1295
- this.#r({ type: "pause" });
1296
- },
1297
- onContinue: e,
1298
- retry: this.options.retry ?? 0,
1299
- retryDelay: this.options.retryDelay,
1300
- networkMode: this.options.networkMode,
1301
- canRun: () => this.#s.canRun(this)
1302
- });
1303
- const r = this.state.status === "pending", i = !this.#i.canStart();
1304
- try {
1305
- if (r)
1306
- e();
1307
- else {
1308
- this.#r({ type: "pending", variables: t, isPaused: i }), this.#s.config.onMutate && await this.#s.config.onMutate(
1309
- t,
1310
- this,
1311
- s
1312
- );
1313
- const c = await this.options.onMutate?.(
1314
- t,
1315
- s
1316
- );
1317
- c !== this.state.context && this.#r({
1318
- type: "pending",
1319
- context: c,
1320
- variables: t,
1321
- isPaused: i
1322
- });
1323
- }
1324
- const o = await this.#i.start();
1325
- return await this.#s.config.onSuccess?.(
1326
- o,
1327
- t,
1328
- this.state.context,
1329
- this,
1330
- s
1331
- ), await this.options.onSuccess?.(
1332
- o,
1333
- t,
1334
- this.state.context,
1335
- s
1336
- ), await this.#s.config.onSettled?.(
1337
- o,
1338
- null,
1339
- this.state.variables,
1340
- this.state.context,
1341
- this,
1342
- s
1343
- ), await this.options.onSettled?.(
1344
- o,
1345
- null,
1346
- t,
1347
- this.state.context,
1348
- s
1349
- ), this.#r({ type: "success", data: o }), o;
1350
- } catch (o) {
1351
- try {
1352
- await this.#s.config.onError?.(
1353
- o,
1354
- t,
1355
- this.state.context,
1356
- this,
1357
- s
1358
- );
1359
- } catch (c) {
1360
- Promise.reject(c);
1361
- }
1362
- try {
1363
- await this.options.onError?.(
1364
- o,
1365
- t,
1366
- this.state.context,
1367
- s
1368
- );
1369
- } catch (c) {
1370
- Promise.reject(c);
1371
- }
1372
- try {
1373
- await this.#s.config.onSettled?.(
1374
- void 0,
1375
- o,
1376
- this.state.variables,
1377
- this.state.context,
1378
- this,
1379
- s
1380
- );
1381
- } catch (c) {
1382
- Promise.reject(c);
1383
- }
1384
- try {
1385
- await this.options.onSettled?.(
1386
- void 0,
1387
- o,
1388
- t,
1389
- this.state.context,
1390
- s
1391
- );
1392
- } catch (c) {
1393
- Promise.reject(c);
1394
- }
1395
- throw this.#r({ type: "error", error: o }), o;
1396
- } finally {
1397
- this.#s.runNext(this);
1398
- }
1399
- }
1400
- #r(t) {
1401
- const e = (s) => {
1402
- switch (t.type) {
1403
- case "failed":
1404
- return {
1405
- ...s,
1406
- failureCount: t.failureCount,
1407
- failureReason: t.error
1408
- };
1409
- case "pause":
1410
- return {
1411
- ...s,
1412
- isPaused: !0
1413
- };
1414
- case "continue":
1415
- return {
1416
- ...s,
1417
- isPaused: !1
1418
- };
1419
- case "pending":
1420
- return {
1421
- ...s,
1422
- context: t.context,
1423
- data: void 0,
1424
- failureCount: 0,
1425
- failureReason: null,
1426
- error: null,
1427
- isPaused: t.isPaused,
1428
- status: "pending",
1429
- variables: t.variables,
1430
- submittedAt: Date.now()
1431
- };
1432
- case "success":
1433
- return {
1434
- ...s,
1435
- data: t.data,
1436
- failureCount: 0,
1437
- failureReason: null,
1438
- error: null,
1439
- status: "success",
1440
- isPaused: !1
1441
- };
1442
- case "error":
1443
- return {
1444
- ...s,
1445
- data: void 0,
1446
- error: t.error,
1447
- failureCount: s.failureCount + 1,
1448
- failureReason: t.error,
1449
- isPaused: !1,
1450
- status: "error"
1451
- };
1452
- }
1453
- };
1454
- this.state = e(this.state), M.batch(() => {
1455
- this.#t.forEach((s) => {
1456
- s.onMutationUpdate(t);
1457
- }), this.#s.notify({
1458
- mutation: this,
1459
- type: "updated",
1460
- action: t
1461
- });
1462
- });
1463
- }
1464
- };
1465
- function kt() {
1466
- return {
1467
- context: void 0,
1468
- data: void 0,
1469
- error: null,
1470
- failureCount: 0,
1471
- failureReason: null,
1472
- isPaused: !1,
1473
- status: "idle",
1474
- variables: void 0,
1475
- submittedAt: 0
1476
- };
1477
- }
1478
- var me = class extends x {
1479
- constructor(t = {}) {
1480
- super(), this.config = t, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
1481
- }
1482
- #e;
1483
- #t;
1484
- #s;
1485
- build(t, e, s) {
1486
- const r = new ve({
1487
- client: t,
1488
- mutationCache: this,
1489
- mutationId: ++this.#s,
1490
- options: t.defaultMutationOptions(e),
1491
- state: s
1492
- });
1493
- return this.add(r), r;
1494
- }
1495
- add(t) {
1496
- this.#e.add(t);
1497
- const e = K(t);
1498
- if (typeof e == "string") {
1499
- const s = this.#t.get(e);
1500
- s ? s.push(t) : this.#t.set(e, [t]);
1501
- }
1502
- this.notify({ type: "added", mutation: t });
1503
- }
1504
- remove(t) {
1505
- if (this.#e.delete(t)) {
1506
- const e = K(t);
1507
- if (typeof e == "string") {
1508
- const s = this.#t.get(e);
1509
- if (s)
1510
- if (s.length > 1) {
1511
- const r = s.indexOf(t);
1512
- r !== -1 && s.splice(r, 1);
1513
- } else s[0] === t && this.#t.delete(e);
1514
- }
1515
- }
1516
- this.notify({ type: "removed", mutation: t });
1517
- }
1518
- canRun(t) {
1519
- const e = K(t);
1520
- if (typeof e == "string") {
1521
- const r = this.#t.get(e)?.find(
1522
- (i) => i.state.status === "pending"
1523
- );
1524
- return !r || r === t;
1525
- } else
1526
- return !0;
1527
- }
1528
- runNext(t) {
1529
- const e = K(t);
1530
- return typeof e == "string" ? this.#t.get(e)?.find((r) => r !== t && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
1531
- }
1532
- clear() {
1533
- M.batch(() => {
1534
- this.#e.forEach((t) => {
1535
- this.notify({ type: "removed", mutation: t });
1536
- }), this.#e.clear(), this.#t.clear();
1537
- });
1538
- }
1539
- getAll() {
1540
- return Array.from(this.#e);
1541
- }
1542
- find(t) {
1543
- const e = { exact: !0, ...t };
1544
- return this.getAll().find(
1545
- (s) => yt(e, s)
1546
- );
1547
- }
1548
- findAll(t = {}) {
1549
- return this.getAll().filter((e) => yt(t, e));
1550
- }
1551
- notify(t) {
1552
- M.batch(() => {
1553
- this.listeners.forEach((e) => {
1554
- e(t);
1555
- });
1556
- });
1557
- }
1558
- resumePausedMutations() {
1559
- const t = this.getAll().filter((e) => e.state.isPaused);
1560
- return M.batch(
1561
- () => Promise.all(
1562
- t.map((e) => e.continue().catch(P))
1563
- )
1564
- );
1565
- }
1566
- };
1567
- function K(t) {
1568
- return t.options.scope?.id;
1569
- }
1570
- var ge = class extends x {
1571
- #e;
1572
- #t = void 0;
1573
- #s;
1574
- #i;
1575
- constructor(t, e) {
1576
- super(), this.#e = t, this.setOptions(e), this.bindMethods(), this.#r();
1577
- }
1578
- bindMethods() {
1579
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
1580
- }
1581
- setOptions(t) {
1582
- const e = this.options;
1583
- this.options = this.#e.defaultMutationOptions(t), q(this.options, e) || this.#e.getMutationCache().notify({
1584
- type: "observerOptionsUpdated",
1585
- mutation: this.#s,
1586
- observer: this
1587
- }), e?.mutationKey && this.options.mutationKey && Q(e.mutationKey) !== Q(this.options.mutationKey) ? this.reset() : this.#s?.state.status === "pending" && this.#s.setOptions(this.options);
1588
- }
1589
- onUnsubscribe() {
1590
- this.hasListeners() || this.#s?.removeObserver(this);
1591
- }
1592
- onMutationUpdate(t) {
1593
- this.#r(), this.#n(t);
1594
- }
1595
- getCurrentResult() {
1596
- return this.#t;
1597
- }
1598
- reset() {
1599
- this.#s?.removeObserver(this), this.#s = void 0, this.#r(), this.#n();
1600
- }
1601
- mutate(t, e) {
1602
- return this.#i = e, this.#s?.removeObserver(this), this.#s = this.#e.getMutationCache().build(this.#e, this.options), this.#s.addObserver(this), this.#s.execute(t);
1603
- }
1604
- #r() {
1605
- const t = this.#s?.state ?? kt();
1606
- this.#t = {
1607
- ...t,
1608
- isPending: t.status === "pending",
1609
- isSuccess: t.status === "success",
1610
- isError: t.status === "error",
1611
- isIdle: t.status === "idle",
1612
- mutate: this.mutate,
1613
- reset: this.reset
1614
- };
1615
- }
1616
- #n(t) {
1617
- M.batch(() => {
1618
- if (this.#i && this.hasListeners()) {
1619
- const e = this.#t.variables, s = this.#t.context, r = {
1620
- client: this.#e,
1621
- meta: this.options.meta,
1622
- mutationKey: this.options.mutationKey
1623
- };
1624
- if (t?.type === "success") {
1625
- try {
1626
- this.#i.onSuccess?.(
1627
- t.data,
1628
- e,
1629
- s,
1630
- r
1631
- );
1632
- } catch (i) {
1633
- Promise.reject(i);
1634
- }
1635
- try {
1636
- this.#i.onSettled?.(
1637
- t.data,
1638
- null,
1639
- e,
1640
- s,
1641
- r
1642
- );
1643
- } catch (i) {
1644
- Promise.reject(i);
1645
- }
1646
- } else if (t?.type === "error") {
1647
- try {
1648
- this.#i.onError?.(
1649
- t.error,
1650
- e,
1651
- s,
1652
- r
1653
- );
1654
- } catch (i) {
1655
- Promise.reject(i);
1656
- }
1657
- try {
1658
- this.#i.onSettled?.(
1659
- void 0,
1660
- t.error,
1661
- e,
1662
- s,
1663
- r
1664
- );
1665
- } catch (i) {
1666
- Promise.reject(i);
1667
- }
1668
- }
1669
- }
1670
- this.listeners.forEach((e) => {
1671
- e(this.#t);
1672
- });
1673
- });
1674
- }
1675
- };
1676
- function Et(t, e) {
1677
- const s = new Set(e);
1678
- return t.filter((r) => !s.has(r));
1679
- }
1680
- function be(t, e, s) {
1681
- const r = t.slice(0);
1682
- return r[e] = s, r;
1683
- }
1684
- var Se = class extends x {
1685
- #e;
1686
- #t;
1687
- #s;
1688
- #i;
1689
- #r;
1690
- #n;
1691
- #a;
1692
- #o;
1693
- #p;
1694
- #l = [];
1695
- constructor(t, e, s) {
1696
- super(), this.#e = t, this.#i = s, this.#s = [], this.#r = [], this.#t = [], this.setQueries(e);
1697
- }
1698
- onSubscribe() {
1699
- this.listeners.size === 1 && this.#r.forEach((t) => {
1700
- t.subscribe((e) => {
1701
- this.#u(t, e);
1702
- });
1703
- });
1704
- }
1705
- onUnsubscribe() {
1706
- this.listeners.size || this.destroy();
1707
- }
1708
- destroy() {
1709
- this.listeners = /* @__PURE__ */ new Set(), this.#r.forEach((t) => {
1710
- t.destroy();
1711
- });
1712
- }
1713
- setQueries(t, e) {
1714
- if (this.#s = t, this.#i = e, process.env.NODE_ENV !== "production") {
1715
- const s = t.map(
1716
- (r) => this.#e.defaultQueryOptions(r).queryHash
1717
- );
1718
- new Set(s).size !== s.length && console.warn(
1719
- "[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior."
1720
- );
1721
- }
1722
- M.batch(() => {
1723
- const s = this.#r, r = this.#h(this.#s);
1724
- r.forEach(
1725
- (a) => a.observer.setOptions(a.defaultedQueryOptions)
1726
- );
1727
- const i = r.map((a) => a.observer), o = i.map(
1728
- (a) => a.getCurrentResult()
1729
- ), c = s.length !== i.length, n = i.some(
1730
- (a, l) => a !== s[l]
1731
- ), u = c || n, h = u ? !0 : o.some((a, l) => {
1732
- const f = this.#t[l];
1733
- return !f || !q(a, f);
1734
- });
1735
- !u && !h || (u && (this.#l = r, this.#r = i), this.#t = o, this.hasListeners() && (u && (Et(s, i).forEach((a) => {
1736
- a.destroy();
1737
- }), Et(i, s).forEach((a) => {
1738
- a.subscribe((l) => {
1739
- this.#u(a, l);
1740
- });
1741
- })), this.#d()));
1742
- });
1743
- }
1744
- getCurrentResult() {
1745
- return this.#t;
1746
- }
1747
- getQueries() {
1748
- return this.#r.map((t) => t.getCurrentQuery());
1749
- }
1750
- getObservers() {
1751
- return this.#r;
1752
- }
1753
- getOptimisticResult(t, e) {
1754
- const s = this.#h(t), r = s.map(
1755
- (o) => o.observer.getOptimisticResult(o.defaultedQueryOptions)
1756
- ), i = s.map(
1757
- (o) => o.defaultedQueryOptions.queryHash
1758
- );
1759
- return [
1760
- r,
1761
- (o) => this.#c(o ?? r, e, i),
1762
- () => this.#f(r, s)
1763
- ];
1764
- }
1765
- #f(t, e) {
1766
- return e.map((s, r) => {
1767
- const i = t[r];
1768
- return s.defaultedQueryOptions.notifyOnChangeProps ? i : s.observer.trackResult(i, (o) => {
1769
- e.forEach((c) => {
1770
- c.observer.trackProp(o);
1771
- });
1772
- });
1773
- });
1774
- }
1775
- #c(t, e, s) {
1776
- if (e) {
1777
- const r = this.#p, i = s !== void 0 && r !== void 0 && (r.length !== s.length || s.some((o, c) => o !== r[c]));
1778
- return (!this.#n || this.#t !== this.#o || i || e !== this.#a) && (this.#a = e, this.#o = this.#t, s !== void 0 && (this.#p = s), this.#n = B(
1779
- this.#n,
1780
- e(t)
1781
- )), this.#n;
1782
- }
1783
- return t;
1784
- }
1785
- #h(t) {
1786
- const e = /* @__PURE__ */ new Map();
1787
- this.#r.forEach((r) => {
1788
- const i = r.options.queryHash;
1789
- if (!i) return;
1790
- const o = e.get(i);
1791
- o ? o.push(r) : e.set(i, [r]);
1792
- });
1793
- const s = [];
1794
- return t.forEach((r) => {
1795
- const i = this.#e.defaultQueryOptions(r), c = e.get(i.queryHash)?.shift() ?? new ct(this.#e, i);
1796
- s.push({
1797
- defaultedQueryOptions: i,
1798
- observer: c
1799
- });
1800
- }), s;
1801
- }
1802
- #u(t, e) {
1803
- const s = this.#r.indexOf(t);
1804
- s !== -1 && (this.#t = be(this.#t, s, e), this.#d());
1805
- }
1806
- #d() {
1807
- if (this.hasListeners()) {
1808
- const t = this.#n, e = this.#f(this.#t, this.#l), s = this.#c(e, this.#i?.combine);
1809
- t !== s && M.batch(() => {
1810
- this.listeners.forEach((r) => {
1811
- r(this.#t);
1812
- });
1813
- });
1814
- }
1815
- }
1816
- }, Oe = class extends x {
1817
- constructor(t = {}) {
1818
- super(), this.config = t, this.#e = /* @__PURE__ */ new Map();
1819
- }
1820
- #e;
1821
- build(t, e, s) {
1822
- const r = e.queryKey, i = e.queryHash ?? ot(r, e);
1823
- let o = this.get(i);
1824
- return o || (o = new fe({
1825
- client: t,
1826
- queryKey: r,
1827
- queryHash: i,
1828
- options: t.defaultQueryOptions(e),
1829
- state: s,
1830
- defaultOptions: t.getQueryDefaults(r)
1831
- }), this.add(o)), o;
1832
- }
1833
- add(t) {
1834
- this.#e.has(t.queryHash) || (this.#e.set(t.queryHash, t), this.notify({
1835
- type: "added",
1836
- query: t
1837
- }));
1838
- }
1839
- remove(t) {
1840
- const e = this.#e.get(t.queryHash);
1841
- e && (t.destroy(), e === t && this.#e.delete(t.queryHash), this.notify({ type: "removed", query: t }));
1842
- }
1843
- clear() {
1844
- M.batch(() => {
1845
- this.getAll().forEach((t) => {
1846
- this.remove(t);
1847
- });
1848
- });
1849
- }
1850
- get(t) {
1851
- return this.#e.get(t);
1852
- }
1853
- getAll() {
1854
- return [...this.#e.values()];
1855
- }
1856
- find(t) {
1857
- const e = { exact: !0, ...t };
1858
- return this.getAll().find(
1859
- (s) => pt(e, s)
1860
- );
1861
- }
1862
- findAll(t = {}) {
1863
- const e = this.getAll();
1864
- return Object.keys(t).length > 0 ? e.filter((s) => pt(t, s)) : e;
1865
- }
1866
- notify(t) {
1867
- M.batch(() => {
1868
- this.listeners.forEach((e) => {
1869
- e(t);
1870
- });
1871
- });
1872
- }
1873
- onFocus() {
1874
- M.batch(() => {
1875
- this.getAll().forEach((t) => {
1876
- t.onFocus();
1877
- });
1878
- });
1879
- }
1880
- onOnline() {
1881
- M.batch(() => {
1882
- this.getAll().forEach((t) => {
1883
- t.onOnline();
1884
- });
1885
- });
1886
- }
1887
- }, Le = class {
1888
- #e;
1889
- #t;
1890
- #s;
1891
- #i;
1892
- #r;
1893
- #n;
1894
- #a;
1895
- #o;
1896
- constructor(t = {}) {
1897
- this.#e = t.queryCache || new Oe(), this.#t = t.mutationCache || new me(), this.#s = t.defaultOptions || {}, this.#i = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#n = 0;
1898
- }
1899
- mount() {
1900
- this.#n++, this.#n === 1 && (this.#a = ut.subscribe(async (t) => {
1901
- t && (await this.resumePausedMutations(), this.#e.onFocus());
1902
- }), this.#o = J.subscribe(async (t) => {
1903
- t && (await this.resumePausedMutations(), this.#e.onOnline());
1904
- }));
1905
- }
1906
- unmount() {
1907
- this.#n--, this.#n === 0 && (this.#a?.(), this.#a = void 0, this.#o?.(), this.#o = void 0);
1908
- }
1909
- isFetching(t) {
1910
- return this.#e.findAll({ ...t, fetchStatus: "fetching" }).length;
1911
- }
1912
- isMutating(t) {
1913
- return this.#t.findAll({ ...t, status: "pending" }).length;
1914
- }
1915
- /**
1916
- * Imperative (non-reactive) way to retrieve data for a QueryKey.
1917
- * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
1918
- *
1919
- * Hint: Do not use this function inside a component, because it won't receive updates.
1920
- * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
1921
- */
1922
- getQueryData(t) {
1923
- const e = this.defaultQueryOptions({ queryKey: t });
1924
- return this.#e.get(e.queryHash)?.state.data;
1925
- }
1926
- ensureQueryData(t) {
1927
- const e = this.defaultQueryOptions(t), s = this.#e.build(this, e), r = s.state.data;
1928
- return r === void 0 ? this.fetchQuery(t) : (t.revalidateIfStale && s.isStaleByTime(T(e.staleTime, s)) && this.prefetchQuery(e), Promise.resolve(r));
1929
- }
1930
- getQueriesData(t) {
1931
- return this.#e.findAll(t).map(({ queryKey: e, state: s }) => {
1932
- const r = s.data;
1933
- return [e, r];
1934
- });
1935
- }
1936
- setQueryData(t, e, s) {
1937
- const r = this.defaultQueryOptions({ queryKey: t }), o = this.#e.get(
1938
- r.queryHash
1939
- )?.state.data, c = ee(e, o);
1940
- if (c !== void 0)
1941
- return this.#e.build(this, r).setData(c, { ...s, manual: !0 });
1942
- }
1943
- setQueriesData(t, e, s) {
1944
- return M.batch(
1945
- () => this.#e.findAll(t).map(({ queryKey: r }) => [
1946
- r,
1947
- this.setQueryData(r, e, s)
1948
- ])
1949
- );
1950
- }
1951
- getQueryState(t) {
1952
- const e = this.defaultQueryOptions({ queryKey: t });
1953
- return this.#e.get(
1954
- e.queryHash
1955
- )?.state;
1956
- }
1957
- removeQueries(t) {
1958
- const e = this.#e;
1959
- M.batch(() => {
1960
- e.findAll(t).forEach((s) => {
1961
- e.remove(s);
1962
- });
1963
- });
1964
- }
1965
- resetQueries(t, e) {
1966
- const s = this.#e;
1967
- return M.batch(() => (s.findAll(t).forEach((r) => {
1968
- r.reset();
1969
- }), this.refetchQueries(
1970
- {
1971
- type: "active",
1972
- ...t
1973
- },
1974
- e
1975
- )));
1976
- }
1977
- cancelQueries(t, e = {}) {
1978
- const s = { revert: !0, ...e }, r = M.batch(
1979
- () => this.#e.findAll(t).map((i) => i.cancel(s))
1980
- );
1981
- return Promise.all(r).then(P).catch(P);
1982
- }
1983
- invalidateQueries(t, e = {}) {
1984
- return M.batch(() => (this.#e.findAll(t).forEach((s) => {
1985
- s.invalidate();
1986
- }), t?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
1987
- {
1988
- ...t,
1989
- type: t?.refetchType ?? t?.type ?? "active"
1990
- },
1991
- e
1992
- )));
1993
- }
1994
- refetchQueries(t, e = {}) {
1995
- const s = {
1996
- ...e,
1997
- cancelRefetch: e.cancelRefetch ?? !0
1998
- }, r = M.batch(
1999
- () => this.#e.findAll(t).filter((i) => !i.isDisabled() && !i.isStatic()).map((i) => {
2000
- let o = i.fetch(void 0, s);
2001
- return s.throwOnError || (o = o.catch(P)), i.state.fetchStatus === "paused" ? Promise.resolve() : o;
2002
- })
2003
- );
2004
- return Promise.all(r).then(P);
2005
- }
2006
- fetchQuery(t) {
2007
- const e = this.defaultQueryOptions(t);
2008
- e.retry === void 0 && (e.retry = !1);
2009
- const s = this.#e.build(this, e);
2010
- return s.isStaleByTime(
2011
- T(e.staleTime, s)
2012
- ) ? s.fetch(e) : Promise.resolve(s.state.data);
2013
- }
2014
- prefetchQuery(t) {
2015
- return this.fetchQuery(t).then(P).catch(P);
2016
- }
2017
- fetchInfiniteQuery(t) {
2018
- return t.behavior = wt(t.pages), this.fetchQuery(t);
2019
- }
2020
- prefetchInfiniteQuery(t) {
2021
- return this.fetchInfiniteQuery(t).then(P).catch(P);
2022
- }
2023
- ensureInfiniteQueryData(t) {
2024
- return t.behavior = wt(t.pages), this.ensureQueryData(t);
2025
- }
2026
- resumePausedMutations() {
2027
- return J.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
2028
- }
2029
- getQueryCache() {
2030
- return this.#e;
2031
- }
2032
- getMutationCache() {
2033
- return this.#t;
2034
- }
2035
- getDefaultOptions() {
2036
- return this.#s;
2037
- }
2038
- setDefaultOptions(t) {
2039
- this.#s = t;
2040
- }
2041
- setQueryDefaults(t, e) {
2042
- this.#i.set(Q(t), {
2043
- queryKey: t,
2044
- defaultOptions: e
2045
- });
2046
- }
2047
- getQueryDefaults(t) {
2048
- const e = [...this.#i.values()], s = {};
2049
- return e.forEach((r) => {
2050
- j(t, r.queryKey) && Object.assign(s, r.defaultOptions);
2051
- }), s;
2052
- }
2053
- setMutationDefaults(t, e) {
2054
- this.#r.set(Q(t), {
2055
- mutationKey: t,
2056
- defaultOptions: e
2057
- });
2058
- }
2059
- getMutationDefaults(t) {
2060
- const e = [...this.#r.values()], s = {};
2061
- return e.forEach((r) => {
2062
- j(t, r.mutationKey) && Object.assign(s, r.defaultOptions);
2063
- }), s;
2064
- }
2065
- defaultQueryOptions(t) {
2066
- if (t._defaulted)
2067
- return t;
2068
- const e = {
2069
- ...this.#s.queries,
2070
- ...this.getQueryDefaults(t.queryKey),
2071
- ...t,
2072
- _defaulted: !0
2073
- };
2074
- return e.queryHash || (e.queryHash = ot(
2075
- e.queryKey,
2076
- e
2077
- )), e.refetchOnReconnect === void 0 && (e.refetchOnReconnect = e.networkMode !== "always"), e.throwOnError === void 0 && (e.throwOnError = !!e.suspense), !e.networkMode && e.persister && (e.networkMode = "offlineFirst"), e.queryFn === G && (e.enabled = !1), e;
2078
- }
2079
- defaultMutationOptions(t) {
2080
- return t?._defaulted ? t : {
2081
- ...this.#s.mutations,
2082
- ...t?.mutationKey && this.getMutationDefaults(t.mutationKey),
2083
- ...t,
2084
- _defaulted: !0
2085
- };
2086
- }
2087
- clear() {
2088
- this.#e.clear(), this.#t.clear();
2089
- }
2090
- }, Ut = C.createContext(
2091
- void 0
2092
- ), lt = (t) => {
2093
- const e = C.useContext(Ut);
2094
- if (!e)
2095
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
2096
- return e;
2097
- }, He = ({
2098
- client: t,
2099
- children: e
2100
- }) => (C.useEffect(() => (t.mount(), () => {
2101
- t.unmount();
2102
- }), [t]), /* @__PURE__ */ Gt(Ut.Provider, { value: t, children: e })), we = C.createContext(!1), Nt = () => C.useContext(we);
2103
- function Re() {
2104
- let t = !1;
2105
- return {
2106
- clearReset: () => {
2107
- t = !1;
2108
- },
2109
- reset: () => {
2110
- t = !0;
2111
- },
2112
- isReset: () => t
2113
- };
2114
- }
2115
- var Ee = C.createContext(Re()), Lt = () => C.useContext(Ee), Ht = (t, e, s) => {
2116
- const r = s?.state.error && typeof t.throwOnError == "function" ? at(t.throwOnError, [s.state.error, s]) : t.throwOnError;
2117
- (t.suspense || t.experimental_prefetchInRender || r) && (e.isReset() || (t.retryOnMount = !1));
2118
- }, Kt = (t) => {
2119
- C.useEffect(() => {
2120
- t.clearReset();
2121
- }, [t]);
2122
- }, zt = ({
2123
- result: t,
2124
- errorResetBoundary: e,
2125
- throwOnError: s,
2126
- query: r,
2127
- suspense: i
2128
- }) => t.isError && !e.isReset() && !t.isFetching && r && (i && t.data === void 0 || at(s, [t.error, r])), Bt = (t) => {
2129
- if (t.suspense) {
2130
- const s = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), r = t.staleTime;
2131
- t.staleTime = typeof r == "function" ? (...i) => s(r(...i)) : s(r), typeof t.gcTime == "number" && (t.gcTime = Math.max(
2132
- t.gcTime,
2133
- 1e3
2134
- ));
2135
- }
2136
- }, Ce = (t, e) => t.isLoading && t.isFetching && !e, rt = (t, e) => t?.suspense && e.isPending, it = (t, e, s) => e.fetchOptimistic(t).catch(() => {
2137
- s.clearReset();
2138
- });
2139
- function Ke({
2140
- queries: t,
2141
- ...e
2142
- }, s) {
2143
- const r = lt(), i = Nt(), o = Lt(), c = C.useMemo(
2144
- () => t.map((y) => {
2145
- const v = r.defaultQueryOptions(
2146
- y
2147
- );
2148
- return v._optimisticResults = i ? "isRestoring" : "optimistic", v;
2149
- }),
2150
- [t, r, i]
2151
- );
2152
- c.forEach((y) => {
2153
- Bt(y);
2154
- const v = r.getQueryCache().get(y.queryHash);
2155
- Ht(y, o, v);
2156
- }), Kt(o);
2157
- const [n] = C.useState(
2158
- () => new Se(
2159
- r,
2160
- c,
2161
- e
2162
- )
2163
- ), [u, h, a] = n.getOptimisticResult(
2164
- c,
2165
- e.combine
2166
- ), l = !i && e.subscribed !== !1;
2167
- C.useSyncExternalStore(
2168
- C.useCallback(
2169
- (y) => l ? n.subscribe(M.batchCalls(y)) : P,
2170
- [n, l]
2171
- ),
2172
- () => n.getCurrentResult(),
2173
- () => n.getCurrentResult()
2174
- ), C.useEffect(() => {
2175
- n.setQueries(
2176
- c,
2177
- e
2178
- );
2179
- }, [c, e, n]);
2180
- const m = u.some(
2181
- (y, v) => rt(c[v], y)
2182
- ) ? u.flatMap((y, v) => {
2183
- const p = c[v];
2184
- if (p && rt(p, y)) {
2185
- const w = new ct(r, p);
2186
- return it(p, w, o);
2187
- }
2188
- return [];
2189
- }) : [];
2190
- if (m.length > 0)
2191
- throw Promise.all(m);
2192
- const O = u.find(
2193
- (y, v) => {
2194
- const p = c[v];
2195
- return p && zt({
2196
- result: y,
2197
- errorResetBoundary: o,
2198
- throwOnError: p.throwOnError,
2199
- query: r.getQueryCache().get(p.queryHash),
2200
- suspense: p.suspense
2201
- });
2202
- }
2203
- );
2204
- if (O?.error)
2205
- throw O.error;
2206
- return h(a());
2207
- }
2208
- function Me(t, e, s) {
2209
- if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
2210
- throw new Error(
2211
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
2212
- );
2213
- const r = Nt(), i = Lt(), o = lt(), c = o.defaultQueryOptions(t);
2214
- o.getDefaultOptions().queries?._experimental_beforeQuery?.(
2215
- c
2216
- );
2217
- const n = o.getQueryCache().get(c.queryHash);
2218
- process.env.NODE_ENV !== "production" && (c.queryFn || console.error(
2219
- `[${c.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
2220
- )), c._optimisticResults = r ? "isRestoring" : "optimistic", Bt(c), Ht(c, i, n), Kt(i);
2221
- const u = !o.getQueryCache().get(c.queryHash), [h] = C.useState(
2222
- () => new e(
2223
- o,
2224
- c
2225
- )
2226
- ), a = h.getOptimisticResult(c), l = !r && t.subscribed !== !1;
2227
- if (C.useSyncExternalStore(
2228
- C.useCallback(
2229
- (f) => {
2230
- const m = l ? h.subscribe(M.batchCalls(f)) : P;
2231
- return h.updateResult(), m;
2232
- },
2233
- [h, l]
2234
- ),
2235
- () => h.getCurrentResult(),
2236
- () => h.getCurrentResult()
2237
- ), C.useEffect(() => {
2238
- h.setOptions(c);
2239
- }, [c, h]), rt(c, a))
2240
- throw it(c, h, i);
2241
- if (zt({
2242
- result: a,
2243
- errorResetBoundary: i,
2244
- throwOnError: c.throwOnError,
2245
- query: n,
2246
- suspense: c.suspense
2247
- }))
2248
- throw a.error;
2249
- return o.getDefaultOptions().queries?._experimental_afterQuery?.(
2250
- c,
2251
- a
2252
- ), c.experimental_prefetchInRender && !I && Ce(a, r) && (u ? (
2253
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
2254
- it(c, h, i)
2255
- ) : (
2256
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
2257
- n?.promise
2258
- ))?.catch(P).finally(() => {
2259
- h.updateResult();
2260
- }), c.notifyOnChangeProps ? a : h.trackResult(a);
2261
- }
2262
- function ze(t, e) {
2263
- return Me(t, ct);
2264
- }
2265
- function Be(t, e) {
2266
- const s = lt(), [r] = C.useState(
2267
- () => new ge(
2268
- s,
2269
- t
2270
- )
2271
- );
2272
- C.useEffect(() => {
2273
- r.setOptions(t);
2274
- }, [r, t]);
2275
- const i = C.useSyncExternalStore(
2276
- C.useCallback(
2277
- (c) => r.subscribe(M.batchCalls(c)),
2278
- [r]
2279
- ),
2280
- () => r.getCurrentResult(),
2281
- () => r.getCurrentResult()
2282
- ), o = C.useCallback(
2283
- (c, n) => {
2284
- r.mutate(c, n).catch(P);
2285
- },
2286
- [r]
2287
- );
2288
- if (i.error && at(r.options.throwOnError, [i.error]))
2289
- throw i.error;
2290
- return { ...i, mutate: o, mutateAsync: i.mutate };
2291
- }
2292
- const Ct = (t) => {
2293
- let e;
2294
- const s = /* @__PURE__ */ new Set(), r = (h, a) => {
2295
- const l = typeof h == "function" ? h(e) : h;
2296
- if (!Object.is(l, e)) {
2297
- const f = e;
2298
- e = a ?? (typeof l != "object" || l === null) ? l : Object.assign({}, e, l), s.forEach((m) => m(e, f));
2299
- }
2300
- }, i = () => e, n = { setState: r, getState: i, getInitialState: () => u, subscribe: (h) => (s.add(h), () => s.delete(h)) }, u = e = t(r, i, n);
2301
- return n;
2302
- }, Ge = ((t) => t ? Ct(t) : Ct), Pe = (t) => t;
2303
- function Je(t, e = Pe) {
2304
- const s = D.useSyncExternalStore(
2305
- t.subscribe,
2306
- D.useCallback(() => e(t.getState()), [t, e]),
2307
- D.useCallback(() => e(t.getInitialState()), [t, e])
2308
- );
2309
- return D.useDebugValue(s), s;
2310
- }
2311
- const Mt = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 }, Pt = (t) => !!t.dispatchFromDevtools && typeof t.dispatch == "function", k = /* @__PURE__ */ new Map(), z = (t) => {
2312
- const e = k.get(t);
2313
- return e ? Object.fromEntries(
2314
- Object.entries(e.stores).map(([s, r]) => [s, r.getState()])
2315
- ) : {};
2316
- }, Fe = (t, e, s) => {
2317
- if (t === void 0)
2318
- return {
2319
- type: "untracked",
2320
- connection: e.connect(s)
2321
- };
2322
- const r = k.get(s.name);
2323
- if (r)
2324
- return { type: "tracked", store: t, ...r };
2325
- const i = {
2326
- connection: e.connect(s),
2327
- stores: {}
2328
- };
2329
- return k.set(s.name, i), { type: "tracked", store: t, ...i };
2330
- }, Te = (t, e) => {
2331
- if (e === void 0) return;
2332
- const s = k.get(t);
2333
- s && (delete s.stores[e], Object.keys(s.stores).length === 0 && k.delete(t));
2334
- }, _e = (t) => {
2335
- var e, s;
2336
- if (!t) return;
2337
- const r = t.split(`
2338
- `), i = r.findIndex(
2339
- (c) => c.includes("api.setState")
2340
- );
2341
- if (i < 0) return;
2342
- const o = ((e = r[i + 1]) == null ? void 0 : e.trim()) || "";
2343
- return (s = /.+ (.+) .+/.exec(o)) == null ? void 0 : s[1];
2344
- }, Ie = (t, e = {}) => (s, r, i) => {
2345
- const { enabled: o, anonymousActionType: c, store: n, ...u } = e;
2346
- let h;
2347
- try {
2348
- h = (o ?? (Mt ? "production" : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
2349
- } catch {
2350
- }
2351
- if (!h)
2352
- return t(s, r, i);
2353
- const { connection: a, ...l } = Fe(n, h, u);
2354
- let f = !0;
2355
- i.setState = ((y, v, p) => {
2356
- const w = s(y, v);
2357
- if (!f) return w;
2358
- const E = p === void 0 ? {
2359
- type: c || _e(new Error().stack) || "anonymous"
2360
- } : typeof p == "string" ? { type: p } : p;
2361
- return n === void 0 ? (a?.send(E, r()), w) : (a?.send(
2362
- {
2363
- ...E,
2364
- type: `${n}/${E.type}`
2365
- },
2366
- {
2367
- ...z(u.name),
2368
- [n]: i.getState()
2369
- }
2370
- ), w);
2371
- }), i.devtools = {
2372
- cleanup: () => {
2373
- a && typeof a.unsubscribe == "function" && a.unsubscribe(), Te(u.name, n);
2374
- }
2375
- };
2376
- const m = (...y) => {
2377
- const v = f;
2378
- f = !1, s(...y), f = v;
2379
- }, O = t(i.setState, r, i);
2380
- if (l.type === "untracked" ? a?.init(O) : (l.stores[l.store] = i, a?.init(
2381
- Object.fromEntries(
2382
- Object.entries(l.stores).map(([y, v]) => [
2383
- y,
2384
- y === l.store ? O : v.getState()
2385
- ])
2386
- )
2387
- )), Pt(i)) {
2388
- let y = !1;
2389
- const v = i.dispatch;
2390
- i.dispatch = (...p) => {
2391
- (Mt ? "production" : void 0) !== "production" && p[0].type === "__setState" && !y && (console.warn(
2392
- '[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'
2393
- ), y = !0), v(...p);
2394
- };
2395
- }
2396
- return a.subscribe((y) => {
2397
- var v;
2398
- switch (y.type) {
2399
- case "ACTION":
2400
- if (typeof y.payload != "string") {
2401
- console.error(
2402
- "[zustand devtools middleware] Unsupported action format"
2403
- );
2404
- return;
2405
- }
2406
- return W(
2407
- y.payload,
2408
- (p) => {
2409
- if (p.type === "__setState") {
2410
- if (n === void 0) {
2411
- m(p.state);
2412
- return;
2413
- }
2414
- Object.keys(p.state).length !== 1 && console.error(
2415
- `
2416
- [zustand devtools middleware] Unsupported __setState action format.
2417
- When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
2418
- and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
2419
- `
2420
- );
2421
- const w = p.state[n];
2422
- if (w == null)
2423
- return;
2424
- JSON.stringify(i.getState()) !== JSON.stringify(w) && m(w);
2425
- return;
2426
- }
2427
- Pt(i) && i.dispatch(p);
2428
- }
2429
- );
2430
- case "DISPATCH":
2431
- switch (y.payload.type) {
2432
- case "RESET":
2433
- return m(O), n === void 0 ? a?.init(i.getState()) : a?.init(z(u.name));
2434
- case "COMMIT":
2435
- if (n === void 0) {
2436
- a?.init(i.getState());
2437
- return;
2438
- }
2439
- return a?.init(z(u.name));
2440
- case "ROLLBACK":
2441
- return W(y.state, (p) => {
2442
- if (n === void 0) {
2443
- m(p), a?.init(i.getState());
2444
- return;
2445
- }
2446
- m(p[n]), a?.init(z(u.name));
2447
- });
2448
- case "JUMP_TO_STATE":
2449
- case "JUMP_TO_ACTION":
2450
- return W(y.state, (p) => {
2451
- if (n === void 0) {
2452
- m(p);
2453
- return;
2454
- }
2455
- JSON.stringify(i.getState()) !== JSON.stringify(p[n]) && m(p[n]);
2456
- });
2457
- case "IMPORT_STATE": {
2458
- const { nextLiftedState: p } = y.payload, w = (v = p.computedStates.slice(-1)[0]) == null ? void 0 : v.state;
2459
- if (!w) return;
2460
- m(n === void 0 ? w : w[n]), a?.send(
2461
- null,
2462
- // FIXME no-any
2463
- p
2464
- );
2465
- return;
2466
- }
2467
- case "PAUSE_RECORDING":
2468
- return f = !f;
2469
- }
2470
- return;
2471
- }
2472
- }), O;
2473
- }, We = Ie, W = (t, e) => {
2474
- let s;
2475
- try {
2476
- s = JSON.parse(t);
2477
- } catch (r) {
2478
- console.error(
2479
- "[zustand devtools middleware] Could not parse the received json",
2480
- r
2481
- );
2482
- }
2483
- s !== void 0 && e(s);
2484
- }, Qe = (t) => (e, s, r) => {
2485
- const i = r.subscribe;
2486
- return r.subscribe = ((c, n, u) => {
2487
- let h = c;
2488
- if (n) {
2489
- const a = u?.equalityFn || Object.is;
2490
- let l = c(r.getState());
2491
- h = (f) => {
2492
- const m = c(f);
2493
- if (!a(l, m)) {
2494
- const O = l;
2495
- n(l = m, O);
2496
- }
2497
- }, u?.fireImmediately && n(l, l);
2498
- }
2499
- return i(h);
2500
- }), t(e, s, r);
2501
- }, $e = Qe;
2502
- function xe(t, e) {
2503
- let s;
2504
- try {
2505
- s = t();
2506
- } catch {
2507
- return;
2508
- }
2509
- return {
2510
- getItem: (i) => {
2511
- var o;
2512
- const c = (u) => u === null ? null : JSON.parse(u, void 0), n = (o = s.getItem(i)) != null ? o : null;
2513
- return n instanceof Promise ? n.then(c) : c(n);
2514
- },
2515
- setItem: (i, o) => s.setItem(i, JSON.stringify(o, void 0)),
2516
- removeItem: (i) => s.removeItem(i)
2517
- };
2518
- }
2519
- const nt = (t) => (e) => {
2520
- try {
2521
- const s = t(e);
2522
- return s instanceof Promise ? s : {
2523
- then(r) {
2524
- return nt(r)(s);
2525
- },
2526
- catch(r) {
2527
- return this;
2528
- }
2529
- };
2530
- } catch (s) {
2531
- return {
2532
- then(r) {
2533
- return this;
2534
- },
2535
- catch(r) {
2536
- return nt(r)(s);
2537
- }
2538
- };
2539
- }
2540
- }, Ae = (t, e) => (s, r, i) => {
2541
- let o = {
2542
- storage: xe(() => window.localStorage),
2543
- partialize: (v) => v,
2544
- version: 0,
2545
- merge: (v, p) => ({
2546
- ...p,
2547
- ...v
2548
- }),
2549
- ...e
2550
- }, c = !1, n = 0;
2551
- const u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
2552
- let a = o.storage;
2553
- if (!a)
2554
- return t(
2555
- (...v) => {
2556
- console.warn(
2557
- `[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`
2558
- ), s(...v);
2559
- },
2560
- r,
2561
- i
2562
- );
2563
- const l = () => {
2564
- const v = o.partialize({ ...r() });
2565
- return a.setItem(o.name, {
2566
- state: v,
2567
- version: o.version
2568
- });
2569
- }, f = i.setState;
2570
- i.setState = (v, p) => (f(v, p), l());
2571
- const m = t(
2572
- (...v) => (s(...v), l()),
2573
- r,
2574
- i
2575
- );
2576
- i.getInitialState = () => m;
2577
- let O;
2578
- const y = () => {
2579
- var v, p;
2580
- if (!a) return;
2581
- const w = ++n;
2582
- c = !1, u.forEach((S) => {
2583
- var R;
2584
- return S((R = r()) != null ? R : m);
2585
- });
2586
- const E = ((p = o.onRehydrateStorage) == null ? void 0 : p.call(o, (v = r()) != null ? v : m)) || void 0;
2587
- return nt(a.getItem.bind(a))(o.name).then((S) => {
2588
- if (S)
2589
- if (typeof S.version == "number" && S.version !== o.version) {
2590
- if (o.migrate) {
2591
- const R = o.migrate(
2592
- S.state,
2593
- S.version
2594
- );
2595
- return R instanceof Promise ? R.then((d) => [!0, d]) : [!0, R];
2596
- }
2597
- console.error(
2598
- "State loaded from storage couldn't be migrated since no migrate function was provided"
2599
- );
2600
- } else
2601
- return [!1, S.state];
2602
- return [!1, void 0];
2603
- }).then((S) => {
2604
- var R;
2605
- if (w !== n)
2606
- return;
2607
- const [d, b] = S;
2608
- if (O = o.merge(
2609
- b,
2610
- (R = r()) != null ? R : m
2611
- ), s(O, !0), d)
2612
- return l();
2613
- }).then(() => {
2614
- w === n && (E?.(O, void 0), O = r(), c = !0, h.forEach((S) => S(O)));
2615
- }).catch((S) => {
2616
- w === n && E?.(void 0, S);
2617
- });
2618
- };
2619
- return i.persist = {
2620
- setOptions: (v) => {
2621
- o = {
2622
- ...o,
2623
- ...v
2624
- }, v.storage && (a = v.storage);
2625
- },
2626
- clearStorage: () => {
2627
- a?.removeItem(o.name);
2628
- },
2629
- getOptions: () => o,
2630
- rehydrate: () => y(),
2631
- hasHydrated: () => c,
2632
- onHydrate: (v) => (u.add(v), () => {
2633
- u.delete(v);
2634
- }),
2635
- onFinishHydration: (v) => (h.add(v), () => {
2636
- h.delete(v);
2637
- })
2638
- }, o.skipHydration || y(), O || m;
2639
- }, Ve = Ae, Ft = (t) => Symbol.iterator in t, Tt = (t) => (
2640
- // HACK: avoid checking entries type
2641
- "entries" in t
2642
- ), _t = (t, e) => {
2643
- const s = t instanceof Map ? t : new Map(t.entries()), r = e instanceof Map ? e : new Map(e.entries());
2644
- if (s.size !== r.size)
2645
- return !1;
2646
- for (const [i, o] of s)
2647
- if (!r.has(i) || !Object.is(o, r.get(i)))
2648
- return !1;
2649
- return !0;
2650
- }, De = (t, e) => {
2651
- const s = t[Symbol.iterator](), r = e[Symbol.iterator]();
2652
- let i = s.next(), o = r.next();
2653
- for (; !i.done && !o.done; ) {
2654
- if (!Object.is(i.value, o.value))
2655
- return !1;
2656
- i = s.next(), o = r.next();
2657
- }
2658
- return !!i.done && !!o.done;
2659
- };
2660
- function je(t, e) {
2661
- return Object.is(t, e) ? !0 : typeof t != "object" || t === null || typeof e != "object" || e === null || Object.getPrototypeOf(t) !== Object.getPrototypeOf(e) ? !1 : Ft(t) && Ft(e) ? Tt(t) && Tt(e) ? _t(t, e) : De(t, e) : _t(
2662
- { entries: () => Object.entries(t) },
2663
- { entries: () => Object.entries(e) }
2664
- );
2665
- }
2666
- function Ze(t) {
2667
- const e = D.useRef(void 0);
2668
- return (s) => {
2669
- const r = t(s);
2670
- return je(e.current, r) ? e.current : e.current = r;
2671
- };
2672
- }
2673
- function Xe(t) {
2674
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
2675
- }
2676
- var $ = { exports: {} }, It;
2677
- function qe() {
2678
- return It || (It = 1, (function(t) {
2679
- var e = (function() {
2680
- var s = String.fromCharCode, r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$", o = {};
2681
- function c(u, h) {
2682
- if (!o[u]) {
2683
- o[u] = {};
2684
- for (var a = 0; a < u.length; a++)
2685
- o[u][u.charAt(a)] = a;
2686
- }
2687
- return o[u][h];
2688
- }
2689
- var n = {
2690
- compressToBase64: function(u) {
2691
- if (u == null) return "";
2692
- var h = n._compress(u, 6, function(a) {
2693
- return r.charAt(a);
2694
- });
2695
- switch (h.length % 4) {
2696
- // To produce valid Base64
2697
- default:
2698
- // When could this happen ?
2699
- case 0:
2700
- return h;
2701
- case 1:
2702
- return h + "===";
2703
- case 2:
2704
- return h + "==";
2705
- case 3:
2706
- return h + "=";
2707
- }
2708
- },
2709
- decompressFromBase64: function(u) {
2710
- return u == null ? "" : u == "" ? null : n._decompress(u.length, 32, function(h) {
2711
- return c(r, u.charAt(h));
2712
- });
2713
- },
2714
- compressToUTF16: function(u) {
2715
- return u == null ? "" : n._compress(u, 15, function(h) {
2716
- return s(h + 32);
2717
- }) + " ";
2718
- },
2719
- decompressFromUTF16: function(u) {
2720
- return u == null ? "" : u == "" ? null : n._decompress(u.length, 16384, function(h) {
2721
- return u.charCodeAt(h) - 32;
2722
- });
2723
- },
2724
- //compress into uint8array (UCS-2 big endian format)
2725
- compressToUint8Array: function(u) {
2726
- for (var h = n.compress(u), a = new Uint8Array(h.length * 2), l = 0, f = h.length; l < f; l++) {
2727
- var m = h.charCodeAt(l);
2728
- a[l * 2] = m >>> 8, a[l * 2 + 1] = m % 256;
2729
- }
2730
- return a;
2731
- },
2732
- //decompress from uint8array (UCS-2 big endian format)
2733
- decompressFromUint8Array: function(u) {
2734
- if (u == null)
2735
- return n.decompress(u);
2736
- for (var h = new Array(u.length / 2), a = 0, l = h.length; a < l; a++)
2737
- h[a] = u[a * 2] * 256 + u[a * 2 + 1];
2738
- var f = [];
2739
- return h.forEach(function(m) {
2740
- f.push(s(m));
2741
- }), n.decompress(f.join(""));
2742
- },
2743
- //compress into a string that is already URI encoded
2744
- compressToEncodedURIComponent: function(u) {
2745
- return u == null ? "" : n._compress(u, 6, function(h) {
2746
- return i.charAt(h);
2747
- });
2748
- },
2749
- //decompress from an output of compressToEncodedURIComponent
2750
- decompressFromEncodedURIComponent: function(u) {
2751
- return u == null ? "" : u == "" ? null : (u = u.replace(/ /g, "+"), n._decompress(u.length, 32, function(h) {
2752
- return c(i, u.charAt(h));
2753
- }));
2754
- },
2755
- compress: function(u) {
2756
- return n._compress(u, 16, function(h) {
2757
- return s(h);
2758
- });
2759
- },
2760
- _compress: function(u, h, a) {
2761
- if (u == null) return "";
2762
- var l, f, m = {}, O = {}, y = "", v = "", p = "", w = 2, E = 3, S = 2, R = [], d = 0, b = 0, g;
2763
- for (g = 0; g < u.length; g += 1)
2764
- if (y = u.charAt(g), Object.prototype.hasOwnProperty.call(m, y) || (m[y] = E++, O[y] = !0), v = p + y, Object.prototype.hasOwnProperty.call(m, v))
2765
- p = v;
2766
- else {
2767
- if (Object.prototype.hasOwnProperty.call(O, p)) {
2768
- if (p.charCodeAt(0) < 256) {
2769
- for (l = 0; l < S; l++)
2770
- d = d << 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++;
2771
- for (f = p.charCodeAt(0), l = 0; l < 8; l++)
2772
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2773
- } else {
2774
- for (f = 1, l = 0; l < S; l++)
2775
- d = d << 1 | f, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = 0;
2776
- for (f = p.charCodeAt(0), l = 0; l < 16; l++)
2777
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2778
- }
2779
- w--, w == 0 && (w = Math.pow(2, S), S++), delete O[p];
2780
- } else
2781
- for (f = m[p], l = 0; l < S; l++)
2782
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2783
- w--, w == 0 && (w = Math.pow(2, S), S++), m[v] = E++, p = String(y);
2784
- }
2785
- if (p !== "") {
2786
- if (Object.prototype.hasOwnProperty.call(O, p)) {
2787
- if (p.charCodeAt(0) < 256) {
2788
- for (l = 0; l < S; l++)
2789
- d = d << 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++;
2790
- for (f = p.charCodeAt(0), l = 0; l < 8; l++)
2791
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2792
- } else {
2793
- for (f = 1, l = 0; l < S; l++)
2794
- d = d << 1 | f, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = 0;
2795
- for (f = p.charCodeAt(0), l = 0; l < 16; l++)
2796
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2797
- }
2798
- w--, w == 0 && (w = Math.pow(2, S), S++), delete O[p];
2799
- } else
2800
- for (f = m[p], l = 0; l < S; l++)
2801
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2802
- w--, w == 0 && (w = Math.pow(2, S), S++);
2803
- }
2804
- for (f = 2, l = 0; l < S; l++)
2805
- d = d << 1 | f & 1, b == h - 1 ? (b = 0, R.push(a(d)), d = 0) : b++, f = f >> 1;
2806
- for (; ; )
2807
- if (d = d << 1, b == h - 1) {
2808
- R.push(a(d));
2809
- break;
2810
- } else b++;
2811
- return R.join("");
2812
- },
2813
- decompress: function(u) {
2814
- return u == null ? "" : u == "" ? null : n._decompress(u.length, 32768, function(h) {
2815
- return u.charCodeAt(h);
2816
- });
2817
- },
2818
- _decompress: function(u, h, a) {
2819
- var l = [], f = 4, m = 4, O = 3, y = "", v = [], p, w, E, S, R, d, b, g = { val: a(0), position: h, index: 1 };
2820
- for (p = 0; p < 3; p += 1)
2821
- l[p] = p;
2822
- for (E = 0, R = Math.pow(2, 2), d = 1; d != R; )
2823
- S = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = h, g.val = a(g.index++)), E |= (S > 0 ? 1 : 0) * d, d <<= 1;
2824
- switch (E) {
2825
- case 0:
2826
- for (E = 0, R = Math.pow(2, 8), d = 1; d != R; )
2827
- S = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = h, g.val = a(g.index++)), E |= (S > 0 ? 1 : 0) * d, d <<= 1;
2828
- b = s(E);
2829
- break;
2830
- case 1:
2831
- for (E = 0, R = Math.pow(2, 16), d = 1; d != R; )
2832
- S = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = h, g.val = a(g.index++)), E |= (S > 0 ? 1 : 0) * d, d <<= 1;
2833
- b = s(E);
2834
- break;
2835
- case 2:
2836
- return "";
2837
- }
2838
- for (l[3] = b, w = b, v.push(b); ; ) {
2839
- if (g.index > u)
2840
- return "";
2841
- for (E = 0, R = Math.pow(2, O), d = 1; d != R; )
2842
- S = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = h, g.val = a(g.index++)), E |= (S > 0 ? 1 : 0) * d, d <<= 1;
2843
- switch (b = E) {
2844
- case 0:
2845
- for (E = 0, R = Math.pow(2, 8), d = 1; d != R; )
2846
- S = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = h, g.val = a(g.index++)), E |= (S > 0 ? 1 : 0) * d, d <<= 1;
2847
- l[m++] = s(E), b = m - 1, f--;
2848
- break;
2849
- case 1:
2850
- for (E = 0, R = Math.pow(2, 16), d = 1; d != R; )
2851
- S = g.val & g.position, g.position >>= 1, g.position == 0 && (g.position = h, g.val = a(g.index++)), E |= (S > 0 ? 1 : 0) * d, d <<= 1;
2852
- l[m++] = s(E), b = m - 1, f--;
2853
- break;
2854
- case 2:
2855
- return v.join("");
2856
- }
2857
- if (f == 0 && (f = Math.pow(2, O), O++), l[b])
2858
- y = l[b];
2859
- else if (b === m)
2860
- y = w + w.charAt(0);
2861
- else
2862
- return null;
2863
- v.push(y), l[m++] = w + y.charAt(0), f--, w = y, f == 0 && (f = Math.pow(2, O), O++);
2864
- }
2865
- }
2866
- };
2867
- return n;
2868
- })();
2869
- t != null ? t.exports = e : typeof angular < "u" && angular != null && angular.module("LZString", []).factory("LZString", function() {
2870
- return e;
2871
- });
2872
- })($)), $.exports;
2873
- }
2874
- var Ye = /* @__PURE__ */ qe();
2875
- export {
2876
- Le as Q,
2877
- ze as a,
2878
- He as b,
2879
- Ke as c,
2880
- Be as d,
2881
- Je as e,
2882
- Ge as f,
2883
- Xe as g,
2884
- We as h,
2885
- Ze as i,
2886
- Ne as j,
2887
- Ye as l,
2888
- Ve as p,
2889
- $e as s,
2890
- lt as u
2891
- };
2892
- //# sourceMappingURL=vendor-B2EH3V58.js.map