zudoku 0.12.2 → 0.13.1

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