codeforlife 2.11.5 → 2.11.7

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 (166) hide show
  1. package/dist/Countdown-CL7dyZrl.cjs +2 -0
  2. package/dist/{Countdown-BtUbr1J_.cjs.map → Countdown-CL7dyZrl.cjs.map} +1 -1
  3. package/dist/Countdown-snRYiLrs.js +28 -0
  4. package/dist/{Countdown-DhjAmB0u.js.map → Countdown-snRYiLrs.js.map} +1 -1
  5. package/dist/Image-B_6DmnVe.cjs +2 -0
  6. package/dist/{Image-CgRVUblT.cjs.map → Image-B_6DmnVe.cjs.map} +1 -1
  7. package/dist/{Image-DTOu0h-V.js → Image-mkNhOo5p.js} +3 -3
  8. package/dist/{Image-DTOu0h-V.js.map → Image-mkNhOo5p.js.map} +1 -1
  9. package/dist/LinkButton-BQMG96aQ.cjs +2 -0
  10. package/dist/{LinkButton-Kw2brLTK.cjs.map → LinkButton-BQMG96aQ.cjs.map} +1 -1
  11. package/dist/LinkButton-CRDs950E.js +12 -0
  12. package/dist/{LinkButton-sQ5jgHnX.js.map → LinkButton-CRDs950E.js.map} +1 -1
  13. package/dist/Navigate-Ch0ljYa-.cjs +2 -0
  14. package/dist/{Navigate-CrMwdIBB.cjs.map → Navigate-Ch0ljYa-.cjs.map} +1 -1
  15. package/dist/Navigate-Zt9DRJve.js +25 -0
  16. package/dist/{Navigate-ClPcw87e.js.map → Navigate-Zt9DRJve.js.map} +1 -1
  17. package/dist/api/endpoints/index.cjs.js +1 -1
  18. package/dist/api/endpoints/index.cjs.js.map +1 -1
  19. package/dist/api/endpoints/index.es.js +29 -28
  20. package/dist/api/endpoints/index.es.js.map +1 -1
  21. package/dist/api/index.cjs.js +1 -3
  22. package/dist/api/index.cjs.js.map +1 -1
  23. package/dist/api/index.es.js +33 -515
  24. package/dist/api/index.es.js.map +1 -1
  25. package/dist/api-DIgp_6Vr.cjs +2 -0
  26. package/dist/{api-9cnyvZj7.cjs.map → api-DIgp_6Vr.cjs.map} +1 -1
  27. package/dist/api-G8CV5bUa.cjs +2 -0
  28. package/dist/{api-CAH3GT1O.cjs.map → api-G8CV5bUa.cjs.map} +1 -1
  29. package/dist/{api-BFYu8ZvQ.js → api-uh8UKwsU.js} +25 -25
  30. package/dist/{api-BFYu8ZvQ.js.map → api-uh8UKwsU.js.map} +1 -1
  31. package/dist/auth-B6anBtxF.js +238 -0
  32. package/dist/{auth-Bb8WkZGN.js.map → auth-B6anBtxF.js.map} +1 -1
  33. package/dist/auth-C2OUeLmQ.cjs +2 -0
  34. package/dist/{auth-BwpsrTko.cjs.map → auth-C2OUeLmQ.cjs.map} +1 -1
  35. package/dist/components/form/index.cjs.js +1 -1
  36. package/dist/components/form/index.es.js +1 -1
  37. package/dist/components/index.cjs.js +1 -1
  38. package/dist/components/index.cjs.js.map +1 -1
  39. package/dist/components/index.es.js +118 -118
  40. package/dist/components/index.es.js.map +1 -1
  41. package/dist/components/page/index.cjs.js +1 -1
  42. package/dist/components/page/index.es.js +1 -1
  43. package/dist/components/router/index.cjs.js +1 -1
  44. package/dist/components/router/index.es.js +2 -2
  45. package/dist/components/table/index.cjs.js +1 -1
  46. package/dist/components/table/index.es.js +1 -1
  47. package/dist/features/index.cjs.js +1 -1
  48. package/dist/features/index.cjs.js.map +1 -1
  49. package/dist/features/index.es.js +24 -22
  50. package/dist/features/index.es.js.map +1 -1
  51. package/dist/general-BPbbmkeX.cjs +2 -0
  52. package/dist/{general-Bo6JGvKB.cjs.map → general-BPbbmkeX.cjs.map} +1 -1
  53. package/dist/hooks/index.cjs.js +1 -1
  54. package/dist/hooks/index.es.js +1 -1
  55. package/dist/index-B3QkMBQe.cjs +2 -0
  56. package/dist/{index-5C9hpxRF.cjs.map → index-B3QkMBQe.cjs.map} +1 -1
  57. package/dist/index-BIL7PoEV.js +622 -0
  58. package/dist/index-BIL7PoEV.js.map +1 -0
  59. package/dist/index-C08WO83n.js +237 -0
  60. package/dist/{index-hdS8RgRc.js.map → index-C08WO83n.js.map} +1 -1
  61. package/dist/{index-CHboZsxD.js → index-CDxf6gMv.js} +92 -92
  62. package/dist/{index-CHboZsxD.js.map → index-CDxf6gMv.js.map} +1 -1
  63. package/dist/index-D2B9uIE4.cjs +2 -0
  64. package/dist/{index-B89FjK7v.cjs.map → index-D2B9uIE4.cjs.map} +1 -1
  65. package/dist/index-Dadidnct.cjs +2 -0
  66. package/dist/index-Dadidnct.cjs.map +1 -0
  67. package/dist/index-IXGAdLKG.js +30 -0
  68. package/dist/{index-B3e_XaVG.js.map → index-IXGAdLKG.js.map} +1 -1
  69. package/dist/index-JY2Et3RQ.cjs +2 -0
  70. package/dist/{index-CwC9mpb3.cjs.map → index-JY2Et3RQ.cjs.map} +1 -1
  71. package/dist/{schemas-BMQZbhti.js → schemas-UIk-meAN.js} +2 -2
  72. package/dist/{schemas-BMQZbhti.js.map → schemas-UIk-meAN.js.map} +1 -1
  73. package/dist/schemas-hIW9-H6-.cjs +2 -0
  74. package/dist/{schemas-DXX4rh8i.cjs.map → schemas-hIW9-H6-.cjs.map} +1 -1
  75. package/dist/server/App.cjs.js +1 -1
  76. package/dist/server/App.cjs.js.map +1 -1
  77. package/dist/server/App.es.js +11 -11
  78. package/dist/server/App.es.js.map +1 -1
  79. package/dist/server/entry.cjs.js +1 -1
  80. package/dist/server/entry.cjs.js.map +1 -1
  81. package/dist/server/entry.es.js +17 -17
  82. package/dist/server/entry.es.js.map +1 -1
  83. package/dist/{session-D312kYKk.js → session-COyN01K0.js} +11 -10
  84. package/dist/{session-D312kYKk.js.map → session-COyN01K0.js.map} +1 -1
  85. package/dist/session-eOp0H-EC.cjs +2 -0
  86. package/dist/{session-CacrgFSv.cjs.map → session-eOp0H-EC.cjs.map} +1 -1
  87. package/dist/theme/components/index.cjs.js +1 -1
  88. package/dist/theme/components/index.es.js +1 -1
  89. package/dist/theme/index.cjs.js +1 -1
  90. package/dist/theme/index.cjs.js.map +1 -1
  91. package/dist/theme/index.es.js +49 -49
  92. package/dist/theme/index.es.js.map +1 -1
  93. package/dist/{urls-CGZI0f1w.cjs → urls-2gheISSO.cjs} +2 -2
  94. package/dist/{urls-CGZI0f1w.cjs.map → urls-2gheISSO.cjs.map} +1 -1
  95. package/dist/{urls-DP4a8kxP.js → urls-BG788CnL.js} +2 -2
  96. package/dist/{urls-DP4a8kxP.js.map → urls-BG788CnL.js.map} +1 -1
  97. package/dist/utils/api.cjs.js +1 -1
  98. package/dist/utils/api.es.js +2 -2
  99. package/dist/utils/router.cjs.js +1 -1
  100. package/dist/utils/router.cjs.js.map +1 -1
  101. package/dist/utils/router.es.js +2 -2
  102. package/dist/utils/store.cjs.js +1 -1
  103. package/dist/utils/store.cjs.js.map +1 -1
  104. package/dist/utils/store.es.js +6 -6
  105. package/dist/utils/test.cjs.js +1 -1
  106. package/dist/utils/test.cjs.js.map +1 -1
  107. package/dist/utils/test.es.js +9 -9
  108. package/dist/utils/test.es.js.map +1 -1
  109. package/dist/utils/theme.cjs.js +1 -1
  110. package/dist/utils/theme.es.js +2 -2
  111. package/package.json +1 -1
  112. package/dist/Countdown-BtUbr1J_.cjs +0 -2
  113. package/dist/Countdown-DhjAmB0u.js +0 -28
  114. package/dist/Image-CgRVUblT.cjs +0 -2
  115. package/dist/LinkButton-Kw2brLTK.cjs +0 -2
  116. package/dist/LinkButton-sQ5jgHnX.js +0 -12
  117. package/dist/Navigate-ClPcw87e.js +0 -25
  118. package/dist/Navigate-CrMwdIBB.cjs +0 -2
  119. package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
  120. package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
  121. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
  122. package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  123. package/dist/api-9cnyvZj7.cjs +0 -2
  124. package/dist/api-CAH3GT1O.cjs +0 -2
  125. package/dist/auth-Bb8WkZGN.js +0 -237
  126. package/dist/auth-BwpsrTko.cjs +0 -2
  127. package/dist/client-CUE3jVb4.js +0 -25227
  128. package/dist/client-CUE3jVb4.js.map +0 -1
  129. package/dist/client-C_dmBP2e.cjs +0 -251
  130. package/dist/client-C_dmBP2e.cjs.map +0 -1
  131. package/dist/emotion-server-create-instance.browser.esm-CgeoyX9a.js +0 -2122
  132. package/dist/emotion-server-create-instance.browser.esm-CgeoyX9a.js.map +0 -1
  133. package/dist/emotion-server-create-instance.browser.esm-CpbXhK4a.cjs +0 -6
  134. package/dist/emotion-server-create-instance.browser.esm-CpbXhK4a.cjs.map +0 -1
  135. package/dist/en-gb-B_rK7Jx1.js +0 -20
  136. package/dist/en-gb-B_rK7Jx1.js.map +0 -1
  137. package/dist/en-gb-CpyEkKq3.cjs +0 -2
  138. package/dist/en-gb-CpyEkKq3.cjs.map +0 -1
  139. package/dist/general-Bo6JGvKB.cjs +0 -2
  140. package/dist/index-5C9hpxRF.cjs +0 -2
  141. package/dist/index-B3e_XaVG.js +0 -30
  142. package/dist/index-B89FjK7v.cjs +0 -2
  143. package/dist/index-BRHFlEjS.js +0 -1187
  144. package/dist/index-BRHFlEjS.js.map +0 -1
  145. package/dist/index-CwC9mpb3.cjs +0 -2
  146. package/dist/index-DuArGzQE.cjs +0 -5
  147. package/dist/index-DuArGzQE.cjs.map +0 -1
  148. package/dist/index-hdS8RgRc.js +0 -237
  149. package/dist/jsx-runtime-B2pbW5Fp.cjs +0 -23
  150. package/dist/jsx-runtime-B2pbW5Fp.cjs.map +0 -1
  151. package/dist/jsx-runtime-lzYHhGH3.js +0 -285
  152. package/dist/jsx-runtime-lzYHhGH3.js.map +0 -1
  153. package/dist/rtk-query.modern-CjetfYPg.js +0 -3038
  154. package/dist/rtk-query.modern-CjetfYPg.js.map +0 -1
  155. package/dist/rtk-query.modern-PBCErCqb.cjs +0 -15
  156. package/dist/rtk-query.modern-PBCErCqb.cjs.map +0 -1
  157. package/dist/schemas-DXX4rh8i.cjs +0 -2
  158. package/dist/server.browser-DeLuEZOk.cjs +0 -205
  159. package/dist/server.browser-DeLuEZOk.cjs.map +0 -1
  160. package/dist/server.browser-gAvZ6xhz.js +0 -19744
  161. package/dist/server.browser-gAvZ6xhz.js.map +0 -1
  162. package/dist/session-CacrgFSv.cjs +0 -2
  163. package/dist/style-BgmNVuOg.cjs +0 -2
  164. package/dist/style-BgmNVuOg.cjs.map +0 -1
  165. package/dist/style-C3515J9T.js +0 -5
  166. package/dist/style-C3515J9T.js.map +0 -1
@@ -1,493 +1,11 @@
1
- import { b as ae, c as fe, a as de, d as U, Q as pe, e as le, f as be } from "../rtk-query.modern-CjetfYPg.js";
2
- import { formatProdErrorMessage as oe } from "@reduxjs/toolkit";
3
- import { useStore as ye, useSelector as he, useDispatch as ge, batch as me, shallowEqual as $ } from "react-redux";
4
- import { useCallback as N, useDebugValue as x, useMemo as k, useState as re, useEffect as A, useRef as q, useLayoutEffect as Se } from "react";
5
- import { SERVICE_API_URL as ve } from "../settings/index.es.js";
6
- import { b as Ee } from "../session-D312kYKk.js";
7
- import { getCsrfCookie as J } from "../utils/auth.es.js";
8
- import { i as Qe } from "../api-BFYu8ZvQ.js";
9
- import { s as Be } from "../schemas-BMQZbhti.js";
10
- import { u as Ze } from "../urls-DP4a8kxP.js";
11
- function F(e) {
12
- return e.replace(e[0], e[0].toUpperCase());
13
- }
14
- function ke(e) {
15
- let f = 0;
16
- for (const y in e)
17
- f++;
18
- return f;
19
- }
20
- function Pe(e) {
21
- return e.type === "query";
22
- }
23
- function Oe(e) {
24
- return e.type === "mutation";
25
- }
26
- function se(e) {
27
- return e.type === "infinitequery";
28
- }
29
- function C(e, ...f) {
30
- return Object.assign(e, ...f);
31
- }
32
- var X = Symbol();
33
- function ee(e) {
34
- const f = q(e), y = k(() => le(f.current, e), [e]);
35
- return A(() => {
36
- f.current !== y && (f.current = y);
37
- }, [y]), y;
38
- }
39
- function G(e) {
40
- const f = q(e);
41
- return A(() => {
42
- $(f.current, e) || (f.current = e);
43
- }, [e]), $(f.current, e) ? f.current : e;
44
- }
45
- var Ie = () => typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", De = /* @__PURE__ */ Ie(), we = () => typeof navigator < "u" && navigator.product === "ReactNative", Le = /* @__PURE__ */ we(), Me = () => De || Le ? Se : A, Ue = /* @__PURE__ */ Me(), ie = (e) => e.isUninitialized ? {
46
- ...e,
47
- isUninitialized: !1,
48
- isFetching: !0,
49
- isLoading: e.data === void 0,
50
- status: pe.pending
51
- } : e;
52
- function te(e, ...f) {
53
- const y = {};
54
- return f.forEach((m) => {
55
- y[m] = e[m];
56
- }), y;
57
- }
58
- var ne = ["data", "status", "isLoading", "isSuccess", "isError", "error"];
59
- function qe({
60
- api: e,
61
- moduleOptions: {
62
- batch: f,
63
- hooks: {
64
- useDispatch: y,
65
- useSelector: m,
66
- useStore: I
67
- },
68
- unstable__sideEffectsInRender: h,
69
- createSelector: S
70
- },
71
- serializeQueryArgs: g,
72
- context: D
73
- }) {
74
- const V = h ? (t) => t() : A;
75
- return {
76
- buildQueryHooks: R,
77
- buildInfiniteQueryHooks: Y,
78
- buildMutationHook: Z,
79
- usePrefetch: B
80
- };
81
- function K(t, r, d) {
82
- if (r?.endpointName && t.isUninitialized) {
83
- const {
84
- endpointName: s
85
- } = r, c = D.endpointDefinitions[s];
86
- d !== U && g({
87
- queryArgs: r.originalArgs,
88
- endpointDefinition: c,
89
- endpointName: s
90
- }) === g({
91
- queryArgs: d,
92
- endpointDefinition: c,
93
- endpointName: s
94
- }) && (r = void 0);
95
- }
96
- let u = t.isSuccess ? t.data : r?.data;
97
- u === void 0 && (u = t.data);
98
- const i = u !== void 0, n = t.isLoading, o = (!r || r.isLoading || r.isUninitialized) && !i && n, a = t.isSuccess || i && (n && !r?.isError || t.isUninitialized);
99
- return {
100
- ...t,
101
- data: u,
102
- currentData: t.data,
103
- isFetching: n,
104
- isLoading: o,
105
- isSuccess: a
106
- };
107
- }
108
- function W(t, r, d) {
109
- if (r?.endpointName && t.isUninitialized) {
110
- const {
111
- endpointName: s
112
- } = r, c = D.endpointDefinitions[s];
113
- d !== U && g({
114
- queryArgs: r.originalArgs,
115
- endpointDefinition: c,
116
- endpointName: s
117
- }) === g({
118
- queryArgs: d,
119
- endpointDefinition: c,
120
- endpointName: s
121
- }) && (r = void 0);
122
- }
123
- let u = t.isSuccess ? t.data : r?.data;
124
- u === void 0 && (u = t.data);
125
- const i = u !== void 0, n = t.isLoading, o = (!r || r.isLoading || r.isUninitialized) && !i && n, a = t.isSuccess || n && i;
126
- return {
127
- ...t,
128
- data: u,
129
- currentData: t.data,
130
- isFetching: n,
131
- isLoading: o,
132
- isSuccess: a
133
- };
134
- }
135
- function B(t, r) {
136
- const d = y(), u = G(r);
137
- return N((i, n) => d(e.util.prefetch(t, i, {
138
- ...u,
139
- ...n
140
- })), [t, d, u]);
141
- }
142
- function P(t, r, {
143
- refetchOnReconnect: d,
144
- refetchOnFocus: u,
145
- refetchOnMountOrArgChange: i,
146
- skip: n = !1,
147
- pollingInterval: o = 0,
148
- skipPollingIfUnfocused: a = !1,
149
- ...s
150
- } = {}) {
151
- const {
152
- initiate: c
153
- } = e.endpoints[t], l = y(), O = q(void 0);
154
- if (!O.current) {
155
- const M = l(e.internalActions.internal_getRTKQSubscriptions());
156
- if (process.env.NODE_ENV !== "production" && (typeof M != "object" || typeof M?.type == "string"))
157
- throw new Error(process.env.NODE_ENV === "production" ? oe(37) : `Warning: Middleware for RTK-Query API at reducerPath "${e.reducerPath}" has not been added to the store.
158
- You must add the middleware for RTK-Query to function correctly!`);
159
- O.current = M;
160
- }
161
- const p = ee(n ? U : r), b = G({
162
- refetchOnReconnect: d,
163
- refetchOnFocus: u,
164
- pollingInterval: o,
165
- skipPollingIfUnfocused: a
166
- }), v = s.initialPageParam, E = G(v), Q = q(void 0);
167
- let {
168
- queryCacheKey: L,
169
- requestId: H
170
- } = Q.current || {}, z = !1;
171
- L && H && (z = O.current.isRequestSubscribed(L, H));
172
- const j = !z && Q.current !== void 0;
173
- return V(() => {
174
- j && (Q.current = void 0);
175
- }, [j]), V(() => {
176
- const M = Q.current;
177
- if (typeof process < "u" && process.env.NODE_ENV === "removeMeOnCompilation" && console.log(j), p === U) {
178
- M?.unsubscribe(), Q.current = void 0;
179
- return;
180
- }
181
- const ue = Q.current?.subscriptionOptions;
182
- if (!M || M.arg !== p) {
183
- M?.unsubscribe();
184
- const ce = l(c(p, {
185
- subscriptionOptions: b,
186
- forceRefetch: i,
187
- ...se(D.endpointDefinitions[t]) ? {
188
- initialPageParam: E
189
- } : {}
190
- }));
191
- Q.current = ce;
192
- } else b !== ue && M.updateSubscriptionOptions(b);
193
- }, [l, c, i, p, b, j, E, t]), [Q, l, c, b];
194
- }
195
- function T(t, r) {
196
- return (u, {
197
- skip: i = !1,
198
- selectFromResult: n
199
- } = {}) => {
200
- const {
201
- select: o
202
- } = e.endpoints[t], a = ee(i ? U : u), s = q(void 0), c = k(() => (
203
- // Normally ts-ignores are bad and should be avoided, but we're
204
- // already casting this selector to be `Selector<any>` anyway,
205
- // so the inconsistencies don't matter here
206
- // @ts-ignore
207
- S([
208
- // @ts-ignore
209
- o(a),
210
- (v, E) => E,
211
- (v) => a
212
- ], r, {
213
- memoizeOptions: {
214
- resultEqualityCheck: $
215
- }
216
- })
217
- ), [o, a]), l = k(() => n ? S([c], n, {
218
- devModeChecks: {
219
- identityFunctionCheck: "never"
220
- }
221
- }) : c, [c, n]), O = m((v) => l(v, s.current), $), p = I(), b = c(p.getState(), s.current);
222
- return Ue(() => {
223
- s.current = b;
224
- }, [b]), O;
225
- };
226
- }
227
- function w(t) {
228
- A(() => () => {
229
- t.current?.unsubscribe?.(), t.current = void 0;
230
- }, [t]);
231
- }
232
- function _(t) {
233
- if (!t.current) throw new Error(process.env.NODE_ENV === "production" ? oe(38) : "Cannot refetch a query that has not been started yet.");
234
- return t.current.refetch();
235
- }
236
- function R(t) {
237
- const r = (i, n = {}) => {
238
- const [o] = P(t, i, n);
239
- return w(o), k(() => ({
240
- /**
241
- * A method to manually refetch data for the query
242
- */
243
- refetch: () => _(o)
244
- }), [o]);
245
- }, d = ({
246
- refetchOnReconnect: i,
247
- refetchOnFocus: n,
248
- pollingInterval: o = 0,
249
- skipPollingIfUnfocused: a = !1
250
- } = {}) => {
251
- const {
252
- initiate: s
253
- } = e.endpoints[t], c = y(), [l, O] = re(X), p = q(void 0), b = G({
254
- refetchOnReconnect: i,
255
- refetchOnFocus: n,
256
- pollingInterval: o,
257
- skipPollingIfUnfocused: a
258
- });
259
- V(() => {
260
- const L = p.current?.subscriptionOptions;
261
- b !== L && p.current?.updateSubscriptionOptions(b);
262
- }, [b]);
263
- const v = q(b);
264
- V(() => {
265
- v.current = b;
266
- }, [b]);
267
- const E = N(function(L, H = !1) {
268
- let z;
269
- return f(() => {
270
- p.current?.unsubscribe(), p.current = z = c(s(L, {
271
- subscriptionOptions: v.current,
272
- forceRefetch: !H
273
- })), O(L);
274
- }), z;
275
- }, [c, s]), Q = N(() => {
276
- p.current?.queryCacheKey && c(e.internalActions.removeQueryResult({
277
- queryCacheKey: p.current?.queryCacheKey
278
- }));
279
- }, [c]);
280
- return A(() => () => {
281
- p?.current?.unsubscribe();
282
- }, []), A(() => {
283
- l !== X && !p.current && E(l, !0);
284
- }, [l, E]), k(() => [E, l, {
285
- reset: Q
286
- }], [E, l, Q]);
287
- }, u = T(t, K);
288
- return {
289
- useQueryState: u,
290
- useQuerySubscription: r,
291
- useLazyQuerySubscription: d,
292
- useLazyQuery(i) {
293
- const [n, o, {
294
- reset: a
295
- }] = d(i), s = u(o, {
296
- ...i,
297
- skip: o === X
298
- }), c = k(() => ({
299
- lastArg: o
300
- }), [o]);
301
- return k(() => [n, {
302
- ...s,
303
- reset: a
304
- }, c], [n, s, a, c]);
305
- },
306
- useQuery(i, n) {
307
- const o = r(i, n), a = u(i, {
308
- selectFromResult: i === U || n?.skip ? void 0 : ie,
309
- ...n
310
- }), s = te(a, ...ne);
311
- return x(s), k(() => ({
312
- ...a,
313
- ...o
314
- }), [a, o]);
315
- }
316
- };
317
- }
318
- function Y(t) {
319
- const r = (u, i = {}) => {
320
- const [n, o, a, s] = P(t, u, i), c = q(s);
321
- V(() => {
322
- c.current = s;
323
- }, [s]);
324
- const l = N(function(b, v) {
325
- let E;
326
- return f(() => {
327
- n.current?.unsubscribe(), n.current = E = o(a(b, {
328
- subscriptionOptions: c.current,
329
- direction: v
330
- }));
331
- }), E;
332
- }, [n, o, a]);
333
- w(n);
334
- const O = ee(i.skip ? U : u), p = N(() => _(n), [n]);
335
- return k(() => ({
336
- trigger: l,
337
- /**
338
- * A method to manually refetch data for the query
339
- */
340
- refetch: p,
341
- fetchNextPage: () => l(O, "forward"),
342
- fetchPreviousPage: () => l(O, "backward")
343
- }), [p, l, O]);
344
- }, d = T(t, W);
345
- return {
346
- useInfiniteQueryState: d,
347
- useInfiniteQuerySubscription: r,
348
- useInfiniteQuery(u, i) {
349
- const {
350
- refetch: n,
351
- fetchNextPage: o,
352
- fetchPreviousPage: a
353
- } = r(u, i), s = d(u, {
354
- selectFromResult: u === U || i?.skip ? void 0 : ie,
355
- ...i
356
- }), c = te(s, ...ne, "hasNextPage", "hasPreviousPage");
357
- return x(c), k(() => ({
358
- ...s,
359
- fetchNextPage: o,
360
- fetchPreviousPage: a,
361
- refetch: n
362
- }), [s, o, a, n]);
363
- }
364
- };
365
- }
366
- function Z(t) {
367
- return ({
368
- selectFromResult: r,
369
- fixedCacheKey: d
370
- } = {}) => {
371
- const {
372
- select: u,
373
- initiate: i
374
- } = e.endpoints[t], n = y(), [o, a] = re();
375
- A(() => () => {
376
- o?.arg.fixedCacheKey || o?.reset();
377
- }, [o]);
378
- const s = N(function(L) {
379
- const H = n(i(L, {
380
- fixedCacheKey: d
381
- }));
382
- return a(H), H;
383
- }, [n, i, d]), {
384
- requestId: c
385
- } = o || {}, l = k(() => u({
386
- fixedCacheKey: d,
387
- requestId: o?.requestId
388
- }), [d, o, u]), O = k(() => r ? S([l], r) : l, [r, l]), p = m(O, $), b = d == null ? o?.arg.originalArgs : void 0, v = N(() => {
389
- f(() => {
390
- o && a(void 0), d && n(e.internalActions.removeMutationResult({
391
- requestId: c,
392
- fixedCacheKey: d
393
- }));
394
- });
395
- }, [n, d, o, c]), E = te(p, ...ne, "endpointName");
396
- x(E);
397
- const Q = k(() => ({
398
- ...p,
399
- originalArgs: b,
400
- reset: v
401
- }), [p, b, v]);
402
- return k(() => [s, Q], [s, Q]);
403
- };
404
- }
405
- }
406
- var Ae = /* @__PURE__ */ Symbol(), Ve = ({
407
- batch: e = me,
408
- hooks: f = {
409
- useDispatch: ge,
410
- useSelector: he,
411
- useStore: ye
412
- },
413
- createSelector: y = de,
414
- unstable__sideEffectsInRender: m = !1,
415
- ...I
416
- } = {}) => {
417
- if (process.env.NODE_ENV !== "production") {
418
- const h = ["useDispatch", "useSelector", "useStore"];
419
- let S = !1;
420
- for (const g of h)
421
- if (ke(I) > 0 && (I[g] && (S || (console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`"), S = !0)), f[g] = I[g]), typeof f[g] != "function")
422
- throw new Error(process.env.NODE_ENV === "production" ? oe(36) : `When using custom hooks for context, all ${h.length} hooks need to be provided: ${h.join(", ")}.
423
- Hook ${g} was either not provided or not a function.`);
424
- }
425
- return {
426
- name: Ae,
427
- init(h, {
428
- serializeQueryArgs: S
429
- }, g) {
430
- const D = h, {
431
- buildQueryHooks: V,
432
- buildInfiniteQueryHooks: K,
433
- buildMutationHook: W,
434
- usePrefetch: B
435
- } = qe({
436
- api: h,
437
- moduleOptions: {
438
- batch: e,
439
- hooks: f,
440
- unstable__sideEffectsInRender: m,
441
- createSelector: y
442
- },
443
- serializeQueryArgs: S,
444
- context: g
445
- });
446
- return C(D, {
447
- usePrefetch: B
448
- }), C(g, {
449
- batch: e
450
- }), {
451
- injectEndpoint(P, T) {
452
- if (Pe(T)) {
453
- const {
454
- useQuery: w,
455
- useLazyQuery: _,
456
- useLazyQuerySubscription: R,
457
- useQueryState: Y,
458
- useQuerySubscription: Z
459
- } = V(P);
460
- C(D.endpoints[P], {
461
- useQuery: w,
462
- useLazyQuery: _,
463
- useLazyQuerySubscription: R,
464
- useQueryState: Y,
465
- useQuerySubscription: Z
466
- }), h[`use${F(P)}Query`] = w, h[`useLazy${F(P)}Query`] = _;
467
- }
468
- if (Oe(T)) {
469
- const w = W(P);
470
- C(D.endpoints[P], {
471
- useMutation: w
472
- }), h[`use${F(P)}Mutation`] = w;
473
- } else if (se(T)) {
474
- const {
475
- useInfiniteQuery: w,
476
- useInfiniteQuerySubscription: _,
477
- useInfiniteQueryState: R
478
- } = K(P);
479
- C(D.endpoints[P], {
480
- useInfiniteQuery: w,
481
- useInfiniteQuerySubscription: _,
482
- useInfiniteQueryState: R
483
- }), h[`use${F(P)}InfiniteQuery`] = w;
484
- }
485
- }
486
- };
487
- }
488
- };
489
- }, _e = /* @__PURE__ */ ae(fe(), Ve());
490
- const He = [
1
+ import { fetchBaseQuery as f, createApi as m } from "@reduxjs/toolkit/query/react";
2
+ import { SERVICE_API_URL as u } from "../settings/index.es.js";
3
+ import { b as d } from "../session-COyN01K0.js";
4
+ import { getCsrfCookie as s } from "../utils/auth.es.js";
5
+ import { i as l } from "../api-uh8UKwsU.js";
6
+ import { s as C } from "../schemas-UIk-meAN.js";
7
+ import { u as G } from "../urls-BG788CnL.js";
8
+ const y = [
491
9
  // These are the tags for the common models used throughout our system.
492
10
  // https://github.com/ocadotechnology/codeforlife-package-python/tree/main/codeforlife/user/models
493
11
  // NOTE: Don't use the "Teacher" and "Student" tags. Use "User" instead.
@@ -496,46 +14,46 @@ const He = [
496
14
  "Class",
497
15
  "AuthFactor"
498
16
  ];
499
- function Ge({
500
- tagTypes: e = []
17
+ function b({
18
+ tagTypes: c = []
501
19
  } = {}) {
502
- const f = be({
503
- baseUrl: `${ve}/`,
20
+ const i = f({
21
+ baseUrl: `${u}/`,
504
22
  credentials: "include",
505
- prepareHeaders: (m, I) => {
506
- const { type: h, arg: S } = I, g = typeof S == "string" ? "GET" : S.method || "GET";
507
- if (h === "mutation" || !Qe(g)) {
508
- const D = J();
509
- D && m.set("x-csrftoken", D);
23
+ prepareHeaders: (t, o) => {
24
+ const { type: r, arg: e } = o, p = typeof e == "string" ? "GET" : e.method || "GET";
25
+ if (r === "mutation" || !l(p)) {
26
+ const a = s();
27
+ a && t.set("x-csrftoken", a);
510
28
  }
511
- return m;
29
+ return t;
512
30
  }
513
- }), y = _e({
31
+ }), n = m({
514
32
  // https://redux-toolkit.js.org/rtk-query/usage/customizing-queries#implementing-a-custom-basequery
515
- baseQuery: async (m, I, h) => {
516
- if (I.type === "mutation" && J() === void 0) {
517
- const { error: S } = await f(
33
+ baseQuery: async (t, o, r) => {
34
+ if (o.type === "mutation" && s() === void 0) {
35
+ const { error: e } = await i(
518
36
  { url: "/csrf/cookie/", method: "GET" },
519
- I,
37
+ o,
520
38
  {}
521
39
  );
522
- S !== void 0 && console.error(S), J();
40
+ e !== void 0 && console.error(e), s();
523
41
  }
524
- return await f(m, I, h);
42
+ return await i(t, o, r);
525
43
  },
526
- tagTypes: [...He, ...e],
44
+ tagTypes: [...y, ...c],
527
45
  endpoints: () => ({})
528
46
  });
529
- return y.injectEndpoints({
530
- endpoints: (m) => ({
531
- logout: Ee(y, m)
47
+ return n.injectEndpoints({
48
+ endpoints: (t) => ({
49
+ logout: d(n, t)
532
50
  })
533
51
  });
534
52
  }
535
53
  export {
536
- Ge as createApi,
537
- Be as schemas,
538
- He as tagTypes,
539
- Ze as urls
54
+ b as createApi,
55
+ C as schemas,
56
+ y as tagTypes,
57
+ G as urls
540
58
  };
541
59
  //# sourceMappingURL=index.es.js.map