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
@@ -0,0 +1,3024 @@
1
+ /**
2
+ * @remix-run/router v1.20.0
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ function I() {
12
+ return I = Object.assign ? Object.assign.bind() : function(e) {
13
+ for (var t = 1; t < arguments.length; t++) {
14
+ var r = arguments[t];
15
+ for (var a in r)
16
+ Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
17
+ }
18
+ return e;
19
+ }, I.apply(this, arguments);
20
+ }
21
+ var $;
22
+ (function(e) {
23
+ e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
24
+ })($ || ($ = {}));
25
+ const Ht = "popstate";
26
+ function Wr(e) {
27
+ e === void 0 && (e = {});
28
+ let {
29
+ initialEntries: t = ["/"],
30
+ initialIndex: r,
31
+ v5Compat: a = !1
32
+ } = e, n;
33
+ n = t.map((h, v) => y(h, typeof h == "string" ? null : h.state, v === 0 ? "default" : void 0));
34
+ let s = d(r ?? n.length - 1), o = $.Pop, c = null;
35
+ function d(h) {
36
+ return Math.min(Math.max(h, 0), n.length - 1);
37
+ }
38
+ function m() {
39
+ return n[s];
40
+ }
41
+ function y(h, v, w) {
42
+ v === void 0 && (v = null);
43
+ let L = ye(n ? m().pathname : "/", h, v, w);
44
+ return le(L.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(h)), L;
45
+ }
46
+ function g(h) {
47
+ return typeof h == "string" ? h : se(h);
48
+ }
49
+ return {
50
+ get index() {
51
+ return s;
52
+ },
53
+ get action() {
54
+ return o;
55
+ },
56
+ get location() {
57
+ return m();
58
+ },
59
+ createHref: g,
60
+ createURL(h) {
61
+ return new URL(g(h), "http://localhost");
62
+ },
63
+ encodeLocation(h) {
64
+ let v = typeof h == "string" ? ie(h) : h;
65
+ return {
66
+ pathname: v.pathname || "",
67
+ search: v.search || "",
68
+ hash: v.hash || ""
69
+ };
70
+ },
71
+ push(h, v) {
72
+ o = $.Push;
73
+ let w = y(h, v);
74
+ s += 1, n.splice(s, n.length, w), a && c && c({
75
+ action: o,
76
+ location: w,
77
+ delta: 1
78
+ });
79
+ },
80
+ replace(h, v) {
81
+ o = $.Replace;
82
+ let w = y(h, v);
83
+ n[s] = w, a && c && c({
84
+ action: o,
85
+ location: w,
86
+ delta: 0
87
+ });
88
+ },
89
+ go(h) {
90
+ o = $.Pop;
91
+ let v = d(s + h), w = n[v];
92
+ s = v, c && c({
93
+ action: o,
94
+ location: w,
95
+ delta: h
96
+ });
97
+ },
98
+ listen(h) {
99
+ return c = h, () => {
100
+ c = null;
101
+ };
102
+ }
103
+ };
104
+ }
105
+ function Kr(e) {
106
+ e === void 0 && (e = {});
107
+ function t(a, n) {
108
+ let {
109
+ pathname: s,
110
+ search: o,
111
+ hash: c
112
+ } = a.location;
113
+ return ye(
114
+ "",
115
+ {
116
+ pathname: s,
117
+ search: o,
118
+ hash: c
119
+ },
120
+ // state defaults to `null` because `window.history.state` does
121
+ n.state && n.state.usr || null,
122
+ n.state && n.state.key || "default"
123
+ );
124
+ }
125
+ function r(a, n) {
126
+ return typeof n == "string" ? n : se(n);
127
+ }
128
+ return qt(t, r, null, e);
129
+ }
130
+ function kr(e) {
131
+ e === void 0 && (e = {});
132
+ function t(n, s) {
133
+ let {
134
+ pathname: o = "/",
135
+ search: c = "",
136
+ hash: d = ""
137
+ } = ie(n.location.hash.substr(1));
138
+ return !o.startsWith("/") && !o.startsWith(".") && (o = "/" + o), ye(
139
+ "",
140
+ {
141
+ pathname: o,
142
+ search: c,
143
+ hash: d
144
+ },
145
+ // state defaults to `null` because `window.history.state` does
146
+ s.state && s.state.usr || null,
147
+ s.state && s.state.key || "default"
148
+ );
149
+ }
150
+ function r(n, s) {
151
+ let o = n.document.querySelector("base"), c = "";
152
+ if (o && o.getAttribute("href")) {
153
+ let d = n.location.href, m = d.indexOf("#");
154
+ c = m === -1 ? d : d.slice(0, m);
155
+ }
156
+ return c + "#" + (typeof s == "string" ? s : se(s));
157
+ }
158
+ function a(n, s) {
159
+ le(n.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(s) + ")");
160
+ }
161
+ return qt(t, r, a, e);
162
+ }
163
+ function B(e, t) {
164
+ if (e === !1 || e === null || typeof e > "u")
165
+ throw new Error(t);
166
+ }
167
+ function le(e, t) {
168
+ if (!e) {
169
+ typeof console < "u" && console.warn(t);
170
+ try {
171
+ throw new Error(t);
172
+ } catch {
173
+ }
174
+ }
175
+ }
176
+ function $r() {
177
+ return Math.random().toString(36).substr(2, 8);
178
+ }
179
+ function zt(e, t) {
180
+ return {
181
+ usr: e.state,
182
+ key: e.key,
183
+ idx: t
184
+ };
185
+ }
186
+ function ye(e, t, r, a) {
187
+ return r === void 0 && (r = null), I({
188
+ pathname: typeof e == "string" ? e : e.pathname,
189
+ search: "",
190
+ hash: ""
191
+ }, typeof t == "string" ? ie(t) : t, {
192
+ state: r,
193
+ // TODO: This could be cleaned up. push/replace should probably just take
194
+ // full Locations now and avoid the need to run through this flow at all
195
+ // But that's a pretty big refactor to the current test suite so going to
196
+ // keep as is for the time being and just let any incoming keys take precedence
197
+ key: t && t.key || a || $r()
198
+ });
199
+ }
200
+ function se(e) {
201
+ let {
202
+ pathname: t = "/",
203
+ search: r = "",
204
+ hash: a = ""
205
+ } = e;
206
+ return r && r !== "?" && (t += r.charAt(0) === "?" ? r : "?" + r), a && a !== "#" && (t += a.charAt(0) === "#" ? a : "#" + a), t;
207
+ }
208
+ function ie(e) {
209
+ let t = {};
210
+ if (e) {
211
+ let r = e.indexOf("#");
212
+ r >= 0 && (t.hash = e.substr(r), e = e.substr(0, r));
213
+ let a = e.indexOf("?");
214
+ a >= 0 && (t.search = e.substr(a), e = e.substr(0, a)), e && (t.pathname = e);
215
+ }
216
+ return t;
217
+ }
218
+ function qt(e, t, r, a) {
219
+ a === void 0 && (a = {});
220
+ let {
221
+ window: n = document.defaultView,
222
+ v5Compat: s = !1
223
+ } = a, o = n.history, c = $.Pop, d = null, m = y();
224
+ m == null && (m = 0, o.replaceState(I({}, o.state, {
225
+ idx: m
226
+ }), ""));
227
+ function y() {
228
+ return (o.state || {
229
+ idx: null
230
+ }).idx;
231
+ }
232
+ function g() {
233
+ c = $.Pop;
234
+ let L = y(), U = L == null ? null : L - m;
235
+ m = L, d && d({
236
+ action: c,
237
+ location: w.location,
238
+ delta: U
239
+ });
240
+ }
241
+ function S(L, U) {
242
+ c = $.Push;
243
+ let x = ye(w.location, L, U);
244
+ r && r(x, L), m = y() + 1;
245
+ let F = zt(x, m), b = w.createHref(x);
246
+ try {
247
+ o.pushState(F, "", b);
248
+ } catch (K) {
249
+ if (K instanceof DOMException && K.name === "DataCloneError")
250
+ throw K;
251
+ n.location.assign(b);
252
+ }
253
+ s && d && d({
254
+ action: c,
255
+ location: w.location,
256
+ delta: 1
257
+ });
258
+ }
259
+ function h(L, U) {
260
+ c = $.Replace;
261
+ let x = ye(w.location, L, U);
262
+ r && r(x, L), m = y();
263
+ let F = zt(x, m), b = w.createHref(x);
264
+ o.replaceState(F, "", b), s && d && d({
265
+ action: c,
266
+ location: w.location,
267
+ delta: 0
268
+ });
269
+ }
270
+ function v(L) {
271
+ let U = n.location.origin !== "null" ? n.location.origin : n.location.href, x = typeof L == "string" ? L : se(L);
272
+ return x = x.replace(/ $/, "%20"), B(U, "No window.location.(origin|href) available to create URL for href: " + x), new URL(x, U);
273
+ }
274
+ let w = {
275
+ get action() {
276
+ return c;
277
+ },
278
+ get location() {
279
+ return e(n, o);
280
+ },
281
+ listen(L) {
282
+ if (d)
283
+ throw new Error("A history only accepts one active listener");
284
+ return n.addEventListener(Ht, g), d = L, () => {
285
+ n.removeEventListener(Ht, g), d = null;
286
+ };
287
+ },
288
+ createHref(L) {
289
+ return t(n, L);
290
+ },
291
+ createURL: v,
292
+ encodeLocation(L) {
293
+ let U = v(L);
294
+ return {
295
+ pathname: U.pathname,
296
+ search: U.search,
297
+ hash: U.hash
298
+ };
299
+ },
300
+ push: S,
301
+ replace: h,
302
+ go(L) {
303
+ return o.go(L);
304
+ }
305
+ };
306
+ return w;
307
+ }
308
+ var H;
309
+ (function(e) {
310
+ e.data = "data", e.deferred = "deferred", e.redirect = "redirect", e.error = "error";
311
+ })(H || (H = {}));
312
+ const Vr = /* @__PURE__ */ new Set(["lazy", "caseSensitive", "path", "id", "index", "children"]);
313
+ function Yr(e) {
314
+ return e.index === !0;
315
+ }
316
+ function Ne(e, t, r, a) {
317
+ return r === void 0 && (r = []), a === void 0 && (a = {}), e.map((n, s) => {
318
+ let o = [...r, String(s)], c = typeof n.id == "string" ? n.id : o.join("-");
319
+ if (B(n.index !== !0 || !n.children, "Cannot specify children on an index route"), B(!a[c], 'Found a route id collision on id "' + c + `". Route id's must be globally unique within Data Router usages`), Yr(n)) {
320
+ let d = I({}, n, t(n), {
321
+ id: c
322
+ });
323
+ return a[c] = d, d;
324
+ } else {
325
+ let d = I({}, n, t(n), {
326
+ id: c,
327
+ children: void 0
328
+ });
329
+ return a[c] = d, n.children && (d.children = Ne(n.children, t, o, a)), d;
330
+ }
331
+ });
332
+ }
333
+ function pe(e, t, r) {
334
+ return r === void 0 && (r = "/"), it(e, t, r, !1);
335
+ }
336
+ function it(e, t, r, a) {
337
+ let n = typeof t == "string" ? ie(t) : t, s = Ye(n.pathname || "/", r);
338
+ if (s == null)
339
+ return null;
340
+ let o = tr(e);
341
+ Jr(o);
342
+ let c = null;
343
+ for (let d = 0; c == null && d < o.length; ++d) {
344
+ let m = ar(s);
345
+ c = aa(o[d], m, a);
346
+ }
347
+ return c;
348
+ }
349
+ function er(e, t) {
350
+ let {
351
+ route: r,
352
+ pathname: a,
353
+ params: n
354
+ } = e;
355
+ return {
356
+ id: r.id,
357
+ pathname: a,
358
+ params: n,
359
+ data: t[r.id],
360
+ handle: r.handle
361
+ };
362
+ }
363
+ function tr(e, t, r, a) {
364
+ t === void 0 && (t = []), r === void 0 && (r = []), a === void 0 && (a = "");
365
+ let n = (s, o, c) => {
366
+ let d = {
367
+ relativePath: c === void 0 ? s.path || "" : c,
368
+ caseSensitive: s.caseSensitive === !0,
369
+ childrenIndex: o,
370
+ route: s
371
+ };
372
+ d.relativePath.startsWith("/") && (B(d.relativePath.startsWith(a), 'Absolute route path "' + d.relativePath + '" nested under path ' + ('"' + a + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes."), d.relativePath = d.relativePath.slice(a.length));
373
+ let m = Ie([a, d.relativePath]), y = r.concat(d);
374
+ s.children && s.children.length > 0 && (B(
375
+ // Our types know better, but runtime JS may not!
376
+ // @ts-expect-error
377
+ s.index !== !0,
378
+ "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + m + '".')
379
+ ), tr(s.children, t, y, m)), !(s.path == null && !s.index) && t.push({
380
+ path: m,
381
+ score: ta(m, s.index),
382
+ routesMeta: y
383
+ });
384
+ };
385
+ return e.forEach((s, o) => {
386
+ var c;
387
+ if (s.path === "" || !((c = s.path) != null && c.includes("?")))
388
+ n(s, o);
389
+ else
390
+ for (let d of rr(s.path))
391
+ n(s, o, d);
392
+ }), t;
393
+ }
394
+ function rr(e) {
395
+ let t = e.split("/");
396
+ if (t.length === 0) return [];
397
+ let [r, ...a] = t, n = r.endsWith("?"), s = r.replace(/\?$/, "");
398
+ if (a.length === 0)
399
+ return n ? [s, ""] : [s];
400
+ let o = rr(a.join("/")), c = [];
401
+ return c.push(...o.map((d) => d === "" ? s : [s, d].join("/"))), n && c.push(...o), c.map((d) => e.startsWith("/") && d === "" ? "/" : d);
402
+ }
403
+ function Jr(e) {
404
+ e.sort((t, r) => t.score !== r.score ? r.score - t.score : ra(t.routesMeta.map((a) => a.childrenIndex), r.routesMeta.map((a) => a.childrenIndex)));
405
+ }
406
+ const Xr = /^:[\w-]+$/, Gr = 3, Qr = 2, Zr = 1, qr = 10, ea = -2, Bt = (e) => e === "*";
407
+ function ta(e, t) {
408
+ let r = e.split("/"), a = r.length;
409
+ return r.some(Bt) && (a += ea), t && (a += Qr), r.filter((n) => !Bt(n)).reduce((n, s) => n + (Xr.test(s) ? Gr : s === "" ? Zr : qr), a);
410
+ }
411
+ function ra(e, t) {
412
+ return e.length === t.length && e.slice(0, -1).every((a, n) => a === t[n]) ? (
413
+ // If two routes are siblings, we should try to match the earlier sibling
414
+ // first. This allows people to have fine-grained control over the matching
415
+ // behavior by simply putting routes with identical paths in the order they
416
+ // want them tried.
417
+ e[e.length - 1] - t[t.length - 1]
418
+ ) : (
419
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
420
+ // so they sort equally.
421
+ 0
422
+ );
423
+ }
424
+ function aa(e, t, r) {
425
+ r === void 0 && (r = !1);
426
+ let {
427
+ routesMeta: a
428
+ } = e, n = {}, s = "/", o = [];
429
+ for (let c = 0; c < a.length; ++c) {
430
+ let d = a[c], m = c === a.length - 1, y = s === "/" ? t : t.slice(s.length) || "/", g = mt({
431
+ path: d.relativePath,
432
+ caseSensitive: d.caseSensitive,
433
+ end: m
434
+ }, y), S = d.route;
435
+ if (!g && m && r && !a[a.length - 1].route.index && (g = mt({
436
+ path: d.relativePath,
437
+ caseSensitive: d.caseSensitive,
438
+ end: !1
439
+ }, y)), !g)
440
+ return null;
441
+ Object.assign(n, g.params), o.push({
442
+ // TODO: Can this as be avoided?
443
+ params: n,
444
+ pathname: Ie([s, g.pathname]),
445
+ pathnameBase: sr(Ie([s, g.pathnameBase])),
446
+ route: S
447
+ }), g.pathnameBase !== "/" && (s = Ie([s, g.pathnameBase]));
448
+ }
449
+ return o;
450
+ }
451
+ function na(e, t) {
452
+ t === void 0 && (t = {});
453
+ let r = e;
454
+ r.endsWith("*") && r !== "*" && !r.endsWith("/*") && (le(!1, 'Route path "' + r + '" will be treated as if it were ' + ('"' + r.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + r.replace(/\*$/, "/*") + '".')), r = r.replace(/\*$/, "/*"));
455
+ const a = r.startsWith("/") ? "/" : "", n = (o) => o == null ? "" : typeof o == "string" ? o : String(o), s = r.split(/\/+/).map((o, c, d) => {
456
+ if (c === d.length - 1 && o === "*")
457
+ return n(t["*"]);
458
+ const y = o.match(/^:([\w-]+)(\??)$/);
459
+ if (y) {
460
+ const [, g, S] = y;
461
+ let h = t[g];
462
+ return B(S === "?" || h != null, 'Missing ":' + g + '" param'), n(h);
463
+ }
464
+ return o.replace(/\?$/g, "");
465
+ }).filter((o) => !!o);
466
+ return a + s.join("/");
467
+ }
468
+ function mt(e, t) {
469
+ typeof e == "string" && (e = {
470
+ path: e,
471
+ caseSensitive: !1,
472
+ end: !0
473
+ });
474
+ let [r, a] = ia(e.path, e.caseSensitive, e.end), n = t.match(r);
475
+ if (!n) return null;
476
+ let s = n[0], o = s.replace(/(.)\/+$/, "$1"), c = n.slice(1);
477
+ return {
478
+ params: a.reduce((m, y, g) => {
479
+ let {
480
+ paramName: S,
481
+ isOptional: h
482
+ } = y;
483
+ if (S === "*") {
484
+ let w = c[g] || "";
485
+ o = s.slice(0, s.length - w.length).replace(/(.)\/+$/, "$1");
486
+ }
487
+ const v = c[g];
488
+ return h && !v ? m[S] = void 0 : m[S] = (v || "").replace(/%2F/g, "/"), m;
489
+ }, {}),
490
+ pathname: s,
491
+ pathnameBase: o,
492
+ pattern: e
493
+ };
494
+ }
495
+ function ia(e, t, r) {
496
+ t === void 0 && (t = !1), r === void 0 && (r = !0), le(e === "*" || !e.endsWith("*") || e.endsWith("/*"), 'Route path "' + e + '" will be treated as if it were ' + ('"' + e.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + e.replace(/\*$/, "/*") + '".'));
497
+ let a = [], n = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (o, c, d) => (a.push({
498
+ paramName: c,
499
+ isOptional: d != null
500
+ }), d ? "/?([^\\/]+)?" : "/([^\\/]+)"));
501
+ return e.endsWith("*") ? (a.push({
502
+ paramName: "*"
503
+ }), n += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? n += "\\/*$" : e !== "" && e !== "/" && (n += "(?:(?=\\/|$))"), [new RegExp(n, t ? void 0 : "i"), a];
504
+ }
505
+ function ar(e) {
506
+ try {
507
+ return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
508
+ } catch (t) {
509
+ return le(!1, 'The URL path "' + e + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + t + ").")), e;
510
+ }
511
+ }
512
+ function Ye(e, t) {
513
+ if (t === "/") return e;
514
+ if (!e.toLowerCase().startsWith(t.toLowerCase()))
515
+ return null;
516
+ let r = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(r);
517
+ return a && a !== "/" ? null : e.slice(r) || "/";
518
+ }
519
+ function nr(e, t) {
520
+ t === void 0 && (t = "/");
521
+ let {
522
+ pathname: r,
523
+ search: a = "",
524
+ hash: n = ""
525
+ } = typeof e == "string" ? ie(e) : e;
526
+ return {
527
+ pathname: r ? r.startsWith("/") ? r : oa(r, t) : t,
528
+ search: sa(a),
529
+ hash: da(n)
530
+ };
531
+ }
532
+ function oa(e, t) {
533
+ let r = t.replace(/\/+$/, "").split("/");
534
+ return e.split("/").forEach((n) => {
535
+ n === ".." ? r.length > 1 && r.pop() : n !== "." && r.push(n);
536
+ }), r.length > 1 ? r.join("/") : "/";
537
+ }
538
+ function ht(e, t, r, a) {
539
+ return "Cannot include a '" + e + "' character in a manually specified " + ("`to." + t + "` field [" + JSON.stringify(a) + "]. Please separate it out to the ") + ("`to." + r + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
540
+ }
541
+ function ir(e) {
542
+ return e.filter((t, r) => r === 0 || t.route.path && t.route.path.length > 0);
543
+ }
544
+ function or(e, t) {
545
+ let r = ir(e);
546
+ return t ? r.map((a, n) => n === r.length - 1 ? a.pathname : a.pathnameBase) : r.map((a) => a.pathnameBase);
547
+ }
548
+ function lr(e, t, r, a) {
549
+ a === void 0 && (a = !1);
550
+ let n;
551
+ typeof e == "string" ? n = ie(e) : (n = I({}, e), B(!n.pathname || !n.pathname.includes("?"), ht("?", "pathname", "search", n)), B(!n.pathname || !n.pathname.includes("#"), ht("#", "pathname", "hash", n)), B(!n.search || !n.search.includes("#"), ht("#", "search", "hash", n)));
552
+ let s = e === "" || n.pathname === "", o = s ? "/" : n.pathname, c;
553
+ if (o == null)
554
+ c = r;
555
+ else {
556
+ let g = t.length - 1;
557
+ if (!a && o.startsWith("..")) {
558
+ let S = o.split("/");
559
+ for (; S[0] === ".."; )
560
+ S.shift(), g -= 1;
561
+ n.pathname = S.join("/");
562
+ }
563
+ c = g >= 0 ? t[g] : "/";
564
+ }
565
+ let d = nr(n, c), m = o && o !== "/" && o.endsWith("/"), y = (s || o === ".") && r.endsWith("/");
566
+ return !d.pathname.endsWith("/") && (m || y) && (d.pathname += "/"), d;
567
+ }
568
+ function la(e) {
569
+ return e === "" || e.pathname === "" ? "/" : typeof e == "string" ? ie(e).pathname : e.pathname;
570
+ }
571
+ const Ie = (e) => e.join("/").replace(/\/\/+/g, "/"), sr = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), sa = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, da = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, ua = function(t, r) {
572
+ r === void 0 && (r = {});
573
+ let a = typeof r == "number" ? {
574
+ status: r
575
+ } : r, n = new Headers(a.headers);
576
+ return n.has("Content-Type") || n.set("Content-Type", "application/json; charset=utf-8"), new Response(JSON.stringify(t), I({}, a, {
577
+ headers: n
578
+ }));
579
+ };
580
+ class fa {
581
+ constructor(t, r) {
582
+ this.type = "DataWithResponseInit", this.data = t, this.init = r || null;
583
+ }
584
+ }
585
+ function ca(e, t) {
586
+ return new fa(e, typeof t == "number" ? {
587
+ status: t
588
+ } : t);
589
+ }
590
+ class yt extends Error {
591
+ }
592
+ class dr {
593
+ constructor(t, r) {
594
+ this.pendingKeysSet = /* @__PURE__ */ new Set(), this.subscribers = /* @__PURE__ */ new Set(), this.deferredKeys = [], B(t && typeof t == "object" && !Array.isArray(t), "defer() only accepts plain objects");
595
+ let a;
596
+ this.abortPromise = new Promise((s, o) => a = o), this.controller = new AbortController();
597
+ let n = () => a(new yt("Deferred data aborted"));
598
+ this.unlistenAbortSignal = () => this.controller.signal.removeEventListener("abort", n), this.controller.signal.addEventListener("abort", n), this.data = Object.entries(t).reduce((s, o) => {
599
+ let [c, d] = o;
600
+ return Object.assign(s, {
601
+ [c]: this.trackPromise(c, d)
602
+ });
603
+ }, {}), this.done && this.unlistenAbortSignal(), this.init = r;
604
+ }
605
+ trackPromise(t, r) {
606
+ if (!(r instanceof Promise))
607
+ return r;
608
+ this.deferredKeys.push(t), this.pendingKeysSet.add(t);
609
+ let a = Promise.race([r, this.abortPromise]).then((n) => this.onSettle(a, t, void 0, n), (n) => this.onSettle(a, t, n));
610
+ return a.catch(() => {
611
+ }), Object.defineProperty(a, "_tracked", {
612
+ get: () => !0
613
+ }), a;
614
+ }
615
+ onSettle(t, r, a, n) {
616
+ if (this.controller.signal.aborted && a instanceof yt)
617
+ return this.unlistenAbortSignal(), Object.defineProperty(t, "_error", {
618
+ get: () => a
619
+ }), Promise.reject(a);
620
+ if (this.pendingKeysSet.delete(r), this.done && this.unlistenAbortSignal(), a === void 0 && n === void 0) {
621
+ let s = new Error('Deferred data for key "' + r + '" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');
622
+ return Object.defineProperty(t, "_error", {
623
+ get: () => s
624
+ }), this.emit(!1, r), Promise.reject(s);
625
+ }
626
+ return n === void 0 ? (Object.defineProperty(t, "_error", {
627
+ get: () => a
628
+ }), this.emit(!1, r), Promise.reject(a)) : (Object.defineProperty(t, "_data", {
629
+ get: () => n
630
+ }), this.emit(!1, r), n);
631
+ }
632
+ emit(t, r) {
633
+ this.subscribers.forEach((a) => a(t, r));
634
+ }
635
+ subscribe(t) {
636
+ return this.subscribers.add(t), () => this.subscribers.delete(t);
637
+ }
638
+ cancel() {
639
+ this.controller.abort(), this.pendingKeysSet.forEach((t, r) => this.pendingKeysSet.delete(r)), this.emit(!0);
640
+ }
641
+ async resolveData(t) {
642
+ let r = !1;
643
+ if (!this.done) {
644
+ let a = () => this.cancel();
645
+ t.addEventListener("abort", a), r = await new Promise((n) => {
646
+ this.subscribe((s) => {
647
+ t.removeEventListener("abort", a), (s || this.done) && n(s);
648
+ });
649
+ });
650
+ }
651
+ return r;
652
+ }
653
+ get done() {
654
+ return this.pendingKeysSet.size === 0;
655
+ }
656
+ get unwrappedData() {
657
+ return B(this.data !== null && this.done, "Can only unwrap data on initialized and settled deferreds"), Object.entries(this.data).reduce((t, r) => {
658
+ let [a, n] = r;
659
+ return Object.assign(t, {
660
+ [a]: pa(n)
661
+ });
662
+ }, {});
663
+ }
664
+ get pendingKeys() {
665
+ return Array.from(this.pendingKeysSet);
666
+ }
667
+ }
668
+ function ha(e) {
669
+ return e instanceof Promise && e._tracked === !0;
670
+ }
671
+ function pa(e) {
672
+ if (!ha(e))
673
+ return e;
674
+ if (e._error)
675
+ throw e._error;
676
+ return e._data;
677
+ }
678
+ const ma = function(t, r) {
679
+ r === void 0 && (r = {});
680
+ let a = typeof r == "number" ? {
681
+ status: r
682
+ } : r;
683
+ return new dr(t, a);
684
+ }, St = function(t, r) {
685
+ r === void 0 && (r = 302);
686
+ let a = r;
687
+ typeof a == "number" ? a = {
688
+ status: a
689
+ } : typeof a.status > "u" && (a.status = 302);
690
+ let n = new Headers(a.headers);
691
+ return n.set("Location", t), new Response(null, I({}, a, {
692
+ headers: n
693
+ }));
694
+ }, ya = (e, t) => {
695
+ let r = St(e, t);
696
+ return r.headers.set("X-Remix-Reload-Document", "true"), r;
697
+ }, ga = (e, t) => {
698
+ let r = St(e, t);
699
+ return r.headers.set("X-Remix-Replace", "true"), r;
700
+ };
701
+ class lt {
702
+ constructor(t, r, a, n) {
703
+ n === void 0 && (n = !1), this.status = t, this.statusText = r || "", this.internal = n, a instanceof Error ? (this.data = a.toString(), this.error = a) : this.data = a;
704
+ }
705
+ }
706
+ function He(e) {
707
+ return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
708
+ }
709
+ const ur = ["post", "put", "patch", "delete"], va = new Set(ur), wa = ["get", ...ur], ba = new Set(wa), Ra = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]), Da = /* @__PURE__ */ new Set([307, 308]), ot = {
710
+ state: "idle",
711
+ location: void 0,
712
+ formMethod: void 0,
713
+ formAction: void 0,
714
+ formEncType: void 0,
715
+ formData: void 0,
716
+ json: void 0,
717
+ text: void 0
718
+ }, fr = {
719
+ state: "idle",
720
+ data: void 0,
721
+ formMethod: void 0,
722
+ formAction: void 0,
723
+ formEncType: void 0,
724
+ formData: void 0,
725
+ json: void 0,
726
+ text: void 0
727
+ }, Oe = {
728
+ state: "unblocked",
729
+ proceed: void 0,
730
+ reset: void 0,
731
+ location: void 0
732
+ }, Et = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, cr = (e) => ({
733
+ hasErrorBoundary: !!e.hasErrorBoundary
734
+ }), hr = "remix-router-transitions";
735
+ function Sa(e) {
736
+ const t = e.window ? e.window : typeof window < "u" ? window : void 0, r = typeof t < "u" && typeof t.document < "u" && typeof t.document.createElement < "u", a = !r;
737
+ B(e.routes.length > 0, "You must provide a non-empty routes array to createRouter");
738
+ let n;
739
+ if (e.mapRouteProperties)
740
+ n = e.mapRouteProperties;
741
+ else if (e.detectErrorBoundary) {
742
+ let i = e.detectErrorBoundary;
743
+ n = (l) => ({
744
+ hasErrorBoundary: i(l)
745
+ });
746
+ } else
747
+ n = cr;
748
+ let s = {}, o = Ne(e.routes, n, void 0, s), c, d = e.basename || "/", m = e.dataStrategy || gr, y = e.patchRoutesOnNavigation, g = I({
749
+ v7_fetcherPersist: !1,
750
+ v7_normalizeFormMethod: !1,
751
+ v7_partialHydration: !1,
752
+ v7_prependBasename: !1,
753
+ v7_relativeSplatPath: !1,
754
+ v7_skipActionErrorRevalidation: !1
755
+ }, e.future), S = null, h = /* @__PURE__ */ new Set(), v = null, w = null, L = null, U = e.hydrationData != null, x = pe(o, e.history.location, d), F = null;
756
+ if (x == null && !y) {
757
+ let i = Y(404, {
758
+ pathname: e.history.location.pathname
759
+ }), {
760
+ matches: l,
761
+ route: u
762
+ } = st(o);
763
+ x = l, F = {
764
+ [u.id]: i
765
+ };
766
+ }
767
+ x && !e.hydrationData && et(x, o, e.history.location.pathname).active && (x = null);
768
+ let b;
769
+ if (x)
770
+ if (x.some((i) => i.route.lazy))
771
+ b = !1;
772
+ else if (!x.some((i) => i.route.loader))
773
+ b = !0;
774
+ else if (g.v7_partialHydration) {
775
+ let i = e.hydrationData ? e.hydrationData.loaderData : null, l = e.hydrationData ? e.hydrationData.errors : null;
776
+ if (l) {
777
+ let u = x.findIndex((p) => l[p.route.id] !== void 0);
778
+ b = x.slice(0, u + 1).every((p) => !wt(p.route, i, l));
779
+ } else
780
+ b = x.every((u) => !wt(u.route, i, l));
781
+ } else
782
+ b = e.hydrationData != null;
783
+ else if (b = !1, x = [], g.v7_partialHydration) {
784
+ let i = et(null, o, e.history.location.pathname);
785
+ i.active && i.matches && (x = i.matches);
786
+ }
787
+ let K, f = {
788
+ historyAction: e.history.action,
789
+ location: e.history.location,
790
+ matches: x,
791
+ initialized: b,
792
+ navigation: ot,
793
+ // Don't restore on initial updateState() if we were SSR'd
794
+ restoreScrollPosition: e.hydrationData != null ? !1 : null,
795
+ preventScrollReset: !1,
796
+ revalidation: "idle",
797
+ loaderData: e.hydrationData && e.hydrationData.loaderData || {},
798
+ actionData: e.hydrationData && e.hydrationData.actionData || null,
799
+ errors: e.hydrationData && e.hydrationData.errors || F,
800
+ fetchers: /* @__PURE__ */ new Map(),
801
+ blockers: /* @__PURE__ */ new Map()
802
+ }, j = $.Pop, O = !1, A, G = !1, V = /* @__PURE__ */ new Map(), ne = null, re = !1, de = !1, Je = [], Xe = /* @__PURE__ */ new Set(), Z = /* @__PURE__ */ new Map(), Ge = 0, ze = -1, Te = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Set(), je = /* @__PURE__ */ new Map(), Be = /* @__PURE__ */ new Map(), fe = /* @__PURE__ */ new Set(), Se = /* @__PURE__ */ new Map(), Ee = /* @__PURE__ */ new Map(), Qe;
803
+ function Pr() {
804
+ if (S = e.history.listen((i) => {
805
+ let {
806
+ action: l,
807
+ location: u,
808
+ delta: p
809
+ } = i;
810
+ if (Qe) {
811
+ Qe(), Qe = void 0;
812
+ return;
813
+ }
814
+ le(Ee.size === 0 || p != null, "You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");
815
+ let R = _t({
816
+ currentLocation: f.location,
817
+ nextLocation: u,
818
+ historyAction: l
819
+ });
820
+ if (R && p != null) {
821
+ let M = new Promise((C) => {
822
+ Qe = C;
823
+ });
824
+ e.history.go(p * -1), qe(R, {
825
+ state: "blocked",
826
+ location: u,
827
+ proceed() {
828
+ qe(R, {
829
+ state: "proceeding",
830
+ proceed: void 0,
831
+ reset: void 0,
832
+ location: u
833
+ }), M.then(() => e.history.go(p));
834
+ },
835
+ reset() {
836
+ let C = new Map(f.blockers);
837
+ C.set(R, Oe), te({
838
+ blockers: C
839
+ });
840
+ }
841
+ });
842
+ return;
843
+ }
844
+ return Pe(l, u);
845
+ }), r) {
846
+ Ia(t, V);
847
+ let i = () => Na(t, V);
848
+ t.addEventListener("pagehide", i), ne = () => t.removeEventListener("pagehide", i);
849
+ }
850
+ return f.initialized || Pe($.Pop, f.location, {
851
+ initialHydration: !0
852
+ }), K;
853
+ }
854
+ function xr() {
855
+ S && S(), ne && ne(), h.clear(), A && A.abort(), f.fetchers.forEach((i, l) => Ze(l)), f.blockers.forEach((i, l) => At(l));
856
+ }
857
+ function Lr(i) {
858
+ return h.add(i), () => h.delete(i);
859
+ }
860
+ function te(i, l) {
861
+ l === void 0 && (l = {}), f = I({}, f, i);
862
+ let u = [], p = [];
863
+ g.v7_fetcherPersist && f.fetchers.forEach((R, M) => {
864
+ R.state === "idle" && (fe.has(M) ? p.push(M) : u.push(M));
865
+ }), [...h].forEach((R) => R(f, {
866
+ deletedFetchers: p,
867
+ viewTransitionOpts: l.viewTransitionOpts,
868
+ flushSync: l.flushSync === !0
869
+ })), g.v7_fetcherPersist && (u.forEach((R) => f.fetchers.delete(R)), p.forEach((R) => Ze(R)));
870
+ }
871
+ function Ce(i, l, u) {
872
+ var p, R;
873
+ let {
874
+ flushSync: M
875
+ } = u === void 0 ? {} : u, C = f.actionData != null && f.navigation.formMethod != null && ae(f.navigation.formMethod) && f.navigation.state === "loading" && ((p = i.state) == null ? void 0 : p._isRedirect) !== !0, E;
876
+ l.actionData ? Object.keys(l.actionData).length > 0 ? E = l.actionData : E = null : C ? E = f.actionData : E = null;
877
+ let P = l.loaderData ? Gt(f.loaderData, l.loaderData, l.matches || [], l.errors) : f.loaderData, D = f.blockers;
878
+ D.size > 0 && (D = new Map(D), D.forEach((N, q) => D.set(q, Oe)));
879
+ let T = O === !0 || f.navigation.formMethod != null && ae(f.navigation.formMethod) && ((R = i.state) == null ? void 0 : R._isRedirect) !== !0;
880
+ c && (o = c, c = void 0), re || j === $.Pop || (j === $.Push ? e.history.push(i, i.state) : j === $.Replace && e.history.replace(i, i.state));
881
+ let _;
882
+ if (j === $.Pop) {
883
+ let N = V.get(f.location.pathname);
884
+ N && N.has(i.pathname) ? _ = {
885
+ currentLocation: f.location,
886
+ nextLocation: i
887
+ } : V.has(i.pathname) && (_ = {
888
+ currentLocation: i,
889
+ nextLocation: f.location
890
+ });
891
+ } else if (G) {
892
+ let N = V.get(f.location.pathname);
893
+ N ? N.add(i.pathname) : (N = /* @__PURE__ */ new Set([i.pathname]), V.set(f.location.pathname, N)), _ = {
894
+ currentLocation: f.location,
895
+ nextLocation: i
896
+ };
897
+ }
898
+ te(I({}, l, {
899
+ actionData: E,
900
+ loaderData: P,
901
+ historyAction: j,
902
+ location: i,
903
+ initialized: !0,
904
+ navigation: ot,
905
+ revalidation: "idle",
906
+ restoreScrollPosition: It(i, l.matches || f.matches),
907
+ preventScrollReset: T,
908
+ blockers: D
909
+ }), {
910
+ viewTransitionOpts: _,
911
+ flushSync: M === !0
912
+ }), j = $.Pop, O = !1, G = !1, re = !1, de = !1, Je = [];
913
+ }
914
+ async function Lt(i, l) {
915
+ if (typeof i == "number") {
916
+ e.history.go(i);
917
+ return;
918
+ }
919
+ let u = gt(f.location, f.matches, d, g.v7_prependBasename, i, g.v7_relativeSplatPath, l == null ? void 0 : l.fromRouteId, l == null ? void 0 : l.relative), {
920
+ path: p,
921
+ submission: R,
922
+ error: M
923
+ } = Kt(g.v7_normalizeFormMethod, !1, u, l), C = f.location, E = ye(f.location, p, l && l.state);
924
+ E = I({}, E, e.history.encodeLocation(E));
925
+ let P = l && l.replace != null ? l.replace : void 0, D = $.Push;
926
+ P === !0 ? D = $.Replace : P === !1 || R != null && ae(R.formMethod) && R.formAction === f.location.pathname + f.location.search && (D = $.Replace);
927
+ let T = l && "preventScrollReset" in l ? l.preventScrollReset === !0 : void 0, _ = (l && l.flushSync) === !0, N = _t({
928
+ currentLocation: C,
929
+ nextLocation: E,
930
+ historyAction: D
931
+ });
932
+ if (N) {
933
+ qe(N, {
934
+ state: "blocked",
935
+ location: E,
936
+ proceed() {
937
+ qe(N, {
938
+ state: "proceeding",
939
+ proceed: void 0,
940
+ reset: void 0,
941
+ location: E
942
+ }), Lt(i, l);
943
+ },
944
+ reset() {
945
+ let q = new Map(f.blockers);
946
+ q.set(N, Oe), te({
947
+ blockers: q
948
+ });
949
+ }
950
+ });
951
+ return;
952
+ }
953
+ return await Pe(D, E, {
954
+ submission: R,
955
+ // Send through the formData serialization error if we have one so we can
956
+ // render at the right error boundary after we match routes
957
+ pendingError: M,
958
+ preventScrollReset: T,
959
+ replace: l && l.replace,
960
+ enableViewTransition: l && l.viewTransition,
961
+ flushSync: _
962
+ });
963
+ }
964
+ function Mr() {
965
+ if (dt(), te({
966
+ revalidation: "loading"
967
+ }), f.navigation.state !== "submitting") {
968
+ if (f.navigation.state === "idle") {
969
+ Pe(f.historyAction, f.location, {
970
+ startUninterruptedRevalidation: !0
971
+ });
972
+ return;
973
+ }
974
+ Pe(j || f.historyAction, f.navigation.location, {
975
+ overrideNavigation: f.navigation,
976
+ // Proxy through any rending view transition
977
+ enableViewTransition: G === !0
978
+ });
979
+ }
980
+ }
981
+ async function Pe(i, l, u) {
982
+ A && A.abort(), A = null, j = i, re = (u && u.startUninterruptedRevalidation) === !0, Nr(f.location, f.matches), O = (u && u.preventScrollReset) === !0, G = (u && u.enableViewTransition) === !0;
983
+ let p = c || o, R = u && u.overrideNavigation, M = pe(p, l, d), C = (u && u.flushSync) === !0, E = et(M, p, l.pathname);
984
+ if (E.active && E.matches && (M = E.matches), !M) {
985
+ let {
986
+ error: k,
987
+ notFoundMatches: W,
988
+ route: J
989
+ } = ut(l.pathname);
990
+ Ce(l, {
991
+ matches: W,
992
+ loaderData: {},
993
+ errors: {
994
+ [J.id]: k
995
+ }
996
+ }, {
997
+ flushSync: C
998
+ });
999
+ return;
1000
+ }
1001
+ if (f.initialized && !de && ja(f.location, l) && !(u && u.submission && ae(u.submission.formMethod))) {
1002
+ Ce(l, {
1003
+ matches: M
1004
+ }, {
1005
+ flushSync: C
1006
+ });
1007
+ return;
1008
+ }
1009
+ A = new AbortController();
1010
+ let P = _e(e.history, l, A.signal, u && u.submission), D;
1011
+ if (u && u.pendingError)
1012
+ D = [be(M).route.id, {
1013
+ type: H.error,
1014
+ error: u.pendingError
1015
+ }];
1016
+ else if (u && u.submission && ae(u.submission.formMethod)) {
1017
+ let k = await Tr(P, l, u.submission, M, E.active, {
1018
+ replace: u.replace,
1019
+ flushSync: C
1020
+ });
1021
+ if (k.shortCircuited)
1022
+ return;
1023
+ if (k.pendingActionResult) {
1024
+ let [W, J] = k.pendingActionResult;
1025
+ if (ee(J) && He(J.error) && J.error.status === 404) {
1026
+ A = null, Ce(l, {
1027
+ matches: k.matches,
1028
+ loaderData: {},
1029
+ errors: {
1030
+ [W]: J.error
1031
+ }
1032
+ });
1033
+ return;
1034
+ }
1035
+ }
1036
+ M = k.matches || M, D = k.pendingActionResult, R = pt(l, u.submission), C = !1, E.active = !1, P = _e(e.history, P.url, P.signal);
1037
+ }
1038
+ let {
1039
+ shortCircuited: T,
1040
+ matches: _,
1041
+ loaderData: N,
1042
+ errors: q
1043
+ } = await jr(P, l, M, E.active, R, u && u.submission, u && u.fetcherSubmission, u && u.replace, u && u.initialHydration === !0, C, D);
1044
+ T || (A = null, Ce(l, I({
1045
+ matches: _ || M
1046
+ }, Qt(D), {
1047
+ loaderData: N,
1048
+ errors: q
1049
+ })));
1050
+ }
1051
+ async function Tr(i, l, u, p, R, M) {
1052
+ M === void 0 && (M = {}), dt();
1053
+ let C = _a(l, u);
1054
+ if (te({
1055
+ navigation: C
1056
+ }, {
1057
+ flushSync: M.flushSync === !0
1058
+ }), R) {
1059
+ let D = await tt(p, l.pathname, i.signal);
1060
+ if (D.type === "aborted")
1061
+ return {
1062
+ shortCircuited: !0
1063
+ };
1064
+ if (D.type === "error") {
1065
+ let T = be(D.partialMatches).route.id;
1066
+ return {
1067
+ matches: D.partialMatches,
1068
+ pendingActionResult: [T, {
1069
+ type: H.error,
1070
+ error: D.error
1071
+ }]
1072
+ };
1073
+ } else if (D.matches)
1074
+ p = D.matches;
1075
+ else {
1076
+ let {
1077
+ notFoundMatches: T,
1078
+ error: _,
1079
+ route: N
1080
+ } = ut(l.pathname);
1081
+ return {
1082
+ matches: T,
1083
+ pendingActionResult: [N.id, {
1084
+ type: H.error,
1085
+ error: _
1086
+ }]
1087
+ };
1088
+ }
1089
+ }
1090
+ let E, P = Me(p, l);
1091
+ if (!P.route.action && !P.route.lazy)
1092
+ E = {
1093
+ type: H.error,
1094
+ error: Y(405, {
1095
+ method: i.method,
1096
+ pathname: l.pathname,
1097
+ routeId: P.route.id
1098
+ })
1099
+ };
1100
+ else if (E = (await We("action", f, i, [P], p, null))[P.route.id], i.signal.aborted)
1101
+ return {
1102
+ shortCircuited: !0
1103
+ };
1104
+ if (De(E)) {
1105
+ let D;
1106
+ return M && M.replace != null ? D = M.replace : D = Yt(E.response.headers.get("Location"), new URL(i.url), d) === f.location.pathname + f.location.search, await xe(i, E, !0, {
1107
+ submission: u,
1108
+ replace: D
1109
+ }), {
1110
+ shortCircuited: !0
1111
+ };
1112
+ }
1113
+ if (me(E))
1114
+ throw Y(400, {
1115
+ type: "defer-action"
1116
+ });
1117
+ if (ee(E)) {
1118
+ let D = be(p, P.route.id);
1119
+ return (M && M.replace) !== !0 && (j = $.Push), {
1120
+ matches: p,
1121
+ pendingActionResult: [D.route.id, E]
1122
+ };
1123
+ }
1124
+ return {
1125
+ matches: p,
1126
+ pendingActionResult: [P.route.id, E]
1127
+ };
1128
+ }
1129
+ async function jr(i, l, u, p, R, M, C, E, P, D, T) {
1130
+ let _ = R || pt(l, M), N = M || C || Zt(_), q = !re && (!g.v7_partialHydration || !P);
1131
+ if (p) {
1132
+ if (q) {
1133
+ let X = Mt(T);
1134
+ te(I({
1135
+ navigation: _
1136
+ }, X !== void 0 ? {
1137
+ actionData: X
1138
+ } : {}), {
1139
+ flushSync: D
1140
+ });
1141
+ }
1142
+ let z = await tt(u, l.pathname, i.signal);
1143
+ if (z.type === "aborted")
1144
+ return {
1145
+ shortCircuited: !0
1146
+ };
1147
+ if (z.type === "error") {
1148
+ let X = be(z.partialMatches).route.id;
1149
+ return {
1150
+ matches: z.partialMatches,
1151
+ loaderData: {},
1152
+ errors: {
1153
+ [X]: z.error
1154
+ }
1155
+ };
1156
+ } else if (z.matches)
1157
+ u = z.matches;
1158
+ else {
1159
+ let {
1160
+ error: X,
1161
+ notFoundMatches: Ue,
1162
+ route: $e
1163
+ } = ut(l.pathname);
1164
+ return {
1165
+ matches: Ue,
1166
+ loaderData: {},
1167
+ errors: {
1168
+ [$e.id]: X
1169
+ }
1170
+ };
1171
+ }
1172
+ }
1173
+ let k = c || o, [W, J] = kt(e.history, f, u, N, l, g.v7_partialHydration && P === !0, g.v7_skipActionErrorRevalidation, de, Je, Xe, fe, je, ue, k, d, T);
1174
+ if (ft((z) => !(u && u.some((X) => X.route.id === z)) || W && W.some((X) => X.route.id === z)), ze = ++Ge, W.length === 0 && J.length === 0) {
1175
+ let z = Ft();
1176
+ return Ce(l, I({
1177
+ matches: u,
1178
+ loaderData: {},
1179
+ // Commit pending error if we're short circuiting
1180
+ errors: T && ee(T[1]) ? {
1181
+ [T[0]]: T[1].error
1182
+ } : null
1183
+ }, Qt(T), z ? {
1184
+ fetchers: new Map(f.fetchers)
1185
+ } : {}), {
1186
+ flushSync: D
1187
+ }), {
1188
+ shortCircuited: !0
1189
+ };
1190
+ }
1191
+ if (q) {
1192
+ let z = {};
1193
+ if (!p) {
1194
+ z.navigation = _;
1195
+ let X = Mt(T);
1196
+ X !== void 0 && (z.actionData = X);
1197
+ }
1198
+ J.length > 0 && (z.fetchers = Cr(J)), te(z, {
1199
+ flushSync: D
1200
+ });
1201
+ }
1202
+ J.forEach((z) => {
1203
+ ve(z.key), z.controller && Z.set(z.key, z.controller);
1204
+ });
1205
+ let Fe = () => J.forEach((z) => ve(z.key));
1206
+ A && A.signal.addEventListener("abort", Fe);
1207
+ let {
1208
+ loaderResults: Ke,
1209
+ fetcherResults: he
1210
+ } = await Tt(f, u, W, J, i);
1211
+ if (i.signal.aborted)
1212
+ return {
1213
+ shortCircuited: !0
1214
+ };
1215
+ A && A.signal.removeEventListener("abort", Fe), J.forEach((z) => Z.delete(z.key));
1216
+ let oe = nt(Ke);
1217
+ if (oe)
1218
+ return await xe(i, oe.result, !0, {
1219
+ replace: E
1220
+ }), {
1221
+ shortCircuited: !0
1222
+ };
1223
+ if (oe = nt(he), oe)
1224
+ return ue.add(oe.key), await xe(i, oe.result, !0, {
1225
+ replace: E
1226
+ }), {
1227
+ shortCircuited: !0
1228
+ };
1229
+ let {
1230
+ loaderData: ct,
1231
+ errors: ke
1232
+ } = Xt(f, u, Ke, T, J, he, Se);
1233
+ Se.forEach((z, X) => {
1234
+ z.subscribe((Ue) => {
1235
+ (Ue || z.done) && Se.delete(X);
1236
+ });
1237
+ }), g.v7_partialHydration && P && f.errors && (ke = I({}, f.errors, ke));
1238
+ let Le = Ft(), rt = Ut(ze), at = Le || rt || J.length > 0;
1239
+ return I({
1240
+ matches: u,
1241
+ loaderData: ct,
1242
+ errors: ke
1243
+ }, at ? {
1244
+ fetchers: new Map(f.fetchers)
1245
+ } : {});
1246
+ }
1247
+ function Mt(i) {
1248
+ if (i && !ee(i[1]))
1249
+ return {
1250
+ [i[0]]: i[1].data
1251
+ };
1252
+ if (f.actionData)
1253
+ return Object.keys(f.actionData).length === 0 ? null : f.actionData;
1254
+ }
1255
+ function Cr(i) {
1256
+ return i.forEach((l) => {
1257
+ let u = f.fetchers.get(l.key), p = Ve(void 0, u ? u.data : void 0);
1258
+ f.fetchers.set(l.key, p);
1259
+ }), new Map(f.fetchers);
1260
+ }
1261
+ function Fr(i, l, u, p) {
1262
+ if (a)
1263
+ throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");
1264
+ ve(i);
1265
+ let R = (p && p.flushSync) === !0, M = c || o, C = gt(f.location, f.matches, d, g.v7_prependBasename, u, g.v7_relativeSplatPath, l, p == null ? void 0 : p.relative), E = pe(M, C, d), P = et(E, M, C);
1266
+ if (P.active && P.matches && (E = P.matches), !E) {
1267
+ ce(i, l, Y(404, {
1268
+ pathname: C
1269
+ }), {
1270
+ flushSync: R
1271
+ });
1272
+ return;
1273
+ }
1274
+ let {
1275
+ path: D,
1276
+ submission: T,
1277
+ error: _
1278
+ } = Kt(g.v7_normalizeFormMethod, !0, C, p);
1279
+ if (_) {
1280
+ ce(i, l, _, {
1281
+ flushSync: R
1282
+ });
1283
+ return;
1284
+ }
1285
+ let N = Me(E, D), q = (p && p.preventScrollReset) === !0;
1286
+ if (T && ae(T.formMethod)) {
1287
+ Ur(i, l, D, N, E, P.active, R, q, T);
1288
+ return;
1289
+ }
1290
+ je.set(i, {
1291
+ routeId: l,
1292
+ path: D
1293
+ }), Ar(i, l, D, N, E, P.active, R, q, T);
1294
+ }
1295
+ async function Ur(i, l, u, p, R, M, C, E, P) {
1296
+ dt(), je.delete(i);
1297
+ function D(Q) {
1298
+ if (!Q.route.action && !Q.route.lazy) {
1299
+ let Ae = Y(405, {
1300
+ method: P.formMethod,
1301
+ pathname: u,
1302
+ routeId: l
1303
+ });
1304
+ return ce(i, l, Ae, {
1305
+ flushSync: C
1306
+ }), !0;
1307
+ }
1308
+ return !1;
1309
+ }
1310
+ if (!M && D(p))
1311
+ return;
1312
+ let T = f.fetchers.get(i);
1313
+ ge(i, Oa(P, T), {
1314
+ flushSync: C
1315
+ });
1316
+ let _ = new AbortController(), N = _e(e.history, u, _.signal, P);
1317
+ if (M) {
1318
+ let Q = await tt(R, u, N.signal);
1319
+ if (Q.type === "aborted")
1320
+ return;
1321
+ if (Q.type === "error") {
1322
+ ce(i, l, Q.error, {
1323
+ flushSync: C
1324
+ });
1325
+ return;
1326
+ } else if (Q.matches) {
1327
+ if (R = Q.matches, p = Me(R, u), D(p))
1328
+ return;
1329
+ } else {
1330
+ ce(i, l, Y(404, {
1331
+ pathname: u
1332
+ }), {
1333
+ flushSync: C
1334
+ });
1335
+ return;
1336
+ }
1337
+ }
1338
+ Z.set(i, _);
1339
+ let q = Ge, W = (await We("action", f, N, [p], R, i))[p.route.id];
1340
+ if (N.signal.aborted) {
1341
+ Z.get(i) === _ && Z.delete(i);
1342
+ return;
1343
+ }
1344
+ if (g.v7_fetcherPersist && fe.has(i)) {
1345
+ if (De(W) || ee(W)) {
1346
+ ge(i, we(void 0));
1347
+ return;
1348
+ }
1349
+ } else {
1350
+ if (De(W))
1351
+ if (Z.delete(i), ze > q) {
1352
+ ge(i, we(void 0));
1353
+ return;
1354
+ } else
1355
+ return ue.add(i), ge(i, Ve(P)), xe(N, W, !1, {
1356
+ fetcherSubmission: P,
1357
+ preventScrollReset: E
1358
+ });
1359
+ if (ee(W)) {
1360
+ ce(i, l, W.error);
1361
+ return;
1362
+ }
1363
+ }
1364
+ if (me(W))
1365
+ throw Y(400, {
1366
+ type: "defer-action"
1367
+ });
1368
+ let J = f.navigation.location || f.location, Fe = _e(e.history, J, _.signal), Ke = c || o, he = f.navigation.state !== "idle" ? pe(Ke, f.navigation.location, d) : f.matches;
1369
+ B(he, "Didn't find any matches after fetcher action");
1370
+ let oe = ++Ge;
1371
+ Te.set(i, oe);
1372
+ let ct = Ve(P, W.data);
1373
+ f.fetchers.set(i, ct);
1374
+ let [ke, Le] = kt(e.history, f, he, P, J, !1, g.v7_skipActionErrorRevalidation, de, Je, Xe, fe, je, ue, Ke, d, [p.route.id, W]);
1375
+ Le.filter((Q) => Q.key !== i).forEach((Q) => {
1376
+ let Ae = Q.key, Nt = f.fetchers.get(Ae), Br = Ve(void 0, Nt ? Nt.data : void 0);
1377
+ f.fetchers.set(Ae, Br), ve(Ae), Q.controller && Z.set(Ae, Q.controller);
1378
+ }), te({
1379
+ fetchers: new Map(f.fetchers)
1380
+ });
1381
+ let rt = () => Le.forEach((Q) => ve(Q.key));
1382
+ _.signal.addEventListener("abort", rt);
1383
+ let {
1384
+ loaderResults: at,
1385
+ fetcherResults: z
1386
+ } = await Tt(f, he, ke, Le, Fe);
1387
+ if (_.signal.aborted)
1388
+ return;
1389
+ _.signal.removeEventListener("abort", rt), Te.delete(i), Z.delete(i), Le.forEach((Q) => Z.delete(Q.key));
1390
+ let X = nt(at);
1391
+ if (X)
1392
+ return xe(Fe, X.result, !1, {
1393
+ preventScrollReset: E
1394
+ });
1395
+ if (X = nt(z), X)
1396
+ return ue.add(X.key), xe(Fe, X.result, !1, {
1397
+ preventScrollReset: E
1398
+ });
1399
+ let {
1400
+ loaderData: Ue,
1401
+ errors: $e
1402
+ } = Xt(f, he, at, void 0, Le, z, Se);
1403
+ if (f.fetchers.has(i)) {
1404
+ let Q = we(W.data);
1405
+ f.fetchers.set(i, Q);
1406
+ }
1407
+ Ut(oe), f.navigation.state === "loading" && oe > ze ? (B(j, "Expected pending action"), A && A.abort(), Ce(f.navigation.location, {
1408
+ matches: he,
1409
+ loaderData: Ue,
1410
+ errors: $e,
1411
+ fetchers: new Map(f.fetchers)
1412
+ })) : (te({
1413
+ errors: $e,
1414
+ loaderData: Gt(f.loaderData, Ue, he, $e),
1415
+ fetchers: new Map(f.fetchers)
1416
+ }), de = !1);
1417
+ }
1418
+ async function Ar(i, l, u, p, R, M, C, E, P) {
1419
+ let D = f.fetchers.get(i);
1420
+ ge(i, Ve(P, D ? D.data : void 0), {
1421
+ flushSync: C
1422
+ });
1423
+ let T = new AbortController(), _ = _e(e.history, u, T.signal);
1424
+ if (M) {
1425
+ let W = await tt(R, u, _.signal);
1426
+ if (W.type === "aborted")
1427
+ return;
1428
+ if (W.type === "error") {
1429
+ ce(i, l, W.error, {
1430
+ flushSync: C
1431
+ });
1432
+ return;
1433
+ } else if (W.matches)
1434
+ R = W.matches, p = Me(R, u);
1435
+ else {
1436
+ ce(i, l, Y(404, {
1437
+ pathname: u
1438
+ }), {
1439
+ flushSync: C
1440
+ });
1441
+ return;
1442
+ }
1443
+ }
1444
+ Z.set(i, T);
1445
+ let N = Ge, k = (await We("loader", f, _, [p], R, i))[p.route.id];
1446
+ if (me(k) && (k = await Pt(k, _.signal, !0) || k), Z.get(i) === T && Z.delete(i), !_.signal.aborted) {
1447
+ if (fe.has(i)) {
1448
+ ge(i, we(void 0));
1449
+ return;
1450
+ }
1451
+ if (De(k))
1452
+ if (ze > N) {
1453
+ ge(i, we(void 0));
1454
+ return;
1455
+ } else {
1456
+ ue.add(i), await xe(_, k, !1, {
1457
+ preventScrollReset: E
1458
+ });
1459
+ return;
1460
+ }
1461
+ if (ee(k)) {
1462
+ ce(i, l, k.error);
1463
+ return;
1464
+ }
1465
+ B(!me(k), "Unhandled fetcher deferred data"), ge(i, we(k.data));
1466
+ }
1467
+ }
1468
+ async function xe(i, l, u, p) {
1469
+ let {
1470
+ submission: R,
1471
+ fetcherSubmission: M,
1472
+ preventScrollReset: C,
1473
+ replace: E
1474
+ } = p === void 0 ? {} : p;
1475
+ l.response.headers.has("X-Remix-Revalidate") && (de = !0);
1476
+ let P = l.response.headers.get("Location");
1477
+ B(P, "Expected a Location header on the redirect Response"), P = Yt(P, new URL(i.url), d);
1478
+ let D = ye(f.location, P, {
1479
+ _isRedirect: !0
1480
+ });
1481
+ if (r) {
1482
+ let W = !1;
1483
+ if (l.response.headers.has("X-Remix-Reload-Document"))
1484
+ W = !0;
1485
+ else if (Et.test(P)) {
1486
+ const J = e.history.createURL(P);
1487
+ W = // Hard reload if it's an absolute URL to a new origin
1488
+ J.origin !== t.location.origin || // Hard reload if it's an absolute URL that does not match our basename
1489
+ Ye(J.pathname, d) == null;
1490
+ }
1491
+ if (W) {
1492
+ E ? t.location.replace(P) : t.location.assign(P);
1493
+ return;
1494
+ }
1495
+ }
1496
+ A = null;
1497
+ let T = E === !0 || l.response.headers.has("X-Remix-Replace") ? $.Replace : $.Push, {
1498
+ formMethod: _,
1499
+ formAction: N,
1500
+ formEncType: q
1501
+ } = f.navigation;
1502
+ !R && !M && _ && N && q && (R = Zt(f.navigation));
1503
+ let k = R || M;
1504
+ if (Da.has(l.response.status) && k && ae(k.formMethod))
1505
+ await Pe(T, D, {
1506
+ submission: I({}, k, {
1507
+ formAction: P
1508
+ }),
1509
+ // Preserve these flags across redirects
1510
+ preventScrollReset: C || O,
1511
+ enableViewTransition: u ? G : void 0
1512
+ });
1513
+ else {
1514
+ let W = pt(D, R);
1515
+ await Pe(T, D, {
1516
+ overrideNavigation: W,
1517
+ // Send fetcher submissions through for shouldRevalidate
1518
+ fetcherSubmission: M,
1519
+ // Preserve these flags across redirects
1520
+ preventScrollReset: C || O,
1521
+ enableViewTransition: u ? G : void 0
1522
+ });
1523
+ }
1524
+ }
1525
+ async function We(i, l, u, p, R, M) {
1526
+ let C, E = {};
1527
+ try {
1528
+ C = await vr(m, i, l, u, p, R, M, s, n);
1529
+ } catch (P) {
1530
+ return p.forEach((D) => {
1531
+ E[D.route.id] = {
1532
+ type: H.error,
1533
+ error: P
1534
+ };
1535
+ }), E;
1536
+ }
1537
+ for (let [P, D] of Object.entries(C))
1538
+ if (Sr(D)) {
1539
+ let T = D.result;
1540
+ E[P] = {
1541
+ type: H.redirect,
1542
+ response: br(T, u, P, R, d, g.v7_relativeSplatPath)
1543
+ };
1544
+ } else
1545
+ E[P] = await wr(D);
1546
+ return E;
1547
+ }
1548
+ async function Tt(i, l, u, p, R) {
1549
+ let M = i.matches, C = We("loader", i, R, u, l, null), E = Promise.all(p.map(async (T) => {
1550
+ if (T.matches && T.match && T.controller) {
1551
+ let N = (await We("loader", i, _e(e.history, T.path, T.controller.signal), [T.match], T.matches, T.key))[T.match.route.id];
1552
+ return {
1553
+ [T.key]: N
1554
+ };
1555
+ } else
1556
+ return Promise.resolve({
1557
+ [T.key]: {
1558
+ type: H.error,
1559
+ error: Y(404, {
1560
+ pathname: T.path
1561
+ })
1562
+ }
1563
+ });
1564
+ })), P = await C, D = (await E).reduce((T, _) => Object.assign(T, _), {});
1565
+ return await Promise.all([Ua(l, P, R.signal, M, i.loaderData), Aa(l, D, p)]), {
1566
+ loaderResults: P,
1567
+ fetcherResults: D
1568
+ };
1569
+ }
1570
+ function dt() {
1571
+ de = !0, Je.push(...ft()), je.forEach((i, l) => {
1572
+ Z.has(l) && Xe.add(l), ve(l);
1573
+ });
1574
+ }
1575
+ function ge(i, l, u) {
1576
+ u === void 0 && (u = {}), f.fetchers.set(i, l), te({
1577
+ fetchers: new Map(f.fetchers)
1578
+ }, {
1579
+ flushSync: (u && u.flushSync) === !0
1580
+ });
1581
+ }
1582
+ function ce(i, l, u, p) {
1583
+ p === void 0 && (p = {});
1584
+ let R = be(f.matches, l);
1585
+ Ze(i), te({
1586
+ errors: {
1587
+ [R.route.id]: u
1588
+ },
1589
+ fetchers: new Map(f.fetchers)
1590
+ }, {
1591
+ flushSync: (p && p.flushSync) === !0
1592
+ });
1593
+ }
1594
+ function jt(i) {
1595
+ return g.v7_fetcherPersist && (Be.set(i, (Be.get(i) || 0) + 1), fe.has(i) && fe.delete(i)), f.fetchers.get(i) || fr;
1596
+ }
1597
+ function Ze(i) {
1598
+ let l = f.fetchers.get(i);
1599
+ Z.has(i) && !(l && l.state === "loading" && Te.has(i)) && ve(i), je.delete(i), Te.delete(i), ue.delete(i), fe.delete(i), Xe.delete(i), f.fetchers.delete(i);
1600
+ }
1601
+ function _r(i) {
1602
+ if (g.v7_fetcherPersist) {
1603
+ let l = (Be.get(i) || 0) - 1;
1604
+ l <= 0 ? (Be.delete(i), fe.add(i)) : Be.set(i, l);
1605
+ } else
1606
+ Ze(i);
1607
+ te({
1608
+ fetchers: new Map(f.fetchers)
1609
+ });
1610
+ }
1611
+ function ve(i) {
1612
+ let l = Z.get(i);
1613
+ l && (l.abort(), Z.delete(i));
1614
+ }
1615
+ function Ct(i) {
1616
+ for (let l of i) {
1617
+ let u = jt(l), p = we(u.data);
1618
+ f.fetchers.set(l, p);
1619
+ }
1620
+ }
1621
+ function Ft() {
1622
+ let i = [], l = !1;
1623
+ for (let u of ue) {
1624
+ let p = f.fetchers.get(u);
1625
+ B(p, "Expected fetcher: " + u), p.state === "loading" && (ue.delete(u), i.push(u), l = !0);
1626
+ }
1627
+ return Ct(i), l;
1628
+ }
1629
+ function Ut(i) {
1630
+ let l = [];
1631
+ for (let [u, p] of Te)
1632
+ if (p < i) {
1633
+ let R = f.fetchers.get(u);
1634
+ B(R, "Expected fetcher: " + u), R.state === "loading" && (ve(u), Te.delete(u), l.push(u));
1635
+ }
1636
+ return Ct(l), l.length > 0;
1637
+ }
1638
+ function Or(i, l) {
1639
+ let u = f.blockers.get(i) || Oe;
1640
+ return Ee.get(i) !== l && Ee.set(i, l), u;
1641
+ }
1642
+ function At(i) {
1643
+ f.blockers.delete(i), Ee.delete(i);
1644
+ }
1645
+ function qe(i, l) {
1646
+ let u = f.blockers.get(i) || Oe;
1647
+ B(u.state === "unblocked" && l.state === "blocked" || u.state === "blocked" && l.state === "blocked" || u.state === "blocked" && l.state === "proceeding" || u.state === "blocked" && l.state === "unblocked" || u.state === "proceeding" && l.state === "unblocked", "Invalid blocker state transition: " + u.state + " -> " + l.state);
1648
+ let p = new Map(f.blockers);
1649
+ p.set(i, l), te({
1650
+ blockers: p
1651
+ });
1652
+ }
1653
+ function _t(i) {
1654
+ let {
1655
+ currentLocation: l,
1656
+ nextLocation: u,
1657
+ historyAction: p
1658
+ } = i;
1659
+ if (Ee.size === 0)
1660
+ return;
1661
+ Ee.size > 1 && le(!1, "A router only supports one blocker at a time");
1662
+ let R = Array.from(Ee.entries()), [M, C] = R[R.length - 1], E = f.blockers.get(M);
1663
+ if (!(E && E.state === "proceeding") && C({
1664
+ currentLocation: l,
1665
+ nextLocation: u,
1666
+ historyAction: p
1667
+ }))
1668
+ return M;
1669
+ }
1670
+ function ut(i) {
1671
+ let l = Y(404, {
1672
+ pathname: i
1673
+ }), u = c || o, {
1674
+ matches: p,
1675
+ route: R
1676
+ } = st(u);
1677
+ return ft(), {
1678
+ notFoundMatches: p,
1679
+ route: R,
1680
+ error: l
1681
+ };
1682
+ }
1683
+ function ft(i) {
1684
+ let l = [];
1685
+ return Se.forEach((u, p) => {
1686
+ (!i || i(p)) && (u.cancel(), l.push(p), Se.delete(p));
1687
+ }), l;
1688
+ }
1689
+ function Ir(i, l, u) {
1690
+ if (v = i, L = l, w = u || null, !U && f.navigation === ot) {
1691
+ U = !0;
1692
+ let p = It(f.location, f.matches);
1693
+ p != null && te({
1694
+ restoreScrollPosition: p
1695
+ });
1696
+ }
1697
+ return () => {
1698
+ v = null, L = null, w = null;
1699
+ };
1700
+ }
1701
+ function Ot(i, l) {
1702
+ return w && w(i, l.map((p) => er(p, f.loaderData))) || i.key;
1703
+ }
1704
+ function Nr(i, l) {
1705
+ if (v && L) {
1706
+ let u = Ot(i, l);
1707
+ v[u] = L();
1708
+ }
1709
+ }
1710
+ function It(i, l) {
1711
+ if (v) {
1712
+ let u = Ot(i, l), p = v[u];
1713
+ if (typeof p == "number")
1714
+ return p;
1715
+ }
1716
+ return null;
1717
+ }
1718
+ function et(i, l, u) {
1719
+ if (y)
1720
+ if (i) {
1721
+ if (Object.keys(i[0].params).length > 0)
1722
+ return {
1723
+ active: !0,
1724
+ matches: it(l, u, d, !0)
1725
+ };
1726
+ } else
1727
+ return {
1728
+ active: !0,
1729
+ matches: it(l, u, d, !0) || []
1730
+ };
1731
+ return {
1732
+ active: !1,
1733
+ matches: null
1734
+ };
1735
+ }
1736
+ async function tt(i, l, u) {
1737
+ if (!y)
1738
+ return {
1739
+ type: "success",
1740
+ matches: i
1741
+ };
1742
+ let p = i;
1743
+ for (; ; ) {
1744
+ let R = c == null, M = c || o, C = s;
1745
+ try {
1746
+ await y({
1747
+ path: l,
1748
+ matches: p,
1749
+ patch: (D, T) => {
1750
+ u.aborted || Vt(D, T, M, C, n);
1751
+ }
1752
+ });
1753
+ } catch (D) {
1754
+ return {
1755
+ type: "error",
1756
+ error: D,
1757
+ partialMatches: p
1758
+ };
1759
+ } finally {
1760
+ R && !u.aborted && (o = [...o]);
1761
+ }
1762
+ if (u.aborted)
1763
+ return {
1764
+ type: "aborted"
1765
+ };
1766
+ let E = pe(M, l, d);
1767
+ if (E)
1768
+ return {
1769
+ type: "success",
1770
+ matches: E
1771
+ };
1772
+ let P = it(M, l, d, !0);
1773
+ if (!P || p.length === P.length && p.every((D, T) => D.route.id === P[T].route.id))
1774
+ return {
1775
+ type: "success",
1776
+ matches: null
1777
+ };
1778
+ p = P;
1779
+ }
1780
+ }
1781
+ function Hr(i) {
1782
+ s = {}, c = Ne(i, n, void 0, s);
1783
+ }
1784
+ function zr(i, l) {
1785
+ let u = c == null;
1786
+ Vt(i, l, c || o, s, n), u && (o = [...o], te({}));
1787
+ }
1788
+ return K = {
1789
+ get basename() {
1790
+ return d;
1791
+ },
1792
+ get future() {
1793
+ return g;
1794
+ },
1795
+ get state() {
1796
+ return f;
1797
+ },
1798
+ get routes() {
1799
+ return o;
1800
+ },
1801
+ get window() {
1802
+ return t;
1803
+ },
1804
+ initialize: Pr,
1805
+ subscribe: Lr,
1806
+ enableScrollRestoration: Ir,
1807
+ navigate: Lt,
1808
+ fetch: Fr,
1809
+ revalidate: Mr,
1810
+ // Passthrough to history-aware createHref used by useHref so we get proper
1811
+ // hash-aware URLs in DOM paths
1812
+ createHref: (i) => e.history.createHref(i),
1813
+ encodeLocation: (i) => e.history.encodeLocation(i),
1814
+ getFetcher: jt,
1815
+ deleteFetcher: _r,
1816
+ dispose: xr,
1817
+ getBlocker: Or,
1818
+ deleteBlocker: At,
1819
+ patchRoutes: zr,
1820
+ _internalFetchControllers: Z,
1821
+ _internalActiveDeferreds: Se,
1822
+ // TODO: Remove setRoutes, it's temporary to avoid dealing with
1823
+ // updating the tree while validating the update algorithm.
1824
+ _internalSetRoutes: Hr
1825
+ }, K;
1826
+ }
1827
+ const pr = Symbol("deferred");
1828
+ function Ea(e, t) {
1829
+ B(e.length > 0, "You must provide a non-empty routes array to createStaticHandler");
1830
+ let r = {}, a = (t ? t.basename : null) || "/", n;
1831
+ if (t != null && t.mapRouteProperties)
1832
+ n = t.mapRouteProperties;
1833
+ else if (t != null && t.detectErrorBoundary) {
1834
+ let h = t.detectErrorBoundary;
1835
+ n = (v) => ({
1836
+ hasErrorBoundary: h(v)
1837
+ });
1838
+ } else
1839
+ n = cr;
1840
+ let s = I({
1841
+ v7_relativeSplatPath: !1,
1842
+ v7_throwAbortReason: !1
1843
+ }, t ? t.future : null), o = Ne(e, n, void 0, r);
1844
+ async function c(h, v) {
1845
+ let {
1846
+ requestContext: w,
1847
+ skipLoaderErrorBubbling: L,
1848
+ dataStrategy: U
1849
+ } = v === void 0 ? {} : v, x = new URL(h.url), F = h.method, b = ye("", se(x), null, "default"), K = pe(o, b, a);
1850
+ if (!Dt(F) && F !== "HEAD") {
1851
+ let j = Y(405, {
1852
+ method: F
1853
+ }), {
1854
+ matches: O,
1855
+ route: A
1856
+ } = st(o);
1857
+ return {
1858
+ basename: a,
1859
+ location: b,
1860
+ matches: O,
1861
+ loaderData: {},
1862
+ actionData: null,
1863
+ errors: {
1864
+ [A.id]: j
1865
+ },
1866
+ statusCode: j.status,
1867
+ loaderHeaders: {},
1868
+ actionHeaders: {},
1869
+ activeDeferreds: null
1870
+ };
1871
+ } else if (!K) {
1872
+ let j = Y(404, {
1873
+ pathname: b.pathname
1874
+ }), {
1875
+ matches: O,
1876
+ route: A
1877
+ } = st(o);
1878
+ return {
1879
+ basename: a,
1880
+ location: b,
1881
+ matches: O,
1882
+ loaderData: {},
1883
+ actionData: null,
1884
+ errors: {
1885
+ [A.id]: j
1886
+ },
1887
+ statusCode: j.status,
1888
+ loaderHeaders: {},
1889
+ actionHeaders: {},
1890
+ activeDeferreds: null
1891
+ };
1892
+ }
1893
+ let f = await m(h, b, K, w, U || null, L === !0, null);
1894
+ return Re(f) ? f : I({
1895
+ location: b,
1896
+ basename: a
1897
+ }, f);
1898
+ }
1899
+ async function d(h, v) {
1900
+ let {
1901
+ routeId: w,
1902
+ requestContext: L,
1903
+ dataStrategy: U
1904
+ } = v === void 0 ? {} : v, x = new URL(h.url), F = h.method, b = ye("", se(x), null, "default"), K = pe(o, b, a);
1905
+ if (!Dt(F) && F !== "HEAD" && F !== "OPTIONS")
1906
+ throw Y(405, {
1907
+ method: F
1908
+ });
1909
+ if (!K)
1910
+ throw Y(404, {
1911
+ pathname: b.pathname
1912
+ });
1913
+ let f = w ? K.find((G) => G.route.id === w) : Me(K, b);
1914
+ if (w && !f)
1915
+ throw Y(403, {
1916
+ pathname: b.pathname,
1917
+ routeId: w
1918
+ });
1919
+ if (!f)
1920
+ throw Y(404, {
1921
+ pathname: b.pathname
1922
+ });
1923
+ let j = await m(h, b, K, L, U || null, !1, f);
1924
+ if (Re(j))
1925
+ return j;
1926
+ let O = j.errors ? Object.values(j.errors)[0] : void 0;
1927
+ if (O !== void 0)
1928
+ throw O;
1929
+ if (j.actionData)
1930
+ return Object.values(j.actionData)[0];
1931
+ if (j.loaderData) {
1932
+ var A;
1933
+ let G = Object.values(j.loaderData)[0];
1934
+ return (A = j.activeDeferreds) != null && A[f.route.id] && (G[pr] = j.activeDeferreds[f.route.id]), G;
1935
+ }
1936
+ }
1937
+ async function m(h, v, w, L, U, x, F) {
1938
+ B(h.signal, "query()/queryRoute() requests must contain an AbortController signal");
1939
+ try {
1940
+ if (ae(h.method.toLowerCase()))
1941
+ return await y(h, w, F || Me(w, v), L, U, x, F != null);
1942
+ let b = await g(h, w, L, U, x, F);
1943
+ return Re(b) ? b : I({}, b, {
1944
+ actionData: null,
1945
+ actionHeaders: {}
1946
+ });
1947
+ } catch (b) {
1948
+ if (Ca(b) && Re(b.result)) {
1949
+ if (b.type === H.error)
1950
+ throw b.result;
1951
+ return b.result;
1952
+ }
1953
+ if (Fa(b))
1954
+ return b;
1955
+ throw b;
1956
+ }
1957
+ }
1958
+ async function y(h, v, w, L, U, x, F) {
1959
+ let b;
1960
+ if (!w.route.action && !w.route.lazy) {
1961
+ let j = Y(405, {
1962
+ method: h.method,
1963
+ pathname: new URL(h.url).pathname,
1964
+ routeId: w.route.id
1965
+ });
1966
+ if (F)
1967
+ throw j;
1968
+ b = {
1969
+ type: H.error,
1970
+ error: j
1971
+ };
1972
+ } else
1973
+ b = (await S("action", h, [w], v, F, L, U))[w.route.id], h.signal.aborted && Wt(h, F, s);
1974
+ if (De(b))
1975
+ throw new Response(null, {
1976
+ status: b.response.status,
1977
+ headers: {
1978
+ Location: b.response.headers.get("Location")
1979
+ }
1980
+ });
1981
+ if (me(b)) {
1982
+ let j = Y(400, {
1983
+ type: "defer-action"
1984
+ });
1985
+ if (F)
1986
+ throw j;
1987
+ b = {
1988
+ type: H.error,
1989
+ error: j
1990
+ };
1991
+ }
1992
+ if (F) {
1993
+ if (ee(b))
1994
+ throw b.error;
1995
+ return {
1996
+ matches: [w],
1997
+ loaderData: {},
1998
+ actionData: {
1999
+ [w.route.id]: b.data
2000
+ },
2001
+ errors: null,
2002
+ // Note: statusCode + headers are unused here since queryRoute will
2003
+ // return the raw Response or value
2004
+ statusCode: 200,
2005
+ loaderHeaders: {},
2006
+ actionHeaders: {},
2007
+ activeDeferreds: null
2008
+ };
2009
+ }
2010
+ let K = new Request(h.url, {
2011
+ headers: h.headers,
2012
+ redirect: h.redirect,
2013
+ signal: h.signal
2014
+ });
2015
+ if (ee(b)) {
2016
+ let j = x ? w : be(v, w.route.id), O = await g(K, v, L, U, x, null, [j.route.id, b]);
2017
+ return I({}, O, {
2018
+ statusCode: He(b.error) ? b.error.status : b.statusCode != null ? b.statusCode : 500,
2019
+ actionData: null,
2020
+ actionHeaders: I({}, b.headers ? {
2021
+ [w.route.id]: b.headers
2022
+ } : {})
2023
+ });
2024
+ }
2025
+ let f = await g(K, v, L, U, x, null);
2026
+ return I({}, f, {
2027
+ actionData: {
2028
+ [w.route.id]: b.data
2029
+ }
2030
+ }, b.statusCode ? {
2031
+ statusCode: b.statusCode
2032
+ } : {}, {
2033
+ actionHeaders: b.headers ? {
2034
+ [w.route.id]: b.headers
2035
+ } : {}
2036
+ });
2037
+ }
2038
+ async function g(h, v, w, L, U, x, F) {
2039
+ let b = x != null;
2040
+ if (b && !(x != null && x.route.loader) && !(x != null && x.route.lazy))
2041
+ throw Y(400, {
2042
+ method: h.method,
2043
+ pathname: new URL(h.url).pathname,
2044
+ routeId: x == null ? void 0 : x.route.id
2045
+ });
2046
+ let f = (x ? [x] : F && ee(F[1]) ? vt(v, F[0]) : v).filter((V) => V.route.loader || V.route.lazy);
2047
+ if (f.length === 0)
2048
+ return {
2049
+ matches: v,
2050
+ // Add a null for all matched routes for proper revalidation on the client
2051
+ loaderData: v.reduce((V, ne) => Object.assign(V, {
2052
+ [ne.route.id]: null
2053
+ }), {}),
2054
+ errors: F && ee(F[1]) ? {
2055
+ [F[0]]: F[1].error
2056
+ } : null,
2057
+ statusCode: 200,
2058
+ loaderHeaders: {},
2059
+ activeDeferreds: null
2060
+ };
2061
+ let j = await S("loader", h, f, v, b, w, L);
2062
+ h.signal.aborted && Wt(h, b, s);
2063
+ let O = /* @__PURE__ */ new Map(), A = Rr(v, j, F, O, U), G = new Set(f.map((V) => V.route.id));
2064
+ return v.forEach((V) => {
2065
+ G.has(V.route.id) || (A.loaderData[V.route.id] = null);
2066
+ }), I({}, A, {
2067
+ matches: v,
2068
+ activeDeferreds: O.size > 0 ? Object.fromEntries(O.entries()) : null
2069
+ });
2070
+ }
2071
+ async function S(h, v, w, L, U, x, F) {
2072
+ let b = await vr(F || gr, h, null, v, w, L, null, r, n, x), K = {};
2073
+ return await Promise.all(L.map(async (f) => {
2074
+ if (!(f.route.id in b))
2075
+ return;
2076
+ let j = b[f.route.id];
2077
+ if (Sr(j)) {
2078
+ let O = j.result;
2079
+ throw br(O, v, f.route.id, L, a, s.v7_relativeSplatPath);
2080
+ }
2081
+ if (Re(j.result) && U)
2082
+ throw j;
2083
+ K[f.route.id] = await wr(j);
2084
+ })), K;
2085
+ }
2086
+ return {
2087
+ dataRoutes: o,
2088
+ query: c,
2089
+ queryRoute: d
2090
+ };
2091
+ }
2092
+ function Pa(e, t, r) {
2093
+ return I({}, t, {
2094
+ statusCode: He(r) ? r.status : 500,
2095
+ errors: {
2096
+ [t._deepestRenderedBoundaryId || e[0].id]: r
2097
+ }
2098
+ });
2099
+ }
2100
+ function Wt(e, t, r) {
2101
+ if (r.v7_throwAbortReason && e.signal.reason !== void 0)
2102
+ throw e.signal.reason;
2103
+ let a = t ? "queryRoute" : "query";
2104
+ throw new Error(a + "() call aborted: " + e.method + " " + e.url);
2105
+ }
2106
+ function xa(e) {
2107
+ return e != null && ("formData" in e && e.formData != null || "body" in e && e.body !== void 0);
2108
+ }
2109
+ function gt(e, t, r, a, n, s, o, c) {
2110
+ let d, m;
2111
+ if (o) {
2112
+ d = [];
2113
+ for (let g of t)
2114
+ if (d.push(g), g.route.id === o) {
2115
+ m = g;
2116
+ break;
2117
+ }
2118
+ } else
2119
+ d = t, m = t[t.length - 1];
2120
+ let y = lr(n || ".", or(d, s), Ye(e.pathname, r) || e.pathname, c === "path");
2121
+ if (n == null && (y.search = e.search, y.hash = e.hash), (n == null || n === "" || n === ".") && m) {
2122
+ let g = xt(y.search);
2123
+ if (m.route.index && !g)
2124
+ y.search = y.search ? y.search.replace(/^\?/, "?index&") : "?index";
2125
+ else if (!m.route.index && g) {
2126
+ let S = new URLSearchParams(y.search), h = S.getAll("index");
2127
+ S.delete("index"), h.filter((w) => w).forEach((w) => S.append("index", w));
2128
+ let v = S.toString();
2129
+ y.search = v ? "?" + v : "";
2130
+ }
2131
+ }
2132
+ return a && r !== "/" && (y.pathname = y.pathname === "/" ? r : Ie([r, y.pathname])), se(y);
2133
+ }
2134
+ function Kt(e, t, r, a) {
2135
+ if (!a || !xa(a))
2136
+ return {
2137
+ path: r
2138
+ };
2139
+ if (a.formMethod && !Dt(a.formMethod))
2140
+ return {
2141
+ path: r,
2142
+ error: Y(405, {
2143
+ method: a.formMethod
2144
+ })
2145
+ };
2146
+ let n = () => ({
2147
+ path: r,
2148
+ error: Y(400, {
2149
+ type: "invalid-body"
2150
+ })
2151
+ }), s = a.formMethod || "get", o = e ? s.toUpperCase() : s.toLowerCase(), c = Dr(r);
2152
+ if (a.body !== void 0) {
2153
+ if (a.formEncType === "text/plain") {
2154
+ if (!ae(o))
2155
+ return n();
2156
+ let S = typeof a.body == "string" ? a.body : a.body instanceof FormData || a.body instanceof URLSearchParams ? (
2157
+ // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data
2158
+ Array.from(a.body.entries()).reduce((h, v) => {
2159
+ let [w, L] = v;
2160
+ return "" + h + w + "=" + L + `
2161
+ `;
2162
+ }, "")
2163
+ ) : String(a.body);
2164
+ return {
2165
+ path: r,
2166
+ submission: {
2167
+ formMethod: o,
2168
+ formAction: c,
2169
+ formEncType: a.formEncType,
2170
+ formData: void 0,
2171
+ json: void 0,
2172
+ text: S
2173
+ }
2174
+ };
2175
+ } else if (a.formEncType === "application/json") {
2176
+ if (!ae(o))
2177
+ return n();
2178
+ try {
2179
+ let S = typeof a.body == "string" ? JSON.parse(a.body) : a.body;
2180
+ return {
2181
+ path: r,
2182
+ submission: {
2183
+ formMethod: o,
2184
+ formAction: c,
2185
+ formEncType: a.formEncType,
2186
+ formData: void 0,
2187
+ json: S,
2188
+ text: void 0
2189
+ }
2190
+ };
2191
+ } catch {
2192
+ return n();
2193
+ }
2194
+ }
2195
+ }
2196
+ B(typeof FormData == "function", "FormData is not available in this environment");
2197
+ let d, m;
2198
+ if (a.formData)
2199
+ d = bt(a.formData), m = a.formData;
2200
+ else if (a.body instanceof FormData)
2201
+ d = bt(a.body), m = a.body;
2202
+ else if (a.body instanceof URLSearchParams)
2203
+ d = a.body, m = Jt(d);
2204
+ else if (a.body == null)
2205
+ d = new URLSearchParams(), m = new FormData();
2206
+ else
2207
+ try {
2208
+ d = new URLSearchParams(a.body), m = Jt(d);
2209
+ } catch {
2210
+ return n();
2211
+ }
2212
+ let y = {
2213
+ formMethod: o,
2214
+ formAction: c,
2215
+ formEncType: a && a.formEncType || "application/x-www-form-urlencoded",
2216
+ formData: m,
2217
+ json: void 0,
2218
+ text: void 0
2219
+ };
2220
+ if (ae(y.formMethod))
2221
+ return {
2222
+ path: r,
2223
+ submission: y
2224
+ };
2225
+ let g = ie(r);
2226
+ return t && g.search && xt(g.search) && d.append("index", ""), g.search = "?" + d, {
2227
+ path: se(g),
2228
+ submission: y
2229
+ };
2230
+ }
2231
+ function vt(e, t, r) {
2232
+ r === void 0 && (r = !1);
2233
+ let a = e.findIndex((n) => n.route.id === t);
2234
+ return a >= 0 ? e.slice(0, r ? a + 1 : a) : e;
2235
+ }
2236
+ function kt(e, t, r, a, n, s, o, c, d, m, y, g, S, h, v, w) {
2237
+ let L = w ? ee(w[1]) ? w[1].error : w[1].data : void 0, U = e.createURL(t.location), x = e.createURL(n), F = r;
2238
+ s && t.errors ? F = vt(r, Object.keys(t.errors)[0], !0) : w && ee(w[1]) && (F = vt(r, w[0]));
2239
+ let b = w ? w[1].statusCode : void 0, K = o && b && b >= 400, f = F.filter((O, A) => {
2240
+ let {
2241
+ route: G
2242
+ } = O;
2243
+ if (G.lazy)
2244
+ return !0;
2245
+ if (G.loader == null)
2246
+ return !1;
2247
+ if (s)
2248
+ return wt(G, t.loaderData, t.errors);
2249
+ if (La(t.loaderData, t.matches[A], O) || d.some((re) => re === O.route.id))
2250
+ return !0;
2251
+ let V = t.matches[A], ne = O;
2252
+ return $t(O, I({
2253
+ currentUrl: U,
2254
+ currentParams: V.params,
2255
+ nextUrl: x,
2256
+ nextParams: ne.params
2257
+ }, a, {
2258
+ actionResult: L,
2259
+ actionStatus: b,
2260
+ defaultShouldRevalidate: K ? !1 : (
2261
+ // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
2262
+ c || U.pathname + U.search === x.pathname + x.search || // Search params affect all loaders
2263
+ U.search !== x.search || mr(V, ne)
2264
+ )
2265
+ }));
2266
+ }), j = [];
2267
+ return g.forEach((O, A) => {
2268
+ if (s || !r.some((de) => de.route.id === O.routeId) || y.has(A))
2269
+ return;
2270
+ let G = pe(h, O.path, v);
2271
+ if (!G) {
2272
+ j.push({
2273
+ key: A,
2274
+ routeId: O.routeId,
2275
+ path: O.path,
2276
+ matches: null,
2277
+ match: null,
2278
+ controller: null
2279
+ });
2280
+ return;
2281
+ }
2282
+ let V = t.fetchers.get(A), ne = Me(G, O.path), re = !1;
2283
+ S.has(A) ? re = !1 : m.has(A) ? (m.delete(A), re = !0) : V && V.state !== "idle" && V.data === void 0 ? re = c : re = $t(ne, I({
2284
+ currentUrl: U,
2285
+ currentParams: t.matches[t.matches.length - 1].params,
2286
+ nextUrl: x,
2287
+ nextParams: r[r.length - 1].params
2288
+ }, a, {
2289
+ actionResult: L,
2290
+ actionStatus: b,
2291
+ defaultShouldRevalidate: K ? !1 : c
2292
+ })), re && j.push({
2293
+ key: A,
2294
+ routeId: O.routeId,
2295
+ path: O.path,
2296
+ matches: G,
2297
+ match: ne,
2298
+ controller: new AbortController()
2299
+ });
2300
+ }), [f, j];
2301
+ }
2302
+ function wt(e, t, r) {
2303
+ if (e.lazy)
2304
+ return !0;
2305
+ if (!e.loader)
2306
+ return !1;
2307
+ let a = t != null && t[e.id] !== void 0, n = r != null && r[e.id] !== void 0;
2308
+ return !a && n ? !1 : typeof e.loader == "function" && e.loader.hydrate === !0 ? !0 : !a && !n;
2309
+ }
2310
+ function La(e, t, r) {
2311
+ let a = (
2312
+ // [a] -> [a, b]
2313
+ !t || // [a, b] -> [a, c]
2314
+ r.route.id !== t.route.id
2315
+ ), n = e[r.route.id] === void 0;
2316
+ return a || n;
2317
+ }
2318
+ function mr(e, t) {
2319
+ let r = e.route.path;
2320
+ return (
2321
+ // param change for this match, /users/123 -> /users/456
2322
+ e.pathname !== t.pathname || // splat param changed, which is not present in match.path
2323
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
2324
+ r != null && r.endsWith("*") && e.params["*"] !== t.params["*"]
2325
+ );
2326
+ }
2327
+ function $t(e, t) {
2328
+ if (e.route.shouldRevalidate) {
2329
+ let r = e.route.shouldRevalidate(t);
2330
+ if (typeof r == "boolean")
2331
+ return r;
2332
+ }
2333
+ return t.defaultShouldRevalidate;
2334
+ }
2335
+ function Vt(e, t, r, a, n) {
2336
+ var s;
2337
+ let o;
2338
+ if (e) {
2339
+ let m = a[e];
2340
+ B(m, "No route found to patch children into: routeId = " + e), m.children || (m.children = []), o = m.children;
2341
+ } else
2342
+ o = r;
2343
+ let c = t.filter((m) => !o.some((y) => yr(m, y))), d = Ne(c, n, [e || "_", "patch", String(((s = o) == null ? void 0 : s.length) || "0")], a);
2344
+ o.push(...d);
2345
+ }
2346
+ function yr(e, t) {
2347
+ return "id" in e && "id" in t && e.id === t.id ? !0 : e.index === t.index && e.path === t.path && e.caseSensitive === t.caseSensitive ? (!e.children || e.children.length === 0) && (!t.children || t.children.length === 0) ? !0 : e.children.every((r, a) => {
2348
+ var n;
2349
+ return (n = t.children) == null ? void 0 : n.some((s) => yr(r, s));
2350
+ }) : !1;
2351
+ }
2352
+ async function Ma(e, t, r) {
2353
+ if (!e.lazy)
2354
+ return;
2355
+ let a = await e.lazy();
2356
+ if (!e.lazy)
2357
+ return;
2358
+ let n = r[e.id];
2359
+ B(n, "No route found in manifest");
2360
+ let s = {};
2361
+ for (let o in a) {
2362
+ let d = n[o] !== void 0 && // This property isn't static since it should always be updated based
2363
+ // on the route updates
2364
+ o !== "hasErrorBoundary";
2365
+ le(!d, 'Route "' + n.id + '" has a static property "' + o + '" defined but its lazy function is also returning a value for this property. ' + ('The lazy route property "' + o + '" will be ignored.')), !d && !Vr.has(o) && (s[o] = a[o]);
2366
+ }
2367
+ Object.assign(n, s), Object.assign(n, I({}, t(n), {
2368
+ lazy: void 0
2369
+ }));
2370
+ }
2371
+ async function gr(e) {
2372
+ let {
2373
+ matches: t
2374
+ } = e, r = t.filter((n) => n.shouldLoad);
2375
+ return (await Promise.all(r.map((n) => n.resolve()))).reduce((n, s, o) => Object.assign(n, {
2376
+ [r[o].route.id]: s
2377
+ }), {});
2378
+ }
2379
+ async function vr(e, t, r, a, n, s, o, c, d, m) {
2380
+ let y = s.map((h) => h.route.lazy ? Ma(h.route, d, c) : void 0), g = s.map((h, v) => {
2381
+ let w = y[v], L = n.some((x) => x.route.id === h.route.id);
2382
+ return I({}, h, {
2383
+ shouldLoad: L,
2384
+ resolve: async (x) => (x && a.method === "GET" && (h.route.lazy || h.route.loader) && (L = !0), L ? Ta(t, a, h, w, x, m) : Promise.resolve({
2385
+ type: H.data,
2386
+ result: void 0
2387
+ }))
2388
+ });
2389
+ }), S = await e({
2390
+ matches: g,
2391
+ request: a,
2392
+ params: s[0].params,
2393
+ fetcherKey: o,
2394
+ context: m
2395
+ });
2396
+ try {
2397
+ await Promise.all(y);
2398
+ } catch {
2399
+ }
2400
+ return S;
2401
+ }
2402
+ async function Ta(e, t, r, a, n, s) {
2403
+ let o, c, d = (m) => {
2404
+ let y, g = new Promise((v, w) => y = w);
2405
+ c = () => y(), t.signal.addEventListener("abort", c);
2406
+ let S = (v) => typeof m != "function" ? Promise.reject(new Error("You cannot call the handler for a route which defines a boolean " + ('"' + e + '" [routeId: ' + r.route.id + "]"))) : m({
2407
+ request: t,
2408
+ params: r.params,
2409
+ context: s
2410
+ }, ...v !== void 0 ? [v] : []), h = (async () => {
2411
+ try {
2412
+ return {
2413
+ type: "data",
2414
+ result: await (n ? n((w) => S(w)) : S())
2415
+ };
2416
+ } catch (v) {
2417
+ return {
2418
+ type: "error",
2419
+ result: v
2420
+ };
2421
+ }
2422
+ })();
2423
+ return Promise.race([h, g]);
2424
+ };
2425
+ try {
2426
+ let m = r.route[e];
2427
+ if (a)
2428
+ if (m) {
2429
+ let y, [g] = await Promise.all([
2430
+ // If the handler throws, don't let it immediately bubble out,
2431
+ // since we need to let the lazy() execution finish so we know if this
2432
+ // route has a boundary that can handle the error
2433
+ d(m).catch((S) => {
2434
+ y = S;
2435
+ }),
2436
+ a
2437
+ ]);
2438
+ if (y !== void 0)
2439
+ throw y;
2440
+ o = g;
2441
+ } else if (await a, m = r.route[e], m)
2442
+ o = await d(m);
2443
+ else if (e === "action") {
2444
+ let y = new URL(t.url), g = y.pathname + y.search;
2445
+ throw Y(405, {
2446
+ method: t.method,
2447
+ pathname: g,
2448
+ routeId: r.route.id
2449
+ });
2450
+ } else
2451
+ return {
2452
+ type: H.data,
2453
+ result: void 0
2454
+ };
2455
+ else if (m)
2456
+ o = await d(m);
2457
+ else {
2458
+ let y = new URL(t.url), g = y.pathname + y.search;
2459
+ throw Y(404, {
2460
+ pathname: g
2461
+ });
2462
+ }
2463
+ B(o.result !== void 0, "You defined " + (e === "action" ? "an action" : "a loader") + " for route " + ('"' + r.route.id + "\" but didn't return anything from your `" + e + "` ") + "function. Please return a value or `null`.");
2464
+ } catch (m) {
2465
+ return {
2466
+ type: H.error,
2467
+ result: m
2468
+ };
2469
+ } finally {
2470
+ c && t.signal.removeEventListener("abort", c);
2471
+ }
2472
+ return o;
2473
+ }
2474
+ async function wr(e) {
2475
+ let {
2476
+ result: t,
2477
+ type: r
2478
+ } = e;
2479
+ if (Re(t)) {
2480
+ let m;
2481
+ try {
2482
+ let y = t.headers.get("Content-Type");
2483
+ y && /\bapplication\/json\b/.test(y) ? t.body == null ? m = null : m = await t.json() : m = await t.text();
2484
+ } catch (y) {
2485
+ return {
2486
+ type: H.error,
2487
+ error: y
2488
+ };
2489
+ }
2490
+ return r === H.error ? {
2491
+ type: H.error,
2492
+ error: new lt(t.status, t.statusText, m),
2493
+ statusCode: t.status,
2494
+ headers: t.headers
2495
+ } : {
2496
+ type: H.data,
2497
+ data: m,
2498
+ statusCode: t.status,
2499
+ headers: t.headers
2500
+ };
2501
+ }
2502
+ if (r === H.error) {
2503
+ if (Rt(t)) {
2504
+ var a;
2505
+ if (t.data instanceof Error) {
2506
+ var n;
2507
+ return {
2508
+ type: H.error,
2509
+ error: t.data,
2510
+ statusCode: (n = t.init) == null ? void 0 : n.status
2511
+ };
2512
+ }
2513
+ t = new lt(((a = t.init) == null ? void 0 : a.status) || 500, void 0, t.data);
2514
+ }
2515
+ return {
2516
+ type: H.error,
2517
+ error: t,
2518
+ statusCode: He(t) ? t.status : void 0
2519
+ };
2520
+ }
2521
+ if (Er(t)) {
2522
+ var s, o;
2523
+ return {
2524
+ type: H.deferred,
2525
+ deferredData: t,
2526
+ statusCode: (s = t.init) == null ? void 0 : s.status,
2527
+ headers: ((o = t.init) == null ? void 0 : o.headers) && new Headers(t.init.headers)
2528
+ };
2529
+ }
2530
+ if (Rt(t)) {
2531
+ var c, d;
2532
+ return {
2533
+ type: H.data,
2534
+ data: t.data,
2535
+ statusCode: (c = t.init) == null ? void 0 : c.status,
2536
+ headers: (d = t.init) != null && d.headers ? new Headers(t.init.headers) : void 0
2537
+ };
2538
+ }
2539
+ return {
2540
+ type: H.data,
2541
+ data: t
2542
+ };
2543
+ }
2544
+ function br(e, t, r, a, n, s) {
2545
+ let o = e.headers.get("Location");
2546
+ if (B(o, "Redirects returned/thrown from loaders/actions must have a Location header"), !Et.test(o)) {
2547
+ let c = a.slice(0, a.findIndex((d) => d.route.id === r) + 1);
2548
+ o = gt(new URL(t.url), c, n, !0, o, s), e.headers.set("Location", o);
2549
+ }
2550
+ return e;
2551
+ }
2552
+ function Yt(e, t, r) {
2553
+ if (Et.test(e)) {
2554
+ let a = e, n = a.startsWith("//") ? new URL(t.protocol + a) : new URL(a), s = Ye(n.pathname, r) != null;
2555
+ if (n.origin === t.origin && s)
2556
+ return n.pathname + n.search + n.hash;
2557
+ }
2558
+ return e;
2559
+ }
2560
+ function _e(e, t, r, a) {
2561
+ let n = e.createURL(Dr(t)).toString(), s = {
2562
+ signal: r
2563
+ };
2564
+ if (a && ae(a.formMethod)) {
2565
+ let {
2566
+ formMethod: o,
2567
+ formEncType: c
2568
+ } = a;
2569
+ s.method = o.toUpperCase(), c === "application/json" ? (s.headers = new Headers({
2570
+ "Content-Type": c
2571
+ }), s.body = JSON.stringify(a.json)) : c === "text/plain" ? s.body = a.text : c === "application/x-www-form-urlencoded" && a.formData ? s.body = bt(a.formData) : s.body = a.formData;
2572
+ }
2573
+ return new Request(n, s);
2574
+ }
2575
+ function bt(e) {
2576
+ let t = new URLSearchParams();
2577
+ for (let [r, a] of e.entries())
2578
+ t.append(r, typeof a == "string" ? a : a.name);
2579
+ return t;
2580
+ }
2581
+ function Jt(e) {
2582
+ let t = new FormData();
2583
+ for (let [r, a] of e.entries())
2584
+ t.append(r, a);
2585
+ return t;
2586
+ }
2587
+ function Rr(e, t, r, a, n) {
2588
+ let s = {}, o = null, c, d = !1, m = {}, y = r && ee(r[1]) ? r[1].error : void 0;
2589
+ return e.forEach((g) => {
2590
+ if (!(g.route.id in t))
2591
+ return;
2592
+ let S = g.route.id, h = t[S];
2593
+ if (B(!De(h), "Cannot handle redirect results in processLoaderData"), ee(h)) {
2594
+ let v = h.error;
2595
+ if (y !== void 0 && (v = y, y = void 0), o = o || {}, n)
2596
+ o[S] = v;
2597
+ else {
2598
+ let w = be(e, S);
2599
+ o[w.route.id] == null && (o[w.route.id] = v);
2600
+ }
2601
+ s[S] = void 0, d || (d = !0, c = He(h.error) ? h.error.status : 500), h.headers && (m[S] = h.headers);
2602
+ } else
2603
+ me(h) ? (a.set(S, h.deferredData), s[S] = h.deferredData.data, h.statusCode != null && h.statusCode !== 200 && !d && (c = h.statusCode), h.headers && (m[S] = h.headers)) : (s[S] = h.data, h.statusCode && h.statusCode !== 200 && !d && (c = h.statusCode), h.headers && (m[S] = h.headers));
2604
+ }), y !== void 0 && r && (o = {
2605
+ [r[0]]: y
2606
+ }, s[r[0]] = void 0), {
2607
+ loaderData: s,
2608
+ errors: o,
2609
+ statusCode: c || 200,
2610
+ loaderHeaders: m
2611
+ };
2612
+ }
2613
+ function Xt(e, t, r, a, n, s, o) {
2614
+ let {
2615
+ loaderData: c,
2616
+ errors: d
2617
+ } = Rr(
2618
+ t,
2619
+ r,
2620
+ a,
2621
+ o,
2622
+ !1
2623
+ // This method is only called client side so we always want to bubble
2624
+ );
2625
+ return n.forEach((m) => {
2626
+ let {
2627
+ key: y,
2628
+ match: g,
2629
+ controller: S
2630
+ } = m, h = s[y];
2631
+ if (B(h, "Did not find corresponding fetcher result"), !(S && S.signal.aborted))
2632
+ if (ee(h)) {
2633
+ let v = be(e.matches, g == null ? void 0 : g.route.id);
2634
+ d && d[v.route.id] || (d = I({}, d, {
2635
+ [v.route.id]: h.error
2636
+ })), e.fetchers.delete(y);
2637
+ } else if (De(h))
2638
+ B(!1, "Unhandled fetcher revalidation redirect");
2639
+ else if (me(h))
2640
+ B(!1, "Unhandled fetcher deferred data");
2641
+ else {
2642
+ let v = we(h.data);
2643
+ e.fetchers.set(y, v);
2644
+ }
2645
+ }), {
2646
+ loaderData: c,
2647
+ errors: d
2648
+ };
2649
+ }
2650
+ function Gt(e, t, r, a) {
2651
+ let n = I({}, t);
2652
+ for (let s of r) {
2653
+ let o = s.route.id;
2654
+ if (t.hasOwnProperty(o) ? t[o] !== void 0 && (n[o] = t[o]) : e[o] !== void 0 && s.route.loader && (n[o] = e[o]), a && a.hasOwnProperty(o))
2655
+ break;
2656
+ }
2657
+ return n;
2658
+ }
2659
+ function Qt(e) {
2660
+ return e ? ee(e[1]) ? {
2661
+ // Clear out prior actionData on errors
2662
+ actionData: {}
2663
+ } : {
2664
+ actionData: {
2665
+ [e[0]]: e[1].data
2666
+ }
2667
+ } : {};
2668
+ }
2669
+ function be(e, t) {
2670
+ return (t ? e.slice(0, e.findIndex((a) => a.route.id === t) + 1) : [...e]).reverse().find((a) => a.route.hasErrorBoundary === !0) || e[0];
2671
+ }
2672
+ function st(e) {
2673
+ let t = e.length === 1 ? e[0] : e.find((r) => r.index || !r.path || r.path === "/") || {
2674
+ id: "__shim-error-route__"
2675
+ };
2676
+ return {
2677
+ matches: [{
2678
+ params: {},
2679
+ pathname: "",
2680
+ pathnameBase: "",
2681
+ route: t
2682
+ }],
2683
+ route: t
2684
+ };
2685
+ }
2686
+ function Y(e, t) {
2687
+ let {
2688
+ pathname: r,
2689
+ routeId: a,
2690
+ method: n,
2691
+ type: s,
2692
+ message: o
2693
+ } = t === void 0 ? {} : t, c = "Unknown Server Error", d = "Unknown @remix-run/router error";
2694
+ return e === 400 ? (c = "Bad Request", n && r && a ? d = "You made a " + n + ' request to "' + r + '" but ' + ('did not provide a `loader` for route "' + a + '", ') + "so there is no way to handle the request." : s === "defer-action" ? d = "defer() is not supported in actions" : s === "invalid-body" && (d = "Unable to encode submission body")) : e === 403 ? (c = "Forbidden", d = 'Route "' + a + '" does not match URL "' + r + '"') : e === 404 ? (c = "Not Found", d = 'No route matches URL "' + r + '"') : e === 405 && (c = "Method Not Allowed", n && r && a ? d = "You made a " + n.toUpperCase() + ' request to "' + r + '" but ' + ('did not provide an `action` for route "' + a + '", ') + "so there is no way to handle the request." : n && (d = 'Invalid request method "' + n.toUpperCase() + '"')), new lt(e || 500, c, new Error(d), !0);
2695
+ }
2696
+ function nt(e) {
2697
+ let t = Object.entries(e);
2698
+ for (let r = t.length - 1; r >= 0; r--) {
2699
+ let [a, n] = t[r];
2700
+ if (De(n))
2701
+ return {
2702
+ key: a,
2703
+ result: n
2704
+ };
2705
+ }
2706
+ }
2707
+ function Dr(e) {
2708
+ let t = typeof e == "string" ? ie(e) : e;
2709
+ return se(I({}, t, {
2710
+ hash: ""
2711
+ }));
2712
+ }
2713
+ function ja(e, t) {
2714
+ return e.pathname !== t.pathname || e.search !== t.search ? !1 : e.hash === "" ? t.hash !== "" : e.hash === t.hash ? !0 : t.hash !== "";
2715
+ }
2716
+ function Ca(e) {
2717
+ return e != null && typeof e == "object" && "type" in e && "result" in e && (e.type === H.data || e.type === H.error);
2718
+ }
2719
+ function Sr(e) {
2720
+ return Re(e.result) && Ra.has(e.result.status);
2721
+ }
2722
+ function me(e) {
2723
+ return e.type === H.deferred;
2724
+ }
2725
+ function ee(e) {
2726
+ return e.type === H.error;
2727
+ }
2728
+ function De(e) {
2729
+ return (e && e.type) === H.redirect;
2730
+ }
2731
+ function Rt(e) {
2732
+ return typeof e == "object" && e != null && "type" in e && "data" in e && "init" in e && e.type === "DataWithResponseInit";
2733
+ }
2734
+ function Er(e) {
2735
+ let t = e;
2736
+ return t && typeof t == "object" && typeof t.data == "object" && typeof t.subscribe == "function" && typeof t.cancel == "function" && typeof t.resolveData == "function";
2737
+ }
2738
+ function Re(e) {
2739
+ return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.headers == "object" && typeof e.body < "u";
2740
+ }
2741
+ function Fa(e) {
2742
+ if (!Re(e))
2743
+ return !1;
2744
+ let t = e.status, r = e.headers.get("Location");
2745
+ return t >= 300 && t <= 399 && r != null;
2746
+ }
2747
+ function Dt(e) {
2748
+ return ba.has(e.toLowerCase());
2749
+ }
2750
+ function ae(e) {
2751
+ return va.has(e.toLowerCase());
2752
+ }
2753
+ async function Ua(e, t, r, a, n) {
2754
+ let s = Object.entries(t);
2755
+ for (let o = 0; o < s.length; o++) {
2756
+ let [c, d] = s[o], m = e.find((S) => (S == null ? void 0 : S.route.id) === c);
2757
+ if (!m)
2758
+ continue;
2759
+ let y = a.find((S) => S.route.id === m.route.id), g = y != null && !mr(y, m) && (n && n[m.route.id]) !== void 0;
2760
+ me(d) && g && await Pt(d, r, !1).then((S) => {
2761
+ S && (t[c] = S);
2762
+ });
2763
+ }
2764
+ }
2765
+ async function Aa(e, t, r) {
2766
+ for (let a = 0; a < r.length; a++) {
2767
+ let {
2768
+ key: n,
2769
+ routeId: s,
2770
+ controller: o
2771
+ } = r[a], c = t[n];
2772
+ e.find((m) => (m == null ? void 0 : m.route.id) === s) && me(c) && (B(o, "Expected an AbortController for revalidating fetcher deferred result"), await Pt(c, o.signal, !0).then((m) => {
2773
+ m && (t[n] = m);
2774
+ }));
2775
+ }
2776
+ }
2777
+ async function Pt(e, t, r) {
2778
+ if (r === void 0 && (r = !1), !await e.deferredData.resolveData(t)) {
2779
+ if (r)
2780
+ try {
2781
+ return {
2782
+ type: H.data,
2783
+ data: e.deferredData.unwrappedData
2784
+ };
2785
+ } catch (n) {
2786
+ return {
2787
+ type: H.error,
2788
+ error: n
2789
+ };
2790
+ }
2791
+ return {
2792
+ type: H.data,
2793
+ data: e.deferredData.data
2794
+ };
2795
+ }
2796
+ }
2797
+ function xt(e) {
2798
+ return new URLSearchParams(e).getAll("index").some((t) => t === "");
2799
+ }
2800
+ function Me(e, t) {
2801
+ let r = typeof t == "string" ? ie(t).search : t.search;
2802
+ if (e[e.length - 1].route.index && xt(r || ""))
2803
+ return e[e.length - 1];
2804
+ let a = ir(e);
2805
+ return a[a.length - 1];
2806
+ }
2807
+ function Zt(e) {
2808
+ let {
2809
+ formMethod: t,
2810
+ formAction: r,
2811
+ formEncType: a,
2812
+ text: n,
2813
+ formData: s,
2814
+ json: o
2815
+ } = e;
2816
+ if (!(!t || !r || !a)) {
2817
+ if (n != null)
2818
+ return {
2819
+ formMethod: t,
2820
+ formAction: r,
2821
+ formEncType: a,
2822
+ formData: void 0,
2823
+ json: void 0,
2824
+ text: n
2825
+ };
2826
+ if (s != null)
2827
+ return {
2828
+ formMethod: t,
2829
+ formAction: r,
2830
+ formEncType: a,
2831
+ formData: s,
2832
+ json: void 0,
2833
+ text: void 0
2834
+ };
2835
+ if (o !== void 0)
2836
+ return {
2837
+ formMethod: t,
2838
+ formAction: r,
2839
+ formEncType: a,
2840
+ formData: void 0,
2841
+ json: o,
2842
+ text: void 0
2843
+ };
2844
+ }
2845
+ }
2846
+ function pt(e, t) {
2847
+ return t ? {
2848
+ state: "loading",
2849
+ location: e,
2850
+ formMethod: t.formMethod,
2851
+ formAction: t.formAction,
2852
+ formEncType: t.formEncType,
2853
+ formData: t.formData,
2854
+ json: t.json,
2855
+ text: t.text
2856
+ } : {
2857
+ state: "loading",
2858
+ location: e,
2859
+ formMethod: void 0,
2860
+ formAction: void 0,
2861
+ formEncType: void 0,
2862
+ formData: void 0,
2863
+ json: void 0,
2864
+ text: void 0
2865
+ };
2866
+ }
2867
+ function _a(e, t) {
2868
+ return {
2869
+ state: "submitting",
2870
+ location: e,
2871
+ formMethod: t.formMethod,
2872
+ formAction: t.formAction,
2873
+ formEncType: t.formEncType,
2874
+ formData: t.formData,
2875
+ json: t.json,
2876
+ text: t.text
2877
+ };
2878
+ }
2879
+ function Ve(e, t) {
2880
+ return e ? {
2881
+ state: "loading",
2882
+ formMethod: e.formMethod,
2883
+ formAction: e.formAction,
2884
+ formEncType: e.formEncType,
2885
+ formData: e.formData,
2886
+ json: e.json,
2887
+ text: e.text,
2888
+ data: t
2889
+ } : {
2890
+ state: "loading",
2891
+ formMethod: void 0,
2892
+ formAction: void 0,
2893
+ formEncType: void 0,
2894
+ formData: void 0,
2895
+ json: void 0,
2896
+ text: void 0,
2897
+ data: t
2898
+ };
2899
+ }
2900
+ function Oa(e, t) {
2901
+ return {
2902
+ state: "submitting",
2903
+ formMethod: e.formMethod,
2904
+ formAction: e.formAction,
2905
+ formEncType: e.formEncType,
2906
+ formData: e.formData,
2907
+ json: e.json,
2908
+ text: e.text,
2909
+ data: t ? t.data : void 0
2910
+ };
2911
+ }
2912
+ function we(e) {
2913
+ return {
2914
+ state: "idle",
2915
+ formMethod: void 0,
2916
+ formAction: void 0,
2917
+ formEncType: void 0,
2918
+ formData: void 0,
2919
+ json: void 0,
2920
+ text: void 0,
2921
+ data: e
2922
+ };
2923
+ }
2924
+ function Ia(e, t) {
2925
+ try {
2926
+ let r = e.sessionStorage.getItem(hr);
2927
+ if (r) {
2928
+ let a = JSON.parse(r);
2929
+ for (let [n, s] of Object.entries(a || {}))
2930
+ s && Array.isArray(s) && t.set(n, new Set(s || []));
2931
+ }
2932
+ } catch {
2933
+ }
2934
+ }
2935
+ function Na(e, t) {
2936
+ if (t.size > 0) {
2937
+ let r = {};
2938
+ for (let [a, n] of t)
2939
+ r[a] = [...n];
2940
+ try {
2941
+ e.sessionStorage.setItem(hr, JSON.stringify(r));
2942
+ } catch (a) {
2943
+ le(!1, "Failed to save applied view transitions in sessionStorage (" + a + ").");
2944
+ }
2945
+ }
2946
+ }
2947
+ const Ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2948
+ __proto__: null,
2949
+ AbortedDeferredError: yt,
2950
+ get Action() {
2951
+ return $;
2952
+ },
2953
+ IDLE_BLOCKER: Oe,
2954
+ IDLE_FETCHER: fr,
2955
+ IDLE_NAVIGATION: ot,
2956
+ UNSAFE_DEFERRED_SYMBOL: pr,
2957
+ UNSAFE_DeferredData: dr,
2958
+ UNSAFE_ErrorResponseImpl: lt,
2959
+ UNSAFE_convertRouteMatchToUiMatch: er,
2960
+ UNSAFE_convertRoutesToDataRoutes: Ne,
2961
+ UNSAFE_decodePath: ar,
2962
+ UNSAFE_getResolveToMatches: or,
2963
+ UNSAFE_invariant: B,
2964
+ UNSAFE_warning: le,
2965
+ createBrowserHistory: Kr,
2966
+ createHashHistory: kr,
2967
+ createMemoryHistory: Wr,
2968
+ createPath: se,
2969
+ createRouter: Sa,
2970
+ createStaticHandler: Ea,
2971
+ data: ca,
2972
+ defer: ma,
2973
+ generatePath: na,
2974
+ getStaticContextFromError: Pa,
2975
+ getToPathname: la,
2976
+ isDataWithResponseInit: Rt,
2977
+ isDeferredData: Er,
2978
+ isRouteErrorResponse: He,
2979
+ joinPaths: Ie,
2980
+ json: ua,
2981
+ matchPath: mt,
2982
+ matchRoutes: pe,
2983
+ normalizePathname: sr,
2984
+ parsePath: ie,
2985
+ redirect: St,
2986
+ redirectDocument: ya,
2987
+ replace: ga,
2988
+ resolvePath: nr,
2989
+ resolveTo: lr,
2990
+ stripBasename: Ye
2991
+ }, Symbol.toStringTag, { value: "Module" }));
2992
+ export {
2993
+ $ as A,
2994
+ Ha as B,
2995
+ lt as E,
2996
+ Oe as I,
2997
+ lr as a,
2998
+ He as b,
2999
+ mt as c,
3000
+ ar as d,
3001
+ er as e,
3002
+ Wr as f,
3003
+ or as g,
3004
+ yt as h,
3005
+ B as i,
3006
+ Ie as j,
3007
+ Sa as k,
3008
+ se as l,
3009
+ pe as m,
3010
+ ma as n,
3011
+ na as o,
3012
+ ie as p,
3013
+ ua as q,
3014
+ St as r,
3015
+ Ye as s,
3016
+ ya as t,
3017
+ ga as u,
3018
+ nr as v,
3019
+ le as w,
3020
+ Kr as x,
3021
+ kr as y,
3022
+ fr as z
3023
+ };
3024
+ //# sourceMappingURL=router-Oe6YmY6B.js.map