zudoku 0.37.1 → 0.39.0

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 (260) hide show
  1. package/dist/app/main.js +2 -0
  2. package/dist/app/main.js.map +1 -1
  3. package/dist/app/tailwind.js +14 -0
  4. package/dist/app/tailwind.js.map +1 -1
  5. package/dist/config/validators/common.d.ts +287 -18
  6. package/dist/config/validators/common.js +2 -0
  7. package/dist/config/validators/common.js.map +1 -1
  8. package/dist/config/validators/validate.d.ts +107 -7
  9. package/dist/lib/authentication/authentication.d.ts +1 -0
  10. package/dist/lib/authentication/providers/clerk.js +19 -0
  11. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  12. package/dist/lib/authentication/providers/openid.d.ts +1 -0
  13. package/dist/lib/authentication/providers/openid.js +5 -0
  14. package/dist/lib/authentication/providers/openid.js.map +1 -1
  15. package/dist/lib/authentication/providers/supabase.js +5 -0
  16. package/dist/lib/authentication/providers/supabase.js.map +1 -1
  17. package/dist/lib/authentication/state.d.ts +0 -26
  18. package/dist/lib/authentication/state.js +1 -16
  19. package/dist/lib/authentication/state.js.map +1 -1
  20. package/dist/lib/components/Heading.d.ts +1 -1
  21. package/dist/lib/components/Layout.js +5 -10
  22. package/dist/lib/components/Layout.js.map +1 -1
  23. package/dist/lib/components/Main.js +3 -1
  24. package/dist/lib/components/Main.js.map +1 -1
  25. package/dist/lib/components/Pagination.d.ts +10 -0
  26. package/dist/lib/components/Pagination.js +10 -0
  27. package/dist/lib/components/Pagination.js.map +1 -0
  28. package/dist/lib/components/TopNavigation.js +18 -2
  29. package/dist/lib/components/TopNavigation.js.map +1 -1
  30. package/dist/lib/components/navigation/SidebarItem.d.ts +1 -0
  31. package/dist/lib/components/navigation/SidebarItem.js +7 -3
  32. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  33. package/dist/lib/{plugins/markdown → components/navigation}/Toc.js +5 -7
  34. package/dist/lib/components/navigation/Toc.js.map +1 -0
  35. package/dist/lib/core/ZudokuContext.d.ts +7 -0
  36. package/dist/lib/core/ZudokuContext.js +8 -3
  37. package/dist/lib/core/ZudokuContext.js.map +1 -1
  38. package/dist/lib/core/plugins.d.ts +1 -1
  39. package/dist/lib/oas/graphql/index.d.ts +2 -1
  40. package/dist/lib/oas/graphql/index.js +74 -14
  41. package/dist/lib/oas/graphql/index.js.map +1 -1
  42. package/dist/lib/oas/parser/dereference/index.js +2 -0
  43. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  44. package/dist/lib/oas/parser/index.d.ts +5 -3
  45. package/dist/lib/oas/parser/index.js +0 -22
  46. package/dist/lib/oas/parser/index.js.map +1 -1
  47. package/dist/lib/plugins/api-catalog/index.js +19 -17
  48. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  49. package/dist/lib/plugins/markdown/MdxPage.js +3 -9
  50. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  51. package/dist/lib/plugins/openapi/ColorizedParam.js +1 -1
  52. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  53. package/dist/lib/plugins/openapi/Endpoint.js +1 -1
  54. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  55. package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
  56. package/dist/lib/plugins/openapi/OperationList.js +29 -9
  57. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  58. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  59. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  60. package/dist/lib/plugins/openapi/ParameterListItem.js +2 -1
  61. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  62. package/dist/lib/plugins/openapi/SchemaList.d.ts +1 -0
  63. package/dist/lib/plugins/openapi/SchemaList.js +52 -0
  64. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -0
  65. package/dist/lib/plugins/openapi/Sidecar.js +29 -5
  66. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  67. package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +1 -1
  68. package/dist/lib/plugins/openapi/client/GraphQLClient.js +1 -1
  69. package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -1
  70. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +6 -2
  71. package/dist/lib/plugins/openapi/client/useCreateQuery.js +5 -5
  72. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  73. package/dist/lib/plugins/openapi/components/EnumValues.js +1 -1
  74. package/dist/lib/plugins/openapi/components/EnumValues.js.map +1 -1
  75. package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
  76. package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
  77. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  78. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +67 -11
  79. package/dist/lib/plugins/openapi/graphql/graphql.js +34 -5
  80. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  81. package/dist/lib/plugins/openapi/index.js +12 -0
  82. package/dist/lib/plugins/openapi/index.js.map +1 -1
  83. package/dist/lib/plugins/openapi/interfaces.d.ts +26 -0
  84. package/dist/lib/plugins/openapi/playground/Playground.js +1 -1
  85. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  86. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +2 -2
  87. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -1
  88. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +1 -2
  89. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +2 -2
  90. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -1
  91. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +0 -1
  92. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +1 -1
  93. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -1
  94. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.d.ts +4 -0
  95. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js +12 -0
  96. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js.map +1 -0
  97. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.d.ts +2 -4
  98. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +12 -9
  99. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
  100. package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -2
  101. package/dist/lib/plugins/openapi/schema/SchemaView.js +30 -52
  102. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  103. package/dist/lib/plugins/openapi/schema/utils.d.ts +1 -0
  104. package/dist/lib/plugins/openapi/schema/utils.js +3 -1
  105. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  106. package/dist/lib/plugins/openapi/state.d.ts +25 -0
  107. package/dist/lib/plugins/openapi/state.js +18 -0
  108. package/dist/lib/plugins/openapi/state.js.map +1 -0
  109. package/dist/lib/plugins/openapi/util/getRoutes.js +9 -3
  110. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  111. package/dist/lib/plugins/search-pagefind/PagefindSearch.js +13 -4
  112. package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -1
  113. package/dist/lib/plugins/search-pagefind/ResultList.js +19 -12
  114. package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -1
  115. package/dist/lib/plugins/search-pagefind/get-results.d.ts +8 -1
  116. package/dist/lib/plugins/search-pagefind/get-results.js +9 -4
  117. package/dist/lib/plugins/search-pagefind/get-results.js.map +1 -1
  118. package/dist/lib/util/traverse.d.ts +2 -8
  119. package/dist/lib/util/traverse.js.map +1 -1
  120. package/dist/lib/util/types.d.ts +7 -0
  121. package/dist/lib/util/types.js +2 -0
  122. package/dist/lib/util/types.js.map +1 -0
  123. package/dist/lib/util/useOnScreen.d.ts +3 -2
  124. package/dist/lib/util/useOnScreen.js +3 -3
  125. package/dist/lib/util/useOnScreen.js.map +1 -1
  126. package/dist/lib/util/useScrollToAnchor.js +18 -12
  127. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  128. package/dist/vite/api/schema-codegen.js +2 -2
  129. package/dist/vite/api/schema-codegen.js.map +1 -1
  130. package/dist/vite/api/schema-codegen.test.js +5 -0
  131. package/dist/vite/api/schema-codegen.test.js.map +1 -1
  132. package/dist/vite/plugin-api.js +12 -8
  133. package/dist/vite/plugin-api.js.map +1 -1
  134. package/lib/{AuthenticationPlugin-Cij2tPWa.js → AuthenticationPlugin-foqdvvkf.js} +3 -3
  135. package/lib/{AuthenticationPlugin-Cij2tPWa.js.map → AuthenticationPlugin-foqdvvkf.js.map} +1 -1
  136. package/lib/{Callout-B2vsR09t.js → Callout-D5frCCJ0.js} +2 -2
  137. package/lib/{Callout-B2vsR09t.js.map → Callout-D5frCCJ0.js.map} +1 -1
  138. package/lib/{Dialog-sbgekbjb.js → Dialog-Dv6WG8RN.js} +5 -5
  139. package/lib/{Dialog-sbgekbjb.js.map → Dialog-Dv6WG8RN.js.map} +1 -1
  140. package/lib/{Markdown-DT5Rrq8_.js → Markdown-aF5FdsNi.js} +1945 -1937
  141. package/lib/{Markdown-DT5Rrq8_.js.map → Markdown-aF5FdsNi.js.map} +1 -1
  142. package/lib/MdxPage-ZW1StNhp.js +83 -0
  143. package/lib/MdxPage-ZW1StNhp.js.map +1 -0
  144. package/lib/{OasProvider-DdEBf2qS.js → OasProvider-Cld9RAMQ.js} +4 -4
  145. package/lib/{OasProvider-DdEBf2qS.js.map → OasProvider-Cld9RAMQ.js.map} +1 -1
  146. package/lib/OperationList-D-OfzJm6.js +5065 -0
  147. package/lib/OperationList-D-OfzJm6.js.map +1 -0
  148. package/lib/Pagination-CYB3nVYx.js +46 -0
  149. package/lib/Pagination-CYB3nVYx.js.map +1 -0
  150. package/lib/SchemaList-Ci1WxRh0.js +148 -0
  151. package/lib/SchemaList-Ci1WxRh0.js.map +1 -0
  152. package/lib/SchemaView-Brn-YxHY.js +345 -0
  153. package/lib/SchemaView-Brn-YxHY.js.map +1 -0
  154. package/lib/{Select-z1Lwl0-J.js → Select-DVFRKf1R.js} +8 -8
  155. package/lib/{Select-z1Lwl0-J.js.map → Select-DVFRKf1R.js.map} +1 -1
  156. package/lib/{SlotletProvider-D8OBnr77.js → SlotletProvider-DXvc0aY6.js} +4 -4
  157. package/lib/{SlotletProvider-D8OBnr77.js.map → SlotletProvider-DXvc0aY6.js.map} +1 -1
  158. package/lib/Toc-YBsgI72s.js +92 -0
  159. package/lib/Toc-YBsgI72s.js.map +1 -0
  160. package/lib/{chunk-HA7DTUK3-ZGg2W6yV.js → chunk-HA7DTUK3-C4gP41vD.js} +5 -5
  161. package/lib/{chunk-HA7DTUK3-ZGg2W6yV.js.map → chunk-HA7DTUK3-C4gP41vD.js.map} +1 -1
  162. package/lib/{createServer-DjgKDpGV.js → createServer-mMau3eV_.js} +1732 -1664
  163. package/lib/{createServer-DjgKDpGV.js.map → createServer-mMau3eV_.js.map} +1 -1
  164. package/lib/hook-CqpVYDqN.js +1483 -0
  165. package/lib/hook-CqpVYDqN.js.map +1 -0
  166. package/lib/index-Bt7MKhZq.js +2514 -0
  167. package/lib/index-Bt7MKhZq.js.map +1 -0
  168. package/lib/{index-DdQSV2RF.js → index-CjPMxpOV.js} +809 -750
  169. package/lib/index-CjPMxpOV.js.map +1 -0
  170. package/lib/{mutation-_Z5C2wFZ.js → mutation-8LjrN7uz.js} +2 -2
  171. package/lib/{mutation-_Z5C2wFZ.js.map → mutation-8LjrN7uz.js.map} +1 -1
  172. package/lib/post-processors/traverse.js.map +1 -1
  173. package/lib/ui/Command.js +1 -1
  174. package/lib/{useExposedProps-BslIn-FE.js → useExposedProps-B9qXJedG.js} +2 -2
  175. package/lib/{useExposedProps-BslIn-FE.js.map → useExposedProps-B9qXJedG.js.map} +1 -1
  176. package/lib/zudoku.auth-auth0.js +1 -1
  177. package/lib/zudoku.auth-clerk.js +59 -41
  178. package/lib/zudoku.auth-clerk.js.map +1 -1
  179. package/lib/zudoku.auth-openid.js +76 -73
  180. package/lib/zudoku.auth-openid.js.map +1 -1
  181. package/lib/zudoku.components.js +31 -1440
  182. package/lib/zudoku.components.js.map +1 -1
  183. package/lib/zudoku.hooks.js +1 -1
  184. package/lib/zudoku.plugin-api-catalog.js +81 -79
  185. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  186. package/lib/zudoku.plugin-api-keys.js +15 -16
  187. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  188. package/lib/zudoku.plugin-custom-pages.js +2 -2
  189. package/lib/zudoku.plugin-markdown.js +1 -1
  190. package/lib/zudoku.plugin-openapi.js +5 -6
  191. package/lib/zudoku.plugin-openapi.js.map +1 -1
  192. package/lib/zudoku.plugin-redirect.js +1 -1
  193. package/lib/zudoku.plugin-search-pagefind.js +133 -98
  194. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  195. package/lib/zudoku.plugins.js.map +1 -1
  196. package/package.json +4 -3
  197. package/src/app/main.tsx +2 -0
  198. package/src/app/tailwind.ts +14 -0
  199. package/src/lib/authentication/authentication.ts +2 -0
  200. package/src/lib/authentication/providers/clerk.tsx +20 -0
  201. package/src/lib/authentication/providers/openid.tsx +6 -0
  202. package/src/lib/authentication/providers/supabase.tsx +6 -0
  203. package/src/lib/authentication/state.ts +1 -35
  204. package/src/lib/components/Layout.tsx +17 -17
  205. package/src/lib/components/Main.tsx +3 -1
  206. package/src/lib/components/Pagination.tsx +47 -0
  207. package/src/lib/components/TopNavigation.tsx +29 -2
  208. package/src/lib/components/navigation/SidebarItem.tsx +10 -4
  209. package/src/lib/{plugins/markdown → components/navigation}/Toc.tsx +5 -14
  210. package/src/lib/core/ZudokuContext.ts +13 -6
  211. package/src/lib/core/plugins.ts +1 -1
  212. package/src/lib/oas/graphql/index.ts +118 -45
  213. package/src/lib/oas/parser/dereference/index.ts +2 -0
  214. package/src/lib/oas/parser/index.ts +7 -29
  215. package/src/lib/plugins/api-catalog/index.tsx +40 -35
  216. package/src/lib/plugins/markdown/MdxPage.tsx +6 -43
  217. package/src/lib/plugins/openapi/ColorizedParam.tsx +1 -1
  218. package/src/lib/plugins/openapi/Endpoint.tsx +1 -1
  219. package/src/lib/plugins/openapi/OperationList.tsx +37 -16
  220. package/src/lib/plugins/openapi/OperationListItem.tsx +7 -2
  221. package/src/lib/plugins/openapi/ParameterListItem.tsx +2 -0
  222. package/src/lib/plugins/openapi/SchemaList.tsx +151 -0
  223. package/src/lib/plugins/openapi/Sidecar.tsx +36 -7
  224. package/src/lib/plugins/openapi/client/GraphQLClient.tsx +1 -1
  225. package/src/lib/plugins/openapi/client/useCreateQuery.ts +12 -5
  226. package/src/lib/plugins/openapi/components/EnumValues.tsx +1 -1
  227. package/src/lib/plugins/openapi/graphql/gql.ts +15 -6
  228. package/src/lib/plugins/openapi/graphql/graphql.ts +104 -15
  229. package/src/lib/plugins/openapi/index.tsx +13 -0
  230. package/src/lib/plugins/openapi/interfaces.ts +29 -0
  231. package/src/lib/plugins/openapi/playground/Playground.tsx +1 -1
  232. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +2 -1
  233. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +1 -8
  234. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +1 -2
  235. package/src/lib/plugins/openapi/schema/SchemaExampleAndDefault.tsx +36 -0
  236. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +20 -21
  237. package/src/lib/plugins/openapi/schema/SchemaView.tsx +69 -141
  238. package/src/lib/plugins/openapi/schema/utils.ts +7 -1
  239. package/src/lib/plugins/openapi/state.ts +36 -0
  240. package/src/lib/plugins/openapi/util/getRoutes.tsx +9 -6
  241. package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +26 -4
  242. package/src/lib/plugins/search-pagefind/ResultList.tsx +59 -47
  243. package/src/lib/plugins/search-pagefind/get-results.tsx +31 -10
  244. package/src/lib/util/traverse.ts +2 -6
  245. package/src/lib/util/types.ts +7 -0
  246. package/src/lib/util/useOnScreen.ts +6 -4
  247. package/src/lib/util/useScrollToAnchor.ts +20 -12
  248. package/dist/lib/plugins/markdown/Toc.js.map +0 -1
  249. package/lib/MdxPage-D2rD1vC4.js +0 -200
  250. package/lib/MdxPage-D2rD1vC4.js.map +0 -1
  251. package/lib/OperationList-DT4-gm_S.js +0 -5363
  252. package/lib/OperationList-DT4-gm_S.js.map +0 -1
  253. package/lib/hook-DzQC8PzJ.js +0 -355
  254. package/lib/hook-DzQC8PzJ.js.map +0 -1
  255. package/lib/index-DdQSV2RF.js.map +0 -1
  256. package/lib/index.esm-CltAN0Tf.js +0 -711
  257. package/lib/index.esm-CltAN0Tf.js.map +0 -1
  258. package/lib/joinUrl-BjDooT-T.js +0 -1154
  259. package/lib/joinUrl-BjDooT-T.js.map +0 -1
  260. /package/dist/lib/{plugins/markdown → components/navigation}/Toc.d.ts +0 -0
@@ -1,1154 +0,0 @@
1
- var Le = (t) => {
2
- throw TypeError(t);
3
- };
4
- var pe = (t, e, s) => e.has(t) || Le("Cannot " + s);
5
- var i = (t, e, s) => (pe(t, e, "read from private field"), s ? s.call(t) : e.get(t)), d = (t, e, s) => e.has(t) ? Le("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), h = (t, e, s, r) => (pe(t, e, "write to private field"), r ? r.call(t, s) : e.set(t, s), s), b = (t, e, s) => (pe(t, e, "access private method"), s);
6
- import * as D from "react";
7
- import { j as at } from "./jsx-runtime-CYK1ROHF.js";
8
- var Qe = class {
9
- constructor() {
10
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
11
- }
12
- subscribe(t) {
13
- return this.listeners.add(t), this.onSubscribe(), () => {
14
- this.listeners.delete(t), this.onUnsubscribe();
15
- };
16
- }
17
- hasListeners() {
18
- return this.listeners.size > 0;
19
- }
20
- onSubscribe() {
21
- }
22
- onUnsubscribe() {
23
- }
24
- }, $ = typeof window > "u" || "Deno" in globalThis;
25
- function be() {
26
- }
27
- function Lt(t, e) {
28
- return typeof t == "function" ? t(e) : t;
29
- }
30
- function me(t) {
31
- return typeof t == "number" && t >= 0 && t !== 1 / 0;
32
- }
33
- function Xe(t, e) {
34
- return Math.max(t + (e || 0) - Date.now(), 0);
35
- }
36
- function de(t, e) {
37
- return typeof t == "function" ? t(e) : t;
38
- }
39
- function j(t, e) {
40
- return typeof t == "function" ? t(e) : t;
41
- }
42
- function Nt(t, e) {
43
- const {
44
- type: s = "all",
45
- exact: r,
46
- fetchStatus: n,
47
- predicate: u,
48
- queryKey: a,
49
- stale: c
50
- } = t;
51
- if (a) {
52
- if (r) {
53
- if (e.queryHash !== ot(a, e.options))
54
- return !1;
55
- } else if (!Ae(e.queryKey, a))
56
- return !1;
57
- }
58
- if (s !== "all") {
59
- const l = e.isActive();
60
- if (s === "active" && !l || s === "inactive" && l)
61
- return !1;
62
- }
63
- return !(typeof c == "boolean" && e.isStale() !== c || n && n !== e.state.fetchStatus || u && !u(e));
64
- }
65
- function _t(t, e) {
66
- const { exact: s, status: r, predicate: n, mutationKey: u } = t;
67
- if (u) {
68
- if (!e.options.mutationKey)
69
- return !1;
70
- if (s) {
71
- if (ge(e.options.mutationKey) !== ge(u))
72
- return !1;
73
- } else if (!Ae(e.options.mutationKey, u))
74
- return !1;
75
- }
76
- return !(r && e.state.status !== r || n && !n(e));
77
- }
78
- function ot(t, e) {
79
- return ((e == null ? void 0 : e.queryKeyHashFn) || ge)(t);
80
- }
81
- function ge(t) {
82
- return JSON.stringify(
83
- t,
84
- (e, s) => Ce(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
85
- );
86
- }
87
- function Ae(t, e) {
88
- return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? !Object.keys(e).some((s) => !Ae(t[s], e[s])) : !1;
89
- }
90
- function Re(t, e) {
91
- if (t === e)
92
- return t;
93
- const s = Ne(t) && Ne(e);
94
- if (s || Ce(t) && Ce(e)) {
95
- const r = s ? t : Object.keys(t), n = r.length, u = s ? e : Object.keys(e), a = u.length, c = s ? [] : {};
96
- let l = 0;
97
- for (let R = 0; R < a; R++) {
98
- const m = s ? R : u[R];
99
- (!s && r.includes(m) || s) && t[m] === void 0 && e[m] === void 0 ? (c[m] = void 0, l++) : (c[m] = Re(t[m], e[m]), c[m] === t[m] && t[m] !== void 0 && l++);
100
- }
101
- return n === a && l === n ? t : c;
102
- }
103
- return e;
104
- }
105
- function Se(t, e) {
106
- if (!e || Object.keys(t).length !== Object.keys(e).length)
107
- return !1;
108
- for (const s in t)
109
- if (t[s] !== e[s])
110
- return !1;
111
- return !0;
112
- }
113
- function Ne(t) {
114
- return Array.isArray(t) && t.length === Object.keys(t).length;
115
- }
116
- function Ce(t) {
117
- if (!_e(t))
118
- return !1;
119
- const e = t.constructor;
120
- if (e === void 0)
121
- return !0;
122
- const s = e.prototype;
123
- return !(!_e(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
124
- }
125
- function _e(t) {
126
- return Object.prototype.toString.call(t) === "[object Object]";
127
- }
128
- function ut(t) {
129
- return new Promise((e) => {
130
- setTimeout(e, t);
131
- });
132
- }
133
- function we(t, e, s) {
134
- if (typeof s.structuralSharing == "function")
135
- return s.structuralSharing(t, e);
136
- if (s.structuralSharing !== !1) {
137
- if (process.env.NODE_ENV !== "production")
138
- try {
139
- return Re(t, e);
140
- } catch (r) {
141
- console.error(
142
- `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}`
143
- );
144
- }
145
- return Re(t, e);
146
- }
147
- return e;
148
- }
149
- function Kt(t) {
150
- return t;
151
- }
152
- function Ht(t, e, s = 0) {
153
- const r = [...t, e];
154
- return s && r.length > s ? r.slice(1) : r;
155
- }
156
- function zt(t, e, s = 0) {
157
- const r = [e, ...t];
158
- return s && r.length > s ? r.slice(0, -1) : r;
159
- }
160
- var Ee = Symbol();
161
- function ht(t, e) {
162
- return process.env.NODE_ENV !== "production" && t.queryFn === Ee && console.error(
163
- `Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`
164
- ), !t.queryFn && (e != null && e.initialPromise) ? () => e.initialPromise : !t.queryFn || t.queryFn === Ee ? () => Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)) : t.queryFn;
165
- }
166
- var _, q, X, Ge, ct = (Ge = class extends Qe {
167
- constructor() {
168
- super();
169
- d(this, _);
170
- d(this, q);
171
- d(this, X);
172
- h(this, X, (e) => {
173
- if (!$ && window.addEventListener) {
174
- const s = () => e();
175
- return window.addEventListener("visibilitychange", s, !1), () => {
176
- window.removeEventListener("visibilitychange", s);
177
- };
178
- }
179
- });
180
- }
181
- onSubscribe() {
182
- i(this, q) || this.setEventListener(i(this, X));
183
- }
184
- onUnsubscribe() {
185
- var e;
186
- this.hasListeners() || ((e = i(this, q)) == null || e.call(this), h(this, q, void 0));
187
- }
188
- setEventListener(e) {
189
- var s;
190
- h(this, X, e), (s = i(this, q)) == null || s.call(this), h(this, q, e((r) => {
191
- typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
192
- }));
193
- }
194
- setFocused(e) {
195
- i(this, _) !== e && (h(this, _, e), this.onFocus());
196
- }
197
- onFocus() {
198
- const e = this.isFocused();
199
- this.listeners.forEach((s) => {
200
- s(e);
201
- });
202
- }
203
- isFocused() {
204
- var e;
205
- return typeof i(this, _) == "boolean" ? i(this, _) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
206
- }
207
- }, _ = new WeakMap(), q = new WeakMap(), X = new WeakMap(), Ge), Ye = new ct(), Y, M, Z, Ve, lt = (Ve = class extends Qe {
208
- constructor() {
209
- super();
210
- d(this, Y, !0);
211
- d(this, M);
212
- d(this, Z);
213
- h(this, Z, (e) => {
214
- if (!$ && window.addEventListener) {
215
- const s = () => e(!0), r = () => e(!1);
216
- return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
217
- window.removeEventListener("online", s), window.removeEventListener("offline", r);
218
- };
219
- }
220
- });
221
- }
222
- onSubscribe() {
223
- i(this, M) || this.setEventListener(i(this, Z));
224
- }
225
- onUnsubscribe() {
226
- var e;
227
- this.hasListeners() || ((e = i(this, M)) == null || e.call(this), h(this, M, void 0));
228
- }
229
- setEventListener(e) {
230
- var s;
231
- h(this, Z, e), (s = i(this, M)) == null || s.call(this), h(this, M, e(this.setOnline.bind(this)));
232
- }
233
- setOnline(e) {
234
- i(this, Y) !== e && (h(this, Y, e), this.listeners.forEach((r) => {
235
- r(e);
236
- }));
237
- }
238
- isOnline() {
239
- return i(this, Y);
240
- }
241
- }, Y = new WeakMap(), M = new WeakMap(), Z = new WeakMap(), Ve), Ze = new lt();
242
- function Fe() {
243
- let t, e;
244
- const s = new Promise((n, u) => {
245
- t = n, e = u;
246
- });
247
- s.status = "pending", s.catch(() => {
248
- });
249
- function r(n) {
250
- Object.assign(s, n), delete s.resolve, delete s.reject;
251
- }
252
- return s.resolve = (n) => {
253
- r({
254
- status: "fulfilled",
255
- value: n
256
- }), t(n);
257
- }, s.reject = (n) => {
258
- r({
259
- status: "rejected",
260
- reason: n
261
- }), e(n);
262
- }, s;
263
- }
264
- function ft(t) {
265
- return Math.min(1e3 * 2 ** t, 3e4);
266
- }
267
- function et(t) {
268
- return (t ?? "online") === "online" ? Ze.isOnline() : !0;
269
- }
270
- var tt = class extends Error {
271
- constructor(t) {
272
- super("CancelledError"), this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
273
- }
274
- };
275
- function ve(t) {
276
- return t instanceof tt;
277
- }
278
- function dt(t) {
279
- let e = !1, s = 0, r = !1, n;
280
- const u = Fe(), a = (v) => {
281
- var p;
282
- r || (S(new tt(v)), (p = t.abort) == null || p.call(t));
283
- }, c = () => {
284
- e = !0;
285
- }, l = () => {
286
- e = !1;
287
- }, R = () => Ye.isFocused() && (t.networkMode === "always" || Ze.isOnline()) && t.canRun(), m = () => et(t.networkMode) && t.canRun(), o = (v) => {
288
- var p;
289
- r || (r = !0, (p = t.onSuccess) == null || p.call(t, v), n == null || n(), u.resolve(v));
290
- }, S = (v) => {
291
- var p;
292
- r || (r = !0, (p = t.onError) == null || p.call(t, v), n == null || n(), u.reject(v));
293
- }, g = () => new Promise((v) => {
294
- var p;
295
- n = (E) => {
296
- (r || R()) && v(E);
297
- }, (p = t.onPause) == null || p.call(t);
298
- }).then(() => {
299
- var v;
300
- n = void 0, r || (v = t.onContinue) == null || v.call(t);
301
- }), w = () => {
302
- if (r)
303
- return;
304
- let v;
305
- const p = s === 0 ? t.initialPromise : void 0;
306
- try {
307
- v = p ?? t.fn();
308
- } catch (E) {
309
- v = Promise.reject(E);
310
- }
311
- Promise.resolve(v).then(o).catch((E) => {
312
- var ye;
313
- if (r)
314
- return;
315
- const Q = t.retry ?? ($ ? 0 : 3), N = t.retryDelay ?? ft, ce = typeof N == "function" ? N(s, E) : N, le = Q === !0 || typeof Q == "number" && s < Q || typeof Q == "function" && Q(s, E);
316
- if (e || !le) {
317
- S(E);
318
- return;
319
- }
320
- s++, (ye = t.onFail) == null || ye.call(t, s, E), ut(ce).then(() => R() ? void 0 : g()).then(() => {
321
- e ? S(E) : w();
322
- });
323
- });
324
- };
325
- return {
326
- promise: u,
327
- cancel: a,
328
- continue: () => (n == null || n(), u),
329
- cancelRetry: c,
330
- continueRetry: l,
331
- canStart: m,
332
- start: () => (m() ? w() : g().then(w), u)
333
- };
334
- }
335
- function yt() {
336
- let t = [], e = 0, s = (c) => {
337
- c();
338
- }, r = (c) => {
339
- c();
340
- }, n = (c) => setTimeout(c, 0);
341
- const u = (c) => {
342
- e ? t.push(c) : n(() => {
343
- s(c);
344
- });
345
- }, a = () => {
346
- const c = t;
347
- t = [], c.length && n(() => {
348
- r(() => {
349
- c.forEach((l) => {
350
- s(l);
351
- });
352
- });
353
- });
354
- };
355
- return {
356
- batch: (c) => {
357
- let l;
358
- e++;
359
- try {
360
- l = c();
361
- } finally {
362
- e--, e || a();
363
- }
364
- return l;
365
- },
366
- /**
367
- * All calls to the wrapped function will be batched.
368
- */
369
- batchCalls: (c) => (...l) => {
370
- u(() => {
371
- c(...l);
372
- });
373
- },
374
- schedule: u,
375
- /**
376
- * Use this method to set a custom notify function.
377
- * This can be used to for example wrap notifications with `React.act` while running tests.
378
- */
379
- setNotifyFunction: (c) => {
380
- s = c;
381
- },
382
- /**
383
- * Use this method to set a custom function to batch notifications together into a single tick.
384
- * By default React Query will use the batch function provided by ReactDOM or React Native.
385
- */
386
- setBatchNotifyFunction: (c) => {
387
- r = c;
388
- },
389
- setScheduler: (c) => {
390
- n = c;
391
- }
392
- };
393
- }
394
- var qe = yt(), K, $e, pt = ($e = class {
395
- constructor() {
396
- d(this, K);
397
- }
398
- destroy() {
399
- this.clearGcTimeout();
400
- }
401
- scheduleGc() {
402
- this.clearGcTimeout(), me(this.gcTime) && h(this, K, setTimeout(() => {
403
- this.optionalRemove();
404
- }, this.gcTime));
405
- }
406
- updateGcTime(t) {
407
- this.gcTime = Math.max(
408
- this.gcTime || 0,
409
- t ?? ($ ? 1 / 0 : 5 * 60 * 1e3)
410
- );
411
- }
412
- clearGcTimeout() {
413
- i(this, K) && (clearTimeout(i(this, K)), h(this, K, void 0));
414
- }
415
- }, K = new WeakMap(), $e), ee, te, P, H, C, oe, z, U, A, We, Bt = (We = class extends pt {
416
- constructor(e) {
417
- super();
418
- d(this, U);
419
- d(this, ee);
420
- d(this, te);
421
- d(this, P);
422
- d(this, H);
423
- d(this, C);
424
- d(this, oe);
425
- d(this, z);
426
- h(this, z, !1), h(this, oe, e.defaultOptions), this.setOptions(e.options), this.observers = [], h(this, H, e.client), h(this, P, i(this, H).getQueryCache()), this.queryKey = e.queryKey, this.queryHash = e.queryHash, h(this, ee, vt(this.options)), this.state = e.state ?? i(this, ee), this.scheduleGc();
427
- }
428
- get meta() {
429
- return this.options.meta;
430
- }
431
- get promise() {
432
- var e;
433
- return (e = i(this, C)) == null ? void 0 : e.promise;
434
- }
435
- setOptions(e) {
436
- this.options = { ...i(this, oe), ...e }, this.updateGcTime(this.options.gcTime);
437
- }
438
- optionalRemove() {
439
- !this.observers.length && this.state.fetchStatus === "idle" && i(this, P).remove(this);
440
- }
441
- setData(e, s) {
442
- const r = we(this.state.data, e, this.options);
443
- return b(this, U, A).call(this, {
444
- data: r,
445
- type: "success",
446
- dataUpdatedAt: s == null ? void 0 : s.updatedAt,
447
- manual: s == null ? void 0 : s.manual
448
- }), r;
449
- }
450
- setState(e, s) {
451
- b(this, U, A).call(this, { type: "setState", state: e, setStateOptions: s });
452
- }
453
- cancel(e) {
454
- var r, n;
455
- const s = (r = i(this, C)) == null ? void 0 : r.promise;
456
- return (n = i(this, C)) == null || n.cancel(e), s ? s.then(be).catch(be) : Promise.resolve();
457
- }
458
- destroy() {
459
- super.destroy(), this.cancel({ silent: !0 });
460
- }
461
- reset() {
462
- this.destroy(), this.setState(i(this, ee));
463
- }
464
- isActive() {
465
- return this.observers.some(
466
- (e) => j(e.options.enabled, this) !== !1
467
- );
468
- }
469
- isDisabled() {
470
- return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === Ee || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
471
- }
472
- isStale() {
473
- return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
474
- (e) => e.getCurrentResult().isStale
475
- ) : this.state.data === void 0;
476
- }
477
- isStaleByTime(e = 0) {
478
- return this.state.isInvalidated || this.state.data === void 0 || !Xe(this.state.dataUpdatedAt, e);
479
- }
480
- onFocus() {
481
- var s;
482
- const e = this.observers.find((r) => r.shouldFetchOnWindowFocus());
483
- e == null || e.refetch({ cancelRefetch: !1 }), (s = i(this, C)) == null || s.continue();
484
- }
485
- onOnline() {
486
- var s;
487
- const e = this.observers.find((r) => r.shouldFetchOnReconnect());
488
- e == null || e.refetch({ cancelRefetch: !1 }), (s = i(this, C)) == null || s.continue();
489
- }
490
- addObserver(e) {
491
- this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), i(this, P).notify({ type: "observerAdded", query: this, observer: e }));
492
- }
493
- removeObserver(e) {
494
- this.observers.includes(e) && (this.observers = this.observers.filter((s) => s !== e), this.observers.length || (i(this, C) && (i(this, z) ? i(this, C).cancel({ revert: !0 }) : i(this, C).cancelRetry()), this.scheduleGc()), i(this, P).notify({ type: "observerRemoved", query: this, observer: e }));
495
- }
496
- getObserversCount() {
497
- return this.observers.length;
498
- }
499
- invalidate() {
500
- this.state.isInvalidated || b(this, U, A).call(this, { type: "invalidate" });
501
- }
502
- fetch(e, s) {
503
- var l, R, m;
504
- if (this.state.fetchStatus !== "idle") {
505
- if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
506
- this.cancel({ silent: !0 });
507
- else if (i(this, C))
508
- return i(this, C).continueRetry(), i(this, C).promise;
509
- }
510
- if (e && this.setOptions(e), !this.options.queryFn) {
511
- const o = this.observers.find((S) => S.options.queryFn);
512
- o && this.setOptions(o.options);
513
- }
514
- process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
515
- "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']"
516
- ));
517
- const r = new AbortController(), n = (o) => {
518
- Object.defineProperty(o, "signal", {
519
- enumerable: !0,
520
- get: () => (h(this, z, !0), r.signal)
521
- });
522
- }, u = () => {
523
- const o = ht(this.options, s), S = {
524
- client: i(this, H),
525
- queryKey: this.queryKey,
526
- meta: this.meta
527
- };
528
- return n(S), h(this, z, !1), this.options.persister ? this.options.persister(
529
- o,
530
- S,
531
- this
532
- ) : o(S);
533
- }, a = {
534
- fetchOptions: s,
535
- options: this.options,
536
- queryKey: this.queryKey,
537
- client: i(this, H),
538
- state: this.state,
539
- fetchFn: u
540
- };
541
- n(a), (l = this.options.behavior) == null || l.onFetch(
542
- a,
543
- this
544
- ), h(this, te, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((R = a.fetchOptions) == null ? void 0 : R.meta)) && b(this, U, A).call(this, { type: "fetch", meta: (m = a.fetchOptions) == null ? void 0 : m.meta });
545
- const c = (o) => {
546
- var S, g, w, v;
547
- ve(o) && o.silent || b(this, U, A).call(this, {
548
- type: "error",
549
- error: o
550
- }), ve(o) || ((g = (S = i(this, P).config).onError) == null || g.call(
551
- S,
552
- o,
553
- this
554
- ), (v = (w = i(this, P).config).onSettled) == null || v.call(
555
- w,
556
- this.state.data,
557
- o,
558
- this
559
- )), this.scheduleGc();
560
- };
561
- return h(this, C, dt({
562
- initialPromise: s == null ? void 0 : s.initialPromise,
563
- fn: a.fetchFn,
564
- abort: r.abort.bind(r),
565
- onSuccess: (o) => {
566
- var S, g, w, v;
567
- if (o === void 0) {
568
- process.env.NODE_ENV !== "production" && console.error(
569
- `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
570
- ), c(new Error(`${this.queryHash} data is undefined`));
571
- return;
572
- }
573
- try {
574
- this.setData(o);
575
- } catch (p) {
576
- c(p);
577
- return;
578
- }
579
- (g = (S = i(this, P).config).onSuccess) == null || g.call(S, o, this), (v = (w = i(this, P).config).onSettled) == null || v.call(
580
- w,
581
- o,
582
- this.state.error,
583
- this
584
- ), this.scheduleGc();
585
- },
586
- onError: c,
587
- onFail: (o, S) => {
588
- b(this, U, A).call(this, { type: "failed", failureCount: o, error: S });
589
- },
590
- onPause: () => {
591
- b(this, U, A).call(this, { type: "pause" });
592
- },
593
- onContinue: () => {
594
- b(this, U, A).call(this, { type: "continue" });
595
- },
596
- retry: a.options.retry,
597
- retryDelay: a.options.retryDelay,
598
- networkMode: a.options.networkMode,
599
- canRun: () => !0
600
- })), i(this, C).start();
601
- }
602
- }, ee = new WeakMap(), te = new WeakMap(), P = new WeakMap(), H = new WeakMap(), C = new WeakMap(), oe = new WeakMap(), z = new WeakMap(), U = new WeakSet(), A = function(e) {
603
- const s = (r) => {
604
- switch (e.type) {
605
- case "failed":
606
- return {
607
- ...r,
608
- fetchFailureCount: e.failureCount,
609
- fetchFailureReason: e.error
610
- };
611
- case "pause":
612
- return {
613
- ...r,
614
- fetchStatus: "paused"
615
- };
616
- case "continue":
617
- return {
618
- ...r,
619
- fetchStatus: "fetching"
620
- };
621
- case "fetch":
622
- return {
623
- ...r,
624
- ...st(r.data, this.options),
625
- fetchMeta: e.meta ?? null
626
- };
627
- case "success":
628
- return {
629
- ...r,
630
- data: e.data,
631
- dataUpdateCount: r.dataUpdateCount + 1,
632
- dataUpdatedAt: e.dataUpdatedAt ?? Date.now(),
633
- error: null,
634
- isInvalidated: !1,
635
- status: "success",
636
- ...!e.manual && {
637
- fetchStatus: "idle",
638
- fetchFailureCount: 0,
639
- fetchFailureReason: null
640
- }
641
- };
642
- case "error":
643
- const n = e.error;
644
- return ve(n) && n.revert && i(this, te) ? { ...i(this, te), fetchStatus: "idle" } : {
645
- ...r,
646
- error: n,
647
- errorUpdateCount: r.errorUpdateCount + 1,
648
- errorUpdatedAt: Date.now(),
649
- fetchFailureCount: r.fetchFailureCount + 1,
650
- fetchFailureReason: n,
651
- fetchStatus: "idle",
652
- status: "error"
653
- };
654
- case "invalidate":
655
- return {
656
- ...r,
657
- isInvalidated: !0
658
- };
659
- case "setState":
660
- return {
661
- ...r,
662
- ...e.state
663
- };
664
- }
665
- };
666
- this.state = s(this.state), qe.batch(() => {
667
- this.observers.forEach((r) => {
668
- r.onQueryUpdate();
669
- }), i(this, P).notify({ query: this, type: "updated", action: e });
670
- });
671
- }, We);
672
- function st(t, e) {
673
- return {
674
- fetchFailureCount: 0,
675
- fetchFailureReason: null,
676
- fetchStatus: et(e.networkMode) ? "fetching" : "paused",
677
- ...t === void 0 && {
678
- error: null,
679
- status: "pending"
680
- }
681
- };
682
- }
683
- function vt(t) {
684
- 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;
685
- return {
686
- data: e,
687
- dataUpdateCount: 0,
688
- dataUpdatedAt: s ? r ?? Date.now() : 0,
689
- error: null,
690
- errorUpdateCount: 0,
691
- errorUpdatedAt: 0,
692
- fetchFailureCount: 0,
693
- fetchFailureReason: null,
694
- fetchMeta: null,
695
- isInvalidated: !1,
696
- status: s ? "success" : "pending",
697
- fetchStatus: "idle"
698
- };
699
- }
700
- var T, f, ue, O, B, se, k, I, he, re, ie, G, V, L, ne, y, ae, Oe, Te, Pe, De, Ue, je, xe, rt, Je, bt = (Je = class extends Qe {
701
- constructor(e, s) {
702
- super();
703
- d(this, y);
704
- d(this, T);
705
- d(this, f);
706
- d(this, ue);
707
- d(this, O);
708
- d(this, B);
709
- d(this, se);
710
- d(this, k);
711
- d(this, I);
712
- d(this, he);
713
- d(this, re);
714
- // This property keeps track of the last query with defined data.
715
- // It will be used to pass the previous data and query to the placeholder function between renders.
716
- d(this, ie);
717
- d(this, G);
718
- d(this, V);
719
- d(this, L);
720
- d(this, ne, /* @__PURE__ */ new Set());
721
- this.options = s, h(this, T, e), h(this, I, null), h(this, k, Fe()), this.options.experimental_prefetchInRender || i(this, k).reject(
722
- new Error("experimental_prefetchInRender feature flag is not enabled")
723
- ), this.bindMethods(), this.setOptions(s);
724
- }
725
- bindMethods() {
726
- this.refetch = this.refetch.bind(this);
727
- }
728
- onSubscribe() {
729
- this.listeners.size === 1 && (i(this, f).addObserver(this), Ke(i(this, f), this.options) ? b(this, y, ae).call(this) : this.updateResult(), b(this, y, De).call(this));
730
- }
731
- onUnsubscribe() {
732
- this.hasListeners() || this.destroy();
733
- }
734
- shouldFetchOnReconnect() {
735
- return Ie(
736
- i(this, f),
737
- this.options,
738
- this.options.refetchOnReconnect
739
- );
740
- }
741
- shouldFetchOnWindowFocus() {
742
- return Ie(
743
- i(this, f),
744
- this.options,
745
- this.options.refetchOnWindowFocus
746
- );
747
- }
748
- destroy() {
749
- this.listeners = /* @__PURE__ */ new Set(), b(this, y, Ue).call(this), b(this, y, je).call(this), i(this, f).removeObserver(this);
750
- }
751
- setOptions(e, s) {
752
- const r = this.options, n = i(this, f);
753
- if (this.options = i(this, T).defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof j(this.options.enabled, i(this, f)) != "boolean")
754
- throw new Error(
755
- "Expected enabled to be a boolean or a callback that returns a boolean"
756
- );
757
- b(this, y, xe).call(this), i(this, f).setOptions(this.options), r._defaulted && !Se(this.options, r) && i(this, T).getQueryCache().notify({
758
- type: "observerOptionsUpdated",
759
- query: i(this, f),
760
- observer: this
761
- });
762
- const u = this.hasListeners();
763
- u && He(
764
- i(this, f),
765
- n,
766
- this.options,
767
- r
768
- ) && b(this, y, ae).call(this), this.updateResult(s), u && (i(this, f) !== n || j(this.options.enabled, i(this, f)) !== j(r.enabled, i(this, f)) || de(this.options.staleTime, i(this, f)) !== de(r.staleTime, i(this, f))) && b(this, y, Oe).call(this);
769
- const a = b(this, y, Te).call(this);
770
- u && (i(this, f) !== n || j(this.options.enabled, i(this, f)) !== j(r.enabled, i(this, f)) || a !== i(this, L)) && b(this, y, Pe).call(this, a);
771
- }
772
- getOptimisticResult(e) {
773
- const s = i(this, T).getQueryCache().build(i(this, T), e), r = this.createResult(s, e);
774
- return gt(this, r) && (h(this, O, r), h(this, se, this.options), h(this, B, i(this, f).state)), r;
775
- }
776
- getCurrentResult() {
777
- return i(this, O);
778
- }
779
- trackResult(e, s) {
780
- const r = {};
781
- return Object.keys(e).forEach((n) => {
782
- Object.defineProperty(r, n, {
783
- configurable: !1,
784
- enumerable: !0,
785
- get: () => (this.trackProp(n), s == null || s(n), e[n])
786
- });
787
- }), r;
788
- }
789
- trackProp(e) {
790
- i(this, ne).add(e);
791
- }
792
- getCurrentQuery() {
793
- return i(this, f);
794
- }
795
- refetch({ ...e } = {}) {
796
- return this.fetch({
797
- ...e
798
- });
799
- }
800
- fetchOptimistic(e) {
801
- const s = i(this, T).defaultQueryOptions(e), r = i(this, T).getQueryCache().build(i(this, T), s);
802
- return r.fetch().then(() => this.createResult(r, s));
803
- }
804
- fetch(e) {
805
- return b(this, y, ae).call(this, {
806
- ...e,
807
- cancelRefetch: e.cancelRefetch ?? !0
808
- }).then(() => (this.updateResult(), i(this, O)));
809
- }
810
- createResult(e, s) {
811
- var ke;
812
- const r = i(this, f), n = this.options, u = i(this, O), a = i(this, B), c = i(this, se), R = e !== r ? e.state : i(this, ue), { state: m } = e;
813
- let o = { ...m }, S = !1, g;
814
- if (s._optimisticResults) {
815
- const F = this.hasListeners(), W = !F && Ke(e, s), J = F && He(e, r, s, n);
816
- (W || J) && (o = {
817
- ...o,
818
- ...st(m.data, e.options)
819
- }), s._optimisticResults === "isRestoring" && (o.fetchStatus = "idle");
820
- }
821
- let { error: w, errorUpdatedAt: v, status: p } = o;
822
- if (s.select && o.data !== void 0)
823
- if (u && o.data === (a == null ? void 0 : a.data) && s.select === i(this, he))
824
- g = i(this, re);
825
- else
826
- try {
827
- h(this, he, s.select), g = s.select(o.data), g = we(u == null ? void 0 : u.data, g, s), h(this, re, g), h(this, I, null);
828
- } catch (F) {
829
- h(this, I, F);
830
- }
831
- else
832
- g = o.data;
833
- if (s.placeholderData !== void 0 && g === void 0 && p === "pending") {
834
- let F;
835
- if (u != null && u.isPlaceholderData && s.placeholderData === (c == null ? void 0 : c.placeholderData))
836
- F = u.data;
837
- else if (F = typeof s.placeholderData == "function" ? s.placeholderData(
838
- (ke = i(this, ie)) == null ? void 0 : ke.state.data,
839
- i(this, ie)
840
- ) : s.placeholderData, s.select && F !== void 0)
841
- try {
842
- F = s.select(F), h(this, I, null);
843
- } catch (W) {
844
- h(this, I, W);
845
- }
846
- F !== void 0 && (p = "success", g = we(
847
- u == null ? void 0 : u.data,
848
- F,
849
- s
850
- ), S = !0);
851
- }
852
- i(this, I) && (w = i(this, I), g = i(this, re), v = Date.now(), p = "error");
853
- const E = o.fetchStatus === "fetching", Q = p === "pending", N = p === "error", ce = Q && E, le = g !== void 0, x = {
854
- status: p,
855
- fetchStatus: o.fetchStatus,
856
- isPending: Q,
857
- isSuccess: p === "success",
858
- isError: N,
859
- isInitialLoading: ce,
860
- isLoading: ce,
861
- data: g,
862
- dataUpdatedAt: o.dataUpdatedAt,
863
- error: w,
864
- errorUpdatedAt: v,
865
- failureCount: o.fetchFailureCount,
866
- failureReason: o.fetchFailureReason,
867
- errorUpdateCount: o.errorUpdateCount,
868
- isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
869
- isFetchedAfterMount: o.dataUpdateCount > R.dataUpdateCount || o.errorUpdateCount > R.errorUpdateCount,
870
- isFetching: E,
871
- isRefetching: E && !Q,
872
- isLoadingError: N && !le,
873
- isPaused: o.fetchStatus === "paused",
874
- isPlaceholderData: S,
875
- isRefetchError: N && le,
876
- isStale: Me(e, s),
877
- refetch: this.refetch,
878
- promise: i(this, k)
879
- };
880
- if (this.options.experimental_prefetchInRender) {
881
- const F = (fe) => {
882
- x.status === "error" ? fe.reject(x.error) : x.data !== void 0 && fe.resolve(x.data);
883
- }, W = () => {
884
- const fe = h(this, k, x.promise = Fe());
885
- F(fe);
886
- }, J = i(this, k);
887
- switch (J.status) {
888
- case "pending":
889
- e.queryHash === r.queryHash && F(J);
890
- break;
891
- case "fulfilled":
892
- (x.status === "error" || x.data !== J.value) && W();
893
- break;
894
- case "rejected":
895
- (x.status !== "error" || x.error !== J.reason) && W();
896
- break;
897
- }
898
- }
899
- return x;
900
- }
901
- updateResult(e) {
902
- const s = i(this, O), r = this.createResult(i(this, f), this.options);
903
- if (h(this, B, i(this, f).state), h(this, se, this.options), i(this, B).data !== void 0 && h(this, ie, i(this, f)), Se(r, s))
904
- return;
905
- h(this, O, r);
906
- const n = {}, u = () => {
907
- if (!s)
908
- return !0;
909
- const { notifyOnChangeProps: a } = this.options, c = typeof a == "function" ? a() : a;
910
- if (c === "all" || !c && !i(this, ne).size)
911
- return !0;
912
- const l = new Set(
913
- c ?? i(this, ne)
914
- );
915
- return this.options.throwOnError && l.add("error"), Object.keys(i(this, O)).some((R) => {
916
- const m = R;
917
- return i(this, O)[m] !== s[m] && l.has(m);
918
- });
919
- };
920
- (e == null ? void 0 : e.listeners) !== !1 && u() && (n.listeners = !0), b(this, y, rt).call(this, { ...n, ...e });
921
- }
922
- onQueryUpdate() {
923
- this.updateResult(), this.hasListeners() && b(this, y, De).call(this);
924
- }
925
- }, T = new WeakMap(), f = new WeakMap(), ue = new WeakMap(), O = new WeakMap(), B = new WeakMap(), se = new WeakMap(), k = new WeakMap(), I = new WeakMap(), he = new WeakMap(), re = new WeakMap(), ie = new WeakMap(), G = new WeakMap(), V = new WeakMap(), L = new WeakMap(), ne = new WeakMap(), y = new WeakSet(), ae = function(e) {
926
- b(this, y, xe).call(this);
927
- let s = i(this, f).fetch(
928
- this.options,
929
- e
930
- );
931
- return e != null && e.throwOnError || (s = s.catch(be)), s;
932
- }, Oe = function() {
933
- b(this, y, Ue).call(this);
934
- const e = de(
935
- this.options.staleTime,
936
- i(this, f)
937
- );
938
- if ($ || i(this, O).isStale || !me(e))
939
- return;
940
- const r = Xe(i(this, O).dataUpdatedAt, e) + 1;
941
- h(this, G, setTimeout(() => {
942
- i(this, O).isStale || this.updateResult();
943
- }, r));
944
- }, Te = function() {
945
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(i(this, f)) : this.options.refetchInterval) ?? !1;
946
- }, Pe = function(e) {
947
- b(this, y, je).call(this), h(this, L, e), !($ || j(this.options.enabled, i(this, f)) === !1 || !me(i(this, L)) || i(this, L) === 0) && h(this, V, setInterval(() => {
948
- (this.options.refetchIntervalInBackground || Ye.isFocused()) && b(this, y, ae).call(this);
949
- }, i(this, L)));
950
- }, De = function() {
951
- b(this, y, Oe).call(this), b(this, y, Pe).call(this, b(this, y, Te).call(this));
952
- }, Ue = function() {
953
- i(this, G) && (clearTimeout(i(this, G)), h(this, G, void 0));
954
- }, je = function() {
955
- i(this, V) && (clearInterval(i(this, V)), h(this, V, void 0));
956
- }, xe = function() {
957
- const e = i(this, T).getQueryCache().build(i(this, T), this.options);
958
- if (e === i(this, f))
959
- return;
960
- const s = i(this, f);
961
- h(this, f, e), h(this, ue, e.state), this.hasListeners() && (s == null || s.removeObserver(this), e.addObserver(this));
962
- }, rt = function(e) {
963
- qe.batch(() => {
964
- e.listeners && this.listeners.forEach((s) => {
965
- s(i(this, O));
966
- }), i(this, T).getQueryCache().notify({
967
- query: i(this, f),
968
- type: "observerResultsUpdated"
969
- });
970
- });
971
- }, Je);
972
- function mt(t, e) {
973
- return j(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
974
- }
975
- function Ke(t, e) {
976
- return mt(t, e) || t.state.data !== void 0 && Ie(t, e, e.refetchOnMount);
977
- }
978
- function Ie(t, e, s) {
979
- if (j(e.enabled, t) !== !1) {
980
- const r = typeof s == "function" ? s(t) : s;
981
- return r === "always" || r !== !1 && Me(t, e);
982
- }
983
- return !1;
984
- }
985
- function He(t, e, s, r) {
986
- return (t !== e || j(r.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && Me(t, s);
987
- }
988
- function Me(t, e) {
989
- return j(e.enabled, t) !== !1 && t.isStaleByTime(de(e.staleTime, t));
990
- }
991
- function gt(t, e) {
992
- return !Se(t.getCurrentResult(), e);
993
- }
994
- var it = D.createContext(
995
- void 0
996
- ), Rt = (t) => {
997
- const e = D.useContext(it);
998
- if (t)
999
- return t;
1000
- if (!e)
1001
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1002
- return e;
1003
- }, Gt = ({
1004
- client: t,
1005
- children: e
1006
- }) => (D.useEffect(() => (t.mount(), () => {
1007
- t.unmount();
1008
- }), [t]), /* @__PURE__ */ at.jsx(it.Provider, { value: t, children: e })), nt = D.createContext(!1), St = () => D.useContext(nt);
1009
- nt.Provider;
1010
- function Ct() {
1011
- let t = !1;
1012
- return {
1013
- clearReset: () => {
1014
- t = !1;
1015
- },
1016
- reset: () => {
1017
- t = !0;
1018
- },
1019
- isReset: () => t
1020
- };
1021
- }
1022
- var wt = D.createContext(Ct()), Et = () => D.useContext(wt);
1023
- function Ft(t, e) {
1024
- return typeof t == "function" ? t(...e) : !!t;
1025
- }
1026
- function ze() {
1027
- }
1028
- var Ot = (t, e) => {
1029
- (t.suspense || t.throwOnError || t.experimental_prefetchInRender) && (e.isReset() || (t.retryOnMount = !1));
1030
- }, Tt = (t) => {
1031
- D.useEffect(() => {
1032
- t.clearReset();
1033
- }, [t]);
1034
- }, Pt = ({
1035
- result: t,
1036
- errorResetBoundary: e,
1037
- throwOnError: s,
1038
- query: r,
1039
- suspense: n
1040
- }) => t.isError && !e.isReset() && !t.isFetching && r && (n && t.data === void 0 || Ft(s, [t.error, r])), Vt = (t, e) => e.state.data === void 0, Dt = (t) => {
1041
- const e = t.staleTime;
1042
- t.suspense && (t.staleTime = typeof e == "function" ? (...s) => Math.max(e(...s), 1e3) : Math.max(e ?? 1e3, 1e3), typeof t.gcTime == "number" && (t.gcTime = Math.max(t.gcTime, 1e3)));
1043
- }, Ut = (t, e) => t.isLoading && t.isFetching && !e, jt = (t, e) => (t == null ? void 0 : t.suspense) && e.isPending, Be = (t, e, s) => e.fetchOptimistic(t).catch(() => {
1044
- s.clearReset();
1045
- });
1046
- function xt(t, e, s) {
1047
- var o, S, g, w, v;
1048
- if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
1049
- throw new Error(
1050
- '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'
1051
- );
1052
- const r = Rt(s), n = St(), u = Et(), a = r.defaultQueryOptions(t);
1053
- (S = (o = r.getDefaultOptions().queries) == null ? void 0 : o._experimental_beforeQuery) == null || S.call(
1054
- o,
1055
- a
1056
- ), a._optimisticResults = n ? "isRestoring" : "optimistic", Dt(a), Ot(a, u), Tt(u);
1057
- const c = !r.getQueryCache().get(a.queryHash), [l] = D.useState(
1058
- () => new e(
1059
- r,
1060
- a
1061
- )
1062
- ), R = l.getOptimisticResult(a), m = !n && t.subscribed !== !1;
1063
- if (D.useSyncExternalStore(
1064
- D.useCallback(
1065
- (p) => {
1066
- const E = m ? l.subscribe(qe.batchCalls(p)) : ze;
1067
- return l.updateResult(), E;
1068
- },
1069
- [l, m]
1070
- ),
1071
- () => l.getCurrentResult(),
1072
- () => l.getCurrentResult()
1073
- ), D.useEffect(() => {
1074
- l.setOptions(a, { listeners: !1 });
1075
- }, [a, l]), jt(a, R))
1076
- throw Be(a, l, u);
1077
- if (Pt({
1078
- result: R,
1079
- errorResetBoundary: u,
1080
- throwOnError: a.throwOnError,
1081
- query: r.getQueryCache().get(a.queryHash),
1082
- suspense: a.suspense
1083
- }))
1084
- throw R.error;
1085
- if ((w = (g = r.getDefaultOptions().queries) == null ? void 0 : g._experimental_afterQuery) == null || w.call(
1086
- g,
1087
- a,
1088
- R
1089
- ), a.experimental_prefetchInRender && !$ && Ut(R, n)) {
1090
- const p = c ? (
1091
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1092
- Be(a, l, u)
1093
- ) : (
1094
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1095
- (v = r.getQueryCache().get(a.queryHash)) == null ? void 0 : v.promise
1096
- );
1097
- p == null || p.catch(ze).finally(() => {
1098
- l.updateResult();
1099
- });
1100
- }
1101
- return a.notifyOnChangeProps ? R : l.trackResult(R);
1102
- }
1103
- function $t(t, e) {
1104
- return xt(t, bt, e);
1105
- }
1106
- const It = /^(\w+:\/\/[^/?]+)?([^?]*)(\?.*)?$/, Qt = (t) => t.filter(
1107
- (e) => e != null && e !== !1 && (typeof e == "string" || typeof e == "number")
1108
- ).map((e) => `${e}`).filter((e) => e), At = (t) => {
1109
- const e = t.join("/"), [, s = "", r = ""] = e.match(It) ?? [];
1110
- return {
1111
- prefix: s,
1112
- pathname: r.split("/").filter((n) => n !== "")
1113
- };
1114
- }, qt = (t) => {
1115
- const { prefix: e, pathname: s } = t;
1116
- let r = e;
1117
- return s.length > 0 ? (r ? r += "/" : r = "/", r += s.join("/")) : r || (r = "/"), r;
1118
- }, Wt = (...t) => {
1119
- const e = Qt(t), s = At(e);
1120
- return qt(s);
1121
- };
1122
- export {
1123
- Gt as A,
1124
- bt as Q,
1125
- pt as R,
1126
- Qe as S,
1127
- ze as a,
1128
- Ft as b,
1129
- dt as c,
1130
- $t as d,
1131
- Ee as e,
1132
- xt as f,
1133
- Vt as g,
1134
- ge as h,
1135
- ot as i,
1136
- Wt as j,
1137
- Kt as k,
1138
- Bt as l,
1139
- Nt as m,
1140
- qe as n,
1141
- _t as o,
1142
- be as p,
1143
- ht as q,
1144
- zt as r,
1145
- Se as s,
1146
- Ht as t,
1147
- Rt as u,
1148
- Ye as v,
1149
- Ze as w,
1150
- de as x,
1151
- Lt as y,
1152
- Ae as z
1153
- };
1154
- //# sourceMappingURL=joinUrl-BjDooT-T.js.map