@uva-glass/component-library 2.0.1 → 2.0.2

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 (46) hide show
  1. package/dist/{TablePlugin-DDlrU-7e.js → TablePlugin-E6UFlCgy.js} +6 -5
  2. package/dist/{TablePlugin-DDlrU-7e.js.map → TablePlugin-E6UFlCgy.js.map} +1 -1
  3. package/dist/components/Buttons/LinkButton.d.ts +2 -2
  4. package/dist/components/Buttons/LinkButton.js +1 -1
  5. package/dist/components/Buttons/LinkButton.js.map +1 -1
  6. package/dist/components/Buttons/LinkButton.stories.js +5 -5
  7. package/dist/components/CheckboxTree/CheckboxTree.js +7 -6
  8. package/dist/components/CheckboxTree/CheckboxTree.js.map +1 -1
  9. package/dist/components/FormInput/FormInput.js +9 -8
  10. package/dist/components/FormInput/FormInput.js.map +1 -1
  11. package/dist/components/InputField/InputField.stories.js +4 -3
  12. package/dist/components/InputField/InputField.stories.js.map +1 -1
  13. package/dist/components/MenuLink/MenuLink.js +5 -5
  14. package/dist/components/MenuLink/MenuLink.stories.js +2 -2
  15. package/dist/components/MenuLink/MenuLink.stories.js.map +1 -1
  16. package/dist/components/MultiSelect/MultiSelect.js +1 -1
  17. package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
  18. package/dist/components/MultiSelect/components/MultiSelectHeader.js +3 -2
  19. package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
  20. package/dist/components/MultiSelect/index.js +1 -1
  21. package/dist/components/PeriodSelector/PeriodSelector.js +4 -3
  22. package/dist/components/PeriodSelector/PeriodSelector.js.map +1 -1
  23. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +4 -3
  24. package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
  25. package/dist/components/RteEditor/EditorHeader/EditorHeader.js +4 -3
  26. package/dist/components/RteEditor/EditorHeader/EditorHeader.js.map +1 -1
  27. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +4 -3
  28. package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js.map +1 -1
  29. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +3 -2
  30. package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js.map +1 -1
  31. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +4 -3
  32. package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
  33. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +3 -2
  34. package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js.map +1 -1
  35. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +3 -2
  36. package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js.map +1 -1
  37. package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
  38. package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +1 -1
  39. package/dist/components/RteEditor/Plugins/index.js +1 -1
  40. package/dist/components/RteEditor/RteEditor.js +4 -3
  41. package/dist/components/RteEditor/RteEditor.js.map +1 -1
  42. package/dist/components/index.js +1 -1
  43. package/dist/index.js +1 -1
  44. package/package.json +1 -1
  45. package/dist/chunk-D52XG6IA-CQ2nAQyC.js +0 -1701
  46. package/dist/chunk-D52XG6IA-CQ2nAQyC.js.map +0 -1
@@ -1,1701 +0,0 @@
1
- import * as s from "react";
2
- var B = {}, ae;
3
- function Pe() {
4
- if (ae) return B;
5
- ae = 1, Object.defineProperty(B, "__esModule", { value: !0 }), B.parse = u, B.serialize = l;
6
- const e = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, t = /^[\u0021-\u003A\u003C-\u007E]*$/, n = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, i = /^[\u0020-\u003A\u003D-\u007E]*$/, r = Object.prototype.toString, a = /* @__PURE__ */ (() => {
7
- const m = function() {
8
- };
9
- return m.prototype = /* @__PURE__ */ Object.create(null), m;
10
- })();
11
- function u(m, d) {
12
- const f = new a(), g = m.length;
13
- if (g < 2)
14
- return f;
15
- const v = (d == null ? void 0 : d.decode) || p;
16
- let h = 0;
17
- do {
18
- const w = m.indexOf("=", h);
19
- if (w === -1)
20
- break;
21
- const x = m.indexOf(";", h), C = x === -1 ? g : x;
22
- if (w > C) {
23
- h = m.lastIndexOf(";", w - 1) + 1;
24
- continue;
25
- }
26
- const R = c(m, h, w), A = o(m, w, R), $ = m.slice(R, A);
27
- if (f[$] === void 0) {
28
- let D = c(m, w + 1, C), b = o(m, C, D);
29
- const I = v(m.slice(D, b));
30
- f[$] = I;
31
- }
32
- h = C + 1;
33
- } while (h < g);
34
- return f;
35
- }
36
- function c(m, d, f) {
37
- do {
38
- const g = m.charCodeAt(d);
39
- if (g !== 32 && g !== 9)
40
- return d;
41
- } while (++d < f);
42
- return f;
43
- }
44
- function o(m, d, f) {
45
- for (; d > f; ) {
46
- const g = m.charCodeAt(--d);
47
- if (g !== 32 && g !== 9)
48
- return d + 1;
49
- }
50
- return f;
51
- }
52
- function l(m, d, f) {
53
- const g = (f == null ? void 0 : f.encode) || encodeURIComponent;
54
- if (!e.test(m))
55
- throw new TypeError(`argument name is invalid: ${m}`);
56
- const v = g(d);
57
- if (!t.test(v))
58
- throw new TypeError(`argument val is invalid: ${d}`);
59
- let h = m + "=" + v;
60
- if (!f)
61
- return h;
62
- if (f.maxAge !== void 0) {
63
- if (!Number.isInteger(f.maxAge))
64
- throw new TypeError(`option maxAge is invalid: ${f.maxAge}`);
65
- h += "; Max-Age=" + f.maxAge;
66
- }
67
- if (f.domain) {
68
- if (!n.test(f.domain))
69
- throw new TypeError(`option domain is invalid: ${f.domain}`);
70
- h += "; Domain=" + f.domain;
71
- }
72
- if (f.path) {
73
- if (!i.test(f.path))
74
- throw new TypeError(`option path is invalid: ${f.path}`);
75
- h += "; Path=" + f.path;
76
- }
77
- if (f.expires) {
78
- if (!y(f.expires) || !Number.isFinite(f.expires.valueOf()))
79
- throw new TypeError(`option expires is invalid: ${f.expires}`);
80
- h += "; Expires=" + f.expires.toUTCString();
81
- }
82
- if (f.httpOnly && (h += "; HttpOnly"), f.secure && (h += "; Secure"), f.partitioned && (h += "; Partitioned"), f.priority)
83
- switch (typeof f.priority == "string" ? f.priority.toLowerCase() : void 0) {
84
- case "low":
85
- h += "; Priority=Low";
86
- break;
87
- case "medium":
88
- h += "; Priority=Medium";
89
- break;
90
- case "high":
91
- h += "; Priority=High";
92
- break;
93
- default:
94
- throw new TypeError(`option priority is invalid: ${f.priority}`);
95
- }
96
- if (f.sameSite)
97
- switch (typeof f.sameSite == "string" ? f.sameSite.toLowerCase() : f.sameSite) {
98
- case !0:
99
- case "strict":
100
- h += "; SameSite=Strict";
101
- break;
102
- case "lax":
103
- h += "; SameSite=Lax";
104
- break;
105
- case "none":
106
- h += "; SameSite=None";
107
- break;
108
- default:
109
- throw new TypeError(`option sameSite is invalid: ${f.sameSite}`);
110
- }
111
- return h;
112
- }
113
- function p(m) {
114
- if (m.indexOf("%") === -1)
115
- return m;
116
- try {
117
- return decodeURIComponent(m);
118
- } catch {
119
- return m;
120
- }
121
- }
122
- function y(m) {
123
- return r.call(m) === "[object Date]";
124
- }
125
- return B;
126
- }
127
- Pe();
128
- /**
129
- * react-router v7.0.2
130
- *
131
- * Copyright (c) Remix Software Inc.
132
- *
133
- * This source code is licensed under the MIT license found in the
134
- * LICENSE.md file in the root directory of this source tree.
135
- *
136
- * @license MIT
137
- */
138
- var ie = "popstate";
139
- function Le(e = {}) {
140
- let { initialEntries: t = ["/"], initialIndex: n, v5Compat: i = !1 } = e, r;
141
- r = t.map(
142
- (d, f) => p(
143
- d,
144
- typeof d == "string" ? null : d.state,
145
- f === 0 ? "default" : void 0
146
- )
147
- );
148
- let a = o(
149
- n ?? r.length - 1
150
- ), u = "POP", c = null;
151
- function o(d) {
152
- return Math.min(Math.max(d, 0), r.length - 1);
153
- }
154
- function l() {
155
- return r[a];
156
- }
157
- function p(d, f = null, g) {
158
- let v = j(
159
- r ? l().pathname : "/",
160
- d,
161
- f,
162
- g
163
- );
164
- return S(
165
- v.pathname.charAt(0) === "/",
166
- `relative pathnames are not supported in memory history: ${JSON.stringify(
167
- d
168
- )}`
169
- ), v;
170
- }
171
- function y(d) {
172
- return typeof d == "string" ? d : F(d);
173
- }
174
- return {
175
- get index() {
176
- return a;
177
- },
178
- get action() {
179
- return u;
180
- },
181
- get location() {
182
- return l();
183
- },
184
- createHref: y,
185
- createURL(d) {
186
- return new URL(y(d), "http://localhost");
187
- },
188
- encodeLocation(d) {
189
- let f = typeof d == "string" ? M(d) : d;
190
- return {
191
- pathname: f.pathname || "",
192
- search: f.search || "",
193
- hash: f.hash || ""
194
- };
195
- },
196
- push(d, f) {
197
- u = "PUSH";
198
- let g = p(d, f);
199
- a += 1, r.splice(a, r.length, g), i && c && c({ action: u, location: g, delta: 1 });
200
- },
201
- replace(d, f) {
202
- u = "REPLACE";
203
- let g = p(d, f);
204
- r[a] = g, i && c && c({ action: u, location: g, delta: 0 });
205
- },
206
- go(d) {
207
- u = "POP";
208
- let f = o(a + d), g = r[f];
209
- a = f, c && c({ action: u, location: g, delta: d });
210
- },
211
- listen(d) {
212
- return c = d, () => {
213
- c = null;
214
- };
215
- }
216
- };
217
- }
218
- function ke(e = {}) {
219
- function t(i, r) {
220
- let { pathname: a, search: u, hash: c } = i.location;
221
- return j(
222
- "",
223
- { pathname: a, search: u, hash: c },
224
- // state defaults to `null` because `window.history.state` does
225
- r.state && r.state.usr || null,
226
- r.state && r.state.key || "default"
227
- );
228
- }
229
- function n(i, r) {
230
- return typeof r == "string" ? r : F(r);
231
- }
232
- return Ie(
233
- t,
234
- n,
235
- null,
236
- e
237
- );
238
- }
239
- function E(e, t) {
240
- if (e === !1 || e === null || typeof e > "u")
241
- throw new Error(t);
242
- }
243
- function S(e, t) {
244
- if (!e) {
245
- typeof console < "u" && console.warn(t);
246
- try {
247
- throw new Error(t);
248
- } catch {
249
- }
250
- }
251
- }
252
- function $e() {
253
- return Math.random().toString(36).substring(2, 10);
254
- }
255
- function oe(e, t) {
256
- return {
257
- usr: e.state,
258
- key: e.key,
259
- idx: t
260
- };
261
- }
262
- function j(e, t, n = null, i) {
263
- return {
264
- pathname: typeof e == "string" ? e : e.pathname,
265
- search: "",
266
- hash: "",
267
- ...typeof t == "string" ? M(t) : t,
268
- state: n,
269
- // TODO: This could be cleaned up. push/replace should probably just take
270
- // full Locations now and avoid the need to run through this flow at all
271
- // But that's a pretty big refactor to the current test suite so going to
272
- // keep as is for the time being and just let any incoming keys take precedence
273
- key: t && t.key || i || $e()
274
- };
275
- }
276
- function F({
277
- pathname: e = "/",
278
- search: t = "",
279
- hash: n = ""
280
- }) {
281
- return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), n && n !== "#" && (e += n.charAt(0) === "#" ? n : "#" + n), e;
282
- }
283
- function M(e) {
284
- let t = {};
285
- if (e) {
286
- let n = e.indexOf("#");
287
- n >= 0 && (t.hash = e.substring(n), e = e.substring(0, n));
288
- let i = e.indexOf("?");
289
- i >= 0 && (t.search = e.substring(i), e = e.substring(0, i)), e && (t.pathname = e);
290
- }
291
- return t;
292
- }
293
- function Ie(e, t, n, i = {}) {
294
- let { window: r = document.defaultView, v5Compat: a = !1 } = i, u = r.history, c = "POP", o = null, l = p();
295
- l == null && (l = 0, u.replaceState({ ...u.state, idx: l }, ""));
296
- function p() {
297
- return (u.state || { idx: null }).idx;
298
- }
299
- function y() {
300
- c = "POP";
301
- let v = p(), h = v == null ? null : v - l;
302
- l = v, o && o({ action: c, location: g.location, delta: h });
303
- }
304
- function m(v, h) {
305
- c = "PUSH";
306
- let w = j(g.location, v, h);
307
- l = p() + 1;
308
- let x = oe(w, l), C = g.createHref(w);
309
- try {
310
- u.pushState(x, "", C);
311
- } catch (R) {
312
- if (R instanceof DOMException && R.name === "DataCloneError")
313
- throw R;
314
- r.location.assign(C);
315
- }
316
- a && o && o({ action: c, location: g.location, delta: 1 });
317
- }
318
- function d(v, h) {
319
- c = "REPLACE";
320
- let w = j(g.location, v, h);
321
- l = p();
322
- let x = oe(w, l), C = g.createHref(w);
323
- u.replaceState(x, "", C), a && o && o({ action: c, location: g.location, delta: 0 });
324
- }
325
- function f(v) {
326
- let h = r.location.origin !== "null" ? r.location.origin : r.location.href, w = typeof v == "string" ? v : F(v);
327
- return w = w.replace(/ $/, "%20"), E(
328
- h,
329
- `No window.location.(origin|href) available to create URL for href: ${w}`
330
- ), new URL(w, h);
331
- }
332
- let g = {
333
- get action() {
334
- return c;
335
- },
336
- get location() {
337
- return e(r, u);
338
- },
339
- listen(v) {
340
- if (o)
341
- throw new Error("A history only accepts one active listener");
342
- return r.addEventListener(ie, y), o = v, () => {
343
- r.removeEventListener(ie, y), o = null;
344
- };
345
- },
346
- createHref(v) {
347
- return t(r, v);
348
- },
349
- createURL: f,
350
- encodeLocation(v) {
351
- let h = f(v);
352
- return {
353
- pathname: h.pathname,
354
- search: h.search,
355
- hash: h.hash
356
- };
357
- },
358
- push: m,
359
- replace: d,
360
- go(v) {
361
- return u.go(v);
362
- }
363
- };
364
- return g;
365
- }
366
- function ce(e, t, n = "/") {
367
- return Te(e, t, n, !1);
368
- }
369
- function Te(e, t, n, i) {
370
- let r = typeof t == "string" ? M(t) : t, a = T(r.pathname || "/", n);
371
- if (a == null)
372
- return null;
373
- let u = fe(e);
374
- De(u);
375
- let c = null;
376
- for (let o = 0; c == null && o < u.length; ++o) {
377
- let l = ze(a);
378
- c = We(
379
- u[o],
380
- l,
381
- i
382
- );
383
- }
384
- return c;
385
- }
386
- function fe(e, t = [], n = [], i = "") {
387
- let r = (a, u, c) => {
388
- let o = {
389
- relativePath: c === void 0 ? a.path || "" : c,
390
- caseSensitive: a.caseSensitive === !0,
391
- childrenIndex: u,
392
- route: a
393
- };
394
- o.relativePath.startsWith("/") && (E(
395
- o.relativePath.startsWith(i),
396
- `Absolute route path "${o.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
397
- ), o.relativePath = o.relativePath.slice(i.length));
398
- let l = L([i, o.relativePath]), p = n.concat(o);
399
- a.children && a.children.length > 0 && (E(
400
- // Our types know better, but runtime JS may not!
401
- // @ts-expect-error
402
- a.index !== !0,
403
- `Index routes must not have child routes. Please remove all child routes from route path "${l}".`
404
- ), fe(a.children, t, p, l)), !(a.path == null && !a.index) && t.push({
405
- path: l,
406
- score: Ue(l, a.index),
407
- routesMeta: p
408
- });
409
- };
410
- return e.forEach((a, u) => {
411
- var c;
412
- if (a.path === "" || !((c = a.path) != null && c.includes("?")))
413
- r(a, u);
414
- else
415
- for (let o of de(a.path))
416
- r(a, u, o);
417
- }), t;
418
- }
419
- function de(e) {
420
- let t = e.split("/");
421
- if (t.length === 0) return [];
422
- let [n, ...i] = t, r = n.endsWith("?"), a = n.replace(/\?$/, "");
423
- if (i.length === 0)
424
- return r ? [a, ""] : [a];
425
- let u = de(i.join("/")), c = [];
426
- return c.push(
427
- ...u.map(
428
- (o) => o === "" ? a : [a, o].join("/")
429
- )
430
- ), r && c.push(...u), c.map(
431
- (o) => e.startsWith("/") && o === "" ? "/" : o
432
- );
433
- }
434
- function De(e) {
435
- e.sort(
436
- (t, n) => t.score !== n.score ? n.score - t.score : He(
437
- t.routesMeta.map((i) => i.childrenIndex),
438
- n.routesMeta.map((i) => i.childrenIndex)
439
- )
440
- );
441
- }
442
- var Ne = /^:[\w-]+$/, Ae = 3, Fe = 2, Me = 1, Oe = 10, Be = -2, le = (e) => e === "*";
443
- function Ue(e, t) {
444
- let n = e.split("/"), i = n.length;
445
- return n.some(le) && (i += Be), t && (i += Fe), n.filter((r) => !le(r)).reduce(
446
- (r, a) => r + (Ne.test(a) ? Ae : a === "" ? Me : Oe),
447
- i
448
- );
449
- }
450
- function He(e, t) {
451
- return e.length === t.length && e.slice(0, -1).every((i, r) => i === t[r]) ? (
452
- // If two routes are siblings, we should try to match the earlier sibling
453
- // first. This allows people to have fine-grained control over the matching
454
- // behavior by simply putting routes with identical paths in the order they
455
- // want them tried.
456
- e[e.length - 1] - t[t.length - 1]
457
- ) : (
458
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
459
- // so they sort equally.
460
- 0
461
- );
462
- }
463
- function We(e, t, n = !1) {
464
- let { routesMeta: i } = e, r = {}, a = "/", u = [];
465
- for (let c = 0; c < i.length; ++c) {
466
- let o = i[c], l = c === i.length - 1, p = a === "/" ? t : t.slice(a.length) || "/", y = J(
467
- { path: o.relativePath, caseSensitive: o.caseSensitive, end: l },
468
- p
469
- ), m = o.route;
470
- if (!y && l && n && !i[i.length - 1].route.index && (y = J(
471
- {
472
- path: o.relativePath,
473
- caseSensitive: o.caseSensitive,
474
- end: !1
475
- },
476
- p
477
- )), !y)
478
- return null;
479
- Object.assign(r, y.params), u.push({
480
- // TODO: Can this as be avoided?
481
- params: r,
482
- pathname: L([a, y.pathname]),
483
- pathnameBase: Ke(
484
- L([a, y.pathnameBase])
485
- ),
486
- route: m
487
- }), y.pathnameBase !== "/" && (a = L([a, y.pathnameBase]));
488
- }
489
- return u;
490
- }
491
- function J(e, t) {
492
- typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
493
- let [n, i] = _e(
494
- e.path,
495
- e.caseSensitive,
496
- e.end
497
- ), r = t.match(n);
498
- if (!r) return null;
499
- let a = r[0], u = a.replace(/(.)\/+$/, "$1"), c = r.slice(1);
500
- return {
501
- params: i.reduce(
502
- (l, { paramName: p, isOptional: y }, m) => {
503
- if (p === "*") {
504
- let f = c[m] || "";
505
- u = a.slice(0, a.length - f.length).replace(/(.)\/+$/, "$1");
506
- }
507
- const d = c[m];
508
- return y && !d ? l[p] = void 0 : l[p] = (d || "").replace(/%2F/g, "/"), l;
509
- },
510
- {}
511
- ),
512
- pathname: a,
513
- pathnameBase: u,
514
- pattern: e
515
- };
516
- }
517
- function _e(e, t = !1, n = !0) {
518
- S(
519
- e === "*" || !e.endsWith("*") || e.endsWith("/*"),
520
- `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(/\*$/, "/*")}".`
521
- );
522
- let i = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
523
- /\/:([\w-]+)(\?)?/g,
524
- (u, c, o) => (i.push({ paramName: c, isOptional: o != null }), o ? "/?([^\\/]+)?" : "/([^\\/]+)")
525
- );
526
- return e.endsWith("*") ? (i.push({ paramName: "*" }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), i];
527
- }
528
- function ze(e) {
529
- try {
530
- return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
531
- } catch (t) {
532
- return S(
533
- !1,
534
- `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}).`
535
- ), e;
536
- }
537
- }
538
- function T(e, t) {
539
- if (t === "/") return e;
540
- if (!e.toLowerCase().startsWith(t.toLowerCase()))
541
- return null;
542
- let n = t.endsWith("/") ? t.length - 1 : t.length, i = e.charAt(n);
543
- return i && i !== "/" ? null : e.slice(n) || "/";
544
- }
545
- function Ve(e, t = "/") {
546
- let {
547
- pathname: n,
548
- search: i = "",
549
- hash: r = ""
550
- } = typeof e == "string" ? M(e) : e;
551
- return {
552
- pathname: n ? n.startsWith("/") ? n : je(n, t) : t,
553
- search: Ye(i),
554
- hash: qe(r)
555
- };
556
- }
557
- function je(e, t) {
558
- let n = t.replace(/\/+$/, "").split("/");
559
- return e.split("/").forEach((r) => {
560
- r === ".." ? n.length > 1 && n.pop() : r !== "." && n.push(r);
561
- }), n.length > 1 ? n.join("/") : "/";
562
- }
563
- function G(e, t, n, i) {
564
- return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
565
- i
566
- )}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
567
- }
568
- function Je(e) {
569
- return e.filter(
570
- (t, n) => n === 0 || t.route.path && t.route.path.length > 0
571
- );
572
- }
573
- function he(e) {
574
- let t = Je(e);
575
- return t.map(
576
- (n, i) => i === t.length - 1 ? n.pathname : n.pathnameBase
577
- );
578
- }
579
- function me(e, t, n, i = !1) {
580
- let r;
581
- typeof e == "string" ? r = M(e) : (r = { ...e }, E(
582
- !r.pathname || !r.pathname.includes("?"),
583
- G("?", "pathname", "search", r)
584
- ), E(
585
- !r.pathname || !r.pathname.includes("#"),
586
- G("#", "pathname", "hash", r)
587
- ), E(
588
- !r.search || !r.search.includes("#"),
589
- G("#", "search", "hash", r)
590
- ));
591
- let a = e === "" || r.pathname === "", u = a ? "/" : r.pathname, c;
592
- if (u == null)
593
- c = n;
594
- else {
595
- let y = t.length - 1;
596
- if (!i && u.startsWith("..")) {
597
- let m = u.split("/");
598
- for (; m[0] === ".."; )
599
- m.shift(), y -= 1;
600
- r.pathname = m.join("/");
601
- }
602
- c = y >= 0 ? t[y] : "/";
603
- }
604
- let o = Ve(r, c), l = u && u !== "/" && u.endsWith("/"), p = (a || u === ".") && n.endsWith("/");
605
- return !o.pathname.endsWith("/") && (l || p) && (o.pathname += "/"), o;
606
- }
607
- var L = (e) => e.join("/").replace(/\/\/+/g, "/"), Ke = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Ye = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, qe = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
608
- function Ge(e) {
609
- return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
610
- }
611
- var pe = [
612
- "POST",
613
- "PUT",
614
- "PATCH",
615
- "DELETE"
616
- ];
617
- new Set(
618
- pe
619
- );
620
- var Xe = [
621
- "GET",
622
- ...pe
623
- ];
624
- new Set(Xe);
625
- var O = s.createContext(null);
626
- O.displayName = "DataRouter";
627
- var K = s.createContext(null);
628
- K.displayName = "DataRouterState";
629
- var ge = s.createContext({
630
- isTransitioning: !1
631
- });
632
- ge.displayName = "ViewTransition";
633
- var Qe = s.createContext(
634
- /* @__PURE__ */ new Map()
635
- );
636
- Qe.displayName = "Fetchers";
637
- var Ze = s.createContext(null);
638
- Ze.displayName = "Await";
639
- var P = s.createContext(
640
- null
641
- );
642
- P.displayName = "Navigation";
643
- var Y = s.createContext(
644
- null
645
- );
646
- Y.displayName = "Location";
647
- var k = s.createContext({
648
- outlet: null,
649
- matches: [],
650
- isDataRoute: !1
651
- });
652
- k.displayName = "Route";
653
- var Q = s.createContext(null);
654
- Q.displayName = "RouteError";
655
- function et(e, { relative: t } = {}) {
656
- E(
657
- H(),
658
- // TODO: This error is probably because they somehow have 2 versions of the
659
- // router loaded. We can help them understand how to avoid that.
660
- "useHref() may be used only in the context of a <Router> component."
661
- );
662
- let { basename: n, navigator: i } = s.useContext(P), { hash: r, pathname: a, search: u } = W(e, { relative: t }), c = a;
663
- return n !== "/" && (c = a === "/" ? n : L([n, a])), i.createHref({ pathname: c, search: u, hash: r });
664
- }
665
- function H() {
666
- return s.useContext(Y) != null;
667
- }
668
- function N() {
669
- return E(
670
- H(),
671
- // TODO: This error is probably because they somehow have 2 versions of the
672
- // router loaded. We can help them understand how to avoid that.
673
- "useLocation() may be used only in the context of a <Router> component."
674
- ), s.useContext(Y).location;
675
- }
676
- var ye = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
677
- function ve(e) {
678
- s.useContext(P).static || s.useLayoutEffect(e);
679
- }
680
- function tt() {
681
- let { isDataRoute: e } = s.useContext(k);
682
- return e ? mt() : nt();
683
- }
684
- function nt() {
685
- E(
686
- H(),
687
- // TODO: This error is probably because they somehow have 2 versions of the
688
- // router loaded. We can help them understand how to avoid that.
689
- "useNavigate() may be used only in the context of a <Router> component."
690
- );
691
- let e = s.useContext(O), { basename: t, navigator: n } = s.useContext(P), { matches: i } = s.useContext(k), { pathname: r } = N(), a = JSON.stringify(he(i)), u = s.useRef(!1);
692
- return ve(() => {
693
- u.current = !0;
694
- }), s.useCallback(
695
- (o, l = {}) => {
696
- if (S(u.current, ye), !u.current) return;
697
- if (typeof o == "number") {
698
- n.go(o);
699
- return;
700
- }
701
- let p = me(
702
- o,
703
- JSON.parse(a),
704
- r,
705
- l.relative === "path"
706
- );
707
- e == null && t !== "/" && (p.pathname = p.pathname === "/" ? t : L([t, p.pathname])), (l.replace ? n.replace : n.push)(
708
- p,
709
- l.state,
710
- l
711
- );
712
- },
713
- [
714
- t,
715
- n,
716
- a,
717
- r,
718
- e
719
- ]
720
- );
721
- }
722
- s.createContext(null);
723
- function W(e, { relative: t } = {}) {
724
- let { matches: n } = s.useContext(k), { pathname: i } = N(), r = JSON.stringify(he(n));
725
- return s.useMemo(
726
- () => me(
727
- e,
728
- JSON.parse(r),
729
- i,
730
- t === "path"
731
- ),
732
- [e, r, i, t]
733
- );
734
- }
735
- function rt(e, t, n, i) {
736
- E(
737
- H(),
738
- // TODO: This error is probably because they somehow have 2 versions of the
739
- // router loaded. We can help them understand how to avoid that.
740
- "useRoutes() may be used only in the context of a <Router> component."
741
- );
742
- let { navigator: r } = s.useContext(P), { matches: a } = s.useContext(k), u = a[a.length - 1], c = u ? u.params : {}, o = u ? u.pathname : "/", l = u ? u.pathnameBase : "/", p = u && u.route;
743
- {
744
- let h = p && p.path || "";
745
- we(
746
- o,
747
- !p || h.endsWith("*") || h.endsWith("*?"),
748
- `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
749
-
750
- Please change the parent <Route path="${h}"> to <Route path="${h === "/" ? "*" : `${h}/*`}">.`
751
- );
752
- }
753
- let y = N(), m;
754
- m = y;
755
- let d = m.pathname || "/", f = d;
756
- if (l !== "/") {
757
- let h = l.replace(/^\//, "").split("/");
758
- f = "/" + d.replace(/^\//, "").split("/").slice(h.length).join("/");
759
- }
760
- let g = ce(e, { pathname: f });
761
- return S(
762
- p || g != null,
763
- `No routes matched location "${m.pathname}${m.search}${m.hash}" `
764
- ), S(
765
- g == null || g[g.length - 1].route.element !== void 0 || g[g.length - 1].route.Component !== void 0 || g[g.length - 1].route.lazy !== void 0,
766
- `Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
767
- ), ut(
768
- g && g.map(
769
- (h) => Object.assign({}, h, {
770
- params: Object.assign({}, c, h.params),
771
- pathname: L([
772
- l,
773
- // Re-encode pathnames that were decoded inside matchRoutes
774
- r.encodeLocation ? r.encodeLocation(h.pathname).pathname : h.pathname
775
- ]),
776
- pathnameBase: h.pathnameBase === "/" ? l : L([
777
- l,
778
- // Re-encode pathnames that were decoded inside matchRoutes
779
- r.encodeLocation ? r.encodeLocation(h.pathnameBase).pathname : h.pathnameBase
780
- ])
781
- })
782
- ),
783
- a,
784
- n,
785
- i
786
- );
787
- }
788
- function at() {
789
- let e = ht(), t = Ge(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), n = e instanceof Error ? e.stack : null, i = "rgba(200,200,200, 0.5)", r = { padding: "0.5rem", backgroundColor: i }, a = { padding: "2px 4px", backgroundColor: i }, u = null;
790
- return console.error(
791
- "Error handled by React Router default ErrorBoundary:",
792
- e
793
- ), u = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ s.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ s.createElement("code", { style: a }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ s.createElement("code", { style: a }, "errorElement"), " prop on your route.")), /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ s.createElement("h3", { style: { fontStyle: "italic" } }, t), n ? /* @__PURE__ */ s.createElement("pre", { style: r }, n) : null, u);
794
- }
795
- var it = /* @__PURE__ */ s.createElement(at, null), ot = class extends s.Component {
796
- constructor(e) {
797
- super(e), this.state = {
798
- location: e.location,
799
- revalidation: e.revalidation,
800
- error: e.error
801
- };
802
- }
803
- static getDerivedStateFromError(e) {
804
- return { error: e };
805
- }
806
- static getDerivedStateFromProps(e, t) {
807
- return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
808
- error: e.error,
809
- location: e.location,
810
- revalidation: e.revalidation
811
- } : {
812
- error: e.error !== void 0 ? e.error : t.error,
813
- location: t.location,
814
- revalidation: e.revalidation || t.revalidation
815
- };
816
- }
817
- componentDidCatch(e, t) {
818
- console.error(
819
- "React Router caught the following error during render",
820
- e,
821
- t
822
- );
823
- }
824
- render() {
825
- return this.state.error !== void 0 ? /* @__PURE__ */ s.createElement(k.Provider, { value: this.props.routeContext }, /* @__PURE__ */ s.createElement(
826
- Q.Provider,
827
- {
828
- value: this.state.error,
829
- children: this.props.component
830
- }
831
- )) : this.props.children;
832
- }
833
- };
834
- function lt({ routeContext: e, match: t, children: n }) {
835
- let i = s.useContext(O);
836
- return i && i.static && i.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (i.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ s.createElement(k.Provider, { value: e }, n);
837
- }
838
- function ut(e, t = [], n = null, i = null) {
839
- if (e == null) {
840
- if (!n)
841
- return null;
842
- if (n.errors)
843
- e = n.matches;
844
- else if (t.length === 0 && !n.initialized && n.matches.length > 0)
845
- e = n.matches;
846
- else
847
- return null;
848
- }
849
- let r = e, a = n == null ? void 0 : n.errors;
850
- if (a != null) {
851
- let o = r.findIndex(
852
- (l) => l.route.id && (a == null ? void 0 : a[l.route.id]) !== void 0
853
- );
854
- E(
855
- o >= 0,
856
- `Could not find a matching route for errors on route IDs: ${Object.keys(
857
- a
858
- ).join(",")}`
859
- ), r = r.slice(
860
- 0,
861
- Math.min(r.length, o + 1)
862
- );
863
- }
864
- let u = !1, c = -1;
865
- if (n)
866
- for (let o = 0; o < r.length; o++) {
867
- let l = r[o];
868
- if ((l.route.HydrateFallback || l.route.hydrateFallbackElement) && (c = o), l.route.id) {
869
- let { loaderData: p, errors: y } = n, m = l.route.loader && !p.hasOwnProperty(l.route.id) && (!y || y[l.route.id] === void 0);
870
- if (l.route.lazy || m) {
871
- u = !0, c >= 0 ? r = r.slice(0, c + 1) : r = [r[0]];
872
- break;
873
- }
874
- }
875
- }
876
- return r.reduceRight((o, l, p) => {
877
- let y, m = !1, d = null, f = null;
878
- n && (y = a && l.route.id ? a[l.route.id] : void 0, d = l.route.errorElement || it, u && (c < 0 && p === 0 ? (we(
879
- "route-fallback",
880
- !1,
881
- "No `HydrateFallback` element provided to render during initial hydration"
882
- ), m = !0, f = null) : c === p && (m = !0, f = l.route.hydrateFallbackElement || null)));
883
- let g = t.concat(r.slice(0, p + 1)), v = () => {
884
- let h;
885
- return y ? h = d : m ? h = f : l.route.Component ? h = /* @__PURE__ */ s.createElement(l.route.Component, null) : l.route.element ? h = l.route.element : h = o, /* @__PURE__ */ s.createElement(
886
- lt,
887
- {
888
- match: l,
889
- routeContext: {
890
- outlet: o,
891
- matches: g,
892
- isDataRoute: n != null
893
- },
894
- children: h
895
- }
896
- );
897
- };
898
- return n && (l.route.ErrorBoundary || l.route.errorElement || p === 0) ? /* @__PURE__ */ s.createElement(
899
- ot,
900
- {
901
- location: n.location,
902
- revalidation: n.revalidation,
903
- component: d,
904
- error: y,
905
- children: v(),
906
- routeContext: { outlet: null, matches: g, isDataRoute: !0 }
907
- }
908
- ) : v();
909
- }, null);
910
- }
911
- function Z(e) {
912
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
913
- }
914
- function st(e) {
915
- let t = s.useContext(O);
916
- return E(t, Z(e)), t;
917
- }
918
- function ct(e) {
919
- let t = s.useContext(K);
920
- return E(t, Z(e)), t;
921
- }
922
- function ft(e) {
923
- let t = s.useContext(k);
924
- return E(t, Z(e)), t;
925
- }
926
- function ee(e) {
927
- let t = ft(e), n = t.matches[t.matches.length - 1];
928
- return E(
929
- n.route.id,
930
- `${e} can only be used on routes that contain a unique "id"`
931
- ), n.route.id;
932
- }
933
- function dt() {
934
- return ee(
935
- "useRouteId"
936
- /* UseRouteId */
937
- );
938
- }
939
- function ht() {
940
- var i;
941
- let e = s.useContext(Q), t = ct(
942
- "useRouteError"
943
- /* UseRouteError */
944
- ), n = ee(
945
- "useRouteError"
946
- /* UseRouteError */
947
- );
948
- return e !== void 0 ? e : (i = t.errors) == null ? void 0 : i[n];
949
- }
950
- function mt() {
951
- let { router: e } = st(
952
- "useNavigate"
953
- /* UseNavigateStable */
954
- ), t = ee(
955
- "useNavigate"
956
- /* UseNavigateStable */
957
- ), n = s.useRef(!1);
958
- return ve(() => {
959
- n.current = !0;
960
- }), s.useCallback(
961
- async (r, a = {}) => {
962
- S(n.current, ye), n.current && (typeof r == "number" ? e.navigate(r) : await e.navigate(r, { fromRouteId: t, ...a }));
963
- },
964
- [e, t]
965
- );
966
- }
967
- var ue = {};
968
- function we(e, t, n) {
969
- !t && !ue[e] && (ue[e] = !0, S(!1, n));
970
- }
971
- s.memo(pt);
972
- function pt({
973
- routes: e,
974
- future: t,
975
- state: n
976
- }) {
977
- return rt(e, void 0, n, t);
978
- }
979
- function Yt({
980
- basename: e,
981
- children: t,
982
- initialEntries: n,
983
- initialIndex: i
984
- }) {
985
- let r = s.useRef();
986
- r.current == null && (r.current = Le({
987
- initialEntries: n,
988
- initialIndex: i,
989
- v5Compat: !0
990
- }));
991
- let a = r.current, [u, c] = s.useState({
992
- action: a.action,
993
- location: a.location
994
- }), o = s.useCallback(
995
- (l) => {
996
- s.startTransition(() => c(l));
997
- },
998
- [c]
999
- );
1000
- return s.useLayoutEffect(() => a.listen(o), [a, o]), /* @__PURE__ */ s.createElement(
1001
- xe,
1002
- {
1003
- basename: e,
1004
- children: t,
1005
- location: u.location,
1006
- navigationType: u.action,
1007
- navigator: a
1008
- }
1009
- );
1010
- }
1011
- function xe({
1012
- basename: e = "/",
1013
- children: t = null,
1014
- location: n,
1015
- navigationType: i = "POP",
1016
- navigator: r,
1017
- static: a = !1
1018
- }) {
1019
- E(
1020
- !H(),
1021
- "You cannot render a <Router> inside another <Router>. You should never have more than one in your app."
1022
- );
1023
- let u = e.replace(/^\/*/, "/"), c = s.useMemo(
1024
- () => ({
1025
- basename: u,
1026
- navigator: r,
1027
- static: a,
1028
- future: {}
1029
- }),
1030
- [u, r, a]
1031
- );
1032
- typeof n == "string" && (n = M(n));
1033
- let {
1034
- pathname: o = "/",
1035
- search: l = "",
1036
- hash: p = "",
1037
- state: y = null,
1038
- key: m = "default"
1039
- } = n, d = s.useMemo(() => {
1040
- let f = T(o, u);
1041
- return f == null ? null : {
1042
- location: {
1043
- pathname: f,
1044
- search: l,
1045
- hash: p,
1046
- state: y,
1047
- key: m
1048
- },
1049
- navigationType: i
1050
- };
1051
- }, [u, o, l, p, y, m, i]);
1052
- return S(
1053
- d != null,
1054
- `<Router basename="${u}"> is not able to match the URL "${o}${l}${p}" because it does not start with the basename, so the <Router> won't render anything.`
1055
- ), d == null ? null : /* @__PURE__ */ s.createElement(P.Provider, { value: c }, /* @__PURE__ */ s.createElement(Y.Provider, { children: t, value: d }));
1056
- }
1057
- var z = "get", V = "application/x-www-form-urlencoded";
1058
- function q(e) {
1059
- return e != null && typeof e.tagName == "string";
1060
- }
1061
- function gt(e) {
1062
- return q(e) && e.tagName.toLowerCase() === "button";
1063
- }
1064
- function yt(e) {
1065
- return q(e) && e.tagName.toLowerCase() === "form";
1066
- }
1067
- function vt(e) {
1068
- return q(e) && e.tagName.toLowerCase() === "input";
1069
- }
1070
- function wt(e) {
1071
- return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
1072
- }
1073
- function xt(e, t) {
1074
- return e.button === 0 && // Ignore everything but left clicks
1075
- (!t || t === "_self") && // Let browser handle "target=_blank" etc.
1076
- !wt(e);
1077
- }
1078
- var _ = null;
1079
- function Et() {
1080
- if (_ === null)
1081
- try {
1082
- new FormData(
1083
- document.createElement("form"),
1084
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
1085
- 0
1086
- ), _ = !1;
1087
- } catch {
1088
- _ = !0;
1089
- }
1090
- return _;
1091
- }
1092
- var Ct = /* @__PURE__ */ new Set([
1093
- "application/x-www-form-urlencoded",
1094
- "multipart/form-data",
1095
- "text/plain"
1096
- ]);
1097
- function X(e) {
1098
- return e != null && !Ct.has(e) ? (S(
1099
- !1,
1100
- `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${V}"`
1101
- ), null) : e;
1102
- }
1103
- function Rt(e, t) {
1104
- let n, i, r, a, u;
1105
- if (yt(e)) {
1106
- let c = e.getAttribute("action");
1107
- i = c ? T(c, t) : null, n = e.getAttribute("method") || z, r = X(e.getAttribute("enctype")) || V, a = new FormData(e);
1108
- } else if (gt(e) || vt(e) && (e.type === "submit" || e.type === "image")) {
1109
- let c = e.form;
1110
- if (c == null)
1111
- throw new Error(
1112
- 'Cannot submit a <button> or <input type="submit"> without a <form>'
1113
- );
1114
- let o = e.getAttribute("formaction") || c.getAttribute("action");
1115
- if (i = o ? T(o, t) : null, n = e.getAttribute("formmethod") || c.getAttribute("method") || z, r = X(e.getAttribute("formenctype")) || X(c.getAttribute("enctype")) || V, a = new FormData(c, e), !Et()) {
1116
- let { name: l, type: p, value: y } = e;
1117
- if (p === "image") {
1118
- let m = l ? `${l}.` : "";
1119
- a.append(`${m}x`, "0"), a.append(`${m}y`, "0");
1120
- } else l && a.append(l, y);
1121
- }
1122
- } else {
1123
- if (q(e))
1124
- throw new Error(
1125
- 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
1126
- );
1127
- n = z, i = null, r = V, u = e;
1128
- }
1129
- return a && r === "text/plain" && (u = a, a = void 0), { action: i, method: n.toLowerCase(), encType: r, formData: a, body: u };
1130
- }
1131
- function te(e, t) {
1132
- if (e === !1 || e === null || typeof e > "u")
1133
- throw new Error(t);
1134
- }
1135
- async function bt(e, t) {
1136
- if (e.id in t)
1137
- return t[e.id];
1138
- try {
1139
- let n = await import(
1140
- /* @vite-ignore */
1141
- /* webpackIgnore: true */
1142
- e.module
1143
- );
1144
- return t[e.id] = n, n;
1145
- } catch (n) {
1146
- return console.error(
1147
- `Error loading route module \`${e.module}\`, reloading page...`
1148
- ), console.error(n), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
1149
- });
1150
- }
1151
- }
1152
- function St(e) {
1153
- return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
1154
- }
1155
- async function Pt(e, t, n) {
1156
- let i = await Promise.all(
1157
- e.map(async (r) => {
1158
- let a = t.routes[r.route.id];
1159
- if (a) {
1160
- let u = await bt(a, n);
1161
- return u.links ? u.links() : [];
1162
- }
1163
- return [];
1164
- })
1165
- );
1166
- return It(
1167
- i.flat(1).filter(St).filter((r) => r.rel === "stylesheet" || r.rel === "preload").map(
1168
- (r) => r.rel === "stylesheet" ? { ...r, rel: "prefetch", as: "style" } : { ...r, rel: "prefetch" }
1169
- )
1170
- );
1171
- }
1172
- function se(e, t, n, i, r, a) {
1173
- let u = (o, l) => n[l] ? o.route.id !== n[l].route.id : !0, c = (o, l) => {
1174
- var p;
1175
- return (
1176
- // param change, /users/123 -> /users/456
1177
- n[l].pathname !== o.pathname || // splat param changed, which is not present in match.path
1178
- // e.g. /files/images/avatar.jpg -> files/finances.xls
1179
- ((p = n[l].route.path) == null ? void 0 : p.endsWith("*")) && n[l].params["*"] !== o.params["*"]
1180
- );
1181
- };
1182
- return a === "assets" ? t.filter(
1183
- (o, l) => u(o, l) || c(o, l)
1184
- ) : a === "data" ? t.filter((o, l) => {
1185
- var y;
1186
- let p = i.routes[o.route.id];
1187
- if (!p || !p.hasLoader)
1188
- return !1;
1189
- if (u(o, l) || c(o, l))
1190
- return !0;
1191
- if (o.route.shouldRevalidate) {
1192
- let m = o.route.shouldRevalidate({
1193
- currentUrl: new URL(
1194
- r.pathname + r.search + r.hash,
1195
- window.origin
1196
- ),
1197
- currentParams: ((y = n[0]) == null ? void 0 : y.params) || {},
1198
- nextUrl: new URL(e, window.origin),
1199
- nextParams: o.params,
1200
- defaultShouldRevalidate: !0
1201
- });
1202
- if (typeof m == "boolean")
1203
- return m;
1204
- }
1205
- return !0;
1206
- }) : [];
1207
- }
1208
- function Lt(e, t) {
1209
- return kt(
1210
- e.map((n) => {
1211
- let i = t.routes[n.route.id];
1212
- if (!i) return [];
1213
- let r = [i.module];
1214
- return i.imports && (r = r.concat(i.imports)), r;
1215
- }).flat(1)
1216
- );
1217
- }
1218
- function kt(e) {
1219
- return [...new Set(e)];
1220
- }
1221
- function $t(e) {
1222
- let t = {}, n = Object.keys(e).sort();
1223
- for (let i of n)
1224
- t[i] = e[i];
1225
- return t;
1226
- }
1227
- function It(e, t) {
1228
- let n = /* @__PURE__ */ new Set();
1229
- return new Set(t), e.reduce((i, r) => {
1230
- let a = JSON.stringify($t(r));
1231
- return n.has(a) || (n.add(a), i.push({ key: a, link: r })), i;
1232
- }, []);
1233
- }
1234
- function Tt(e) {
1235
- let t = typeof e == "string" ? new URL(
1236
- e,
1237
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
1238
- // don't assume window is available
1239
- typeof window > "u" ? "server://singlefetch/" : window.location.origin
1240
- ) : e;
1241
- return t.pathname === "/" ? t.pathname = "_root.data" : t.pathname = `${t.pathname.replace(/\/$/, "")}.data`, t;
1242
- }
1243
- function Dt() {
1244
- let e = s.useContext(O);
1245
- return te(
1246
- e,
1247
- "You must render this element inside a <DataRouterContext.Provider> element"
1248
- ), e;
1249
- }
1250
- function Nt() {
1251
- let e = s.useContext(K);
1252
- return te(
1253
- e,
1254
- "You must render this element inside a <DataRouterStateContext.Provider> element"
1255
- ), e;
1256
- }
1257
- var ne = s.createContext(void 0);
1258
- ne.displayName = "FrameworkContext";
1259
- function Ee() {
1260
- let e = s.useContext(ne);
1261
- return te(
1262
- e,
1263
- "You must render this element inside a <HydratedRouter> element"
1264
- ), e;
1265
- }
1266
- function At(e, t) {
1267
- let n = s.useContext(ne), [i, r] = s.useState(!1), [a, u] = s.useState(!1), { onFocus: c, onBlur: o, onMouseEnter: l, onMouseLeave: p, onTouchStart: y } = t, m = s.useRef(null);
1268
- s.useEffect(() => {
1269
- if (e === "render" && u(!0), e === "viewport") {
1270
- let g = (h) => {
1271
- h.forEach((w) => {
1272
- u(w.isIntersecting);
1273
- });
1274
- }, v = new IntersectionObserver(g, { threshold: 0.5 });
1275
- return m.current && v.observe(m.current), () => {
1276
- v.disconnect();
1277
- };
1278
- }
1279
- }, [e]), s.useEffect(() => {
1280
- if (i) {
1281
- let g = setTimeout(() => {
1282
- u(!0);
1283
- }, 100);
1284
- return () => {
1285
- clearTimeout(g);
1286
- };
1287
- }
1288
- }, [i]);
1289
- let d = () => {
1290
- r(!0);
1291
- }, f = () => {
1292
- r(!1), u(!1);
1293
- };
1294
- return n ? e !== "intent" ? [a, m, {}] : [
1295
- a,
1296
- m,
1297
- {
1298
- onFocus: U(c, d),
1299
- onBlur: U(o, f),
1300
- onMouseEnter: U(l, d),
1301
- onMouseLeave: U(p, f),
1302
- onTouchStart: U(y, d)
1303
- }
1304
- ] : [!1, m, {}];
1305
- }
1306
- function U(e, t) {
1307
- return (n) => {
1308
- e && e(n), n.defaultPrevented || t(n);
1309
- };
1310
- }
1311
- function Ft({
1312
- page: e,
1313
- ...t
1314
- }) {
1315
- let { router: n } = Dt(), i = s.useMemo(
1316
- () => ce(n.routes, e, n.basename),
1317
- [n.routes, e, n.basename]
1318
- );
1319
- return i ? /* @__PURE__ */ s.createElement(Ot, { page: e, matches: i, ...t }) : (console.warn(`Tried to prefetch ${e} but no routes matched.`), null);
1320
- }
1321
- function Mt(e) {
1322
- let { manifest: t, routeModules: n } = Ee(), [i, r] = s.useState([]);
1323
- return s.useEffect(() => {
1324
- let a = !1;
1325
- return Pt(e, t, n).then(
1326
- (u) => {
1327
- a || r(u);
1328
- }
1329
- ), () => {
1330
- a = !0;
1331
- };
1332
- }, [e, t, n]), i;
1333
- }
1334
- function Ot({
1335
- page: e,
1336
- matches: t,
1337
- ...n
1338
- }) {
1339
- let i = N(), { manifest: r, routeModules: a } = Ee(), { loaderData: u, matches: c } = Nt(), o = s.useMemo(
1340
- () => se(
1341
- e,
1342
- t,
1343
- c,
1344
- r,
1345
- i,
1346
- "data"
1347
- ),
1348
- [e, t, c, r, i]
1349
- ), l = s.useMemo(
1350
- () => se(
1351
- e,
1352
- t,
1353
- c,
1354
- r,
1355
- i,
1356
- "assets"
1357
- ),
1358
- [e, t, c, r, i]
1359
- ), p = s.useMemo(() => {
1360
- if (e === i.pathname + i.search + i.hash)
1361
- return [];
1362
- let d = /* @__PURE__ */ new Set(), f = !1;
1363
- if (t.forEach((v) => {
1364
- var w;
1365
- let h = r.routes[v.route.id];
1366
- !h || !h.hasLoader || (!o.some((x) => x.route.id === v.route.id) && v.route.id in u && ((w = a[v.route.id]) != null && w.shouldRevalidate) || h.hasClientLoader ? f = !0 : d.add(v.route.id));
1367
- }), d.size === 0)
1368
- return [];
1369
- let g = Tt(e);
1370
- return f && d.size > 0 && g.searchParams.set(
1371
- "_routes",
1372
- t.filter((v) => d.has(v.route.id)).map((v) => v.route.id).join(",")
1373
- ), [g.pathname + g.search];
1374
- }, [
1375
- u,
1376
- i,
1377
- r,
1378
- o,
1379
- t,
1380
- e,
1381
- a
1382
- ]), y = s.useMemo(
1383
- () => Lt(l, r),
1384
- [l, r]
1385
- ), m = Mt(l);
1386
- return /* @__PURE__ */ s.createElement(s.Fragment, null, p.map((d) => /* @__PURE__ */ s.createElement("link", { key: d, rel: "prefetch", as: "fetch", href: d, ...n })), y.map((d) => /* @__PURE__ */ s.createElement("link", { key: d, rel: "modulepreload", href: d, ...n })), m.map(({ key: d, link: f }) => (
1387
- // these don't spread `linkProps` because they are full link descriptors
1388
- // already with their own props
1389
- /* @__PURE__ */ s.createElement("link", { key: d, ...f })
1390
- )));
1391
- }
1392
- function Bt(...e) {
1393
- return (t) => {
1394
- e.forEach((n) => {
1395
- typeof n == "function" ? n(t) : n != null && (n.current = t);
1396
- });
1397
- };
1398
- }
1399
- var Ce = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
1400
- try {
1401
- Ce && (window.__reactRouterVersion = "7.0.2");
1402
- } catch {
1403
- }
1404
- function qt({
1405
- basename: e,
1406
- children: t,
1407
- window: n
1408
- }) {
1409
- let i = s.useRef();
1410
- i.current == null && (i.current = ke({ window: n, v5Compat: !0 }));
1411
- let r = i.current, [a, u] = s.useState({
1412
- action: r.action,
1413
- location: r.location
1414
- }), c = s.useCallback(
1415
- (o) => {
1416
- s.startTransition(() => u(o));
1417
- },
1418
- [u]
1419
- );
1420
- return s.useLayoutEffect(() => r.listen(c), [r, c]), /* @__PURE__ */ s.createElement(
1421
- xe,
1422
- {
1423
- basename: e,
1424
- children: t,
1425
- location: a.location,
1426
- navigationType: a.action,
1427
- navigator: r
1428
- }
1429
- );
1430
- }
1431
- var Re = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, be = s.forwardRef(
1432
- function({
1433
- onClick: t,
1434
- discover: n = "render",
1435
- prefetch: i = "none",
1436
- relative: r,
1437
- reloadDocument: a,
1438
- replace: u,
1439
- state: c,
1440
- target: o,
1441
- to: l,
1442
- preventScrollReset: p,
1443
- viewTransition: y,
1444
- ...m
1445
- }, d) {
1446
- let { basename: f } = s.useContext(P), g = typeof l == "string" && Re.test(l), v, h = !1;
1447
- if (typeof l == "string" && g && (v = l, Ce))
1448
- try {
1449
- let b = new URL(window.location.href), I = l.startsWith("//") ? new URL(b.protocol + l) : new URL(l), re = T(I.pathname, f);
1450
- I.origin === b.origin && re != null ? l = re + I.search + I.hash : h = !0;
1451
- } catch {
1452
- S(
1453
- !1,
1454
- `<Link to="${l}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
1455
- );
1456
- }
1457
- let w = et(l, { relative: r }), [x, C, R] = At(
1458
- i,
1459
- m
1460
- ), A = _t(l, {
1461
- replace: u,
1462
- state: c,
1463
- target: o,
1464
- preventScrollReset: p,
1465
- relative: r,
1466
- viewTransition: y
1467
- });
1468
- function $(b) {
1469
- t && t(b), b.defaultPrevented || A(b);
1470
- }
1471
- let D = (
1472
- // eslint-disable-next-line jsx-a11y/anchor-has-content
1473
- /* @__PURE__ */ s.createElement(
1474
- "a",
1475
- {
1476
- ...m,
1477
- ...R,
1478
- href: v || w,
1479
- onClick: h || a ? t : $,
1480
- ref: Bt(d, C),
1481
- target: o,
1482
- "data-discover": !g && n === "render" ? "true" : void 0
1483
- }
1484
- )
1485
- );
1486
- return x && !g ? /* @__PURE__ */ s.createElement(s.Fragment, null, D, /* @__PURE__ */ s.createElement(Ft, { page: w })) : D;
1487
- }
1488
- );
1489
- be.displayName = "Link";
1490
- var Ut = s.forwardRef(
1491
- function({
1492
- "aria-current": t = "page",
1493
- caseSensitive: n = !1,
1494
- className: i = "",
1495
- end: r = !1,
1496
- style: a,
1497
- to: u,
1498
- viewTransition: c,
1499
- children: o,
1500
- ...l
1501
- }, p) {
1502
- let y = W(u, { relative: l.relative }), m = N(), d = s.useContext(K), { navigator: f, basename: g } = s.useContext(P), v = d != null && // Conditional usage is OK here because the usage of a data router is static
1503
- // eslint-disable-next-line react-hooks/rules-of-hooks
1504
- Kt(y) && c === !0, h = f.encodeLocation ? f.encodeLocation(y).pathname : y.pathname, w = m.pathname, x = d && d.navigation && d.navigation.location ? d.navigation.location.pathname : null;
1505
- n || (w = w.toLowerCase(), x = x ? x.toLowerCase() : null, h = h.toLowerCase()), x && g && (x = T(x, g) || x);
1506
- const C = h !== "/" && h.endsWith("/") ? h.length - 1 : h.length;
1507
- let R = w === h || !r && w.startsWith(h) && w.charAt(C) === "/", A = x != null && (x === h || !r && x.startsWith(h) && x.charAt(h.length) === "/"), $ = {
1508
- isActive: R,
1509
- isPending: A,
1510
- isTransitioning: v
1511
- }, D = R ? t : void 0, b;
1512
- typeof i == "function" ? b = i($) : b = [
1513
- i,
1514
- R ? "active" : null,
1515
- A ? "pending" : null,
1516
- v ? "transitioning" : null
1517
- ].filter(Boolean).join(" ");
1518
- let I = typeof a == "function" ? a($) : a;
1519
- return /* @__PURE__ */ s.createElement(
1520
- be,
1521
- {
1522
- ...l,
1523
- "aria-current": D,
1524
- className: b,
1525
- ref: p,
1526
- style: I,
1527
- to: u,
1528
- viewTransition: c
1529
- },
1530
- typeof o == "function" ? o($) : o
1531
- );
1532
- }
1533
- );
1534
- Ut.displayName = "NavLink";
1535
- var Ht = s.forwardRef(
1536
- ({
1537
- discover: e = "render",
1538
- fetcherKey: t,
1539
- navigate: n,
1540
- reloadDocument: i,
1541
- replace: r,
1542
- state: a,
1543
- method: u = z,
1544
- action: c,
1545
- onSubmit: o,
1546
- relative: l,
1547
- preventScrollReset: p,
1548
- viewTransition: y,
1549
- ...m
1550
- }, d) => {
1551
- let f = jt(), g = Jt(c, { relative: l }), v = u.toLowerCase() === "get" ? "get" : "post", h = typeof c == "string" && Re.test(c), w = (x) => {
1552
- if (o && o(x), x.defaultPrevented) return;
1553
- x.preventDefault();
1554
- let C = x.nativeEvent.submitter, R = (C == null ? void 0 : C.getAttribute("formmethod")) || u;
1555
- f(C || x.currentTarget, {
1556
- fetcherKey: t,
1557
- method: R,
1558
- navigate: n,
1559
- replace: r,
1560
- state: a,
1561
- relative: l,
1562
- preventScrollReset: p,
1563
- viewTransition: y
1564
- });
1565
- };
1566
- return /* @__PURE__ */ s.createElement(
1567
- "form",
1568
- {
1569
- ref: d,
1570
- method: v,
1571
- action: g,
1572
- onSubmit: i ? o : w,
1573
- ...m,
1574
- "data-discover": !h && e === "render" ? "true" : void 0
1575
- }
1576
- );
1577
- }
1578
- );
1579
- Ht.displayName = "Form";
1580
- function Wt(e) {
1581
- return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1582
- }
1583
- function Se(e) {
1584
- let t = s.useContext(O);
1585
- return E(t, Wt(e)), t;
1586
- }
1587
- function _t(e, {
1588
- target: t,
1589
- replace: n,
1590
- state: i,
1591
- preventScrollReset: r,
1592
- relative: a,
1593
- viewTransition: u
1594
- } = {}) {
1595
- let c = tt(), o = N(), l = W(e, { relative: a });
1596
- return s.useCallback(
1597
- (p) => {
1598
- if (xt(p, t)) {
1599
- p.preventDefault();
1600
- let y = n !== void 0 ? n : F(o) === F(l);
1601
- c(e, {
1602
- replace: y,
1603
- state: i,
1604
- preventScrollReset: r,
1605
- relative: a,
1606
- viewTransition: u
1607
- });
1608
- }
1609
- },
1610
- [
1611
- o,
1612
- c,
1613
- l,
1614
- n,
1615
- i,
1616
- t,
1617
- e,
1618
- r,
1619
- a,
1620
- u
1621
- ]
1622
- );
1623
- }
1624
- var zt = 0, Vt = () => `__${String(++zt)}__`;
1625
- function jt() {
1626
- let { router: e } = Se(
1627
- "useSubmit"
1628
- /* UseSubmit */
1629
- ), { basename: t } = s.useContext(P), n = dt();
1630
- return s.useCallback(
1631
- async (i, r = {}) => {
1632
- let { action: a, method: u, encType: c, formData: o, body: l } = Rt(
1633
- i,
1634
- t
1635
- );
1636
- if (r.navigate === !1) {
1637
- let p = r.fetcherKey || Vt();
1638
- await e.fetch(p, n, r.action || a, {
1639
- preventScrollReset: r.preventScrollReset,
1640
- formData: o,
1641
- body: l,
1642
- formMethod: r.method || u,
1643
- formEncType: r.encType || c,
1644
- flushSync: r.flushSync
1645
- });
1646
- } else
1647
- await e.navigate(r.action || a, {
1648
- preventScrollReset: r.preventScrollReset,
1649
- formData: o,
1650
- body: l,
1651
- formMethod: r.method || u,
1652
- formEncType: r.encType || c,
1653
- replace: r.replace,
1654
- state: r.state,
1655
- fromRouteId: n,
1656
- flushSync: r.flushSync,
1657
- viewTransition: r.viewTransition
1658
- });
1659
- },
1660
- [e, t, n]
1661
- );
1662
- }
1663
- function Jt(e, { relative: t } = {}) {
1664
- let { basename: n } = s.useContext(P), i = s.useContext(k);
1665
- E(i, "useFormAction must be used inside a RouteContext");
1666
- let [r] = i.matches.slice(-1), a = { ...W(e || ".", { relative: t }) }, u = N();
1667
- if (e == null) {
1668
- a.search = u.search;
1669
- let c = new URLSearchParams(a.search), o = c.getAll("index");
1670
- if (o.some((p) => p === "")) {
1671
- c.delete("index"), o.filter((y) => y).forEach((y) => c.append("index", y));
1672
- let p = c.toString();
1673
- a.search = p ? `?${p}` : "";
1674
- }
1675
- }
1676
- return (!e || e === ".") && r.route.index && (a.search = a.search ? a.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (a.pathname = a.pathname === "/" ? n : L([n, a.pathname])), F(a);
1677
- }
1678
- function Kt(e, t = {}) {
1679
- let n = s.useContext(ge);
1680
- E(
1681
- n != null,
1682
- "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1683
- );
1684
- let { basename: i } = Se(
1685
- "useViewTransitionState"
1686
- /* useViewTransitionState */
1687
- ), r = W(e, { relative: t.relative });
1688
- if (!n.isTransitioning)
1689
- return !1;
1690
- let a = T(n.currentLocation.pathname, i) || n.currentLocation.pathname, u = T(n.nextLocation.pathname, i) || n.nextLocation.pathname;
1691
- return J(r.pathname, u) != null || J(r.pathname, a) != null;
1692
- }
1693
- new TextEncoder();
1694
- export {
1695
- qt as B,
1696
- be as L,
1697
- Yt as M,
1698
- Ut as N,
1699
- N as u
1700
- };
1701
- //# sourceMappingURL=chunk-D52XG6IA-CQ2nAQyC.js.map