@shopify/shop-minis-react 0.0.18 → 0.0.19
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.
- package/dist/_virtual/index2.js +2 -3
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/_virtual/index3.js +3 -2
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/components/atoms/alert-dialog.js +41 -0
- package/dist/components/atoms/alert-dialog.js.map +1 -0
- package/dist/components/atoms/thumbhash-image.js +54 -0
- package/dist/components/atoms/thumbhash-image.js.map +1 -0
- package/dist/components/commerce/merchant-card-skeleton.js +29 -0
- package/dist/components/commerce/merchant-card-skeleton.js.map +1 -0
- package/dist/components/commerce/merchant-card.js +28 -22
- package/dist/components/commerce/merchant-card.js.map +1 -1
- package/dist/components/commerce/product-card-skeleton.js +20 -0
- package/dist/components/commerce/product-card-skeleton.js.map +1 -0
- package/dist/components/commerce/product-card.js +105 -78
- package/dist/components/commerce/product-card.js.map +1 -1
- package/dist/components/navigation/transition-container.js +8 -0
- package/dist/components/navigation/transition-container.js.map +1 -0
- package/dist/components/navigation/transition-link.js +27 -0
- package/dist/components/navigation/transition-link.js.map +1 -0
- package/dist/components/ui/skeleton.js +16 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js +43 -0
- package/dist/hooks/navigation/useNavigateWithTransition.js.map +1 -0
- package/dist/hooks/navigation/useViewTransitions.js +45 -0
- package/dist/hooks/navigation/useViewTransitions.js.map +1 -0
- package/dist/index.js +215 -196
- package/dist/index.js.map +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/@radix-ui_react-use-is-hydrated@0.1.0_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js +21 -0
- package/dist/shop-minis-react/node_modules/.pnpm/js-base64@3.7.7/node_modules/js-base64/base64.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +1 -1
- package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js +1298 -0
- package/dist/shop-minis-react/node_modules/.pnpm/react-router@7.7.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-router/dist/development/chunk-EF7DTUVF.js.map +1 -0
- package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js +145 -0
- package/dist/shop-minis-react/node_modules/.pnpm/thumbhash@0.1.1/node_modules/thumbhash/thumbhash.js.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/image.js +15 -0
- package/dist/utils/image.js.map +1 -0
- package/package.json +13 -3
- package/src/components/atoms/alert-dialog.tsx +67 -0
- package/src/components/atoms/thumbhash-image.tsx +66 -0
- package/src/components/commerce/merchant-card-skeleton.tsx +31 -0
- package/src/components/commerce/merchant-card.tsx +5 -2
- package/src/components/commerce/product-card-skeleton.tsx +30 -0
- package/src/components/commerce/product-card.tsx +49 -8
- package/src/components/index.ts +8 -0
- package/src/components/navigation/transition-container.tsx +7 -0
- package/src/components/navigation/transition-link.tsx +48 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigation/useNavigateWithTransition.ts +62 -0
- package/src/hooks/navigation/useViewTransitions.ts +79 -0
- package/src/index.css +1 -0
- package/src/mocks.ts +8 -2
- package/src/stories/Accordion.stories.tsx +124 -0
- package/src/stories/Alert.stories.tsx +38 -0
- package/src/stories/AlertDialog.stories.tsx +48 -0
- package/src/stories/Avatar.stories.tsx +29 -0
- package/src/stories/Badge.stories.tsx +46 -0
- package/src/stories/Button.stories.tsx +81 -0
- package/src/stories/Card.stories.tsx +40 -0
- package/src/stories/Checkbox.stories.tsx +44 -0
- package/src/stories/FavoriteButton.stories.tsx +58 -0
- package/src/stories/IconButton.stories.tsx +68 -0
- package/src/stories/Input.stories.tsx +44 -0
- package/src/stories/Label.stories.tsx +19 -0
- package/src/stories/MerchantCard.stories.tsx +55 -0
- package/src/stories/ProductCard.stories.tsx +85 -0
- package/src/stories/ProductLink.stories.tsx +46 -0
- package/src/stories/Progress.stories.tsx +30 -0
- package/src/stories/RadioGroup.stories.tsx +51 -0
- package/src/stories/Select.stories.tsx +85 -0
- package/src/stories/Skeleton.stories.tsx +19 -0
- package/src/stories/Toaster.stories.tsx +46 -0
- package/src/stories/Touchable.stories.tsx +40 -0
- package/src/styles/animations.css +90 -0
- package/src/styles/globals.css +8 -0
- package/src/styles/theme.css +1 -1
- package/src/types/index.ts +7 -1
- package/src/utils/image.ts +18 -0
|
@@ -0,0 +1,1298 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
/**
|
|
3
|
+
* react-router v7.7.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Remix Software Inc.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
9
|
+
*
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
function C(e, t) {
|
|
13
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
14
|
+
throw new Error(t);
|
|
15
|
+
}
|
|
16
|
+
function b(e, t) {
|
|
17
|
+
if (!e) {
|
|
18
|
+
typeof console < "u" && console.warn(t);
|
|
19
|
+
try {
|
|
20
|
+
throw new Error(t);
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function Y({
|
|
26
|
+
pathname: e = "/",
|
|
27
|
+
search: t = "",
|
|
28
|
+
hash: n = ""
|
|
29
|
+
}) {
|
|
30
|
+
return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), n && n !== "#" && (e += n.charAt(0) === "#" ? n : "#" + n), e;
|
|
31
|
+
}
|
|
32
|
+
function q(e) {
|
|
33
|
+
let t = {};
|
|
34
|
+
if (e) {
|
|
35
|
+
let n = e.indexOf("#");
|
|
36
|
+
n >= 0 && (t.hash = e.substring(n), e = e.substring(0, n));
|
|
37
|
+
let l = e.indexOf("?");
|
|
38
|
+
l >= 0 && (t.search = e.substring(l), e = e.substring(0, l)), e && (t.pathname = e);
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
function le(e, t, n = "/") {
|
|
43
|
+
return Ce(e, t, n, !1);
|
|
44
|
+
}
|
|
45
|
+
function Ce(e, t, n, l) {
|
|
46
|
+
let r = typeof t == "string" ? q(t) : t, a = L(r.pathname || "/", n);
|
|
47
|
+
if (a == null)
|
|
48
|
+
return null;
|
|
49
|
+
let s = oe(e);
|
|
50
|
+
Re(s);
|
|
51
|
+
let c = null;
|
|
52
|
+
for (let u = 0; c == null && u < s.length; ++u) {
|
|
53
|
+
let o = De(a);
|
|
54
|
+
c = Ne(
|
|
55
|
+
s[u],
|
|
56
|
+
o,
|
|
57
|
+
l
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return c;
|
|
61
|
+
}
|
|
62
|
+
function oe(e, t = [], n = [], l = "") {
|
|
63
|
+
let r = (a, s, c) => {
|
|
64
|
+
let u = {
|
|
65
|
+
relativePath: c === void 0 ? a.path || "" : c,
|
|
66
|
+
caseSensitive: a.caseSensitive === !0,
|
|
67
|
+
childrenIndex: s,
|
|
68
|
+
route: a
|
|
69
|
+
};
|
|
70
|
+
u.relativePath.startsWith("/") && (C(
|
|
71
|
+
u.relativePath.startsWith(l),
|
|
72
|
+
`Absolute route path "${u.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
73
|
+
), u.relativePath = u.relativePath.slice(l.length));
|
|
74
|
+
let o = E([l, u.relativePath]), f = n.concat(u);
|
|
75
|
+
a.children && a.children.length > 0 && (C(
|
|
76
|
+
// Our types know better, but runtime JS may not!
|
|
77
|
+
// @ts-expect-error
|
|
78
|
+
a.index !== !0,
|
|
79
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${o}".`
|
|
80
|
+
), oe(a.children, t, f, o)), !(a.path == null && !a.index) && t.push({
|
|
81
|
+
path: o,
|
|
82
|
+
score: $e(o, a.index),
|
|
83
|
+
routesMeta: f
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return e.forEach((a, s) => {
|
|
87
|
+
if (a.path === "" || !a.path?.includes("?"))
|
|
88
|
+
r(a, s);
|
|
89
|
+
else
|
|
90
|
+
for (let c of ie(a.path))
|
|
91
|
+
r(a, s, c);
|
|
92
|
+
}), t;
|
|
93
|
+
}
|
|
94
|
+
function ie(e) {
|
|
95
|
+
let t = e.split("/");
|
|
96
|
+
if (t.length === 0) return [];
|
|
97
|
+
let [n, ...l] = t, r = n.endsWith("?"), a = n.replace(/\?$/, "");
|
|
98
|
+
if (l.length === 0)
|
|
99
|
+
return r ? [a, ""] : [a];
|
|
100
|
+
let s = ie(l.join("/")), c = [];
|
|
101
|
+
return c.push(
|
|
102
|
+
...s.map(
|
|
103
|
+
(u) => u === "" ? a : [a, u].join("/")
|
|
104
|
+
)
|
|
105
|
+
), r && c.push(...s), c.map(
|
|
106
|
+
(u) => e.startsWith("/") && u === "" ? "/" : u
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function Re(e) {
|
|
110
|
+
e.sort(
|
|
111
|
+
(t, n) => t.score !== n.score ? n.score - t.score : Fe(
|
|
112
|
+
t.routesMeta.map((l) => l.childrenIndex),
|
|
113
|
+
n.routesMeta.map((l) => l.childrenIndex)
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
var Ee = /^:[\w-]+$/, be = 3, Pe = 2, Se = 1, Le = 10, ke = -2, ne = (e) => e === "*";
|
|
118
|
+
function $e(e, t) {
|
|
119
|
+
let n = e.split("/"), l = n.length;
|
|
120
|
+
return n.some(ne) && (l += ke), t && (l += Pe), n.filter((r) => !ne(r)).reduce(
|
|
121
|
+
(r, a) => r + (Ee.test(a) ? be : a === "" ? Se : Le),
|
|
122
|
+
l
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
function Fe(e, t) {
|
|
126
|
+
return e.length === t.length && e.slice(0, -1).every((l, r) => l === t[r]) ? (
|
|
127
|
+
// If two routes are siblings, we should try to match the earlier sibling
|
|
128
|
+
// first. This allows people to have fine-grained control over the matching
|
|
129
|
+
// behavior by simply putting routes with identical paths in the order they
|
|
130
|
+
// want them tried.
|
|
131
|
+
e[e.length - 1] - t[t.length - 1]
|
|
132
|
+
) : (
|
|
133
|
+
// Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
134
|
+
// so they sort equally.
|
|
135
|
+
0
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function Ne(e, t, n = !1) {
|
|
139
|
+
let { routesMeta: l } = e, r = {}, a = "/", s = [];
|
|
140
|
+
for (let c = 0; c < l.length; ++c) {
|
|
141
|
+
let u = l[c], o = c === l.length - 1, f = a === "/" ? t : t.slice(a.length) || "/", h = H(
|
|
142
|
+
{ path: u.relativePath, caseSensitive: u.caseSensitive, end: o },
|
|
143
|
+
f
|
|
144
|
+
), m = u.route;
|
|
145
|
+
if (!h && o && n && !l[l.length - 1].route.index && (h = H(
|
|
146
|
+
{
|
|
147
|
+
path: u.relativePath,
|
|
148
|
+
caseSensitive: u.caseSensitive,
|
|
149
|
+
end: !1
|
|
150
|
+
},
|
|
151
|
+
f
|
|
152
|
+
)), !h)
|
|
153
|
+
return null;
|
|
154
|
+
Object.assign(r, h.params), s.push({
|
|
155
|
+
// TODO: Can this as be avoided?
|
|
156
|
+
params: r,
|
|
157
|
+
pathname: E([a, h.pathname]),
|
|
158
|
+
pathnameBase: Be(
|
|
159
|
+
E([a, h.pathnameBase])
|
|
160
|
+
),
|
|
161
|
+
route: m
|
|
162
|
+
}), h.pathnameBase !== "/" && (a = E([a, h.pathnameBase]));
|
|
163
|
+
}
|
|
164
|
+
return s;
|
|
165
|
+
}
|
|
166
|
+
function H(e, t) {
|
|
167
|
+
typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
|
|
168
|
+
let [n, l] = Te(
|
|
169
|
+
e.path,
|
|
170
|
+
e.caseSensitive,
|
|
171
|
+
e.end
|
|
172
|
+
), r = t.match(n);
|
|
173
|
+
if (!r) return null;
|
|
174
|
+
let a = r[0], s = a.replace(/(.)\/+$/, "$1"), c = r.slice(1);
|
|
175
|
+
return {
|
|
176
|
+
params: l.reduce(
|
|
177
|
+
(o, { paramName: f, isOptional: h }, m) => {
|
|
178
|
+
if (f === "*") {
|
|
179
|
+
let g = c[m] || "";
|
|
180
|
+
s = a.slice(0, a.length - g.length).replace(/(.)\/+$/, "$1");
|
|
181
|
+
}
|
|
182
|
+
const y = c[m];
|
|
183
|
+
return h && !y ? o[f] = void 0 : o[f] = (y || "").replace(/%2F/g, "/"), o;
|
|
184
|
+
},
|
|
185
|
+
{}
|
|
186
|
+
),
|
|
187
|
+
pathname: a,
|
|
188
|
+
pathnameBase: s,
|
|
189
|
+
pattern: e
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function Te(e, t = !1, n = !0) {
|
|
193
|
+
b(
|
|
194
|
+
e === "*" || !e.endsWith("*") || e.endsWith("/*"),
|
|
195
|
+
`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(/\*$/, "/*")}".`
|
|
196
|
+
);
|
|
197
|
+
let l = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
198
|
+
/\/:([\w-]+)(\?)?/g,
|
|
199
|
+
(s, c, u) => (l.push({ paramName: c, isOptional: u != null }), u ? "/?([^\\/]+)?" : "/([^\\/]+)")
|
|
200
|
+
);
|
|
201
|
+
return e.endsWith("*") ? (l.push({ paramName: "*" }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), l];
|
|
202
|
+
}
|
|
203
|
+
function De(e) {
|
|
204
|
+
try {
|
|
205
|
+
return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
|
|
206
|
+
} catch (t) {
|
|
207
|
+
return b(
|
|
208
|
+
!1,
|
|
209
|
+
`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
|
|
210
|
+
), e;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function L(e, t) {
|
|
214
|
+
if (t === "/") return e;
|
|
215
|
+
if (!e.toLowerCase().startsWith(t.toLowerCase()))
|
|
216
|
+
return null;
|
|
217
|
+
let n = t.endsWith("/") ? t.length - 1 : t.length, l = e.charAt(n);
|
|
218
|
+
return l && l !== "/" ? null : e.slice(n) || "/";
|
|
219
|
+
}
|
|
220
|
+
function Ie(e, t = "/") {
|
|
221
|
+
let {
|
|
222
|
+
pathname: n,
|
|
223
|
+
search: l = "",
|
|
224
|
+
hash: r = ""
|
|
225
|
+
} = typeof e == "string" ? q(e) : e;
|
|
226
|
+
return {
|
|
227
|
+
pathname: n ? n.startsWith("/") ? n : Me(n, t) : t,
|
|
228
|
+
search: Oe(l),
|
|
229
|
+
hash: We(r)
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function Me(e, t) {
|
|
233
|
+
let n = t.replace(/\/+$/, "").split("/");
|
|
234
|
+
return e.split("/").forEach((r) => {
|
|
235
|
+
r === ".." ? n.length > 1 && n.pop() : r !== "." && n.push(r);
|
|
236
|
+
}), n.length > 1 ? n.join("/") : "/";
|
|
237
|
+
}
|
|
238
|
+
function J(e, t, n, l) {
|
|
239
|
+
return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
|
|
240
|
+
l
|
|
241
|
+
)}]. 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.`;
|
|
242
|
+
}
|
|
243
|
+
function Ae(e) {
|
|
244
|
+
return e.filter(
|
|
245
|
+
(t, n) => n === 0 || t.route.path && t.route.path.length > 0
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
function ue(e) {
|
|
249
|
+
let t = Ae(e);
|
|
250
|
+
return t.map(
|
|
251
|
+
(n, l) => l === t.length - 1 ? n.pathname : n.pathnameBase
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
function se(e, t, n, l = !1) {
|
|
255
|
+
let r;
|
|
256
|
+
typeof e == "string" ? r = q(e) : (r = { ...e }, C(
|
|
257
|
+
!r.pathname || !r.pathname.includes("?"),
|
|
258
|
+
J("?", "pathname", "search", r)
|
|
259
|
+
), C(
|
|
260
|
+
!r.pathname || !r.pathname.includes("#"),
|
|
261
|
+
J("#", "pathname", "hash", r)
|
|
262
|
+
), C(
|
|
263
|
+
!r.search || !r.search.includes("#"),
|
|
264
|
+
J("#", "search", "hash", r)
|
|
265
|
+
));
|
|
266
|
+
let a = e === "" || r.pathname === "", s = a ? "/" : r.pathname, c;
|
|
267
|
+
if (s == null)
|
|
268
|
+
c = n;
|
|
269
|
+
else {
|
|
270
|
+
let h = t.length - 1;
|
|
271
|
+
if (!l && s.startsWith("..")) {
|
|
272
|
+
let m = s.split("/");
|
|
273
|
+
for (; m[0] === ".."; )
|
|
274
|
+
m.shift(), h -= 1;
|
|
275
|
+
r.pathname = m.join("/");
|
|
276
|
+
}
|
|
277
|
+
c = h >= 0 ? t[h] : "/";
|
|
278
|
+
}
|
|
279
|
+
let u = Ie(r, c), o = s && s !== "/" && s.endsWith("/"), f = (a || s === ".") && n.endsWith("/");
|
|
280
|
+
return !u.pathname.endsWith("/") && (o || f) && (u.pathname += "/"), u;
|
|
281
|
+
}
|
|
282
|
+
var E = (e) => e.join("/").replace(/\/\/+/g, "/"), Be = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Oe = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, We = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
|
|
283
|
+
function Ue(e) {
|
|
284
|
+
return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
|
|
285
|
+
}
|
|
286
|
+
var ce = [
|
|
287
|
+
"POST",
|
|
288
|
+
"PUT",
|
|
289
|
+
"PATCH",
|
|
290
|
+
"DELETE"
|
|
291
|
+
];
|
|
292
|
+
new Set(
|
|
293
|
+
ce
|
|
294
|
+
);
|
|
295
|
+
var He = [
|
|
296
|
+
"GET",
|
|
297
|
+
...ce
|
|
298
|
+
];
|
|
299
|
+
new Set(He);
|
|
300
|
+
var T = i.createContext(null);
|
|
301
|
+
T.displayName = "DataRouter";
|
|
302
|
+
var _ = i.createContext(null);
|
|
303
|
+
_.displayName = "DataRouterState";
|
|
304
|
+
i.createContext(!1);
|
|
305
|
+
var fe = i.createContext({
|
|
306
|
+
isTransitioning: !1
|
|
307
|
+
});
|
|
308
|
+
fe.displayName = "ViewTransition";
|
|
309
|
+
var _e = i.createContext(
|
|
310
|
+
/* @__PURE__ */ new Map()
|
|
311
|
+
);
|
|
312
|
+
_e.displayName = "Fetchers";
|
|
313
|
+
var Ve = i.createContext(null);
|
|
314
|
+
Ve.displayName = "Await";
|
|
315
|
+
var P = i.createContext(
|
|
316
|
+
null
|
|
317
|
+
);
|
|
318
|
+
P.displayName = "Navigation";
|
|
319
|
+
var V = i.createContext(
|
|
320
|
+
null
|
|
321
|
+
);
|
|
322
|
+
V.displayName = "Location";
|
|
323
|
+
var S = i.createContext({
|
|
324
|
+
outlet: null,
|
|
325
|
+
matches: [],
|
|
326
|
+
isDataRoute: !1
|
|
327
|
+
});
|
|
328
|
+
S.displayName = "Route";
|
|
329
|
+
var G = i.createContext(null);
|
|
330
|
+
G.displayName = "RouteError";
|
|
331
|
+
function ze(e, { relative: t } = {}) {
|
|
332
|
+
C(
|
|
333
|
+
z(),
|
|
334
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
335
|
+
// router loaded. We can help them understand how to avoid that.
|
|
336
|
+
"useHref() may be used only in the context of a <Router> component."
|
|
337
|
+
);
|
|
338
|
+
let { basename: n, navigator: l } = i.useContext(P), { hash: r, pathname: a, search: s } = M(e, { relative: t }), c = a;
|
|
339
|
+
return n !== "/" && (c = a === "/" ? n : E([n, a])), l.createHref({ pathname: c, search: s, hash: r });
|
|
340
|
+
}
|
|
341
|
+
function z() {
|
|
342
|
+
return i.useContext(V) != null;
|
|
343
|
+
}
|
|
344
|
+
function $() {
|
|
345
|
+
return C(
|
|
346
|
+
z(),
|
|
347
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
348
|
+
// router loaded. We can help them understand how to avoid that.
|
|
349
|
+
"useLocation() may be used only in the context of a <Router> component."
|
|
350
|
+
), i.useContext(V).location;
|
|
351
|
+
}
|
|
352
|
+
function Bt() {
|
|
353
|
+
return i.useContext(V).navigationType;
|
|
354
|
+
}
|
|
355
|
+
var de = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
356
|
+
function he(e) {
|
|
357
|
+
i.useContext(P).static || i.useLayoutEffect(e);
|
|
358
|
+
}
|
|
359
|
+
function je() {
|
|
360
|
+
let { isDataRoute: e } = i.useContext(S);
|
|
361
|
+
return e ? at() : Je();
|
|
362
|
+
}
|
|
363
|
+
function Je() {
|
|
364
|
+
C(
|
|
365
|
+
z(),
|
|
366
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
367
|
+
// router loaded. We can help them understand how to avoid that.
|
|
368
|
+
"useNavigate() may be used only in the context of a <Router> component."
|
|
369
|
+
);
|
|
370
|
+
let e = i.useContext(T), { basename: t, navigator: n } = i.useContext(P), { matches: l } = i.useContext(S), { pathname: r } = $(), a = JSON.stringify(ue(l)), s = i.useRef(!1);
|
|
371
|
+
return he(() => {
|
|
372
|
+
s.current = !0;
|
|
373
|
+
}), i.useCallback(
|
|
374
|
+
(u, o = {}) => {
|
|
375
|
+
if (b(s.current, de), !s.current) return;
|
|
376
|
+
if (typeof u == "number") {
|
|
377
|
+
n.go(u);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
let f = se(
|
|
381
|
+
u,
|
|
382
|
+
JSON.parse(a),
|
|
383
|
+
r,
|
|
384
|
+
o.relative === "path"
|
|
385
|
+
);
|
|
386
|
+
e == null && t !== "/" && (f.pathname = f.pathname === "/" ? t : E([t, f.pathname])), (o.replace ? n.replace : n.push)(
|
|
387
|
+
f,
|
|
388
|
+
o.state,
|
|
389
|
+
o
|
|
390
|
+
);
|
|
391
|
+
},
|
|
392
|
+
[
|
|
393
|
+
t,
|
|
394
|
+
n,
|
|
395
|
+
a,
|
|
396
|
+
r,
|
|
397
|
+
e
|
|
398
|
+
]
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
i.createContext(null);
|
|
402
|
+
function M(e, { relative: t } = {}) {
|
|
403
|
+
let { matches: n } = i.useContext(S), { pathname: l } = $(), r = JSON.stringify(ue(n));
|
|
404
|
+
return i.useMemo(
|
|
405
|
+
() => se(
|
|
406
|
+
e,
|
|
407
|
+
JSON.parse(r),
|
|
408
|
+
l,
|
|
409
|
+
t === "path"
|
|
410
|
+
),
|
|
411
|
+
[e, r, l, t]
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
function Ke(e, t, n, l) {
|
|
415
|
+
C(
|
|
416
|
+
z(),
|
|
417
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
418
|
+
// router loaded. We can help them understand how to avoid that.
|
|
419
|
+
"useRoutes() may be used only in the context of a <Router> component."
|
|
420
|
+
);
|
|
421
|
+
let { navigator: r } = i.useContext(P), { matches: a } = i.useContext(S), s = a[a.length - 1], c = s ? s.params : {}, u = s ? s.pathname : "/", o = s ? s.pathnameBase : "/", f = s && s.route;
|
|
422
|
+
{
|
|
423
|
+
let d = f && f.path || "";
|
|
424
|
+
me(
|
|
425
|
+
u,
|
|
426
|
+
!f || d.endsWith("*") || d.endsWith("*?"),
|
|
427
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${d}">) 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.
|
|
428
|
+
|
|
429
|
+
Please change the parent <Route path="${d}"> to <Route path="${d === "/" ? "*" : `${d}/*`}">.`
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
let h = $(), m;
|
|
433
|
+
m = h;
|
|
434
|
+
let y = m.pathname || "/", g = y;
|
|
435
|
+
if (o !== "/") {
|
|
436
|
+
let d = o.replace(/^\//, "").split("/");
|
|
437
|
+
g = "/" + y.replace(/^\//, "").split("/").slice(d.length).join("/");
|
|
438
|
+
}
|
|
439
|
+
let p = le(e, { pathname: g });
|
|
440
|
+
return b(
|
|
441
|
+
f || p != null,
|
|
442
|
+
`No routes matched location "${m.pathname}${m.search}${m.hash}" `
|
|
443
|
+
), b(
|
|
444
|
+
p == null || p[p.length - 1].route.element !== void 0 || p[p.length - 1].route.Component !== void 0 || p[p.length - 1].route.lazy !== void 0,
|
|
445
|
+
`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.`
|
|
446
|
+
), Qe(
|
|
447
|
+
p && p.map(
|
|
448
|
+
(d) => Object.assign({}, d, {
|
|
449
|
+
params: Object.assign({}, c, d.params),
|
|
450
|
+
pathname: E([
|
|
451
|
+
o,
|
|
452
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
453
|
+
r.encodeLocation ? r.encodeLocation(d.pathname).pathname : d.pathname
|
|
454
|
+
]),
|
|
455
|
+
pathnameBase: d.pathnameBase === "/" ? o : E([
|
|
456
|
+
o,
|
|
457
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
458
|
+
r.encodeLocation ? r.encodeLocation(d.pathnameBase).pathname : d.pathnameBase
|
|
459
|
+
])
|
|
460
|
+
})
|
|
461
|
+
),
|
|
462
|
+
a,
|
|
463
|
+
n,
|
|
464
|
+
l
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
function Ye() {
|
|
468
|
+
let e = rt(), t = Ue(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), n = e instanceof Error ? e.stack : null, l = "rgba(200,200,200, 0.5)", r = { padding: "0.5rem", backgroundColor: l }, a = { padding: "2px 4px", backgroundColor: l }, s = null;
|
|
469
|
+
return console.error(
|
|
470
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
471
|
+
e
|
|
472
|
+
), s = /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ i.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ i.createElement("code", { style: a }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ i.createElement("code", { style: a }, "errorElement"), " prop on your route.")), /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ i.createElement("h3", { style: { fontStyle: "italic" } }, t), n ? /* @__PURE__ */ i.createElement("pre", { style: r }, n) : null, s);
|
|
473
|
+
}
|
|
474
|
+
var qe = /* @__PURE__ */ i.createElement(Ye, null), Ge = class extends i.Component {
|
|
475
|
+
constructor(e) {
|
|
476
|
+
super(e), this.state = {
|
|
477
|
+
location: e.location,
|
|
478
|
+
revalidation: e.revalidation,
|
|
479
|
+
error: e.error
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
static getDerivedStateFromError(e) {
|
|
483
|
+
return { error: e };
|
|
484
|
+
}
|
|
485
|
+
static getDerivedStateFromProps(e, t) {
|
|
486
|
+
return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
|
|
487
|
+
error: e.error,
|
|
488
|
+
location: e.location,
|
|
489
|
+
revalidation: e.revalidation
|
|
490
|
+
} : {
|
|
491
|
+
error: e.error !== void 0 ? e.error : t.error,
|
|
492
|
+
location: t.location,
|
|
493
|
+
revalidation: e.revalidation || t.revalidation
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
componentDidCatch(e, t) {
|
|
497
|
+
console.error(
|
|
498
|
+
"React Router caught the following error during render",
|
|
499
|
+
e,
|
|
500
|
+
t
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
render() {
|
|
504
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ i.createElement(S.Provider, { value: this.props.routeContext }, /* @__PURE__ */ i.createElement(
|
|
505
|
+
G.Provider,
|
|
506
|
+
{
|
|
507
|
+
value: this.state.error,
|
|
508
|
+
children: this.props.component
|
|
509
|
+
}
|
|
510
|
+
)) : this.props.children;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
function Xe({ routeContext: e, match: t, children: n }) {
|
|
514
|
+
let l = i.useContext(T);
|
|
515
|
+
return l && l.static && l.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (l.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ i.createElement(S.Provider, { value: e }, n);
|
|
516
|
+
}
|
|
517
|
+
function Qe(e, t = [], n = null, l = null) {
|
|
518
|
+
if (e == null) {
|
|
519
|
+
if (!n)
|
|
520
|
+
return null;
|
|
521
|
+
if (n.errors)
|
|
522
|
+
e = n.matches;
|
|
523
|
+
else if (t.length === 0 && !n.initialized && n.matches.length > 0)
|
|
524
|
+
e = n.matches;
|
|
525
|
+
else
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
let r = e, a = n?.errors;
|
|
529
|
+
if (a != null) {
|
|
530
|
+
let u = r.findIndex(
|
|
531
|
+
(o) => o.route.id && a?.[o.route.id] !== void 0
|
|
532
|
+
);
|
|
533
|
+
C(
|
|
534
|
+
u >= 0,
|
|
535
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
536
|
+
a
|
|
537
|
+
).join(",")}`
|
|
538
|
+
), r = r.slice(
|
|
539
|
+
0,
|
|
540
|
+
Math.min(r.length, u + 1)
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
let s = !1, c = -1;
|
|
544
|
+
if (n)
|
|
545
|
+
for (let u = 0; u < r.length; u++) {
|
|
546
|
+
let o = r[u];
|
|
547
|
+
if ((o.route.HydrateFallback || o.route.hydrateFallbackElement) && (c = u), o.route.id) {
|
|
548
|
+
let { loaderData: f, errors: h } = n, m = o.route.loader && !f.hasOwnProperty(o.route.id) && (!h || h[o.route.id] === void 0);
|
|
549
|
+
if (o.route.lazy || m) {
|
|
550
|
+
s = !0, c >= 0 ? r = r.slice(0, c + 1) : r = [r[0]];
|
|
551
|
+
break;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return r.reduceRight((u, o, f) => {
|
|
556
|
+
let h, m = !1, y = null, g = null;
|
|
557
|
+
n && (h = a && o.route.id ? a[o.route.id] : void 0, y = o.route.errorElement || qe, s && (c < 0 && f === 0 ? (me(
|
|
558
|
+
"route-fallback",
|
|
559
|
+
!1,
|
|
560
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
561
|
+
), m = !0, g = null) : c === f && (m = !0, g = o.route.hydrateFallbackElement || null)));
|
|
562
|
+
let p = t.concat(r.slice(0, f + 1)), w = () => {
|
|
563
|
+
let d;
|
|
564
|
+
return h ? d = y : m ? d = g : o.route.Component ? d = /* @__PURE__ */ i.createElement(o.route.Component, null) : o.route.element ? d = o.route.element : d = u, /* @__PURE__ */ i.createElement(
|
|
565
|
+
Xe,
|
|
566
|
+
{
|
|
567
|
+
match: o,
|
|
568
|
+
routeContext: {
|
|
569
|
+
outlet: u,
|
|
570
|
+
matches: p,
|
|
571
|
+
isDataRoute: n != null
|
|
572
|
+
},
|
|
573
|
+
children: d
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
};
|
|
577
|
+
return n && (o.route.ErrorBoundary || o.route.errorElement || f === 0) ? /* @__PURE__ */ i.createElement(
|
|
578
|
+
Ge,
|
|
579
|
+
{
|
|
580
|
+
location: n.location,
|
|
581
|
+
revalidation: n.revalidation,
|
|
582
|
+
component: y,
|
|
583
|
+
error: h,
|
|
584
|
+
children: w(),
|
|
585
|
+
routeContext: { outlet: null, matches: p, isDataRoute: !0 }
|
|
586
|
+
}
|
|
587
|
+
) : w();
|
|
588
|
+
}, null);
|
|
589
|
+
}
|
|
590
|
+
function X(e) {
|
|
591
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
592
|
+
}
|
|
593
|
+
function Ze(e) {
|
|
594
|
+
let t = i.useContext(T);
|
|
595
|
+
return C(t, X(e)), t;
|
|
596
|
+
}
|
|
597
|
+
function et(e) {
|
|
598
|
+
let t = i.useContext(_);
|
|
599
|
+
return C(t, X(e)), t;
|
|
600
|
+
}
|
|
601
|
+
function tt(e) {
|
|
602
|
+
let t = i.useContext(S);
|
|
603
|
+
return C(t, X(e)), t;
|
|
604
|
+
}
|
|
605
|
+
function Q(e) {
|
|
606
|
+
let t = tt(e), n = t.matches[t.matches.length - 1];
|
|
607
|
+
return C(
|
|
608
|
+
n.route.id,
|
|
609
|
+
`${e} can only be used on routes that contain a unique "id"`
|
|
610
|
+
), n.route.id;
|
|
611
|
+
}
|
|
612
|
+
function nt() {
|
|
613
|
+
return Q(
|
|
614
|
+
"useRouteId"
|
|
615
|
+
/* UseRouteId */
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
function rt() {
|
|
619
|
+
let e = i.useContext(G), t = et(
|
|
620
|
+
"useRouteError"
|
|
621
|
+
/* UseRouteError */
|
|
622
|
+
), n = Q(
|
|
623
|
+
"useRouteError"
|
|
624
|
+
/* UseRouteError */
|
|
625
|
+
);
|
|
626
|
+
return e !== void 0 ? e : t.errors?.[n];
|
|
627
|
+
}
|
|
628
|
+
function at() {
|
|
629
|
+
let { router: e } = Ze(
|
|
630
|
+
"useNavigate"
|
|
631
|
+
/* UseNavigateStable */
|
|
632
|
+
), t = Q(
|
|
633
|
+
"useNavigate"
|
|
634
|
+
/* UseNavigateStable */
|
|
635
|
+
), n = i.useRef(!1);
|
|
636
|
+
return he(() => {
|
|
637
|
+
n.current = !0;
|
|
638
|
+
}), i.useCallback(
|
|
639
|
+
async (r, a = {}) => {
|
|
640
|
+
b(n.current, de), n.current && (typeof r == "number" ? e.navigate(r) : await e.navigate(r, { fromRouteId: t, ...a }));
|
|
641
|
+
},
|
|
642
|
+
[e, t]
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
var re = {};
|
|
646
|
+
function me(e, t, n) {
|
|
647
|
+
!t && !re[e] && (re[e] = !0, b(!1, n));
|
|
648
|
+
}
|
|
649
|
+
i.memo(lt);
|
|
650
|
+
function lt({
|
|
651
|
+
routes: e,
|
|
652
|
+
future: t,
|
|
653
|
+
state: n
|
|
654
|
+
}) {
|
|
655
|
+
return Ke(e, void 0, n, t);
|
|
656
|
+
}
|
|
657
|
+
var W = "get", U = "application/x-www-form-urlencoded";
|
|
658
|
+
function j(e) {
|
|
659
|
+
return e != null && typeof e.tagName == "string";
|
|
660
|
+
}
|
|
661
|
+
function ot(e) {
|
|
662
|
+
return j(e) && e.tagName.toLowerCase() === "button";
|
|
663
|
+
}
|
|
664
|
+
function it(e) {
|
|
665
|
+
return j(e) && e.tagName.toLowerCase() === "form";
|
|
666
|
+
}
|
|
667
|
+
function ut(e) {
|
|
668
|
+
return j(e) && e.tagName.toLowerCase() === "input";
|
|
669
|
+
}
|
|
670
|
+
function st(e) {
|
|
671
|
+
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
672
|
+
}
|
|
673
|
+
function ct(e, t) {
|
|
674
|
+
return e.button === 0 && // Ignore everything but left clicks
|
|
675
|
+
(!t || t === "_self") && // Let browser handle "target=_blank" etc.
|
|
676
|
+
!st(e);
|
|
677
|
+
}
|
|
678
|
+
var O = null;
|
|
679
|
+
function ft() {
|
|
680
|
+
if (O === null)
|
|
681
|
+
try {
|
|
682
|
+
new FormData(
|
|
683
|
+
document.createElement("form"),
|
|
684
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
685
|
+
0
|
|
686
|
+
), O = !1;
|
|
687
|
+
} catch {
|
|
688
|
+
O = !0;
|
|
689
|
+
}
|
|
690
|
+
return O;
|
|
691
|
+
}
|
|
692
|
+
var dt = /* @__PURE__ */ new Set([
|
|
693
|
+
"application/x-www-form-urlencoded",
|
|
694
|
+
"multipart/form-data",
|
|
695
|
+
"text/plain"
|
|
696
|
+
]);
|
|
697
|
+
function K(e) {
|
|
698
|
+
return e != null && !dt.has(e) ? (b(
|
|
699
|
+
!1,
|
|
700
|
+
`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${U}"`
|
|
701
|
+
), null) : e;
|
|
702
|
+
}
|
|
703
|
+
function ht(e, t) {
|
|
704
|
+
let n, l, r, a, s;
|
|
705
|
+
if (it(e)) {
|
|
706
|
+
let c = e.getAttribute("action");
|
|
707
|
+
l = c ? L(c, t) : null, n = e.getAttribute("method") || W, r = K(e.getAttribute("enctype")) || U, a = new FormData(e);
|
|
708
|
+
} else if (ot(e) || ut(e) && (e.type === "submit" || e.type === "image")) {
|
|
709
|
+
let c = e.form;
|
|
710
|
+
if (c == null)
|
|
711
|
+
throw new Error(
|
|
712
|
+
'Cannot submit a <button> or <input type="submit"> without a <form>'
|
|
713
|
+
);
|
|
714
|
+
let u = e.getAttribute("formaction") || c.getAttribute("action");
|
|
715
|
+
if (l = u ? L(u, t) : null, n = e.getAttribute("formmethod") || c.getAttribute("method") || W, r = K(e.getAttribute("formenctype")) || K(c.getAttribute("enctype")) || U, a = new FormData(c, e), !ft()) {
|
|
716
|
+
let { name: o, type: f, value: h } = e;
|
|
717
|
+
if (f === "image") {
|
|
718
|
+
let m = o ? `${o}.` : "";
|
|
719
|
+
a.append(`${m}x`, "0"), a.append(`${m}y`, "0");
|
|
720
|
+
} else o && a.append(o, h);
|
|
721
|
+
}
|
|
722
|
+
} else {
|
|
723
|
+
if (j(e))
|
|
724
|
+
throw new Error(
|
|
725
|
+
'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
|
|
726
|
+
);
|
|
727
|
+
n = W, l = null, r = U, s = e;
|
|
728
|
+
}
|
|
729
|
+
return a && r === "text/plain" && (s = a, a = void 0), { action: l, method: n.toLowerCase(), encType: r, formData: a, body: s };
|
|
730
|
+
}
|
|
731
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
732
|
+
function Z(e, t) {
|
|
733
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
734
|
+
throw new Error(t);
|
|
735
|
+
}
|
|
736
|
+
function mt(e, t, n) {
|
|
737
|
+
let l = typeof e == "string" ? new URL(
|
|
738
|
+
e,
|
|
739
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
740
|
+
// don't assume window is available
|
|
741
|
+
typeof window > "u" ? "server://singlefetch/" : window.location.origin
|
|
742
|
+
) : e;
|
|
743
|
+
return l.pathname === "/" ? l.pathname = `_root.${n}` : t && L(l.pathname, t) === "/" ? l.pathname = `${t.replace(/\/$/, "")}/_root.${n}` : l.pathname = `${l.pathname.replace(/\/$/, "")}.${n}`, l;
|
|
744
|
+
}
|
|
745
|
+
async function pt(e, t) {
|
|
746
|
+
if (e.id in t)
|
|
747
|
+
return t[e.id];
|
|
748
|
+
try {
|
|
749
|
+
let n = await import(
|
|
750
|
+
/* @vite-ignore */
|
|
751
|
+
/* webpackIgnore: true */
|
|
752
|
+
e.module
|
|
753
|
+
);
|
|
754
|
+
return t[e.id] = n, n;
|
|
755
|
+
} catch (n) {
|
|
756
|
+
return console.error(
|
|
757
|
+
`Error loading route module \`${e.module}\`, reloading page...`
|
|
758
|
+
), console.error(n), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function gt(e) {
|
|
763
|
+
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";
|
|
764
|
+
}
|
|
765
|
+
async function yt(e, t, n) {
|
|
766
|
+
let l = await Promise.all(
|
|
767
|
+
e.map(async (r) => {
|
|
768
|
+
let a = t.routes[r.route.id];
|
|
769
|
+
if (a) {
|
|
770
|
+
let s = await pt(a, n);
|
|
771
|
+
return s.links ? s.links() : [];
|
|
772
|
+
}
|
|
773
|
+
return [];
|
|
774
|
+
})
|
|
775
|
+
);
|
|
776
|
+
return Ct(
|
|
777
|
+
l.flat(1).filter(gt).filter((r) => r.rel === "stylesheet" || r.rel === "preload").map(
|
|
778
|
+
(r) => r.rel === "stylesheet" ? { ...r, rel: "prefetch", as: "style" } : { ...r, rel: "prefetch" }
|
|
779
|
+
)
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
function ae(e, t, n, l, r, a) {
|
|
783
|
+
let s = (u, o) => n[o] ? u.route.id !== n[o].route.id : !0, c = (u, o) => (
|
|
784
|
+
// param change, /users/123 -> /users/456
|
|
785
|
+
n[o].pathname !== u.pathname || // splat param changed, which is not present in match.path
|
|
786
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
787
|
+
n[o].route.path?.endsWith("*") && n[o].params["*"] !== u.params["*"]
|
|
788
|
+
);
|
|
789
|
+
return a === "assets" ? t.filter(
|
|
790
|
+
(u, o) => s(u, o) || c(u, o)
|
|
791
|
+
) : a === "data" ? t.filter((u, o) => {
|
|
792
|
+
let f = l.routes[u.route.id];
|
|
793
|
+
if (!f || !f.hasLoader)
|
|
794
|
+
return !1;
|
|
795
|
+
if (s(u, o) || c(u, o))
|
|
796
|
+
return !0;
|
|
797
|
+
if (u.route.shouldRevalidate) {
|
|
798
|
+
let h = u.route.shouldRevalidate({
|
|
799
|
+
currentUrl: new URL(
|
|
800
|
+
r.pathname + r.search + r.hash,
|
|
801
|
+
window.origin
|
|
802
|
+
),
|
|
803
|
+
currentParams: n[0]?.params || {},
|
|
804
|
+
nextUrl: new URL(e, window.origin),
|
|
805
|
+
nextParams: u.params,
|
|
806
|
+
defaultShouldRevalidate: !0
|
|
807
|
+
});
|
|
808
|
+
if (typeof h == "boolean")
|
|
809
|
+
return h;
|
|
810
|
+
}
|
|
811
|
+
return !0;
|
|
812
|
+
}) : [];
|
|
813
|
+
}
|
|
814
|
+
function vt(e, t, { includeHydrateFallback: n } = {}) {
|
|
815
|
+
return wt(
|
|
816
|
+
e.map((l) => {
|
|
817
|
+
let r = t.routes[l.route.id];
|
|
818
|
+
if (!r) return [];
|
|
819
|
+
let a = [r.module];
|
|
820
|
+
return r.clientActionModule && (a = a.concat(r.clientActionModule)), r.clientLoaderModule && (a = a.concat(r.clientLoaderModule)), n && r.hydrateFallbackModule && (a = a.concat(r.hydrateFallbackModule)), r.imports && (a = a.concat(r.imports)), a;
|
|
821
|
+
}).flat(1)
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
function wt(e) {
|
|
825
|
+
return [...new Set(e)];
|
|
826
|
+
}
|
|
827
|
+
function xt(e) {
|
|
828
|
+
let t = {}, n = Object.keys(e).sort();
|
|
829
|
+
for (let l of n)
|
|
830
|
+
t[l] = e[l];
|
|
831
|
+
return t;
|
|
832
|
+
}
|
|
833
|
+
function Ct(e, t) {
|
|
834
|
+
let n = /* @__PURE__ */ new Set();
|
|
835
|
+
return new Set(t), e.reduce((l, r) => {
|
|
836
|
+
let a = JSON.stringify(xt(r));
|
|
837
|
+
return n.has(a) || (n.add(a), l.push({ key: a, link: r })), l;
|
|
838
|
+
}, []);
|
|
839
|
+
}
|
|
840
|
+
function pe() {
|
|
841
|
+
let e = i.useContext(T);
|
|
842
|
+
return Z(
|
|
843
|
+
e,
|
|
844
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
845
|
+
), e;
|
|
846
|
+
}
|
|
847
|
+
function Rt() {
|
|
848
|
+
let e = i.useContext(_);
|
|
849
|
+
return Z(
|
|
850
|
+
e,
|
|
851
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
852
|
+
), e;
|
|
853
|
+
}
|
|
854
|
+
var ee = i.createContext(void 0);
|
|
855
|
+
ee.displayName = "FrameworkContext";
|
|
856
|
+
function ge() {
|
|
857
|
+
let e = i.useContext(ee);
|
|
858
|
+
return Z(
|
|
859
|
+
e,
|
|
860
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
861
|
+
), e;
|
|
862
|
+
}
|
|
863
|
+
function Et(e, t) {
|
|
864
|
+
let n = i.useContext(ee), [l, r] = i.useState(!1), [a, s] = i.useState(!1), { onFocus: c, onBlur: u, onMouseEnter: o, onMouseLeave: f, onTouchStart: h } = t, m = i.useRef(null);
|
|
865
|
+
i.useEffect(() => {
|
|
866
|
+
if (e === "render" && s(!0), e === "viewport") {
|
|
867
|
+
let p = (d) => {
|
|
868
|
+
d.forEach((x) => {
|
|
869
|
+
s(x.isIntersecting);
|
|
870
|
+
});
|
|
871
|
+
}, w = new IntersectionObserver(p, { threshold: 0.5 });
|
|
872
|
+
return m.current && w.observe(m.current), () => {
|
|
873
|
+
w.disconnect();
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
}, [e]), i.useEffect(() => {
|
|
877
|
+
if (l) {
|
|
878
|
+
let p = setTimeout(() => {
|
|
879
|
+
s(!0);
|
|
880
|
+
}, 100);
|
|
881
|
+
return () => {
|
|
882
|
+
clearTimeout(p);
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
}, [l]);
|
|
886
|
+
let y = () => {
|
|
887
|
+
r(!0);
|
|
888
|
+
}, g = () => {
|
|
889
|
+
r(!1), s(!1);
|
|
890
|
+
};
|
|
891
|
+
return n ? e !== "intent" ? [a, m, {}] : [
|
|
892
|
+
a,
|
|
893
|
+
m,
|
|
894
|
+
{
|
|
895
|
+
onFocus: I(c, y),
|
|
896
|
+
onBlur: I(u, g),
|
|
897
|
+
onMouseEnter: I(o, y),
|
|
898
|
+
onMouseLeave: I(f, g),
|
|
899
|
+
onTouchStart: I(h, y)
|
|
900
|
+
}
|
|
901
|
+
] : [!1, m, {}];
|
|
902
|
+
}
|
|
903
|
+
function I(e, t) {
|
|
904
|
+
return (n) => {
|
|
905
|
+
e && e(n), n.defaultPrevented || t(n);
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
function bt({
|
|
909
|
+
page: e,
|
|
910
|
+
...t
|
|
911
|
+
}) {
|
|
912
|
+
let { router: n } = pe(), l = i.useMemo(
|
|
913
|
+
() => le(n.routes, e, n.basename),
|
|
914
|
+
[n.routes, e, n.basename]
|
|
915
|
+
);
|
|
916
|
+
return l ? /* @__PURE__ */ i.createElement(St, { page: e, matches: l, ...t }) : null;
|
|
917
|
+
}
|
|
918
|
+
function Pt(e) {
|
|
919
|
+
let { manifest: t, routeModules: n } = ge(), [l, r] = i.useState([]);
|
|
920
|
+
return i.useEffect(() => {
|
|
921
|
+
let a = !1;
|
|
922
|
+
return yt(e, t, n).then(
|
|
923
|
+
(s) => {
|
|
924
|
+
a || r(s);
|
|
925
|
+
}
|
|
926
|
+
), () => {
|
|
927
|
+
a = !0;
|
|
928
|
+
};
|
|
929
|
+
}, [e, t, n]), l;
|
|
930
|
+
}
|
|
931
|
+
function St({
|
|
932
|
+
page: e,
|
|
933
|
+
matches: t,
|
|
934
|
+
...n
|
|
935
|
+
}) {
|
|
936
|
+
let l = $(), { manifest: r, routeModules: a } = ge(), { basename: s } = pe(), { loaderData: c, matches: u } = Rt(), o = i.useMemo(
|
|
937
|
+
() => ae(
|
|
938
|
+
e,
|
|
939
|
+
t,
|
|
940
|
+
u,
|
|
941
|
+
r,
|
|
942
|
+
l,
|
|
943
|
+
"data"
|
|
944
|
+
),
|
|
945
|
+
[e, t, u, r, l]
|
|
946
|
+
), f = i.useMemo(
|
|
947
|
+
() => ae(
|
|
948
|
+
e,
|
|
949
|
+
t,
|
|
950
|
+
u,
|
|
951
|
+
r,
|
|
952
|
+
l,
|
|
953
|
+
"assets"
|
|
954
|
+
),
|
|
955
|
+
[e, t, u, r, l]
|
|
956
|
+
), h = i.useMemo(() => {
|
|
957
|
+
if (e === l.pathname + l.search + l.hash)
|
|
958
|
+
return [];
|
|
959
|
+
let g = /* @__PURE__ */ new Set(), p = !1;
|
|
960
|
+
if (t.forEach((d) => {
|
|
961
|
+
let x = r.routes[d.route.id];
|
|
962
|
+
!x || !x.hasLoader || (!o.some((v) => v.route.id === d.route.id) && d.route.id in c && a[d.route.id]?.shouldRevalidate || x.hasClientLoader ? p = !0 : g.add(d.route.id));
|
|
963
|
+
}), g.size === 0)
|
|
964
|
+
return [];
|
|
965
|
+
let w = mt(e, s, "data");
|
|
966
|
+
return p && g.size > 0 && w.searchParams.set(
|
|
967
|
+
"_routes",
|
|
968
|
+
t.filter((d) => g.has(d.route.id)).map((d) => d.route.id).join(",")
|
|
969
|
+
), [w.pathname + w.search];
|
|
970
|
+
}, [
|
|
971
|
+
s,
|
|
972
|
+
c,
|
|
973
|
+
l,
|
|
974
|
+
r,
|
|
975
|
+
o,
|
|
976
|
+
t,
|
|
977
|
+
e,
|
|
978
|
+
a
|
|
979
|
+
]), m = i.useMemo(
|
|
980
|
+
() => vt(f, r),
|
|
981
|
+
[f, r]
|
|
982
|
+
), y = Pt(f);
|
|
983
|
+
return /* @__PURE__ */ i.createElement(i.Fragment, null, h.map((g) => /* @__PURE__ */ i.createElement("link", { key: g, rel: "prefetch", as: "fetch", href: g, ...n })), m.map((g) => /* @__PURE__ */ i.createElement("link", { key: g, rel: "modulepreload", href: g, ...n })), y.map(({ key: g, link: p }) => (
|
|
984
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
985
|
+
// already with their own props
|
|
986
|
+
/* @__PURE__ */ i.createElement("link", { key: g, ...p })
|
|
987
|
+
)));
|
|
988
|
+
}
|
|
989
|
+
function Lt(...e) {
|
|
990
|
+
return (t) => {
|
|
991
|
+
e.forEach((n) => {
|
|
992
|
+
typeof n == "function" ? n(t) : n != null && (n.current = t);
|
|
993
|
+
});
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
var ye = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
997
|
+
try {
|
|
998
|
+
ye && (window.__reactRouterVersion = // @ts-expect-error
|
|
999
|
+
"7.7.0");
|
|
1000
|
+
} catch {
|
|
1001
|
+
}
|
|
1002
|
+
var ve = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, we = i.forwardRef(
|
|
1003
|
+
function({
|
|
1004
|
+
onClick: t,
|
|
1005
|
+
discover: n = "render",
|
|
1006
|
+
prefetch: l = "none",
|
|
1007
|
+
relative: r,
|
|
1008
|
+
reloadDocument: a,
|
|
1009
|
+
replace: s,
|
|
1010
|
+
state: c,
|
|
1011
|
+
target: u,
|
|
1012
|
+
to: o,
|
|
1013
|
+
preventScrollReset: f,
|
|
1014
|
+
viewTransition: h,
|
|
1015
|
+
...m
|
|
1016
|
+
}, y) {
|
|
1017
|
+
let { basename: g } = i.useContext(P), p = typeof o == "string" && ve.test(o), w, d = !1;
|
|
1018
|
+
if (typeof o == "string" && p && (w = o, ye))
|
|
1019
|
+
try {
|
|
1020
|
+
let R = new URL(window.location.href), N = o.startsWith("//") ? new URL(R.protocol + o) : new URL(o), te = L(N.pathname, g);
|
|
1021
|
+
N.origin === R.origin && te != null ? o = te + N.search + N.hash : d = !0;
|
|
1022
|
+
} catch {
|
|
1023
|
+
b(
|
|
1024
|
+
!1,
|
|
1025
|
+
`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
let x = ze(o, { relative: r }), [v, F, k] = Et(
|
|
1029
|
+
l,
|
|
1030
|
+
m
|
|
1031
|
+
), A = Nt(o, {
|
|
1032
|
+
replace: s,
|
|
1033
|
+
state: c,
|
|
1034
|
+
target: u,
|
|
1035
|
+
preventScrollReset: f,
|
|
1036
|
+
relative: r,
|
|
1037
|
+
viewTransition: h
|
|
1038
|
+
});
|
|
1039
|
+
function D(R) {
|
|
1040
|
+
t && t(R), R.defaultPrevented || A(R);
|
|
1041
|
+
}
|
|
1042
|
+
let B = (
|
|
1043
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
1044
|
+
/* @__PURE__ */ i.createElement(
|
|
1045
|
+
"a",
|
|
1046
|
+
{
|
|
1047
|
+
...m,
|
|
1048
|
+
...k,
|
|
1049
|
+
href: w || x,
|
|
1050
|
+
onClick: d || a ? t : D,
|
|
1051
|
+
ref: Lt(y, F),
|
|
1052
|
+
target: u,
|
|
1053
|
+
"data-discover": !p && n === "render" ? "true" : void 0
|
|
1054
|
+
}
|
|
1055
|
+
)
|
|
1056
|
+
);
|
|
1057
|
+
return v && !p ? /* @__PURE__ */ i.createElement(i.Fragment, null, B, /* @__PURE__ */ i.createElement(bt, { page: x })) : B;
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1060
|
+
we.displayName = "Link";
|
|
1061
|
+
var kt = i.forwardRef(
|
|
1062
|
+
function({
|
|
1063
|
+
"aria-current": t = "page",
|
|
1064
|
+
caseSensitive: n = !1,
|
|
1065
|
+
className: l = "",
|
|
1066
|
+
end: r = !1,
|
|
1067
|
+
style: a,
|
|
1068
|
+
to: s,
|
|
1069
|
+
viewTransition: c,
|
|
1070
|
+
children: u,
|
|
1071
|
+
...o
|
|
1072
|
+
}, f) {
|
|
1073
|
+
let h = M(s, { relative: o.relative }), m = $(), y = i.useContext(_), { navigator: g, basename: p } = i.useContext(P), w = y != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1074
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1075
|
+
At(h) && c === !0, d = g.encodeLocation ? g.encodeLocation(h).pathname : h.pathname, x = m.pathname, v = y && y.navigation && y.navigation.location ? y.navigation.location.pathname : null;
|
|
1076
|
+
n || (x = x.toLowerCase(), v = v ? v.toLowerCase() : null, d = d.toLowerCase()), v && p && (v = L(v, p) || v);
|
|
1077
|
+
const F = d !== "/" && d.endsWith("/") ? d.length - 1 : d.length;
|
|
1078
|
+
let k = x === d || !r && x.startsWith(d) && x.charAt(F) === "/", A = v != null && (v === d || !r && v.startsWith(d) && v.charAt(d.length) === "/"), D = {
|
|
1079
|
+
isActive: k,
|
|
1080
|
+
isPending: A,
|
|
1081
|
+
isTransitioning: w
|
|
1082
|
+
}, B = k ? t : void 0, R;
|
|
1083
|
+
typeof l == "function" ? R = l(D) : R = [
|
|
1084
|
+
l,
|
|
1085
|
+
k ? "active" : null,
|
|
1086
|
+
A ? "pending" : null,
|
|
1087
|
+
w ? "transitioning" : null
|
|
1088
|
+
].filter(Boolean).join(" ");
|
|
1089
|
+
let N = typeof a == "function" ? a(D) : a;
|
|
1090
|
+
return /* @__PURE__ */ i.createElement(
|
|
1091
|
+
we,
|
|
1092
|
+
{
|
|
1093
|
+
...o,
|
|
1094
|
+
"aria-current": B,
|
|
1095
|
+
className: R,
|
|
1096
|
+
ref: f,
|
|
1097
|
+
style: N,
|
|
1098
|
+
to: s,
|
|
1099
|
+
viewTransition: c
|
|
1100
|
+
},
|
|
1101
|
+
typeof u == "function" ? u(D) : u
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1105
|
+
kt.displayName = "NavLink";
|
|
1106
|
+
var $t = i.forwardRef(
|
|
1107
|
+
({
|
|
1108
|
+
discover: e = "render",
|
|
1109
|
+
fetcherKey: t,
|
|
1110
|
+
navigate: n,
|
|
1111
|
+
reloadDocument: l,
|
|
1112
|
+
replace: r,
|
|
1113
|
+
state: a,
|
|
1114
|
+
method: s = W,
|
|
1115
|
+
action: c,
|
|
1116
|
+
onSubmit: u,
|
|
1117
|
+
relative: o,
|
|
1118
|
+
preventScrollReset: f,
|
|
1119
|
+
viewTransition: h,
|
|
1120
|
+
...m
|
|
1121
|
+
}, y) => {
|
|
1122
|
+
let g = It(), p = Mt(c, { relative: o }), w = s.toLowerCase() === "get" ? "get" : "post", d = typeof c == "string" && ve.test(c), x = (v) => {
|
|
1123
|
+
if (u && u(v), v.defaultPrevented) return;
|
|
1124
|
+
v.preventDefault();
|
|
1125
|
+
let F = v.nativeEvent.submitter, k = F?.getAttribute("formmethod") || s;
|
|
1126
|
+
g(F || v.currentTarget, {
|
|
1127
|
+
fetcherKey: t,
|
|
1128
|
+
method: k,
|
|
1129
|
+
navigate: n,
|
|
1130
|
+
replace: r,
|
|
1131
|
+
state: a,
|
|
1132
|
+
relative: o,
|
|
1133
|
+
preventScrollReset: f,
|
|
1134
|
+
viewTransition: h
|
|
1135
|
+
});
|
|
1136
|
+
};
|
|
1137
|
+
return /* @__PURE__ */ i.createElement(
|
|
1138
|
+
"form",
|
|
1139
|
+
{
|
|
1140
|
+
ref: y,
|
|
1141
|
+
method: w,
|
|
1142
|
+
action: p,
|
|
1143
|
+
onSubmit: l ? u : x,
|
|
1144
|
+
...m,
|
|
1145
|
+
"data-discover": !d && e === "render" ? "true" : void 0
|
|
1146
|
+
}
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
$t.displayName = "Form";
|
|
1151
|
+
function Ft(e) {
|
|
1152
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1153
|
+
}
|
|
1154
|
+
function xe(e) {
|
|
1155
|
+
let t = i.useContext(T);
|
|
1156
|
+
return C(t, Ft(e)), t;
|
|
1157
|
+
}
|
|
1158
|
+
function Nt(e, {
|
|
1159
|
+
target: t,
|
|
1160
|
+
replace: n,
|
|
1161
|
+
state: l,
|
|
1162
|
+
preventScrollReset: r,
|
|
1163
|
+
relative: a,
|
|
1164
|
+
viewTransition: s
|
|
1165
|
+
} = {}) {
|
|
1166
|
+
let c = je(), u = $(), o = M(e, { relative: a });
|
|
1167
|
+
return i.useCallback(
|
|
1168
|
+
(f) => {
|
|
1169
|
+
if (ct(f, t)) {
|
|
1170
|
+
f.preventDefault();
|
|
1171
|
+
let h = n !== void 0 ? n : Y(u) === Y(o);
|
|
1172
|
+
c(e, {
|
|
1173
|
+
replace: h,
|
|
1174
|
+
state: l,
|
|
1175
|
+
preventScrollReset: r,
|
|
1176
|
+
relative: a,
|
|
1177
|
+
viewTransition: s
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
[
|
|
1182
|
+
u,
|
|
1183
|
+
c,
|
|
1184
|
+
o,
|
|
1185
|
+
n,
|
|
1186
|
+
l,
|
|
1187
|
+
t,
|
|
1188
|
+
e,
|
|
1189
|
+
r,
|
|
1190
|
+
a,
|
|
1191
|
+
s
|
|
1192
|
+
]
|
|
1193
|
+
);
|
|
1194
|
+
}
|
|
1195
|
+
var Tt = 0, Dt = () => `__${String(++Tt)}__`;
|
|
1196
|
+
function It() {
|
|
1197
|
+
let { router: e } = xe(
|
|
1198
|
+
"useSubmit"
|
|
1199
|
+
/* UseSubmit */
|
|
1200
|
+
), { basename: t } = i.useContext(P), n = nt();
|
|
1201
|
+
return i.useCallback(
|
|
1202
|
+
async (l, r = {}) => {
|
|
1203
|
+
let { action: a, method: s, encType: c, formData: u, body: o } = ht(
|
|
1204
|
+
l,
|
|
1205
|
+
t
|
|
1206
|
+
);
|
|
1207
|
+
if (r.navigate === !1) {
|
|
1208
|
+
let f = r.fetcherKey || Dt();
|
|
1209
|
+
await e.fetch(f, n, r.action || a, {
|
|
1210
|
+
preventScrollReset: r.preventScrollReset,
|
|
1211
|
+
formData: u,
|
|
1212
|
+
body: o,
|
|
1213
|
+
formMethod: r.method || s,
|
|
1214
|
+
formEncType: r.encType || c,
|
|
1215
|
+
flushSync: r.flushSync
|
|
1216
|
+
});
|
|
1217
|
+
} else
|
|
1218
|
+
await e.navigate(r.action || a, {
|
|
1219
|
+
preventScrollReset: r.preventScrollReset,
|
|
1220
|
+
formData: u,
|
|
1221
|
+
body: o,
|
|
1222
|
+
formMethod: r.method || s,
|
|
1223
|
+
formEncType: r.encType || c,
|
|
1224
|
+
replace: r.replace,
|
|
1225
|
+
state: r.state,
|
|
1226
|
+
fromRouteId: n,
|
|
1227
|
+
flushSync: r.flushSync,
|
|
1228
|
+
viewTransition: r.viewTransition
|
|
1229
|
+
});
|
|
1230
|
+
},
|
|
1231
|
+
[e, t, n]
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
function Mt(e, { relative: t } = {}) {
|
|
1235
|
+
let { basename: n } = i.useContext(P), l = i.useContext(S);
|
|
1236
|
+
C(l, "useFormAction must be used inside a RouteContext");
|
|
1237
|
+
let [r] = l.matches.slice(-1), a = { ...M(e || ".", { relative: t }) }, s = $();
|
|
1238
|
+
if (e == null) {
|
|
1239
|
+
a.search = s.search;
|
|
1240
|
+
let c = new URLSearchParams(a.search), u = c.getAll("index");
|
|
1241
|
+
if (u.some((f) => f === "")) {
|
|
1242
|
+
c.delete("index"), u.filter((h) => h).forEach((h) => c.append("index", h));
|
|
1243
|
+
let f = c.toString();
|
|
1244
|
+
a.search = f ? `?${f}` : "";
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
return (!e || e === ".") && r.route.index && (a.search = a.search ? a.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (a.pathname = a.pathname === "/" ? n : E([n, a.pathname])), Y(a);
|
|
1248
|
+
}
|
|
1249
|
+
function At(e, t = {}) {
|
|
1250
|
+
let n = i.useContext(fe);
|
|
1251
|
+
C(
|
|
1252
|
+
n != null,
|
|
1253
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1254
|
+
);
|
|
1255
|
+
let { basename: l } = xe(
|
|
1256
|
+
"useViewTransitionState"
|
|
1257
|
+
/* useViewTransitionState */
|
|
1258
|
+
), r = M(e, { relative: t.relative });
|
|
1259
|
+
if (!n.isTransitioning)
|
|
1260
|
+
return !1;
|
|
1261
|
+
let a = L(n.currentLocation.pathname, l) || n.currentLocation.pathname, s = L(n.nextLocation.pathname, l) || n.nextLocation.pathname;
|
|
1262
|
+
return H(r.pathname, s) != null || H(r.pathname, a) != null;
|
|
1263
|
+
}
|
|
1264
|
+
export {
|
|
1265
|
+
T as DataRouterContext,
|
|
1266
|
+
_ as DataRouterStateContext,
|
|
1267
|
+
_e as FetchersContext,
|
|
1268
|
+
$t as Form,
|
|
1269
|
+
ee as FrameworkContext,
|
|
1270
|
+
we as Link,
|
|
1271
|
+
V as LocationContext,
|
|
1272
|
+
kt as NavLink,
|
|
1273
|
+
P as NavigationContext,
|
|
1274
|
+
bt as PrefetchPageLinks,
|
|
1275
|
+
S as RouteContext,
|
|
1276
|
+
fe as ViewTransitionContext,
|
|
1277
|
+
Y as createPath,
|
|
1278
|
+
C as invariant,
|
|
1279
|
+
Ue as isRouteErrorResponse,
|
|
1280
|
+
H as matchPath,
|
|
1281
|
+
le as matchRoutes,
|
|
1282
|
+
q as parsePath,
|
|
1283
|
+
Ie as resolvePath,
|
|
1284
|
+
mt as singleFetchUrl,
|
|
1285
|
+
L as stripBasename,
|
|
1286
|
+
Mt as useFormAction,
|
|
1287
|
+
ze as useHref,
|
|
1288
|
+
z as useInRouterContext,
|
|
1289
|
+
Nt as useLinkClickHandler,
|
|
1290
|
+
$ as useLocation,
|
|
1291
|
+
je as useNavigate,
|
|
1292
|
+
Bt as useNavigationType,
|
|
1293
|
+
M as useResolvedPath,
|
|
1294
|
+
rt as useRouteError,
|
|
1295
|
+
It as useSubmit,
|
|
1296
|
+
At as useViewTransitionState
|
|
1297
|
+
};
|
|
1298
|
+
//# sourceMappingURL=chunk-EF7DTUVF.js.map
|