@elizaos/server 1.5.4 → 1.5.5
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/client/assets/index-B2zlx7XS.js +160486 -0
- package/dist/client/assets/index-B2zlx7XS.js.br +0 -0
- package/dist/client/assets/index-B2zlx7XS.js.map +1 -0
- package/dist/client/assets/index-DESjREgK.css +1 -0
- package/dist/client/assets/index-DESjREgK.css.br +0 -0
- package/dist/client/assets/vendor-Bifu43sa.js +3130 -0
- package/dist/client/assets/vendor-Bifu43sa.js.br +0 -0
- package/dist/client/assets/vendor-Bifu43sa.js.map +1 -0
- package/dist/client/elizaos-avatar.png +0 -0
- package/dist/client/elizaos-icon.png +0 -0
- package/dist/client/elizaos-logo-light.png +0 -0
- package/dist/client/elizaos.webp +0 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/images/agents/agent1.png +0 -0
- package/dist/client/images/agents/agent2.png +0 -0
- package/dist/client/images/agents/agent3.png +0 -0
- package/dist/client/images/agents/agent4.png +0 -0
- package/dist/client/images/agents/agent5.png +0 -0
- package/dist/client/index.html +24 -0
- package/dist/index.d.ts +258 -13
- package/dist/index.js +3067 -3504
- package/dist/index.js.map +1 -0
- package/package.json +8 -8
- package/dist/api/agents/crud.d.ts +0 -8
- package/dist/api/agents/crud.d.ts.map +0 -1
- package/dist/api/agents/index.d.ts +0 -8
- package/dist/api/agents/index.d.ts.map +0 -1
- package/dist/api/agents/lifecycle.d.ts +0 -8
- package/dist/api/agents/lifecycle.d.ts.map +0 -1
- package/dist/api/agents/logs.d.ts +0 -7
- package/dist/api/agents/logs.d.ts.map +0 -1
- package/dist/api/agents/panels.d.ts +0 -7
- package/dist/api/agents/panels.d.ts.map +0 -1
- package/dist/api/agents/worlds.d.ts +0 -7
- package/dist/api/agents/worlds.d.ts.map +0 -1
- package/dist/api/audio/audioBuffer.d.ts +0 -18
- package/dist/api/audio/audioBuffer.d.ts.map +0 -1
- package/dist/api/audio/conversation.d.ts +0 -7
- package/dist/api/audio/conversation.d.ts.map +0 -1
- package/dist/api/audio/index.d.ts +0 -7
- package/dist/api/audio/index.d.ts.map +0 -1
- package/dist/api/audio/processing.d.ts +0 -10
- package/dist/api/audio/processing.d.ts.map +0 -1
- package/dist/api/audio/synthesis.d.ts +0 -7
- package/dist/api/audio/synthesis.d.ts.map +0 -1
- package/dist/api/index.d.ts +0 -20
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/media/agents.d.ts +0 -6
- package/dist/api/media/agents.d.ts.map +0 -1
- package/dist/api/media/channels.d.ts +0 -6
- package/dist/api/media/channels.d.ts.map +0 -1
- package/dist/api/media/index.d.ts +0 -6
- package/dist/api/media/index.d.ts.map +0 -1
- package/dist/api/memory/agents.d.ts +0 -7
- package/dist/api/memory/agents.d.ts.map +0 -1
- package/dist/api/memory/groups.d.ts +0 -8
- package/dist/api/memory/groups.d.ts.map +0 -1
- package/dist/api/memory/index.d.ts +0 -8
- package/dist/api/memory/index.d.ts.map +0 -1
- package/dist/api/memory/rooms.d.ts +0 -7
- package/dist/api/memory/rooms.d.ts.map +0 -1
- package/dist/api/messaging/channels.d.ts +0 -8
- package/dist/api/messaging/channels.d.ts.map +0 -1
- package/dist/api/messaging/core.d.ts +0 -7
- package/dist/api/messaging/core.d.ts.map +0 -1
- package/dist/api/messaging/errors/SessionErrors.d.ts +0 -149
- package/dist/api/messaging/errors/SessionErrors.d.ts.map +0 -1
- package/dist/api/messaging/index.d.ts +0 -8
- package/dist/api/messaging/index.d.ts.map +0 -1
- package/dist/api/messaging/servers.d.ts +0 -7
- package/dist/api/messaging/servers.d.ts.map +0 -1
- package/dist/api/messaging/sessions.d.ts +0 -23
- package/dist/api/messaging/sessions.d.ts.map +0 -1
- package/dist/api/runtime/debug.d.ts +0 -7
- package/dist/api/runtime/debug.d.ts.map +0 -1
- package/dist/api/runtime/health.d.ts +0 -8
- package/dist/api/runtime/health.d.ts.map +0 -1
- package/dist/api/runtime/index.d.ts +0 -8
- package/dist/api/runtime/index.d.ts.map +0 -1
- package/dist/api/runtime/logging.d.ts +0 -6
- package/dist/api/runtime/logging.d.ts.map +0 -1
- package/dist/api/shared/constants.d.ts +0 -22
- package/dist/api/shared/constants.d.ts.map +0 -1
- package/dist/api/shared/file-utils.d.ts +0 -21
- package/dist/api/shared/file-utils.d.ts.map +0 -1
- package/dist/api/shared/index.d.ts +0 -7
- package/dist/api/shared/index.d.ts.map +0 -1
- package/dist/api/shared/middleware.d.ts +0 -40
- package/dist/api/shared/middleware.d.ts.map +0 -1
- package/dist/api/shared/response-utils.d.ts +0 -10
- package/dist/api/shared/response-utils.d.ts.map +0 -1
- package/dist/api/shared/uploads/index.d.ts +0 -2
- package/dist/api/shared/uploads/index.d.ts.map +0 -1
- package/dist/api/shared/validation.d.ts +0 -27
- package/dist/api/shared/validation.d.ts.map +0 -1
- package/dist/api/system/environment.d.ts +0 -24
- package/dist/api/system/environment.d.ts.map +0 -1
- package/dist/api/system/index.d.ts +0 -6
- package/dist/api/system/index.d.ts.map +0 -1
- package/dist/api/system/version.d.ts +0 -6
- package/dist/api/system/version.d.ts.map +0 -1
- package/dist/api/tee/index.d.ts +0 -6
- package/dist/api/tee/index.d.ts.map +0 -1
- package/dist/api/tee/tee.d.ts +0 -1
- package/dist/api/tee/tee.d.ts.map +0 -1
- package/dist/authMiddleware.d.ts +0 -16
- package/dist/authMiddleware.d.ts.map +0 -1
- package/dist/bus.d.ts +0 -31
- package/dist/bus.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/loader.d.ts +0 -49
- package/dist/loader.d.ts.map +0 -1
- package/dist/scripts/copy-client-dist.d.ts +0 -2
- package/dist/scripts/copy-client-dist.d.ts.map +0 -1
- package/dist/services/message.d.ts +0 -49
- package/dist/services/message.d.ts.map +0 -1
- package/dist/socketio/index.d.ts +0 -23
- package/dist/socketio/index.d.ts.map +0 -1
- package/dist/types/sessions.d.ts +0 -153
- package/dist/types/sessions.d.ts.map +0 -1
- package/dist/types.d.ts +0 -52
- package/dist/types.d.ts.map +0 -1
- package/dist/upload.d.ts +0 -16
- package/dist/upload.d.ts.map +0 -1
|
@@ -0,0 +1,3130 @@
|
|
|
1
|
+
function _mergeNamespaces(n, m) {
|
|
2
|
+
for (var i = 0; i < m.length; i++) {
|
|
3
|
+
const e = m[i];
|
|
4
|
+
if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
|
|
5
|
+
if (k !== 'default' && !(k in n)) {
|
|
6
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
7
|
+
if (d) {
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: () => e[k]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
} }
|
|
15
|
+
}
|
|
16
|
+
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' }));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getDefaultExportFromCjs$1(x) {
|
|
20
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var react = {exports: {}};
|
|
24
|
+
|
|
25
|
+
function getDefaultExportFromCjs(x) {
|
|
26
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
27
|
+
}
|
|
28
|
+
var browser = { exports: {} };
|
|
29
|
+
var process = browser.exports = {};
|
|
30
|
+
var cachedSetTimeout;
|
|
31
|
+
var cachedClearTimeout;
|
|
32
|
+
function defaultSetTimout() {
|
|
33
|
+
throw new Error("setTimeout has not been defined");
|
|
34
|
+
}
|
|
35
|
+
function defaultClearTimeout() {
|
|
36
|
+
throw new Error("clearTimeout has not been defined");
|
|
37
|
+
}
|
|
38
|
+
(function() {
|
|
39
|
+
try {
|
|
40
|
+
if (typeof setTimeout === "function") {
|
|
41
|
+
cachedSetTimeout = setTimeout;
|
|
42
|
+
} else {
|
|
43
|
+
cachedSetTimeout = defaultSetTimout;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
cachedSetTimeout = defaultSetTimout;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
if (typeof clearTimeout === "function") {
|
|
50
|
+
cachedClearTimeout = clearTimeout;
|
|
51
|
+
} else {
|
|
52
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
53
|
+
}
|
|
54
|
+
} catch (e) {
|
|
55
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
function runTimeout(fun) {
|
|
59
|
+
if (cachedSetTimeout === setTimeout) {
|
|
60
|
+
return setTimeout(fun, 0);
|
|
61
|
+
}
|
|
62
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
63
|
+
cachedSetTimeout = setTimeout;
|
|
64
|
+
return setTimeout(fun, 0);
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
return cachedSetTimeout(fun, 0);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
try {
|
|
70
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
71
|
+
} catch (e2) {
|
|
72
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function runClearTimeout(marker) {
|
|
77
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
78
|
+
return clearTimeout(marker);
|
|
79
|
+
}
|
|
80
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
81
|
+
cachedClearTimeout = clearTimeout;
|
|
82
|
+
return clearTimeout(marker);
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
return cachedClearTimeout(marker);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
try {
|
|
88
|
+
return cachedClearTimeout.call(null, marker);
|
|
89
|
+
} catch (e2) {
|
|
90
|
+
return cachedClearTimeout.call(this, marker);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
var queue = [];
|
|
95
|
+
var draining = false;
|
|
96
|
+
var currentQueue;
|
|
97
|
+
var queueIndex = -1;
|
|
98
|
+
function cleanUpNextTick() {
|
|
99
|
+
if (!draining || !currentQueue) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
draining = false;
|
|
103
|
+
if (currentQueue.length) {
|
|
104
|
+
queue = currentQueue.concat(queue);
|
|
105
|
+
} else {
|
|
106
|
+
queueIndex = -1;
|
|
107
|
+
}
|
|
108
|
+
if (queue.length) {
|
|
109
|
+
drainQueue();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function drainQueue() {
|
|
113
|
+
if (draining) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
117
|
+
draining = true;
|
|
118
|
+
var len = queue.length;
|
|
119
|
+
while (len) {
|
|
120
|
+
currentQueue = queue;
|
|
121
|
+
queue = [];
|
|
122
|
+
while (++queueIndex < len) {
|
|
123
|
+
if (currentQueue) {
|
|
124
|
+
currentQueue[queueIndex].run();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
queueIndex = -1;
|
|
128
|
+
len = queue.length;
|
|
129
|
+
}
|
|
130
|
+
currentQueue = null;
|
|
131
|
+
draining = false;
|
|
132
|
+
runClearTimeout(timeout);
|
|
133
|
+
}
|
|
134
|
+
process.nextTick = function(fun) {
|
|
135
|
+
var args = new Array(arguments.length - 1);
|
|
136
|
+
if (arguments.length > 1) {
|
|
137
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
138
|
+
args[i - 1] = arguments[i];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
queue.push(new Item(fun, args));
|
|
142
|
+
if (queue.length === 1 && !draining) {
|
|
143
|
+
runTimeout(drainQueue);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
function Item(fun, array) {
|
|
147
|
+
this.fun = fun;
|
|
148
|
+
this.array = array;
|
|
149
|
+
}
|
|
150
|
+
Item.prototype.run = function() {
|
|
151
|
+
this.fun.apply(null, this.array);
|
|
152
|
+
};
|
|
153
|
+
process.title = "browser";
|
|
154
|
+
process.browser = true;
|
|
155
|
+
process.env = {};
|
|
156
|
+
process.argv = [];
|
|
157
|
+
process.version = "";
|
|
158
|
+
process.versions = {};
|
|
159
|
+
function noop() {
|
|
160
|
+
}
|
|
161
|
+
process.on = noop;
|
|
162
|
+
process.addListener = noop;
|
|
163
|
+
process.once = noop;
|
|
164
|
+
process.off = noop;
|
|
165
|
+
process.removeListener = noop;
|
|
166
|
+
process.removeAllListeners = noop;
|
|
167
|
+
process.emit = noop;
|
|
168
|
+
process.prependListener = noop;
|
|
169
|
+
process.prependOnceListener = noop;
|
|
170
|
+
process.listeners = function(name) {
|
|
171
|
+
return [];
|
|
172
|
+
};
|
|
173
|
+
process.binding = function(name) {
|
|
174
|
+
throw new Error("process.binding is not supported");
|
|
175
|
+
};
|
|
176
|
+
process.cwd = function() {
|
|
177
|
+
return "/";
|
|
178
|
+
};
|
|
179
|
+
process.chdir = function(dir) {
|
|
180
|
+
throw new Error("process.chdir is not supported");
|
|
181
|
+
};
|
|
182
|
+
process.umask = function() {
|
|
183
|
+
return 0;
|
|
184
|
+
};
|
|
185
|
+
var browserExports = browser.exports;
|
|
186
|
+
const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
187
|
+
|
|
188
|
+
var react_production = {};
|
|
189
|
+
|
|
190
|
+
var hasRequiredReact_production;
|
|
191
|
+
|
|
192
|
+
function requireReact_production () {
|
|
193
|
+
if (hasRequiredReact_production) return react_production;
|
|
194
|
+
hasRequiredReact_production = 1;
|
|
195
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
196
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
197
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
198
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
199
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
200
|
+
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
201
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
202
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
203
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
204
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
205
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
206
|
+
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
207
|
+
function getIteratorFn(maybeIterable) {
|
|
208
|
+
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
|
209
|
+
maybeIterable =
|
|
210
|
+
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
|
211
|
+
maybeIterable["@@iterator"];
|
|
212
|
+
return "function" === typeof maybeIterable ? maybeIterable : null;
|
|
213
|
+
}
|
|
214
|
+
var ReactNoopUpdateQueue = {
|
|
215
|
+
isMounted: function () {
|
|
216
|
+
return false;
|
|
217
|
+
},
|
|
218
|
+
enqueueForceUpdate: function () {},
|
|
219
|
+
enqueueReplaceState: function () {},
|
|
220
|
+
enqueueSetState: function () {}
|
|
221
|
+
},
|
|
222
|
+
assign = Object.assign,
|
|
223
|
+
emptyObject = {};
|
|
224
|
+
function Component(props, context, updater) {
|
|
225
|
+
this.props = props;
|
|
226
|
+
this.context = context;
|
|
227
|
+
this.refs = emptyObject;
|
|
228
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
229
|
+
}
|
|
230
|
+
Component.prototype.isReactComponent = {};
|
|
231
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
232
|
+
if (
|
|
233
|
+
"object" !== typeof partialState &&
|
|
234
|
+
"function" !== typeof partialState &&
|
|
235
|
+
null != partialState
|
|
236
|
+
)
|
|
237
|
+
throw Error(
|
|
238
|
+
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
239
|
+
);
|
|
240
|
+
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
241
|
+
};
|
|
242
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
243
|
+
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
244
|
+
};
|
|
245
|
+
function ComponentDummy() {}
|
|
246
|
+
ComponentDummy.prototype = Component.prototype;
|
|
247
|
+
function PureComponent(props, context, updater) {
|
|
248
|
+
this.props = props;
|
|
249
|
+
this.context = context;
|
|
250
|
+
this.refs = emptyObject;
|
|
251
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
252
|
+
}
|
|
253
|
+
var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
|
|
254
|
+
pureComponentPrototype.constructor = PureComponent;
|
|
255
|
+
assign(pureComponentPrototype, Component.prototype);
|
|
256
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
257
|
+
var isArrayImpl = Array.isArray,
|
|
258
|
+
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
|
|
259
|
+
hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
260
|
+
function ReactElement(type, key, self, source, owner, props) {
|
|
261
|
+
self = props.ref;
|
|
262
|
+
return {
|
|
263
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
264
|
+
type: type,
|
|
265
|
+
key: key,
|
|
266
|
+
ref: void 0 !== self ? self : null,
|
|
267
|
+
props: props
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
271
|
+
return ReactElement(
|
|
272
|
+
oldElement.type,
|
|
273
|
+
newKey,
|
|
274
|
+
void 0,
|
|
275
|
+
void 0,
|
|
276
|
+
void 0,
|
|
277
|
+
oldElement.props
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
function isValidElement(object) {
|
|
281
|
+
return (
|
|
282
|
+
"object" === typeof object &&
|
|
283
|
+
null !== object &&
|
|
284
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
function escape(key) {
|
|
288
|
+
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
289
|
+
return (
|
|
290
|
+
"$" +
|
|
291
|
+
key.replace(/[=:]/g, function (match) {
|
|
292
|
+
return escaperLookup[match];
|
|
293
|
+
})
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
297
|
+
function getElementKey(element, index) {
|
|
298
|
+
return "object" === typeof element && null !== element && null != element.key
|
|
299
|
+
? escape("" + element.key)
|
|
300
|
+
: index.toString(36);
|
|
301
|
+
}
|
|
302
|
+
function noop$1() {}
|
|
303
|
+
function resolveThenable(thenable) {
|
|
304
|
+
switch (thenable.status) {
|
|
305
|
+
case "fulfilled":
|
|
306
|
+
return thenable.value;
|
|
307
|
+
case "rejected":
|
|
308
|
+
throw thenable.reason;
|
|
309
|
+
default:
|
|
310
|
+
switch (
|
|
311
|
+
("string" === typeof thenable.status
|
|
312
|
+
? thenable.then(noop$1, noop$1)
|
|
313
|
+
: ((thenable.status = "pending"),
|
|
314
|
+
thenable.then(
|
|
315
|
+
function (fulfilledValue) {
|
|
316
|
+
"pending" === thenable.status &&
|
|
317
|
+
((thenable.status = "fulfilled"),
|
|
318
|
+
(thenable.value = fulfilledValue));
|
|
319
|
+
},
|
|
320
|
+
function (error) {
|
|
321
|
+
"pending" === thenable.status &&
|
|
322
|
+
((thenable.status = "rejected"), (thenable.reason = error));
|
|
323
|
+
}
|
|
324
|
+
)),
|
|
325
|
+
thenable.status)
|
|
326
|
+
) {
|
|
327
|
+
case "fulfilled":
|
|
328
|
+
return thenable.value;
|
|
329
|
+
case "rejected":
|
|
330
|
+
throw thenable.reason;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
throw thenable;
|
|
334
|
+
}
|
|
335
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
336
|
+
var type = typeof children;
|
|
337
|
+
if ("undefined" === type || "boolean" === type) children = null;
|
|
338
|
+
var invokeCallback = false;
|
|
339
|
+
if (null === children) invokeCallback = true;
|
|
340
|
+
else
|
|
341
|
+
switch (type) {
|
|
342
|
+
case "bigint":
|
|
343
|
+
case "string":
|
|
344
|
+
case "number":
|
|
345
|
+
invokeCallback = true;
|
|
346
|
+
break;
|
|
347
|
+
case "object":
|
|
348
|
+
switch (children.$$typeof) {
|
|
349
|
+
case REACT_ELEMENT_TYPE:
|
|
350
|
+
case REACT_PORTAL_TYPE:
|
|
351
|
+
invokeCallback = true;
|
|
352
|
+
break;
|
|
353
|
+
case REACT_LAZY_TYPE:
|
|
354
|
+
return (
|
|
355
|
+
(invokeCallback = children._init),
|
|
356
|
+
mapIntoArray(
|
|
357
|
+
invokeCallback(children._payload),
|
|
358
|
+
array,
|
|
359
|
+
escapedPrefix,
|
|
360
|
+
nameSoFar,
|
|
361
|
+
callback
|
|
362
|
+
)
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (invokeCallback)
|
|
367
|
+
return (
|
|
368
|
+
(callback = callback(children)),
|
|
369
|
+
(invokeCallback =
|
|
370
|
+
"" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
|
|
371
|
+
isArrayImpl(callback)
|
|
372
|
+
? ((escapedPrefix = ""),
|
|
373
|
+
null != invokeCallback &&
|
|
374
|
+
(escapedPrefix =
|
|
375
|
+
invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
|
376
|
+
mapIntoArray(callback, array, escapedPrefix, "", function (c) {
|
|
377
|
+
return c;
|
|
378
|
+
}))
|
|
379
|
+
: null != callback &&
|
|
380
|
+
(isValidElement(callback) &&
|
|
381
|
+
(callback = cloneAndReplaceKey(
|
|
382
|
+
callback,
|
|
383
|
+
escapedPrefix +
|
|
384
|
+
(null == callback.key ||
|
|
385
|
+
(children && children.key === callback.key)
|
|
386
|
+
? ""
|
|
387
|
+
: ("" + callback.key).replace(
|
|
388
|
+
userProvidedKeyEscapeRegex,
|
|
389
|
+
"$&/"
|
|
390
|
+
) + "/") +
|
|
391
|
+
invokeCallback
|
|
392
|
+
)),
|
|
393
|
+
array.push(callback)),
|
|
394
|
+
1
|
|
395
|
+
);
|
|
396
|
+
invokeCallback = 0;
|
|
397
|
+
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
|
398
|
+
if (isArrayImpl(children))
|
|
399
|
+
for (var i = 0; i < children.length; i++)
|
|
400
|
+
(nameSoFar = children[i]),
|
|
401
|
+
(type = nextNamePrefix + getElementKey(nameSoFar, i)),
|
|
402
|
+
(invokeCallback += mapIntoArray(
|
|
403
|
+
nameSoFar,
|
|
404
|
+
array,
|
|
405
|
+
escapedPrefix,
|
|
406
|
+
type,
|
|
407
|
+
callback
|
|
408
|
+
));
|
|
409
|
+
else if (((i = getIteratorFn(children)), "function" === typeof i))
|
|
410
|
+
for (
|
|
411
|
+
children = i.call(children), i = 0;
|
|
412
|
+
!(nameSoFar = children.next()).done;
|
|
413
|
+
|
|
414
|
+
)
|
|
415
|
+
(nameSoFar = nameSoFar.value),
|
|
416
|
+
(type = nextNamePrefix + getElementKey(nameSoFar, i++)),
|
|
417
|
+
(invokeCallback += mapIntoArray(
|
|
418
|
+
nameSoFar,
|
|
419
|
+
array,
|
|
420
|
+
escapedPrefix,
|
|
421
|
+
type,
|
|
422
|
+
callback
|
|
423
|
+
));
|
|
424
|
+
else if ("object" === type) {
|
|
425
|
+
if ("function" === typeof children.then)
|
|
426
|
+
return mapIntoArray(
|
|
427
|
+
resolveThenable(children),
|
|
428
|
+
array,
|
|
429
|
+
escapedPrefix,
|
|
430
|
+
nameSoFar,
|
|
431
|
+
callback
|
|
432
|
+
);
|
|
433
|
+
array = String(children);
|
|
434
|
+
throw Error(
|
|
435
|
+
"Objects are not valid as a React child (found: " +
|
|
436
|
+
("[object Object]" === array
|
|
437
|
+
? "object with keys {" + Object.keys(children).join(", ") + "}"
|
|
438
|
+
: array) +
|
|
439
|
+
"). If you meant to render a collection of children, use an array instead."
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
return invokeCallback;
|
|
443
|
+
}
|
|
444
|
+
function mapChildren(children, func, context) {
|
|
445
|
+
if (null == children) return children;
|
|
446
|
+
var result = [],
|
|
447
|
+
count = 0;
|
|
448
|
+
mapIntoArray(children, result, "", "", function (child) {
|
|
449
|
+
return func.call(context, child, count++);
|
|
450
|
+
});
|
|
451
|
+
return result;
|
|
452
|
+
}
|
|
453
|
+
function lazyInitializer(payload) {
|
|
454
|
+
if (-1 === payload._status) {
|
|
455
|
+
var ctor = payload._result;
|
|
456
|
+
ctor = ctor();
|
|
457
|
+
ctor.then(
|
|
458
|
+
function (moduleObject) {
|
|
459
|
+
if (0 === payload._status || -1 === payload._status)
|
|
460
|
+
(payload._status = 1), (payload._result = moduleObject);
|
|
461
|
+
},
|
|
462
|
+
function (error) {
|
|
463
|
+
if (0 === payload._status || -1 === payload._status)
|
|
464
|
+
(payload._status = 2), (payload._result = error);
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
-1 === payload._status && ((payload._status = 0), (payload._result = ctor));
|
|
468
|
+
}
|
|
469
|
+
if (1 === payload._status) return payload._result.default;
|
|
470
|
+
throw payload._result;
|
|
471
|
+
}
|
|
472
|
+
var reportGlobalError =
|
|
473
|
+
"function" === typeof reportError
|
|
474
|
+
? reportError
|
|
475
|
+
: function (error) {
|
|
476
|
+
if (
|
|
477
|
+
"object" === typeof window &&
|
|
478
|
+
"function" === typeof window.ErrorEvent
|
|
479
|
+
) {
|
|
480
|
+
var event = new window.ErrorEvent("error", {
|
|
481
|
+
bubbles: true,
|
|
482
|
+
cancelable: true,
|
|
483
|
+
message:
|
|
484
|
+
"object" === typeof error &&
|
|
485
|
+
null !== error &&
|
|
486
|
+
"string" === typeof error.message
|
|
487
|
+
? String(error.message)
|
|
488
|
+
: String(error),
|
|
489
|
+
error: error
|
|
490
|
+
});
|
|
491
|
+
if (!window.dispatchEvent(event)) return;
|
|
492
|
+
} else if (
|
|
493
|
+
"object" === typeof process$1 &&
|
|
494
|
+
"function" === typeof process$1.emit
|
|
495
|
+
) {
|
|
496
|
+
process$1.emit("uncaughtException", error);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
console.error(error);
|
|
500
|
+
};
|
|
501
|
+
function noop() {}
|
|
502
|
+
react_production.Children = {
|
|
503
|
+
map: mapChildren,
|
|
504
|
+
forEach: function (children, forEachFunc, forEachContext) {
|
|
505
|
+
mapChildren(
|
|
506
|
+
children,
|
|
507
|
+
function () {
|
|
508
|
+
forEachFunc.apply(this, arguments);
|
|
509
|
+
},
|
|
510
|
+
forEachContext
|
|
511
|
+
);
|
|
512
|
+
},
|
|
513
|
+
count: function (children) {
|
|
514
|
+
var n = 0;
|
|
515
|
+
mapChildren(children, function () {
|
|
516
|
+
n++;
|
|
517
|
+
});
|
|
518
|
+
return n;
|
|
519
|
+
},
|
|
520
|
+
toArray: function (children) {
|
|
521
|
+
return (
|
|
522
|
+
mapChildren(children, function (child) {
|
|
523
|
+
return child;
|
|
524
|
+
}) || []
|
|
525
|
+
);
|
|
526
|
+
},
|
|
527
|
+
only: function (children) {
|
|
528
|
+
if (!isValidElement(children))
|
|
529
|
+
throw Error(
|
|
530
|
+
"React.Children.only expected to receive a single React element child."
|
|
531
|
+
);
|
|
532
|
+
return children;
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
react_production.Component = Component;
|
|
536
|
+
react_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
537
|
+
react_production.Profiler = REACT_PROFILER_TYPE;
|
|
538
|
+
react_production.PureComponent = PureComponent;
|
|
539
|
+
react_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
540
|
+
react_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
541
|
+
react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
542
|
+
ReactSharedInternals;
|
|
543
|
+
react_production.__COMPILER_RUNTIME = {
|
|
544
|
+
__proto__: null,
|
|
545
|
+
c: function (size) {
|
|
546
|
+
return ReactSharedInternals.H.useMemoCache(size);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
react_production.cache = function (fn) {
|
|
550
|
+
return function () {
|
|
551
|
+
return fn.apply(null, arguments);
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
react_production.cloneElement = function (element, config, children) {
|
|
555
|
+
if (null === element || void 0 === element)
|
|
556
|
+
throw Error(
|
|
557
|
+
"The argument must be a React element, but you passed " + element + "."
|
|
558
|
+
);
|
|
559
|
+
var props = assign({}, element.props),
|
|
560
|
+
key = element.key,
|
|
561
|
+
owner = void 0;
|
|
562
|
+
if (null != config)
|
|
563
|
+
for (propName in (void 0 !== config.ref && (owner = void 0),
|
|
564
|
+
void 0 !== config.key && (key = "" + config.key),
|
|
565
|
+
config))
|
|
566
|
+
!hasOwnProperty.call(config, propName) ||
|
|
567
|
+
"key" === propName ||
|
|
568
|
+
"__self" === propName ||
|
|
569
|
+
"__source" === propName ||
|
|
570
|
+
("ref" === propName && void 0 === config.ref) ||
|
|
571
|
+
(props[propName] = config[propName]);
|
|
572
|
+
var propName = arguments.length - 2;
|
|
573
|
+
if (1 === propName) props.children = children;
|
|
574
|
+
else if (1 < propName) {
|
|
575
|
+
for (var childArray = Array(propName), i = 0; i < propName; i++)
|
|
576
|
+
childArray[i] = arguments[i + 2];
|
|
577
|
+
props.children = childArray;
|
|
578
|
+
}
|
|
579
|
+
return ReactElement(element.type, key, void 0, void 0, owner, props);
|
|
580
|
+
};
|
|
581
|
+
react_production.createContext = function (defaultValue) {
|
|
582
|
+
defaultValue = {
|
|
583
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
584
|
+
_currentValue: defaultValue,
|
|
585
|
+
_currentValue2: defaultValue,
|
|
586
|
+
_threadCount: 0,
|
|
587
|
+
Provider: null,
|
|
588
|
+
Consumer: null
|
|
589
|
+
};
|
|
590
|
+
defaultValue.Provider = defaultValue;
|
|
591
|
+
defaultValue.Consumer = {
|
|
592
|
+
$$typeof: REACT_CONSUMER_TYPE,
|
|
593
|
+
_context: defaultValue
|
|
594
|
+
};
|
|
595
|
+
return defaultValue;
|
|
596
|
+
};
|
|
597
|
+
react_production.createElement = function (type, config, children) {
|
|
598
|
+
var propName,
|
|
599
|
+
props = {},
|
|
600
|
+
key = null;
|
|
601
|
+
if (null != config)
|
|
602
|
+
for (propName in (void 0 !== config.key && (key = "" + config.key), config))
|
|
603
|
+
hasOwnProperty.call(config, propName) &&
|
|
604
|
+
"key" !== propName &&
|
|
605
|
+
"__self" !== propName &&
|
|
606
|
+
"__source" !== propName &&
|
|
607
|
+
(props[propName] = config[propName]);
|
|
608
|
+
var childrenLength = arguments.length - 2;
|
|
609
|
+
if (1 === childrenLength) props.children = children;
|
|
610
|
+
else if (1 < childrenLength) {
|
|
611
|
+
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
|
|
612
|
+
childArray[i] = arguments[i + 2];
|
|
613
|
+
props.children = childArray;
|
|
614
|
+
}
|
|
615
|
+
if (type && type.defaultProps)
|
|
616
|
+
for (propName in ((childrenLength = type.defaultProps), childrenLength))
|
|
617
|
+
void 0 === props[propName] &&
|
|
618
|
+
(props[propName] = childrenLength[propName]);
|
|
619
|
+
return ReactElement(type, key, void 0, void 0, null, props);
|
|
620
|
+
};
|
|
621
|
+
react_production.createRef = function () {
|
|
622
|
+
return { current: null };
|
|
623
|
+
};
|
|
624
|
+
react_production.forwardRef = function (render) {
|
|
625
|
+
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
|
|
626
|
+
};
|
|
627
|
+
react_production.isValidElement = isValidElement;
|
|
628
|
+
react_production.lazy = function (ctor) {
|
|
629
|
+
return {
|
|
630
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
631
|
+
_payload: { _status: -1, _result: ctor },
|
|
632
|
+
_init: lazyInitializer
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
react_production.memo = function (type, compare) {
|
|
636
|
+
return {
|
|
637
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
638
|
+
type: type,
|
|
639
|
+
compare: void 0 === compare ? null : compare
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
react_production.startTransition = function (scope) {
|
|
643
|
+
var prevTransition = ReactSharedInternals.T,
|
|
644
|
+
currentTransition = {};
|
|
645
|
+
ReactSharedInternals.T = currentTransition;
|
|
646
|
+
try {
|
|
647
|
+
var returnValue = scope(),
|
|
648
|
+
onStartTransitionFinish = ReactSharedInternals.S;
|
|
649
|
+
null !== onStartTransitionFinish &&
|
|
650
|
+
onStartTransitionFinish(currentTransition, returnValue);
|
|
651
|
+
"object" === typeof returnValue &&
|
|
652
|
+
null !== returnValue &&
|
|
653
|
+
"function" === typeof returnValue.then &&
|
|
654
|
+
returnValue.then(noop, reportGlobalError);
|
|
655
|
+
} catch (error) {
|
|
656
|
+
reportGlobalError(error);
|
|
657
|
+
} finally {
|
|
658
|
+
ReactSharedInternals.T = prevTransition;
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
react_production.unstable_useCacheRefresh = function () {
|
|
662
|
+
return ReactSharedInternals.H.useCacheRefresh();
|
|
663
|
+
};
|
|
664
|
+
react_production.use = function (usable) {
|
|
665
|
+
return ReactSharedInternals.H.use(usable);
|
|
666
|
+
};
|
|
667
|
+
react_production.useActionState = function (action, initialState, permalink) {
|
|
668
|
+
return ReactSharedInternals.H.useActionState(action, initialState, permalink);
|
|
669
|
+
};
|
|
670
|
+
react_production.useCallback = function (callback, deps) {
|
|
671
|
+
return ReactSharedInternals.H.useCallback(callback, deps);
|
|
672
|
+
};
|
|
673
|
+
react_production.useContext = function (Context) {
|
|
674
|
+
return ReactSharedInternals.H.useContext(Context);
|
|
675
|
+
};
|
|
676
|
+
react_production.useDebugValue = function () {};
|
|
677
|
+
react_production.useDeferredValue = function (value, initialValue) {
|
|
678
|
+
return ReactSharedInternals.H.useDeferredValue(value, initialValue);
|
|
679
|
+
};
|
|
680
|
+
react_production.useEffect = function (create, createDeps, update) {
|
|
681
|
+
var dispatcher = ReactSharedInternals.H;
|
|
682
|
+
if ("function" === typeof update)
|
|
683
|
+
throw Error(
|
|
684
|
+
"useEffect CRUD overload is not enabled in this build of React."
|
|
685
|
+
);
|
|
686
|
+
return dispatcher.useEffect(create, createDeps);
|
|
687
|
+
};
|
|
688
|
+
react_production.useId = function () {
|
|
689
|
+
return ReactSharedInternals.H.useId();
|
|
690
|
+
};
|
|
691
|
+
react_production.useImperativeHandle = function (ref, create, deps) {
|
|
692
|
+
return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
|
|
693
|
+
};
|
|
694
|
+
react_production.useInsertionEffect = function (create, deps) {
|
|
695
|
+
return ReactSharedInternals.H.useInsertionEffect(create, deps);
|
|
696
|
+
};
|
|
697
|
+
react_production.useLayoutEffect = function (create, deps) {
|
|
698
|
+
return ReactSharedInternals.H.useLayoutEffect(create, deps);
|
|
699
|
+
};
|
|
700
|
+
react_production.useMemo = function (create, deps) {
|
|
701
|
+
return ReactSharedInternals.H.useMemo(create, deps);
|
|
702
|
+
};
|
|
703
|
+
react_production.useOptimistic = function (passthrough, reducer) {
|
|
704
|
+
return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
|
|
705
|
+
};
|
|
706
|
+
react_production.useReducer = function (reducer, initialArg, init) {
|
|
707
|
+
return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
|
|
708
|
+
};
|
|
709
|
+
react_production.useRef = function (initialValue) {
|
|
710
|
+
return ReactSharedInternals.H.useRef(initialValue);
|
|
711
|
+
};
|
|
712
|
+
react_production.useState = function (initialState) {
|
|
713
|
+
return ReactSharedInternals.H.useState(initialState);
|
|
714
|
+
};
|
|
715
|
+
react_production.useSyncExternalStore = function (
|
|
716
|
+
subscribe,
|
|
717
|
+
getSnapshot,
|
|
718
|
+
getServerSnapshot
|
|
719
|
+
) {
|
|
720
|
+
return ReactSharedInternals.H.useSyncExternalStore(
|
|
721
|
+
subscribe,
|
|
722
|
+
getSnapshot,
|
|
723
|
+
getServerSnapshot
|
|
724
|
+
);
|
|
725
|
+
};
|
|
726
|
+
react_production.useTransition = function () {
|
|
727
|
+
return ReactSharedInternals.H.useTransition();
|
|
728
|
+
};
|
|
729
|
+
react_production.version = "19.1.0";
|
|
730
|
+
return react_production;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
var hasRequiredReact;
|
|
734
|
+
|
|
735
|
+
function requireReact () {
|
|
736
|
+
if (hasRequiredReact) return react.exports;
|
|
737
|
+
hasRequiredReact = 1;
|
|
738
|
+
{
|
|
739
|
+
react.exports = requireReact_production();
|
|
740
|
+
}
|
|
741
|
+
return react.exports;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
var reactExports = requireReact();
|
|
745
|
+
const React = /*@__PURE__*/getDefaultExportFromCjs$1(reactExports);
|
|
746
|
+
|
|
747
|
+
const React$1 = /*#__PURE__*/_mergeNamespaces({
|
|
748
|
+
__proto__: null,
|
|
749
|
+
default: React
|
|
750
|
+
}, [reactExports]);
|
|
751
|
+
|
|
752
|
+
var reactDom = {exports: {}};
|
|
753
|
+
|
|
754
|
+
var reactDom_production = {};
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* @license React
|
|
758
|
+
* react-dom.production.js
|
|
759
|
+
*
|
|
760
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
761
|
+
*
|
|
762
|
+
* This source code is licensed under the MIT license found in the
|
|
763
|
+
* LICENSE file in the root directory of this source tree.
|
|
764
|
+
*/
|
|
765
|
+
|
|
766
|
+
var hasRequiredReactDom_production;
|
|
767
|
+
|
|
768
|
+
function requireReactDom_production () {
|
|
769
|
+
if (hasRequiredReactDom_production) return reactDom_production;
|
|
770
|
+
hasRequiredReactDom_production = 1;
|
|
771
|
+
var React = requireReact();
|
|
772
|
+
function formatProdErrorMessage(code) {
|
|
773
|
+
var url = "https://react.dev/errors/" + code;
|
|
774
|
+
if (1 < arguments.length) {
|
|
775
|
+
url += "?args[]=" + encodeURIComponent(arguments[1]);
|
|
776
|
+
for (var i = 2; i < arguments.length; i++)
|
|
777
|
+
url += "&args[]=" + encodeURIComponent(arguments[i]);
|
|
778
|
+
}
|
|
779
|
+
return (
|
|
780
|
+
"Minified React error #" +
|
|
781
|
+
code +
|
|
782
|
+
"; visit " +
|
|
783
|
+
url +
|
|
784
|
+
" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
function noop() {}
|
|
788
|
+
var Internals = {
|
|
789
|
+
d: {
|
|
790
|
+
f: noop,
|
|
791
|
+
r: function () {
|
|
792
|
+
throw Error(formatProdErrorMessage(522));
|
|
793
|
+
},
|
|
794
|
+
D: noop,
|
|
795
|
+
C: noop,
|
|
796
|
+
L: noop,
|
|
797
|
+
m: noop,
|
|
798
|
+
X: noop,
|
|
799
|
+
S: noop,
|
|
800
|
+
M: noop
|
|
801
|
+
},
|
|
802
|
+
p: 0,
|
|
803
|
+
findDOMNode: null
|
|
804
|
+
},
|
|
805
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
806
|
+
function createPortal$1(children, containerInfo, implementation) {
|
|
807
|
+
var key =
|
|
808
|
+
3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
809
|
+
return {
|
|
810
|
+
$$typeof: REACT_PORTAL_TYPE,
|
|
811
|
+
key: null == key ? null : "" + key,
|
|
812
|
+
children: children,
|
|
813
|
+
containerInfo: containerInfo,
|
|
814
|
+
implementation: implementation
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
var ReactSharedInternals =
|
|
818
|
+
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
819
|
+
function getCrossOriginStringAs(as, input) {
|
|
820
|
+
if ("font" === as) return "";
|
|
821
|
+
if ("string" === typeof input)
|
|
822
|
+
return "use-credentials" === input ? input : "";
|
|
823
|
+
}
|
|
824
|
+
reactDom_production.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
825
|
+
Internals;
|
|
826
|
+
reactDom_production.createPortal = function (children, container) {
|
|
827
|
+
var key =
|
|
828
|
+
2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
|
|
829
|
+
if (
|
|
830
|
+
!container ||
|
|
831
|
+
(1 !== container.nodeType &&
|
|
832
|
+
9 !== container.nodeType &&
|
|
833
|
+
11 !== container.nodeType)
|
|
834
|
+
)
|
|
835
|
+
throw Error(formatProdErrorMessage(299));
|
|
836
|
+
return createPortal$1(children, container, null, key);
|
|
837
|
+
};
|
|
838
|
+
reactDom_production.flushSync = function (fn) {
|
|
839
|
+
var previousTransition = ReactSharedInternals.T,
|
|
840
|
+
previousUpdatePriority = Internals.p;
|
|
841
|
+
try {
|
|
842
|
+
if (((ReactSharedInternals.T = null), (Internals.p = 2), fn)) return fn();
|
|
843
|
+
} finally {
|
|
844
|
+
(ReactSharedInternals.T = previousTransition),
|
|
845
|
+
(Internals.p = previousUpdatePriority),
|
|
846
|
+
Internals.d.f();
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
reactDom_production.preconnect = function (href, options) {
|
|
850
|
+
"string" === typeof href &&
|
|
851
|
+
(options
|
|
852
|
+
? ((options = options.crossOrigin),
|
|
853
|
+
(options =
|
|
854
|
+
"string" === typeof options
|
|
855
|
+
? "use-credentials" === options
|
|
856
|
+
? options
|
|
857
|
+
: ""
|
|
858
|
+
: void 0))
|
|
859
|
+
: (options = null),
|
|
860
|
+
Internals.d.C(href, options));
|
|
861
|
+
};
|
|
862
|
+
reactDom_production.prefetchDNS = function (href) {
|
|
863
|
+
"string" === typeof href && Internals.d.D(href);
|
|
864
|
+
};
|
|
865
|
+
reactDom_production.preinit = function (href, options) {
|
|
866
|
+
if ("string" === typeof href && options && "string" === typeof options.as) {
|
|
867
|
+
var as = options.as,
|
|
868
|
+
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
|
|
869
|
+
integrity =
|
|
870
|
+
"string" === typeof options.integrity ? options.integrity : void 0,
|
|
871
|
+
fetchPriority =
|
|
872
|
+
"string" === typeof options.fetchPriority
|
|
873
|
+
? options.fetchPriority
|
|
874
|
+
: void 0;
|
|
875
|
+
"style" === as
|
|
876
|
+
? Internals.d.S(
|
|
877
|
+
href,
|
|
878
|
+
"string" === typeof options.precedence ? options.precedence : void 0,
|
|
879
|
+
{
|
|
880
|
+
crossOrigin: crossOrigin,
|
|
881
|
+
integrity: integrity,
|
|
882
|
+
fetchPriority: fetchPriority
|
|
883
|
+
}
|
|
884
|
+
)
|
|
885
|
+
: "script" === as &&
|
|
886
|
+
Internals.d.X(href, {
|
|
887
|
+
crossOrigin: crossOrigin,
|
|
888
|
+
integrity: integrity,
|
|
889
|
+
fetchPriority: fetchPriority,
|
|
890
|
+
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
reactDom_production.preinitModule = function (href, options) {
|
|
895
|
+
if ("string" === typeof href)
|
|
896
|
+
if ("object" === typeof options && null !== options) {
|
|
897
|
+
if (null == options.as || "script" === options.as) {
|
|
898
|
+
var crossOrigin = getCrossOriginStringAs(
|
|
899
|
+
options.as,
|
|
900
|
+
options.crossOrigin
|
|
901
|
+
);
|
|
902
|
+
Internals.d.M(href, {
|
|
903
|
+
crossOrigin: crossOrigin,
|
|
904
|
+
integrity:
|
|
905
|
+
"string" === typeof options.integrity ? options.integrity : void 0,
|
|
906
|
+
nonce: "string" === typeof options.nonce ? options.nonce : void 0
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
} else null == options && Internals.d.M(href);
|
|
910
|
+
};
|
|
911
|
+
reactDom_production.preload = function (href, options) {
|
|
912
|
+
if (
|
|
913
|
+
"string" === typeof href &&
|
|
914
|
+
"object" === typeof options &&
|
|
915
|
+
null !== options &&
|
|
916
|
+
"string" === typeof options.as
|
|
917
|
+
) {
|
|
918
|
+
var as = options.as,
|
|
919
|
+
crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
|
|
920
|
+
Internals.d.L(href, as, {
|
|
921
|
+
crossOrigin: crossOrigin,
|
|
922
|
+
integrity:
|
|
923
|
+
"string" === typeof options.integrity ? options.integrity : void 0,
|
|
924
|
+
nonce: "string" === typeof options.nonce ? options.nonce : void 0,
|
|
925
|
+
type: "string" === typeof options.type ? options.type : void 0,
|
|
926
|
+
fetchPriority:
|
|
927
|
+
"string" === typeof options.fetchPriority
|
|
928
|
+
? options.fetchPriority
|
|
929
|
+
: void 0,
|
|
930
|
+
referrerPolicy:
|
|
931
|
+
"string" === typeof options.referrerPolicy
|
|
932
|
+
? options.referrerPolicy
|
|
933
|
+
: void 0,
|
|
934
|
+
imageSrcSet:
|
|
935
|
+
"string" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,
|
|
936
|
+
imageSizes:
|
|
937
|
+
"string" === typeof options.imageSizes ? options.imageSizes : void 0,
|
|
938
|
+
media: "string" === typeof options.media ? options.media : void 0
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
reactDom_production.preloadModule = function (href, options) {
|
|
943
|
+
if ("string" === typeof href)
|
|
944
|
+
if (options) {
|
|
945
|
+
var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
|
|
946
|
+
Internals.d.m(href, {
|
|
947
|
+
as:
|
|
948
|
+
"string" === typeof options.as && "script" !== options.as
|
|
949
|
+
? options.as
|
|
950
|
+
: void 0,
|
|
951
|
+
crossOrigin: crossOrigin,
|
|
952
|
+
integrity:
|
|
953
|
+
"string" === typeof options.integrity ? options.integrity : void 0
|
|
954
|
+
});
|
|
955
|
+
} else Internals.d.m(href);
|
|
956
|
+
};
|
|
957
|
+
reactDom_production.requestFormReset = function (form) {
|
|
958
|
+
Internals.d.r(form);
|
|
959
|
+
};
|
|
960
|
+
reactDom_production.unstable_batchedUpdates = function (fn, a) {
|
|
961
|
+
return fn(a);
|
|
962
|
+
};
|
|
963
|
+
reactDom_production.useFormState = function (action, initialState, permalink) {
|
|
964
|
+
return ReactSharedInternals.H.useFormState(action, initialState, permalink);
|
|
965
|
+
};
|
|
966
|
+
reactDom_production.useFormStatus = function () {
|
|
967
|
+
return ReactSharedInternals.H.useHostTransitionStatus();
|
|
968
|
+
};
|
|
969
|
+
reactDom_production.version = "19.1.0";
|
|
970
|
+
return reactDom_production;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
var hasRequiredReactDom;
|
|
974
|
+
|
|
975
|
+
function requireReactDom () {
|
|
976
|
+
if (hasRequiredReactDom) return reactDom.exports;
|
|
977
|
+
hasRequiredReactDom = 1;
|
|
978
|
+
function checkDCE() {
|
|
979
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") {
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
try {
|
|
983
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
|
984
|
+
} catch (err) {
|
|
985
|
+
console.error(err);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
{
|
|
989
|
+
checkDCE();
|
|
990
|
+
reactDom.exports = requireReactDom_production();
|
|
991
|
+
}
|
|
992
|
+
return reactDom.exports;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
var reactDomExports = requireReactDom();
|
|
996
|
+
const ReactDOM = /*@__PURE__*/getDefaultExportFromCjs$1(reactDomExports);
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* react-router v7.8.2
|
|
1000
|
+
*
|
|
1001
|
+
* Copyright (c) Remix Software Inc.
|
|
1002
|
+
*
|
|
1003
|
+
* This source code is licensed under the MIT license found in the
|
|
1004
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
1005
|
+
*
|
|
1006
|
+
* @license MIT
|
|
1007
|
+
*/
|
|
1008
|
+
var PopStateEventType = "popstate";
|
|
1009
|
+
function createBrowserHistory(options = {}) {
|
|
1010
|
+
function createBrowserLocation(window2, globalHistory) {
|
|
1011
|
+
let { pathname, search, hash } = window2.location;
|
|
1012
|
+
return createLocation(
|
|
1013
|
+
"",
|
|
1014
|
+
{ pathname, search, hash },
|
|
1015
|
+
// state defaults to `null` because `window.history.state` does
|
|
1016
|
+
globalHistory.state && globalHistory.state.usr || null,
|
|
1017
|
+
globalHistory.state && globalHistory.state.key || "default"
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
function createBrowserHref(window2, to) {
|
|
1021
|
+
return typeof to === "string" ? to : createPath(to);
|
|
1022
|
+
}
|
|
1023
|
+
return getUrlBasedHistory(
|
|
1024
|
+
createBrowserLocation,
|
|
1025
|
+
createBrowserHref,
|
|
1026
|
+
null,
|
|
1027
|
+
options
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
function invariant(value, message) {
|
|
1031
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
1032
|
+
throw new Error(message);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
function warning(cond, message) {
|
|
1036
|
+
if (!cond) {
|
|
1037
|
+
if (typeof console !== "undefined") console.warn(message);
|
|
1038
|
+
try {
|
|
1039
|
+
throw new Error(message);
|
|
1040
|
+
} catch (e) {
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function createKey() {
|
|
1045
|
+
return Math.random().toString(36).substring(2, 10);
|
|
1046
|
+
}
|
|
1047
|
+
function getHistoryState(location, index) {
|
|
1048
|
+
return {
|
|
1049
|
+
usr: location.state,
|
|
1050
|
+
key: location.key,
|
|
1051
|
+
idx: index
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
function createLocation(current, to, state = null, key) {
|
|
1055
|
+
let location = {
|
|
1056
|
+
pathname: typeof current === "string" ? current : current.pathname,
|
|
1057
|
+
search: "",
|
|
1058
|
+
hash: "",
|
|
1059
|
+
...typeof to === "string" ? parsePath(to) : to,
|
|
1060
|
+
state,
|
|
1061
|
+
// TODO: This could be cleaned up. push/replace should probably just take
|
|
1062
|
+
// full Locations now and avoid the need to run through this flow at all
|
|
1063
|
+
// But that's a pretty big refactor to the current test suite so going to
|
|
1064
|
+
// keep as is for the time being and just let any incoming keys take precedence
|
|
1065
|
+
key: to && to.key || key || createKey()
|
|
1066
|
+
};
|
|
1067
|
+
return location;
|
|
1068
|
+
}
|
|
1069
|
+
function createPath({
|
|
1070
|
+
pathname = "/",
|
|
1071
|
+
search = "",
|
|
1072
|
+
hash = ""
|
|
1073
|
+
}) {
|
|
1074
|
+
if (search && search !== "?")
|
|
1075
|
+
pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
1076
|
+
if (hash && hash !== "#")
|
|
1077
|
+
pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
1078
|
+
return pathname;
|
|
1079
|
+
}
|
|
1080
|
+
function parsePath(path) {
|
|
1081
|
+
let parsedPath = {};
|
|
1082
|
+
if (path) {
|
|
1083
|
+
let hashIndex = path.indexOf("#");
|
|
1084
|
+
if (hashIndex >= 0) {
|
|
1085
|
+
parsedPath.hash = path.substring(hashIndex);
|
|
1086
|
+
path = path.substring(0, hashIndex);
|
|
1087
|
+
}
|
|
1088
|
+
let searchIndex = path.indexOf("?");
|
|
1089
|
+
if (searchIndex >= 0) {
|
|
1090
|
+
parsedPath.search = path.substring(searchIndex);
|
|
1091
|
+
path = path.substring(0, searchIndex);
|
|
1092
|
+
}
|
|
1093
|
+
if (path) {
|
|
1094
|
+
parsedPath.pathname = path;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
return parsedPath;
|
|
1098
|
+
}
|
|
1099
|
+
function getUrlBasedHistory(getLocation, createHref2, validateLocation, options = {}) {
|
|
1100
|
+
let { window: window2 = document.defaultView, v5Compat = false } = options;
|
|
1101
|
+
let globalHistory = window2.history;
|
|
1102
|
+
let action = "POP";
|
|
1103
|
+
let listener = null;
|
|
1104
|
+
let index = getIndex();
|
|
1105
|
+
if (index == null) {
|
|
1106
|
+
index = 0;
|
|
1107
|
+
globalHistory.replaceState({ ...globalHistory.state, idx: index }, "");
|
|
1108
|
+
}
|
|
1109
|
+
function getIndex() {
|
|
1110
|
+
let state = globalHistory.state || { idx: null };
|
|
1111
|
+
return state.idx;
|
|
1112
|
+
}
|
|
1113
|
+
function handlePop() {
|
|
1114
|
+
action = "POP";
|
|
1115
|
+
let nextIndex = getIndex();
|
|
1116
|
+
let delta = nextIndex == null ? null : nextIndex - index;
|
|
1117
|
+
index = nextIndex;
|
|
1118
|
+
if (listener) {
|
|
1119
|
+
listener({ action, location: history.location, delta });
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
function push(to, state) {
|
|
1123
|
+
action = "PUSH";
|
|
1124
|
+
let location = createLocation(history.location, to, state);
|
|
1125
|
+
index = getIndex() + 1;
|
|
1126
|
+
let historyState = getHistoryState(location, index);
|
|
1127
|
+
let url = history.createHref(location);
|
|
1128
|
+
try {
|
|
1129
|
+
globalHistory.pushState(historyState, "", url);
|
|
1130
|
+
} catch (error) {
|
|
1131
|
+
if (error instanceof DOMException && error.name === "DataCloneError") {
|
|
1132
|
+
throw error;
|
|
1133
|
+
}
|
|
1134
|
+
window2.location.assign(url);
|
|
1135
|
+
}
|
|
1136
|
+
if (v5Compat && listener) {
|
|
1137
|
+
listener({ action, location: history.location, delta: 1 });
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
function replace2(to, state) {
|
|
1141
|
+
action = "REPLACE";
|
|
1142
|
+
let location = createLocation(history.location, to, state);
|
|
1143
|
+
index = getIndex();
|
|
1144
|
+
let historyState = getHistoryState(location, index);
|
|
1145
|
+
let url = history.createHref(location);
|
|
1146
|
+
globalHistory.replaceState(historyState, "", url);
|
|
1147
|
+
if (v5Compat && listener) {
|
|
1148
|
+
listener({ action, location: history.location, delta: 0 });
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function createURL(to) {
|
|
1152
|
+
return createBrowserURLImpl(to);
|
|
1153
|
+
}
|
|
1154
|
+
let history = {
|
|
1155
|
+
get action() {
|
|
1156
|
+
return action;
|
|
1157
|
+
},
|
|
1158
|
+
get location() {
|
|
1159
|
+
return getLocation(window2, globalHistory);
|
|
1160
|
+
},
|
|
1161
|
+
listen(fn) {
|
|
1162
|
+
if (listener) {
|
|
1163
|
+
throw new Error("A history only accepts one active listener");
|
|
1164
|
+
}
|
|
1165
|
+
window2.addEventListener(PopStateEventType, handlePop);
|
|
1166
|
+
listener = fn;
|
|
1167
|
+
return () => {
|
|
1168
|
+
window2.removeEventListener(PopStateEventType, handlePop);
|
|
1169
|
+
listener = null;
|
|
1170
|
+
};
|
|
1171
|
+
},
|
|
1172
|
+
createHref(to) {
|
|
1173
|
+
return createHref2(window2, to);
|
|
1174
|
+
},
|
|
1175
|
+
createURL,
|
|
1176
|
+
encodeLocation(to) {
|
|
1177
|
+
let url = createURL(to);
|
|
1178
|
+
return {
|
|
1179
|
+
pathname: url.pathname,
|
|
1180
|
+
search: url.search,
|
|
1181
|
+
hash: url.hash
|
|
1182
|
+
};
|
|
1183
|
+
},
|
|
1184
|
+
push,
|
|
1185
|
+
replace: replace2,
|
|
1186
|
+
go(n) {
|
|
1187
|
+
return globalHistory.go(n);
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
return history;
|
|
1191
|
+
}
|
|
1192
|
+
function createBrowserURLImpl(to, isAbsolute = false) {
|
|
1193
|
+
let base = "http://localhost";
|
|
1194
|
+
if (typeof window !== "undefined") {
|
|
1195
|
+
base = window.location.origin !== "null" ? window.location.origin : window.location.href;
|
|
1196
|
+
}
|
|
1197
|
+
invariant(base, "No window.location.(origin|href) available to create URL");
|
|
1198
|
+
let href = typeof to === "string" ? to : createPath(to);
|
|
1199
|
+
href = href.replace(/ $/, "%20");
|
|
1200
|
+
if (!isAbsolute && href.startsWith("//")) {
|
|
1201
|
+
href = base + href;
|
|
1202
|
+
}
|
|
1203
|
+
return new URL(href, base);
|
|
1204
|
+
}
|
|
1205
|
+
function matchRoutes(routes, locationArg, basename = "/") {
|
|
1206
|
+
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
1207
|
+
}
|
|
1208
|
+
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
1209
|
+
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
1210
|
+
let pathname = stripBasename(location.pathname || "/", basename);
|
|
1211
|
+
if (pathname == null) {
|
|
1212
|
+
return null;
|
|
1213
|
+
}
|
|
1214
|
+
let branches = flattenRoutes(routes);
|
|
1215
|
+
rankRouteBranches(branches);
|
|
1216
|
+
let matches = null;
|
|
1217
|
+
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
1218
|
+
let decoded = decodePath(pathname);
|
|
1219
|
+
matches = matchRouteBranch(
|
|
1220
|
+
branches[i],
|
|
1221
|
+
decoded,
|
|
1222
|
+
allowPartial
|
|
1223
|
+
);
|
|
1224
|
+
}
|
|
1225
|
+
return matches;
|
|
1226
|
+
}
|
|
1227
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
1228
|
+
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
1229
|
+
let meta = {
|
|
1230
|
+
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
1231
|
+
caseSensitive: route.caseSensitive === true,
|
|
1232
|
+
childrenIndex: index,
|
|
1233
|
+
route
|
|
1234
|
+
};
|
|
1235
|
+
if (meta.relativePath.startsWith("/")) {
|
|
1236
|
+
if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
invariant(
|
|
1240
|
+
meta.relativePath.startsWith(parentPath),
|
|
1241
|
+
`Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
1242
|
+
);
|
|
1243
|
+
meta.relativePath = meta.relativePath.slice(parentPath.length);
|
|
1244
|
+
}
|
|
1245
|
+
let path = joinPaths([parentPath, meta.relativePath]);
|
|
1246
|
+
let routesMeta = parentsMeta.concat(meta);
|
|
1247
|
+
if (route.children && route.children.length > 0) {
|
|
1248
|
+
invariant(
|
|
1249
|
+
// Our types know better, but runtime JS may not!
|
|
1250
|
+
// @ts-expect-error
|
|
1251
|
+
route.index !== true,
|
|
1252
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${path}".`
|
|
1253
|
+
);
|
|
1254
|
+
flattenRoutes(
|
|
1255
|
+
route.children,
|
|
1256
|
+
branches,
|
|
1257
|
+
routesMeta,
|
|
1258
|
+
path,
|
|
1259
|
+
hasParentOptionalSegments
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
if (route.path == null && !route.index) {
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
branches.push({
|
|
1266
|
+
path,
|
|
1267
|
+
score: computeScore(path, route.index),
|
|
1268
|
+
routesMeta
|
|
1269
|
+
});
|
|
1270
|
+
};
|
|
1271
|
+
routes.forEach((route, index) => {
|
|
1272
|
+
if (route.path === "" || !route.path?.includes("?")) {
|
|
1273
|
+
flattenRoute(route, index);
|
|
1274
|
+
} else {
|
|
1275
|
+
for (let exploded of explodeOptionalSegments(route.path)) {
|
|
1276
|
+
flattenRoute(route, index, true, exploded);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
return branches;
|
|
1281
|
+
}
|
|
1282
|
+
function explodeOptionalSegments(path) {
|
|
1283
|
+
let segments = path.split("/");
|
|
1284
|
+
if (segments.length === 0) return [];
|
|
1285
|
+
let [first, ...rest] = segments;
|
|
1286
|
+
let isOptional = first.endsWith("?");
|
|
1287
|
+
let required = first.replace(/\?$/, "");
|
|
1288
|
+
if (rest.length === 0) {
|
|
1289
|
+
return isOptional ? [required, ""] : [required];
|
|
1290
|
+
}
|
|
1291
|
+
let restExploded = explodeOptionalSegments(rest.join("/"));
|
|
1292
|
+
let result = [];
|
|
1293
|
+
result.push(
|
|
1294
|
+
...restExploded.map(
|
|
1295
|
+
(subpath) => subpath === "" ? required : [required, subpath].join("/")
|
|
1296
|
+
)
|
|
1297
|
+
);
|
|
1298
|
+
if (isOptional) {
|
|
1299
|
+
result.push(...restExploded);
|
|
1300
|
+
}
|
|
1301
|
+
return result.map(
|
|
1302
|
+
(exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
|
|
1303
|
+
);
|
|
1304
|
+
}
|
|
1305
|
+
function rankRouteBranches(branches) {
|
|
1306
|
+
branches.sort(
|
|
1307
|
+
(a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
|
|
1308
|
+
a.routesMeta.map((meta) => meta.childrenIndex),
|
|
1309
|
+
b.routesMeta.map((meta) => meta.childrenIndex)
|
|
1310
|
+
)
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
var paramRe = /^:[\w-]+$/;
|
|
1314
|
+
var dynamicSegmentValue = 3;
|
|
1315
|
+
var indexRouteValue = 2;
|
|
1316
|
+
var emptySegmentValue = 1;
|
|
1317
|
+
var staticSegmentValue = 10;
|
|
1318
|
+
var splatPenalty = -2;
|
|
1319
|
+
var isSplat = (s) => s === "*";
|
|
1320
|
+
function computeScore(path, index) {
|
|
1321
|
+
let segments = path.split("/");
|
|
1322
|
+
let initialScore = segments.length;
|
|
1323
|
+
if (segments.some(isSplat)) {
|
|
1324
|
+
initialScore += splatPenalty;
|
|
1325
|
+
}
|
|
1326
|
+
if (index) {
|
|
1327
|
+
initialScore += indexRouteValue;
|
|
1328
|
+
}
|
|
1329
|
+
return segments.filter((s) => !isSplat(s)).reduce(
|
|
1330
|
+
(score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
|
|
1331
|
+
initialScore
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
function compareIndexes(a, b) {
|
|
1335
|
+
let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
|
|
1336
|
+
return siblings ? (
|
|
1337
|
+
// If two routes are siblings, we should try to match the earlier sibling
|
|
1338
|
+
// first. This allows people to have fine-grained control over the matching
|
|
1339
|
+
// behavior by simply putting routes with identical paths in the order they
|
|
1340
|
+
// want them tried.
|
|
1341
|
+
a[a.length - 1] - b[b.length - 1]
|
|
1342
|
+
) : (
|
|
1343
|
+
// Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
1344
|
+
// so they sort equally.
|
|
1345
|
+
0
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
function matchRouteBranch(branch, pathname, allowPartial = false) {
|
|
1349
|
+
let { routesMeta } = branch;
|
|
1350
|
+
let matchedParams = {};
|
|
1351
|
+
let matchedPathname = "/";
|
|
1352
|
+
let matches = [];
|
|
1353
|
+
for (let i = 0; i < routesMeta.length; ++i) {
|
|
1354
|
+
let meta = routesMeta[i];
|
|
1355
|
+
let end = i === routesMeta.length - 1;
|
|
1356
|
+
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
1357
|
+
let match = matchPath(
|
|
1358
|
+
{ path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
|
|
1359
|
+
remainingPathname
|
|
1360
|
+
);
|
|
1361
|
+
let route = meta.route;
|
|
1362
|
+
if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
|
|
1363
|
+
match = matchPath(
|
|
1364
|
+
{
|
|
1365
|
+
path: meta.relativePath,
|
|
1366
|
+
caseSensitive: meta.caseSensitive,
|
|
1367
|
+
end: false
|
|
1368
|
+
},
|
|
1369
|
+
remainingPathname
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
if (!match) {
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1375
|
+
Object.assign(matchedParams, match.params);
|
|
1376
|
+
matches.push({
|
|
1377
|
+
// TODO: Can this as be avoided?
|
|
1378
|
+
params: matchedParams,
|
|
1379
|
+
pathname: joinPaths([matchedPathname, match.pathname]),
|
|
1380
|
+
pathnameBase: normalizePathname(
|
|
1381
|
+
joinPaths([matchedPathname, match.pathnameBase])
|
|
1382
|
+
),
|
|
1383
|
+
route
|
|
1384
|
+
});
|
|
1385
|
+
if (match.pathnameBase !== "/") {
|
|
1386
|
+
matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
return matches;
|
|
1390
|
+
}
|
|
1391
|
+
function matchPath(pattern, pathname) {
|
|
1392
|
+
if (typeof pattern === "string") {
|
|
1393
|
+
pattern = { path: pattern, caseSensitive: false, end: true };
|
|
1394
|
+
}
|
|
1395
|
+
let [matcher, compiledParams] = compilePath(
|
|
1396
|
+
pattern.path,
|
|
1397
|
+
pattern.caseSensitive,
|
|
1398
|
+
pattern.end
|
|
1399
|
+
);
|
|
1400
|
+
let match = pathname.match(matcher);
|
|
1401
|
+
if (!match) return null;
|
|
1402
|
+
let matchedPathname = match[0];
|
|
1403
|
+
let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
|
|
1404
|
+
let captureGroups = match.slice(1);
|
|
1405
|
+
let params = compiledParams.reduce(
|
|
1406
|
+
(memo2, { paramName, isOptional }, index) => {
|
|
1407
|
+
if (paramName === "*") {
|
|
1408
|
+
let splatValue = captureGroups[index] || "";
|
|
1409
|
+
pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
|
|
1410
|
+
}
|
|
1411
|
+
const value = captureGroups[index];
|
|
1412
|
+
if (isOptional && !value) {
|
|
1413
|
+
memo2[paramName] = void 0;
|
|
1414
|
+
} else {
|
|
1415
|
+
memo2[paramName] = (value || "").replace(/%2F/g, "/");
|
|
1416
|
+
}
|
|
1417
|
+
return memo2;
|
|
1418
|
+
},
|
|
1419
|
+
{}
|
|
1420
|
+
);
|
|
1421
|
+
return {
|
|
1422
|
+
params,
|
|
1423
|
+
pathname: matchedPathname,
|
|
1424
|
+
pathnameBase,
|
|
1425
|
+
pattern
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
function compilePath(path, caseSensitive = false, end = true) {
|
|
1429
|
+
warning(
|
|
1430
|
+
path === "*" || !path.endsWith("*") || path.endsWith("/*"),
|
|
1431
|
+
`Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
|
|
1432
|
+
);
|
|
1433
|
+
let params = [];
|
|
1434
|
+
let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
1435
|
+
/\/:([\w-]+)(\?)?/g,
|
|
1436
|
+
(_, paramName, isOptional) => {
|
|
1437
|
+
params.push({ paramName, isOptional: isOptional != null });
|
|
1438
|
+
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
|
|
1439
|
+
}
|
|
1440
|
+
).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
|
|
1441
|
+
if (path.endsWith("*")) {
|
|
1442
|
+
params.push({ paramName: "*" });
|
|
1443
|
+
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
1444
|
+
} else if (end) {
|
|
1445
|
+
regexpSource += "\\/*$";
|
|
1446
|
+
} else if (path !== "" && path !== "/") {
|
|
1447
|
+
regexpSource += "(?:(?=\\/|$))";
|
|
1448
|
+
} else ;
|
|
1449
|
+
let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
|
|
1450
|
+
return [matcher, params];
|
|
1451
|
+
}
|
|
1452
|
+
function decodePath(value) {
|
|
1453
|
+
try {
|
|
1454
|
+
return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
|
|
1455
|
+
} catch (error) {
|
|
1456
|
+
warning(
|
|
1457
|
+
false,
|
|
1458
|
+
`The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
|
|
1459
|
+
);
|
|
1460
|
+
return value;
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
function stripBasename(pathname, basename) {
|
|
1464
|
+
if (basename === "/") return pathname;
|
|
1465
|
+
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
1466
|
+
return null;
|
|
1467
|
+
}
|
|
1468
|
+
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
1469
|
+
let nextChar = pathname.charAt(startIndex);
|
|
1470
|
+
if (nextChar && nextChar !== "/") {
|
|
1471
|
+
return null;
|
|
1472
|
+
}
|
|
1473
|
+
return pathname.slice(startIndex) || "/";
|
|
1474
|
+
}
|
|
1475
|
+
function resolvePath(to, fromPathname = "/") {
|
|
1476
|
+
let {
|
|
1477
|
+
pathname: toPathname,
|
|
1478
|
+
search = "",
|
|
1479
|
+
hash = ""
|
|
1480
|
+
} = typeof to === "string" ? parsePath(to) : to;
|
|
1481
|
+
let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
|
|
1482
|
+
return {
|
|
1483
|
+
pathname,
|
|
1484
|
+
search: normalizeSearch(search),
|
|
1485
|
+
hash: normalizeHash(hash)
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function resolvePathname(relativePath, fromPathname) {
|
|
1489
|
+
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
1490
|
+
let relativeSegments = relativePath.split("/");
|
|
1491
|
+
relativeSegments.forEach((segment) => {
|
|
1492
|
+
if (segment === "..") {
|
|
1493
|
+
if (segments.length > 1) segments.pop();
|
|
1494
|
+
} else if (segment !== ".") {
|
|
1495
|
+
segments.push(segment);
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
return segments.length > 1 ? segments.join("/") : "/";
|
|
1499
|
+
}
|
|
1500
|
+
function getInvalidPathError(char, field, dest, path) {
|
|
1501
|
+
return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
|
|
1502
|
+
path
|
|
1503
|
+
)}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
|
|
1504
|
+
}
|
|
1505
|
+
function getPathContributingMatches(matches) {
|
|
1506
|
+
return matches.filter(
|
|
1507
|
+
(match, index) => index === 0 || match.route.path && match.route.path.length > 0
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
function getResolveToMatches(matches) {
|
|
1511
|
+
let pathMatches = getPathContributingMatches(matches);
|
|
1512
|
+
return pathMatches.map(
|
|
1513
|
+
(match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
|
|
1514
|
+
);
|
|
1515
|
+
}
|
|
1516
|
+
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
|
|
1517
|
+
let to;
|
|
1518
|
+
if (typeof toArg === "string") {
|
|
1519
|
+
to = parsePath(toArg);
|
|
1520
|
+
} else {
|
|
1521
|
+
to = { ...toArg };
|
|
1522
|
+
invariant(
|
|
1523
|
+
!to.pathname || !to.pathname.includes("?"),
|
|
1524
|
+
getInvalidPathError("?", "pathname", "search", to)
|
|
1525
|
+
);
|
|
1526
|
+
invariant(
|
|
1527
|
+
!to.pathname || !to.pathname.includes("#"),
|
|
1528
|
+
getInvalidPathError("#", "pathname", "hash", to)
|
|
1529
|
+
);
|
|
1530
|
+
invariant(
|
|
1531
|
+
!to.search || !to.search.includes("#"),
|
|
1532
|
+
getInvalidPathError("#", "search", "hash", to)
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
let isEmptyPath = toArg === "" || to.pathname === "";
|
|
1536
|
+
let toPathname = isEmptyPath ? "/" : to.pathname;
|
|
1537
|
+
let from;
|
|
1538
|
+
if (toPathname == null) {
|
|
1539
|
+
from = locationPathname;
|
|
1540
|
+
} else {
|
|
1541
|
+
let routePathnameIndex = routePathnames.length - 1;
|
|
1542
|
+
if (!isPathRelative && toPathname.startsWith("..")) {
|
|
1543
|
+
let toSegments = toPathname.split("/");
|
|
1544
|
+
while (toSegments[0] === "..") {
|
|
1545
|
+
toSegments.shift();
|
|
1546
|
+
routePathnameIndex -= 1;
|
|
1547
|
+
}
|
|
1548
|
+
to.pathname = toSegments.join("/");
|
|
1549
|
+
}
|
|
1550
|
+
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
1551
|
+
}
|
|
1552
|
+
let path = resolvePath(to, from);
|
|
1553
|
+
let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
|
|
1554
|
+
let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
1555
|
+
if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
|
|
1556
|
+
path.pathname += "/";
|
|
1557
|
+
}
|
|
1558
|
+
return path;
|
|
1559
|
+
}
|
|
1560
|
+
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
1561
|
+
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
|
1562
|
+
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
1563
|
+
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
1564
|
+
function isRouteErrorResponse(error) {
|
|
1565
|
+
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
1566
|
+
}
|
|
1567
|
+
var validMutationMethodsArr = [
|
|
1568
|
+
"POST",
|
|
1569
|
+
"PUT",
|
|
1570
|
+
"PATCH",
|
|
1571
|
+
"DELETE"
|
|
1572
|
+
];
|
|
1573
|
+
new Set(
|
|
1574
|
+
validMutationMethodsArr
|
|
1575
|
+
);
|
|
1576
|
+
var validRequestMethodsArr = [
|
|
1577
|
+
"GET",
|
|
1578
|
+
...validMutationMethodsArr
|
|
1579
|
+
];
|
|
1580
|
+
new Set(validRequestMethodsArr);
|
|
1581
|
+
var DataRouterContext = reactExports.createContext(null);
|
|
1582
|
+
DataRouterContext.displayName = "DataRouter";
|
|
1583
|
+
var DataRouterStateContext = reactExports.createContext(null);
|
|
1584
|
+
DataRouterStateContext.displayName = "DataRouterState";
|
|
1585
|
+
reactExports.createContext(false);
|
|
1586
|
+
var ViewTransitionContext = reactExports.createContext({
|
|
1587
|
+
isTransitioning: false
|
|
1588
|
+
});
|
|
1589
|
+
ViewTransitionContext.displayName = "ViewTransition";
|
|
1590
|
+
var FetchersContext = reactExports.createContext(
|
|
1591
|
+
/* @__PURE__ */ new Map()
|
|
1592
|
+
);
|
|
1593
|
+
FetchersContext.displayName = "Fetchers";
|
|
1594
|
+
var AwaitContext = reactExports.createContext(null);
|
|
1595
|
+
AwaitContext.displayName = "Await";
|
|
1596
|
+
var NavigationContext = reactExports.createContext(
|
|
1597
|
+
null
|
|
1598
|
+
);
|
|
1599
|
+
NavigationContext.displayName = "Navigation";
|
|
1600
|
+
var LocationContext = reactExports.createContext(
|
|
1601
|
+
null
|
|
1602
|
+
);
|
|
1603
|
+
LocationContext.displayName = "Location";
|
|
1604
|
+
var RouteContext = reactExports.createContext({
|
|
1605
|
+
outlet: null,
|
|
1606
|
+
matches: [],
|
|
1607
|
+
isDataRoute: false
|
|
1608
|
+
});
|
|
1609
|
+
RouteContext.displayName = "Route";
|
|
1610
|
+
var RouteErrorContext = reactExports.createContext(null);
|
|
1611
|
+
RouteErrorContext.displayName = "RouteError";
|
|
1612
|
+
function useHref(to, { relative } = {}) {
|
|
1613
|
+
invariant(
|
|
1614
|
+
useInRouterContext(),
|
|
1615
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1616
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1617
|
+
`useHref() may be used only in the context of a <Router> component.`
|
|
1618
|
+
);
|
|
1619
|
+
let { basename, navigator } = reactExports.useContext(NavigationContext);
|
|
1620
|
+
let { hash, pathname, search } = useResolvedPath(to, { relative });
|
|
1621
|
+
let joinedPathname = pathname;
|
|
1622
|
+
if (basename !== "/") {
|
|
1623
|
+
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
1624
|
+
}
|
|
1625
|
+
return navigator.createHref({ pathname: joinedPathname, search, hash });
|
|
1626
|
+
}
|
|
1627
|
+
function useInRouterContext() {
|
|
1628
|
+
return reactExports.useContext(LocationContext) != null;
|
|
1629
|
+
}
|
|
1630
|
+
function useLocation() {
|
|
1631
|
+
invariant(
|
|
1632
|
+
useInRouterContext(),
|
|
1633
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1634
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1635
|
+
`useLocation() may be used only in the context of a <Router> component.`
|
|
1636
|
+
);
|
|
1637
|
+
return reactExports.useContext(LocationContext).location;
|
|
1638
|
+
}
|
|
1639
|
+
var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
|
|
1640
|
+
function useIsomorphicLayoutEffect(cb) {
|
|
1641
|
+
let isStatic = reactExports.useContext(NavigationContext).static;
|
|
1642
|
+
if (!isStatic) {
|
|
1643
|
+
reactExports.useLayoutEffect(cb);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
function useNavigate() {
|
|
1647
|
+
let { isDataRoute } = reactExports.useContext(RouteContext);
|
|
1648
|
+
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
1649
|
+
}
|
|
1650
|
+
function useNavigateUnstable() {
|
|
1651
|
+
invariant(
|
|
1652
|
+
useInRouterContext(),
|
|
1653
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1654
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1655
|
+
`useNavigate() may be used only in the context of a <Router> component.`
|
|
1656
|
+
);
|
|
1657
|
+
let dataRouterContext = reactExports.useContext(DataRouterContext);
|
|
1658
|
+
let { basename, navigator } = reactExports.useContext(NavigationContext);
|
|
1659
|
+
let { matches } = reactExports.useContext(RouteContext);
|
|
1660
|
+
let { pathname: locationPathname } = useLocation();
|
|
1661
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
1662
|
+
let activeRef = reactExports.useRef(false);
|
|
1663
|
+
useIsomorphicLayoutEffect(() => {
|
|
1664
|
+
activeRef.current = true;
|
|
1665
|
+
});
|
|
1666
|
+
let navigate = reactExports.useCallback(
|
|
1667
|
+
(to, options = {}) => {
|
|
1668
|
+
warning(activeRef.current, navigateEffectWarning);
|
|
1669
|
+
if (!activeRef.current) return;
|
|
1670
|
+
if (typeof to === "number") {
|
|
1671
|
+
navigator.go(to);
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
let path = resolveTo(
|
|
1675
|
+
to,
|
|
1676
|
+
JSON.parse(routePathnamesJson),
|
|
1677
|
+
locationPathname,
|
|
1678
|
+
options.relative === "path"
|
|
1679
|
+
);
|
|
1680
|
+
if (dataRouterContext == null && basename !== "/") {
|
|
1681
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
1682
|
+
}
|
|
1683
|
+
(!!options.replace ? navigator.replace : navigator.push)(
|
|
1684
|
+
path,
|
|
1685
|
+
options.state,
|
|
1686
|
+
options
|
|
1687
|
+
);
|
|
1688
|
+
},
|
|
1689
|
+
[
|
|
1690
|
+
basename,
|
|
1691
|
+
navigator,
|
|
1692
|
+
routePathnamesJson,
|
|
1693
|
+
locationPathname,
|
|
1694
|
+
dataRouterContext
|
|
1695
|
+
]
|
|
1696
|
+
);
|
|
1697
|
+
return navigate;
|
|
1698
|
+
}
|
|
1699
|
+
reactExports.createContext(null);
|
|
1700
|
+
function useParams() {
|
|
1701
|
+
let { matches } = reactExports.useContext(RouteContext);
|
|
1702
|
+
let routeMatch = matches[matches.length - 1];
|
|
1703
|
+
return routeMatch ? routeMatch.params : {};
|
|
1704
|
+
}
|
|
1705
|
+
function useResolvedPath(to, { relative } = {}) {
|
|
1706
|
+
let { matches } = reactExports.useContext(RouteContext);
|
|
1707
|
+
let { pathname: locationPathname } = useLocation();
|
|
1708
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
1709
|
+
return reactExports.useMemo(
|
|
1710
|
+
() => resolveTo(
|
|
1711
|
+
to,
|
|
1712
|
+
JSON.parse(routePathnamesJson),
|
|
1713
|
+
locationPathname,
|
|
1714
|
+
relative === "path"
|
|
1715
|
+
),
|
|
1716
|
+
[to, routePathnamesJson, locationPathname, relative]
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
function useRoutes(routes, locationArg) {
|
|
1720
|
+
return useRoutesImpl(routes, locationArg);
|
|
1721
|
+
}
|
|
1722
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, unstable_onError, future) {
|
|
1723
|
+
invariant(
|
|
1724
|
+
useInRouterContext(),
|
|
1725
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
1726
|
+
// router loaded. We can help them understand how to avoid that.
|
|
1727
|
+
`useRoutes() may be used only in the context of a <Router> component.`
|
|
1728
|
+
);
|
|
1729
|
+
let { navigator } = reactExports.useContext(NavigationContext);
|
|
1730
|
+
let { matches: parentMatches } = reactExports.useContext(RouteContext);
|
|
1731
|
+
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
1732
|
+
let parentParams = routeMatch ? routeMatch.params : {};
|
|
1733
|
+
let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
|
1734
|
+
let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
|
|
1735
|
+
let parentRoute = routeMatch && routeMatch.route;
|
|
1736
|
+
{
|
|
1737
|
+
let parentPath = parentRoute && parentRoute.path || "";
|
|
1738
|
+
warningOnce(
|
|
1739
|
+
parentPathname,
|
|
1740
|
+
!parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
|
|
1741
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) 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.
|
|
1742
|
+
|
|
1743
|
+
Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
|
|
1744
|
+
);
|
|
1745
|
+
}
|
|
1746
|
+
let locationFromContext = useLocation();
|
|
1747
|
+
let location;
|
|
1748
|
+
if (locationArg) {
|
|
1749
|
+
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
1750
|
+
invariant(
|
|
1751
|
+
parentPathnameBase === "/" || parsedLocationArg.pathname?.startsWith(parentPathnameBase),
|
|
1752
|
+
`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
|
|
1753
|
+
);
|
|
1754
|
+
location = parsedLocationArg;
|
|
1755
|
+
} else {
|
|
1756
|
+
location = locationFromContext;
|
|
1757
|
+
}
|
|
1758
|
+
let pathname = location.pathname || "/";
|
|
1759
|
+
let remainingPathname = pathname;
|
|
1760
|
+
if (parentPathnameBase !== "/") {
|
|
1761
|
+
let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
|
|
1762
|
+
let segments = pathname.replace(/^\//, "").split("/");
|
|
1763
|
+
remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
|
|
1764
|
+
}
|
|
1765
|
+
let matches = matchRoutes(routes, { pathname: remainingPathname });
|
|
1766
|
+
{
|
|
1767
|
+
warning(
|
|
1768
|
+
parentRoute || matches != null,
|
|
1769
|
+
`No routes matched location "${location.pathname}${location.search}${location.hash}" `
|
|
1770
|
+
);
|
|
1771
|
+
warning(
|
|
1772
|
+
matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
|
|
1773
|
+
`Matched leaf route at location "${location.pathname}${location.search}${location.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.`
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
1776
|
+
let renderedMatches = _renderMatches(
|
|
1777
|
+
matches && matches.map(
|
|
1778
|
+
(match) => Object.assign({}, match, {
|
|
1779
|
+
params: Object.assign({}, parentParams, match.params),
|
|
1780
|
+
pathname: joinPaths([
|
|
1781
|
+
parentPathnameBase,
|
|
1782
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
1783
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname
|
|
1784
|
+
]),
|
|
1785
|
+
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
|
|
1786
|
+
parentPathnameBase,
|
|
1787
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
1788
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
|
|
1789
|
+
])
|
|
1790
|
+
})
|
|
1791
|
+
),
|
|
1792
|
+
parentMatches,
|
|
1793
|
+
dataRouterState,
|
|
1794
|
+
unstable_onError,
|
|
1795
|
+
future
|
|
1796
|
+
);
|
|
1797
|
+
if (locationArg && renderedMatches) {
|
|
1798
|
+
return /* @__PURE__ */ reactExports.createElement(
|
|
1799
|
+
LocationContext.Provider,
|
|
1800
|
+
{
|
|
1801
|
+
value: {
|
|
1802
|
+
location: {
|
|
1803
|
+
pathname: "/",
|
|
1804
|
+
search: "",
|
|
1805
|
+
hash: "",
|
|
1806
|
+
state: null,
|
|
1807
|
+
key: "default",
|
|
1808
|
+
...location
|
|
1809
|
+
},
|
|
1810
|
+
navigationType: "POP"
|
|
1811
|
+
/* Pop */
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
renderedMatches
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
return renderedMatches;
|
|
1818
|
+
}
|
|
1819
|
+
function DefaultErrorComponent() {
|
|
1820
|
+
let error = useRouteError();
|
|
1821
|
+
let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
|
|
1822
|
+
let stack = error instanceof Error ? error.stack : null;
|
|
1823
|
+
let lightgrey = "rgba(200,200,200, 0.5)";
|
|
1824
|
+
let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
|
|
1825
|
+
let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
|
|
1826
|
+
let devInfo = null;
|
|
1827
|
+
{
|
|
1828
|
+
console.error(
|
|
1829
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
1830
|
+
error
|
|
1831
|
+
);
|
|
1832
|
+
devInfo = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ reactExports.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ reactExports.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ reactExports.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
|
|
1833
|
+
}
|
|
1834
|
+
return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ reactExports.createElement("pre", { style: preStyles }, stack) : null, devInfo);
|
|
1835
|
+
}
|
|
1836
|
+
var defaultErrorElement = /* @__PURE__ */ reactExports.createElement(DefaultErrorComponent, null);
|
|
1837
|
+
var RenderErrorBoundary = class extends reactExports.Component {
|
|
1838
|
+
constructor(props) {
|
|
1839
|
+
super(props);
|
|
1840
|
+
this.state = {
|
|
1841
|
+
location: props.location,
|
|
1842
|
+
revalidation: props.revalidation,
|
|
1843
|
+
error: props.error
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
static getDerivedStateFromError(error) {
|
|
1847
|
+
return { error };
|
|
1848
|
+
}
|
|
1849
|
+
static getDerivedStateFromProps(props, state) {
|
|
1850
|
+
if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
|
|
1851
|
+
return {
|
|
1852
|
+
error: props.error,
|
|
1853
|
+
location: props.location,
|
|
1854
|
+
revalidation: props.revalidation
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
return {
|
|
1858
|
+
error: props.error !== void 0 ? props.error : state.error,
|
|
1859
|
+
location: state.location,
|
|
1860
|
+
revalidation: props.revalidation || state.revalidation
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
componentDidCatch(error, errorInfo) {
|
|
1864
|
+
if (this.props.unstable_onError) {
|
|
1865
|
+
this.props.unstable_onError(error, errorInfo);
|
|
1866
|
+
} else {
|
|
1867
|
+
console.error(
|
|
1868
|
+
"React Router caught the following error during render",
|
|
1869
|
+
error
|
|
1870
|
+
);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
render() {
|
|
1874
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ reactExports.createElement(
|
|
1875
|
+
RouteErrorContext.Provider,
|
|
1876
|
+
{
|
|
1877
|
+
value: this.state.error,
|
|
1878
|
+
children: this.props.component
|
|
1879
|
+
}
|
|
1880
|
+
)) : this.props.children;
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
function RenderedRoute({ routeContext, match, children }) {
|
|
1884
|
+
let dataRouterContext = reactExports.useContext(DataRouterContext);
|
|
1885
|
+
if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
|
|
1886
|
+
dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
|
|
1887
|
+
}
|
|
1888
|
+
return /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
1889
|
+
}
|
|
1890
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, unstable_onError = null, future = null) {
|
|
1891
|
+
if (matches == null) {
|
|
1892
|
+
if (!dataRouterState) {
|
|
1893
|
+
return null;
|
|
1894
|
+
}
|
|
1895
|
+
if (dataRouterState.errors) {
|
|
1896
|
+
matches = dataRouterState.matches;
|
|
1897
|
+
} else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
|
|
1898
|
+
matches = dataRouterState.matches;
|
|
1899
|
+
} else {
|
|
1900
|
+
return null;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
let renderedMatches = matches;
|
|
1904
|
+
let errors = dataRouterState?.errors;
|
|
1905
|
+
if (errors != null) {
|
|
1906
|
+
let errorIndex = renderedMatches.findIndex(
|
|
1907
|
+
(m) => m.route.id && errors?.[m.route.id] !== void 0
|
|
1908
|
+
);
|
|
1909
|
+
invariant(
|
|
1910
|
+
errorIndex >= 0,
|
|
1911
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
1912
|
+
errors
|
|
1913
|
+
).join(",")}`
|
|
1914
|
+
);
|
|
1915
|
+
renderedMatches = renderedMatches.slice(
|
|
1916
|
+
0,
|
|
1917
|
+
Math.min(renderedMatches.length, errorIndex + 1)
|
|
1918
|
+
);
|
|
1919
|
+
}
|
|
1920
|
+
let renderFallback = false;
|
|
1921
|
+
let fallbackIndex = -1;
|
|
1922
|
+
if (dataRouterState) {
|
|
1923
|
+
for (let i = 0; i < renderedMatches.length; i++) {
|
|
1924
|
+
let match = renderedMatches[i];
|
|
1925
|
+
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
1926
|
+
fallbackIndex = i;
|
|
1927
|
+
}
|
|
1928
|
+
if (match.route.id) {
|
|
1929
|
+
let { loaderData, errors: errors2 } = dataRouterState;
|
|
1930
|
+
let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
|
|
1931
|
+
if (match.route.lazy || needsToRunLoader) {
|
|
1932
|
+
renderFallback = true;
|
|
1933
|
+
if (fallbackIndex >= 0) {
|
|
1934
|
+
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
1935
|
+
} else {
|
|
1936
|
+
renderedMatches = [renderedMatches[0]];
|
|
1937
|
+
}
|
|
1938
|
+
break;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
return renderedMatches.reduceRight(
|
|
1944
|
+
(outlet, match, index) => {
|
|
1945
|
+
let error;
|
|
1946
|
+
let shouldRenderHydrateFallback = false;
|
|
1947
|
+
let errorElement = null;
|
|
1948
|
+
let hydrateFallbackElement = null;
|
|
1949
|
+
if (dataRouterState) {
|
|
1950
|
+
error = errors && match.route.id ? errors[match.route.id] : void 0;
|
|
1951
|
+
errorElement = match.route.errorElement || defaultErrorElement;
|
|
1952
|
+
if (renderFallback) {
|
|
1953
|
+
if (fallbackIndex < 0 && index === 0) {
|
|
1954
|
+
warningOnce(
|
|
1955
|
+
"route-fallback",
|
|
1956
|
+
false,
|
|
1957
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
1958
|
+
);
|
|
1959
|
+
shouldRenderHydrateFallback = true;
|
|
1960
|
+
hydrateFallbackElement = null;
|
|
1961
|
+
} else if (fallbackIndex === index) {
|
|
1962
|
+
shouldRenderHydrateFallback = true;
|
|
1963
|
+
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
|
1968
|
+
let getChildren = () => {
|
|
1969
|
+
let children;
|
|
1970
|
+
if (error) {
|
|
1971
|
+
children = errorElement;
|
|
1972
|
+
} else if (shouldRenderHydrateFallback) {
|
|
1973
|
+
children = hydrateFallbackElement;
|
|
1974
|
+
} else if (match.route.Component) {
|
|
1975
|
+
children = /* @__PURE__ */ reactExports.createElement(match.route.Component, null);
|
|
1976
|
+
} else if (match.route.element) {
|
|
1977
|
+
children = match.route.element;
|
|
1978
|
+
} else {
|
|
1979
|
+
children = outlet;
|
|
1980
|
+
}
|
|
1981
|
+
return /* @__PURE__ */ reactExports.createElement(
|
|
1982
|
+
RenderedRoute,
|
|
1983
|
+
{
|
|
1984
|
+
match,
|
|
1985
|
+
routeContext: {
|
|
1986
|
+
outlet,
|
|
1987
|
+
matches: matches2,
|
|
1988
|
+
isDataRoute: dataRouterState != null
|
|
1989
|
+
},
|
|
1990
|
+
children
|
|
1991
|
+
}
|
|
1992
|
+
);
|
|
1993
|
+
};
|
|
1994
|
+
return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ reactExports.createElement(
|
|
1995
|
+
RenderErrorBoundary,
|
|
1996
|
+
{
|
|
1997
|
+
location: dataRouterState.location,
|
|
1998
|
+
revalidation: dataRouterState.revalidation,
|
|
1999
|
+
component: errorElement,
|
|
2000
|
+
error,
|
|
2001
|
+
children: getChildren(),
|
|
2002
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true },
|
|
2003
|
+
unstable_onError
|
|
2004
|
+
}
|
|
2005
|
+
) : getChildren();
|
|
2006
|
+
},
|
|
2007
|
+
null
|
|
2008
|
+
);
|
|
2009
|
+
}
|
|
2010
|
+
function getDataRouterConsoleError(hookName) {
|
|
2011
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
2012
|
+
}
|
|
2013
|
+
function useDataRouterContext(hookName) {
|
|
2014
|
+
let ctx = reactExports.useContext(DataRouterContext);
|
|
2015
|
+
invariant(ctx, getDataRouterConsoleError(hookName));
|
|
2016
|
+
return ctx;
|
|
2017
|
+
}
|
|
2018
|
+
function useDataRouterState(hookName) {
|
|
2019
|
+
let state = reactExports.useContext(DataRouterStateContext);
|
|
2020
|
+
invariant(state, getDataRouterConsoleError(hookName));
|
|
2021
|
+
return state;
|
|
2022
|
+
}
|
|
2023
|
+
function useRouteContext(hookName) {
|
|
2024
|
+
let route = reactExports.useContext(RouteContext);
|
|
2025
|
+
invariant(route, getDataRouterConsoleError(hookName));
|
|
2026
|
+
return route;
|
|
2027
|
+
}
|
|
2028
|
+
function useCurrentRouteId(hookName) {
|
|
2029
|
+
let route = useRouteContext(hookName);
|
|
2030
|
+
let thisRoute = route.matches[route.matches.length - 1];
|
|
2031
|
+
invariant(
|
|
2032
|
+
thisRoute.route.id,
|
|
2033
|
+
`${hookName} can only be used on routes that contain a unique "id"`
|
|
2034
|
+
);
|
|
2035
|
+
return thisRoute.route.id;
|
|
2036
|
+
}
|
|
2037
|
+
function useRouteId() {
|
|
2038
|
+
return useCurrentRouteId(
|
|
2039
|
+
"useRouteId"
|
|
2040
|
+
/* UseRouteId */
|
|
2041
|
+
);
|
|
2042
|
+
}
|
|
2043
|
+
function useRouteError() {
|
|
2044
|
+
let error = reactExports.useContext(RouteErrorContext);
|
|
2045
|
+
let state = useDataRouterState(
|
|
2046
|
+
"useRouteError"
|
|
2047
|
+
/* UseRouteError */
|
|
2048
|
+
);
|
|
2049
|
+
let routeId = useCurrentRouteId(
|
|
2050
|
+
"useRouteError"
|
|
2051
|
+
/* UseRouteError */
|
|
2052
|
+
);
|
|
2053
|
+
if (error !== void 0) {
|
|
2054
|
+
return error;
|
|
2055
|
+
}
|
|
2056
|
+
return state.errors?.[routeId];
|
|
2057
|
+
}
|
|
2058
|
+
function useNavigateStable() {
|
|
2059
|
+
let { router } = useDataRouterContext(
|
|
2060
|
+
"useNavigate"
|
|
2061
|
+
/* UseNavigateStable */
|
|
2062
|
+
);
|
|
2063
|
+
let id = useCurrentRouteId(
|
|
2064
|
+
"useNavigate"
|
|
2065
|
+
/* UseNavigateStable */
|
|
2066
|
+
);
|
|
2067
|
+
let activeRef = reactExports.useRef(false);
|
|
2068
|
+
useIsomorphicLayoutEffect(() => {
|
|
2069
|
+
activeRef.current = true;
|
|
2070
|
+
});
|
|
2071
|
+
let navigate = reactExports.useCallback(
|
|
2072
|
+
async (to, options = {}) => {
|
|
2073
|
+
warning(activeRef.current, navigateEffectWarning);
|
|
2074
|
+
if (!activeRef.current) return;
|
|
2075
|
+
if (typeof to === "number") {
|
|
2076
|
+
router.navigate(to);
|
|
2077
|
+
} else {
|
|
2078
|
+
await router.navigate(to, { fromRouteId: id, ...options });
|
|
2079
|
+
}
|
|
2080
|
+
},
|
|
2081
|
+
[router, id]
|
|
2082
|
+
);
|
|
2083
|
+
return navigate;
|
|
2084
|
+
}
|
|
2085
|
+
var alreadyWarned = {};
|
|
2086
|
+
function warningOnce(key, cond, message) {
|
|
2087
|
+
if (!cond && !alreadyWarned[key]) {
|
|
2088
|
+
alreadyWarned[key] = true;
|
|
2089
|
+
warning(false, message);
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
reactExports.memo(DataRoutes);
|
|
2093
|
+
function DataRoutes({
|
|
2094
|
+
routes,
|
|
2095
|
+
future,
|
|
2096
|
+
state,
|
|
2097
|
+
unstable_onError
|
|
2098
|
+
}) {
|
|
2099
|
+
return useRoutesImpl(routes, void 0, state, unstable_onError, future);
|
|
2100
|
+
}
|
|
2101
|
+
function Route(props) {
|
|
2102
|
+
invariant(
|
|
2103
|
+
false,
|
|
2104
|
+
`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
|
|
2105
|
+
);
|
|
2106
|
+
}
|
|
2107
|
+
function Router({
|
|
2108
|
+
basename: basenameProp = "/",
|
|
2109
|
+
children = null,
|
|
2110
|
+
location: locationProp,
|
|
2111
|
+
navigationType = "POP",
|
|
2112
|
+
navigator,
|
|
2113
|
+
static: staticProp = false
|
|
2114
|
+
}) {
|
|
2115
|
+
invariant(
|
|
2116
|
+
!useInRouterContext(),
|
|
2117
|
+
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
2118
|
+
);
|
|
2119
|
+
let basename = basenameProp.replace(/^\/*/, "/");
|
|
2120
|
+
let navigationContext = reactExports.useMemo(
|
|
2121
|
+
() => ({
|
|
2122
|
+
basename,
|
|
2123
|
+
navigator,
|
|
2124
|
+
static: staticProp,
|
|
2125
|
+
future: {}
|
|
2126
|
+
}),
|
|
2127
|
+
[basename, navigator, staticProp]
|
|
2128
|
+
);
|
|
2129
|
+
if (typeof locationProp === "string") {
|
|
2130
|
+
locationProp = parsePath(locationProp);
|
|
2131
|
+
}
|
|
2132
|
+
let {
|
|
2133
|
+
pathname = "/",
|
|
2134
|
+
search = "",
|
|
2135
|
+
hash = "",
|
|
2136
|
+
state = null,
|
|
2137
|
+
key = "default"
|
|
2138
|
+
} = locationProp;
|
|
2139
|
+
let locationContext = reactExports.useMemo(() => {
|
|
2140
|
+
let trailingPathname = stripBasename(pathname, basename);
|
|
2141
|
+
if (trailingPathname == null) {
|
|
2142
|
+
return null;
|
|
2143
|
+
}
|
|
2144
|
+
return {
|
|
2145
|
+
location: {
|
|
2146
|
+
pathname: trailingPathname,
|
|
2147
|
+
search,
|
|
2148
|
+
hash,
|
|
2149
|
+
state,
|
|
2150
|
+
key
|
|
2151
|
+
},
|
|
2152
|
+
navigationType
|
|
2153
|
+
};
|
|
2154
|
+
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
2155
|
+
warning(
|
|
2156
|
+
locationContext != null,
|
|
2157
|
+
`<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
|
|
2158
|
+
);
|
|
2159
|
+
if (locationContext == null) {
|
|
2160
|
+
return null;
|
|
2161
|
+
}
|
|
2162
|
+
return /* @__PURE__ */ reactExports.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ reactExports.createElement(LocationContext.Provider, { children, value: locationContext }));
|
|
2163
|
+
}
|
|
2164
|
+
function Routes({
|
|
2165
|
+
children,
|
|
2166
|
+
location
|
|
2167
|
+
}) {
|
|
2168
|
+
return useRoutes(createRoutesFromChildren(children), location);
|
|
2169
|
+
}
|
|
2170
|
+
function createRoutesFromChildren(children, parentPath = []) {
|
|
2171
|
+
let routes = [];
|
|
2172
|
+
reactExports.Children.forEach(children, (element, index) => {
|
|
2173
|
+
if (!reactExports.isValidElement(element)) {
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
let treePath = [...parentPath, index];
|
|
2177
|
+
if (element.type === reactExports.Fragment) {
|
|
2178
|
+
routes.push.apply(
|
|
2179
|
+
routes,
|
|
2180
|
+
createRoutesFromChildren(element.props.children, treePath)
|
|
2181
|
+
);
|
|
2182
|
+
return;
|
|
2183
|
+
}
|
|
2184
|
+
invariant(
|
|
2185
|
+
element.type === Route,
|
|
2186
|
+
`[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
|
|
2187
|
+
);
|
|
2188
|
+
invariant(
|
|
2189
|
+
!element.props.index || !element.props.children,
|
|
2190
|
+
"An index route cannot have child routes."
|
|
2191
|
+
);
|
|
2192
|
+
let route = {
|
|
2193
|
+
id: element.props.id || treePath.join("-"),
|
|
2194
|
+
caseSensitive: element.props.caseSensitive,
|
|
2195
|
+
element: element.props.element,
|
|
2196
|
+
Component: element.props.Component,
|
|
2197
|
+
index: element.props.index,
|
|
2198
|
+
path: element.props.path,
|
|
2199
|
+
loader: element.props.loader,
|
|
2200
|
+
action: element.props.action,
|
|
2201
|
+
hydrateFallbackElement: element.props.hydrateFallbackElement,
|
|
2202
|
+
HydrateFallback: element.props.HydrateFallback,
|
|
2203
|
+
errorElement: element.props.errorElement,
|
|
2204
|
+
ErrorBoundary: element.props.ErrorBoundary,
|
|
2205
|
+
hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null,
|
|
2206
|
+
shouldRevalidate: element.props.shouldRevalidate,
|
|
2207
|
+
handle: element.props.handle,
|
|
2208
|
+
lazy: element.props.lazy
|
|
2209
|
+
};
|
|
2210
|
+
if (element.props.children) {
|
|
2211
|
+
route.children = createRoutesFromChildren(
|
|
2212
|
+
element.props.children,
|
|
2213
|
+
treePath
|
|
2214
|
+
);
|
|
2215
|
+
}
|
|
2216
|
+
routes.push(route);
|
|
2217
|
+
});
|
|
2218
|
+
return routes;
|
|
2219
|
+
}
|
|
2220
|
+
var defaultMethod = "get";
|
|
2221
|
+
var defaultEncType = "application/x-www-form-urlencoded";
|
|
2222
|
+
function isHtmlElement(object) {
|
|
2223
|
+
return object != null && typeof object.tagName === "string";
|
|
2224
|
+
}
|
|
2225
|
+
function isButtonElement(object) {
|
|
2226
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
2227
|
+
}
|
|
2228
|
+
function isFormElement(object) {
|
|
2229
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
2230
|
+
}
|
|
2231
|
+
function isInputElement(object) {
|
|
2232
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
2233
|
+
}
|
|
2234
|
+
function isModifiedEvent(event) {
|
|
2235
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
2236
|
+
}
|
|
2237
|
+
function shouldProcessLinkClick(event, target) {
|
|
2238
|
+
return event.button === 0 && // Ignore everything but left clicks
|
|
2239
|
+
(!target || target === "_self") && // Let browser handle "target=_blank" etc.
|
|
2240
|
+
!isModifiedEvent(event);
|
|
2241
|
+
}
|
|
2242
|
+
function createSearchParams(init = "") {
|
|
2243
|
+
return new URLSearchParams(
|
|
2244
|
+
typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo2, key) => {
|
|
2245
|
+
let value = init[key];
|
|
2246
|
+
return memo2.concat(
|
|
2247
|
+
Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]
|
|
2248
|
+
);
|
|
2249
|
+
}, [])
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
|
|
2253
|
+
let searchParams = createSearchParams(locationSearch);
|
|
2254
|
+
if (defaultSearchParams) {
|
|
2255
|
+
defaultSearchParams.forEach((_, key) => {
|
|
2256
|
+
if (!searchParams.has(key)) {
|
|
2257
|
+
defaultSearchParams.getAll(key).forEach((value) => {
|
|
2258
|
+
searchParams.append(key, value);
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
return searchParams;
|
|
2264
|
+
}
|
|
2265
|
+
var _formDataSupportsSubmitter = null;
|
|
2266
|
+
function isFormDataSubmitterSupported() {
|
|
2267
|
+
if (_formDataSupportsSubmitter === null) {
|
|
2268
|
+
try {
|
|
2269
|
+
new FormData(
|
|
2270
|
+
document.createElement("form"),
|
|
2271
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
2272
|
+
0
|
|
2273
|
+
);
|
|
2274
|
+
_formDataSupportsSubmitter = false;
|
|
2275
|
+
} catch (e) {
|
|
2276
|
+
_formDataSupportsSubmitter = true;
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
return _formDataSupportsSubmitter;
|
|
2280
|
+
}
|
|
2281
|
+
var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
2282
|
+
"application/x-www-form-urlencoded",
|
|
2283
|
+
"multipart/form-data",
|
|
2284
|
+
"text/plain"
|
|
2285
|
+
]);
|
|
2286
|
+
function getFormEncType(encType) {
|
|
2287
|
+
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
2288
|
+
warning(
|
|
2289
|
+
false,
|
|
2290
|
+
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
2291
|
+
);
|
|
2292
|
+
return null;
|
|
2293
|
+
}
|
|
2294
|
+
return encType;
|
|
2295
|
+
}
|
|
2296
|
+
function getFormSubmissionInfo(target, basename) {
|
|
2297
|
+
let method;
|
|
2298
|
+
let action;
|
|
2299
|
+
let encType;
|
|
2300
|
+
let formData;
|
|
2301
|
+
let body;
|
|
2302
|
+
if (isFormElement(target)) {
|
|
2303
|
+
let attr = target.getAttribute("action");
|
|
2304
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
2305
|
+
method = target.getAttribute("method") || defaultMethod;
|
|
2306
|
+
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
2307
|
+
formData = new FormData(target);
|
|
2308
|
+
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
2309
|
+
let form = target.form;
|
|
2310
|
+
if (form == null) {
|
|
2311
|
+
throw new Error(
|
|
2312
|
+
`Cannot submit a <button> or <input type="submit"> without a <form>`
|
|
2313
|
+
);
|
|
2314
|
+
}
|
|
2315
|
+
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
2316
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
2317
|
+
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
2318
|
+
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
2319
|
+
formData = new FormData(form, target);
|
|
2320
|
+
if (!isFormDataSubmitterSupported()) {
|
|
2321
|
+
let { name, type, value } = target;
|
|
2322
|
+
if (type === "image") {
|
|
2323
|
+
let prefix = name ? `${name}.` : "";
|
|
2324
|
+
formData.append(`${prefix}x`, "0");
|
|
2325
|
+
formData.append(`${prefix}y`, "0");
|
|
2326
|
+
} else if (name) {
|
|
2327
|
+
formData.append(name, value);
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
} else if (isHtmlElement(target)) {
|
|
2331
|
+
throw new Error(
|
|
2332
|
+
`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
|
|
2333
|
+
);
|
|
2334
|
+
} else {
|
|
2335
|
+
method = defaultMethod;
|
|
2336
|
+
action = null;
|
|
2337
|
+
encType = defaultEncType;
|
|
2338
|
+
body = target;
|
|
2339
|
+
}
|
|
2340
|
+
if (formData && encType === "text/plain") {
|
|
2341
|
+
body = formData;
|
|
2342
|
+
formData = void 0;
|
|
2343
|
+
}
|
|
2344
|
+
return { action, method: method.toLowerCase(), encType, formData, body };
|
|
2345
|
+
}
|
|
2346
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
2347
|
+
function invariant2(value, message) {
|
|
2348
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
2349
|
+
throw new Error(message);
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
function singleFetchUrl(reqUrl, basename, extension) {
|
|
2353
|
+
let url = typeof reqUrl === "string" ? new URL(
|
|
2354
|
+
reqUrl,
|
|
2355
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
2356
|
+
// don't assume window is available
|
|
2357
|
+
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
2358
|
+
) : reqUrl;
|
|
2359
|
+
if (url.pathname === "/") {
|
|
2360
|
+
url.pathname = `_root.${extension}`;
|
|
2361
|
+
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
2362
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
|
|
2363
|
+
} else {
|
|
2364
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
|
|
2365
|
+
}
|
|
2366
|
+
return url;
|
|
2367
|
+
}
|
|
2368
|
+
async function loadRouteModule(route, routeModulesCache) {
|
|
2369
|
+
if (route.id in routeModulesCache) {
|
|
2370
|
+
return routeModulesCache[route.id];
|
|
2371
|
+
}
|
|
2372
|
+
try {
|
|
2373
|
+
let routeModule = await import(
|
|
2374
|
+
/* @vite-ignore */
|
|
2375
|
+
/* webpackIgnore: true */
|
|
2376
|
+
route.module
|
|
2377
|
+
);
|
|
2378
|
+
routeModulesCache[route.id] = routeModule;
|
|
2379
|
+
return routeModule;
|
|
2380
|
+
} catch (error) {
|
|
2381
|
+
console.error(
|
|
2382
|
+
`Error loading route module \`${route.module}\`, reloading page...`
|
|
2383
|
+
);
|
|
2384
|
+
console.error(error);
|
|
2385
|
+
if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
|
|
2386
|
+
void 0) ;
|
|
2387
|
+
window.location.reload();
|
|
2388
|
+
return new Promise(() => {
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
function isHtmlLinkDescriptor(object) {
|
|
2393
|
+
if (object == null) {
|
|
2394
|
+
return false;
|
|
2395
|
+
}
|
|
2396
|
+
if (object.href == null) {
|
|
2397
|
+
return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
|
|
2398
|
+
}
|
|
2399
|
+
return typeof object.rel === "string" && typeof object.href === "string";
|
|
2400
|
+
}
|
|
2401
|
+
async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
|
|
2402
|
+
let links = await Promise.all(
|
|
2403
|
+
matches.map(async (match) => {
|
|
2404
|
+
let route = manifest.routes[match.route.id];
|
|
2405
|
+
if (route) {
|
|
2406
|
+
let mod = await loadRouteModule(route, routeModules);
|
|
2407
|
+
return mod.links ? mod.links() : [];
|
|
2408
|
+
}
|
|
2409
|
+
return [];
|
|
2410
|
+
})
|
|
2411
|
+
);
|
|
2412
|
+
return dedupeLinkDescriptors(
|
|
2413
|
+
links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
|
|
2414
|
+
(link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
|
|
2415
|
+
)
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
|
|
2419
|
+
let isNew = (match, index) => {
|
|
2420
|
+
if (!currentMatches[index]) return true;
|
|
2421
|
+
return match.route.id !== currentMatches[index].route.id;
|
|
2422
|
+
};
|
|
2423
|
+
let matchPathChanged = (match, index) => {
|
|
2424
|
+
return (
|
|
2425
|
+
// param change, /users/123 -> /users/456
|
|
2426
|
+
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
2427
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
2428
|
+
currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
|
|
2429
|
+
);
|
|
2430
|
+
};
|
|
2431
|
+
if (mode === "assets") {
|
|
2432
|
+
return nextMatches.filter(
|
|
2433
|
+
(match, index) => isNew(match, index) || matchPathChanged(match, index)
|
|
2434
|
+
);
|
|
2435
|
+
}
|
|
2436
|
+
if (mode === "data") {
|
|
2437
|
+
return nextMatches.filter((match, index) => {
|
|
2438
|
+
let manifestRoute = manifest.routes[match.route.id];
|
|
2439
|
+
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
2440
|
+
return false;
|
|
2441
|
+
}
|
|
2442
|
+
if (isNew(match, index) || matchPathChanged(match, index)) {
|
|
2443
|
+
return true;
|
|
2444
|
+
}
|
|
2445
|
+
if (match.route.shouldRevalidate) {
|
|
2446
|
+
let routeChoice = match.route.shouldRevalidate({
|
|
2447
|
+
currentUrl: new URL(
|
|
2448
|
+
location.pathname + location.search + location.hash,
|
|
2449
|
+
window.origin
|
|
2450
|
+
),
|
|
2451
|
+
currentParams: currentMatches[0]?.params || {},
|
|
2452
|
+
nextUrl: new URL(page, window.origin),
|
|
2453
|
+
nextParams: match.params,
|
|
2454
|
+
defaultShouldRevalidate: true
|
|
2455
|
+
});
|
|
2456
|
+
if (typeof routeChoice === "boolean") {
|
|
2457
|
+
return routeChoice;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
return true;
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
return [];
|
|
2464
|
+
}
|
|
2465
|
+
function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
|
|
2466
|
+
return dedupeHrefs(
|
|
2467
|
+
matches.map((match) => {
|
|
2468
|
+
let route = manifest.routes[match.route.id];
|
|
2469
|
+
if (!route) return [];
|
|
2470
|
+
let hrefs = [route.module];
|
|
2471
|
+
if (route.clientActionModule) {
|
|
2472
|
+
hrefs = hrefs.concat(route.clientActionModule);
|
|
2473
|
+
}
|
|
2474
|
+
if (route.clientLoaderModule) {
|
|
2475
|
+
hrefs = hrefs.concat(route.clientLoaderModule);
|
|
2476
|
+
}
|
|
2477
|
+
if (includeHydrateFallback && route.hydrateFallbackModule) {
|
|
2478
|
+
hrefs = hrefs.concat(route.hydrateFallbackModule);
|
|
2479
|
+
}
|
|
2480
|
+
if (route.imports) {
|
|
2481
|
+
hrefs = hrefs.concat(route.imports);
|
|
2482
|
+
}
|
|
2483
|
+
return hrefs;
|
|
2484
|
+
}).flat(1)
|
|
2485
|
+
);
|
|
2486
|
+
}
|
|
2487
|
+
function dedupeHrefs(hrefs) {
|
|
2488
|
+
return [...new Set(hrefs)];
|
|
2489
|
+
}
|
|
2490
|
+
function sortKeys(obj) {
|
|
2491
|
+
let sorted = {};
|
|
2492
|
+
let keys = Object.keys(obj).sort();
|
|
2493
|
+
for (let key of keys) {
|
|
2494
|
+
sorted[key] = obj[key];
|
|
2495
|
+
}
|
|
2496
|
+
return sorted;
|
|
2497
|
+
}
|
|
2498
|
+
function dedupeLinkDescriptors(descriptors, preloads) {
|
|
2499
|
+
let set = /* @__PURE__ */ new Set();
|
|
2500
|
+
new Set(preloads);
|
|
2501
|
+
return descriptors.reduce((deduped, descriptor) => {
|
|
2502
|
+
let key = JSON.stringify(sortKeys(descriptor));
|
|
2503
|
+
if (!set.has(key)) {
|
|
2504
|
+
set.add(key);
|
|
2505
|
+
deduped.push({ key, link: descriptor });
|
|
2506
|
+
}
|
|
2507
|
+
return deduped;
|
|
2508
|
+
}, []);
|
|
2509
|
+
}
|
|
2510
|
+
function useDataRouterContext2() {
|
|
2511
|
+
let context = reactExports.useContext(DataRouterContext);
|
|
2512
|
+
invariant2(
|
|
2513
|
+
context,
|
|
2514
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
2515
|
+
);
|
|
2516
|
+
return context;
|
|
2517
|
+
}
|
|
2518
|
+
function useDataRouterStateContext() {
|
|
2519
|
+
let context = reactExports.useContext(DataRouterStateContext);
|
|
2520
|
+
invariant2(
|
|
2521
|
+
context,
|
|
2522
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
2523
|
+
);
|
|
2524
|
+
return context;
|
|
2525
|
+
}
|
|
2526
|
+
var FrameworkContext = reactExports.createContext(void 0);
|
|
2527
|
+
FrameworkContext.displayName = "FrameworkContext";
|
|
2528
|
+
function useFrameworkContext() {
|
|
2529
|
+
let context = reactExports.useContext(FrameworkContext);
|
|
2530
|
+
invariant2(
|
|
2531
|
+
context,
|
|
2532
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
2533
|
+
);
|
|
2534
|
+
return context;
|
|
2535
|
+
}
|
|
2536
|
+
function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
2537
|
+
let frameworkContext = reactExports.useContext(FrameworkContext);
|
|
2538
|
+
let [maybePrefetch, setMaybePrefetch] = reactExports.useState(false);
|
|
2539
|
+
let [shouldPrefetch, setShouldPrefetch] = reactExports.useState(false);
|
|
2540
|
+
let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
|
|
2541
|
+
let ref = reactExports.useRef(null);
|
|
2542
|
+
reactExports.useEffect(() => {
|
|
2543
|
+
if (prefetch === "render") {
|
|
2544
|
+
setShouldPrefetch(true);
|
|
2545
|
+
}
|
|
2546
|
+
if (prefetch === "viewport") {
|
|
2547
|
+
let callback = (entries) => {
|
|
2548
|
+
entries.forEach((entry) => {
|
|
2549
|
+
setShouldPrefetch(entry.isIntersecting);
|
|
2550
|
+
});
|
|
2551
|
+
};
|
|
2552
|
+
let observer = new IntersectionObserver(callback, { threshold: 0.5 });
|
|
2553
|
+
if (ref.current) observer.observe(ref.current);
|
|
2554
|
+
return () => {
|
|
2555
|
+
observer.disconnect();
|
|
2556
|
+
};
|
|
2557
|
+
}
|
|
2558
|
+
}, [prefetch]);
|
|
2559
|
+
reactExports.useEffect(() => {
|
|
2560
|
+
if (maybePrefetch) {
|
|
2561
|
+
let id = setTimeout(() => {
|
|
2562
|
+
setShouldPrefetch(true);
|
|
2563
|
+
}, 100);
|
|
2564
|
+
return () => {
|
|
2565
|
+
clearTimeout(id);
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
}, [maybePrefetch]);
|
|
2569
|
+
let setIntent = () => {
|
|
2570
|
+
setMaybePrefetch(true);
|
|
2571
|
+
};
|
|
2572
|
+
let cancelIntent = () => {
|
|
2573
|
+
setMaybePrefetch(false);
|
|
2574
|
+
setShouldPrefetch(false);
|
|
2575
|
+
};
|
|
2576
|
+
if (!frameworkContext) {
|
|
2577
|
+
return [false, ref, {}];
|
|
2578
|
+
}
|
|
2579
|
+
if (prefetch !== "intent") {
|
|
2580
|
+
return [shouldPrefetch, ref, {}];
|
|
2581
|
+
}
|
|
2582
|
+
return [
|
|
2583
|
+
shouldPrefetch,
|
|
2584
|
+
ref,
|
|
2585
|
+
{
|
|
2586
|
+
onFocus: composeEventHandlers(onFocus, setIntent),
|
|
2587
|
+
onBlur: composeEventHandlers(onBlur, cancelIntent),
|
|
2588
|
+
onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
|
|
2589
|
+
onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
|
|
2590
|
+
onTouchStart: composeEventHandlers(onTouchStart, setIntent)
|
|
2591
|
+
}
|
|
2592
|
+
];
|
|
2593
|
+
}
|
|
2594
|
+
function composeEventHandlers(theirHandler, ourHandler) {
|
|
2595
|
+
return (event) => {
|
|
2596
|
+
theirHandler && theirHandler(event);
|
|
2597
|
+
if (!event.defaultPrevented) {
|
|
2598
|
+
ourHandler(event);
|
|
2599
|
+
}
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
2603
|
+
let { router } = useDataRouterContext2();
|
|
2604
|
+
let matches = reactExports.useMemo(
|
|
2605
|
+
() => matchRoutes(router.routes, page, router.basename),
|
|
2606
|
+
[router.routes, page, router.basename]
|
|
2607
|
+
);
|
|
2608
|
+
if (!matches) {
|
|
2609
|
+
return null;
|
|
2610
|
+
}
|
|
2611
|
+
return /* @__PURE__ */ reactExports.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
2612
|
+
}
|
|
2613
|
+
function useKeyedPrefetchLinks(matches) {
|
|
2614
|
+
let { manifest, routeModules } = useFrameworkContext();
|
|
2615
|
+
let [keyedPrefetchLinks, setKeyedPrefetchLinks] = reactExports.useState([]);
|
|
2616
|
+
reactExports.useEffect(() => {
|
|
2617
|
+
let interrupted = false;
|
|
2618
|
+
void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
|
|
2619
|
+
(links) => {
|
|
2620
|
+
if (!interrupted) {
|
|
2621
|
+
setKeyedPrefetchLinks(links);
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
);
|
|
2625
|
+
return () => {
|
|
2626
|
+
interrupted = true;
|
|
2627
|
+
};
|
|
2628
|
+
}, [matches, manifest, routeModules]);
|
|
2629
|
+
return keyedPrefetchLinks;
|
|
2630
|
+
}
|
|
2631
|
+
function PrefetchPageLinksImpl({
|
|
2632
|
+
page,
|
|
2633
|
+
matches: nextMatches,
|
|
2634
|
+
...linkProps
|
|
2635
|
+
}) {
|
|
2636
|
+
let location = useLocation();
|
|
2637
|
+
let { manifest, routeModules } = useFrameworkContext();
|
|
2638
|
+
let { basename } = useDataRouterContext2();
|
|
2639
|
+
let { loaderData, matches } = useDataRouterStateContext();
|
|
2640
|
+
let newMatchesForData = reactExports.useMemo(
|
|
2641
|
+
() => getNewMatchesForLinks(
|
|
2642
|
+
page,
|
|
2643
|
+
nextMatches,
|
|
2644
|
+
matches,
|
|
2645
|
+
manifest,
|
|
2646
|
+
location,
|
|
2647
|
+
"data"
|
|
2648
|
+
),
|
|
2649
|
+
[page, nextMatches, matches, manifest, location]
|
|
2650
|
+
);
|
|
2651
|
+
let newMatchesForAssets = reactExports.useMemo(
|
|
2652
|
+
() => getNewMatchesForLinks(
|
|
2653
|
+
page,
|
|
2654
|
+
nextMatches,
|
|
2655
|
+
matches,
|
|
2656
|
+
manifest,
|
|
2657
|
+
location,
|
|
2658
|
+
"assets"
|
|
2659
|
+
),
|
|
2660
|
+
[page, nextMatches, matches, manifest, location]
|
|
2661
|
+
);
|
|
2662
|
+
let dataHrefs = reactExports.useMemo(() => {
|
|
2663
|
+
if (page === location.pathname + location.search + location.hash) {
|
|
2664
|
+
return [];
|
|
2665
|
+
}
|
|
2666
|
+
let routesParams = /* @__PURE__ */ new Set();
|
|
2667
|
+
let foundOptOutRoute = false;
|
|
2668
|
+
nextMatches.forEach((m) => {
|
|
2669
|
+
let manifestRoute = manifest.routes[m.route.id];
|
|
2670
|
+
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
2671
|
+
return;
|
|
2672
|
+
}
|
|
2673
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
|
|
2674
|
+
foundOptOutRoute = true;
|
|
2675
|
+
} else if (manifestRoute.hasClientLoader) {
|
|
2676
|
+
foundOptOutRoute = true;
|
|
2677
|
+
} else {
|
|
2678
|
+
routesParams.add(m.route.id);
|
|
2679
|
+
}
|
|
2680
|
+
});
|
|
2681
|
+
if (routesParams.size === 0) {
|
|
2682
|
+
return [];
|
|
2683
|
+
}
|
|
2684
|
+
let url = singleFetchUrl(page, basename, "data");
|
|
2685
|
+
if (foundOptOutRoute && routesParams.size > 0) {
|
|
2686
|
+
url.searchParams.set(
|
|
2687
|
+
"_routes",
|
|
2688
|
+
nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
|
|
2689
|
+
);
|
|
2690
|
+
}
|
|
2691
|
+
return [url.pathname + url.search];
|
|
2692
|
+
}, [
|
|
2693
|
+
basename,
|
|
2694
|
+
loaderData,
|
|
2695
|
+
location,
|
|
2696
|
+
manifest,
|
|
2697
|
+
newMatchesForData,
|
|
2698
|
+
nextMatches,
|
|
2699
|
+
page,
|
|
2700
|
+
routeModules
|
|
2701
|
+
]);
|
|
2702
|
+
let moduleHrefs = reactExports.useMemo(
|
|
2703
|
+
() => getModuleLinkHrefs(newMatchesForAssets, manifest),
|
|
2704
|
+
[newMatchesForAssets, manifest]
|
|
2705
|
+
);
|
|
2706
|
+
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
2707
|
+
return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ reactExports.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ reactExports.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
2708
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
2709
|
+
// already with their own props
|
|
2710
|
+
/* @__PURE__ */ reactExports.createElement("link", { key, nonce: linkProps.nonce, ...link })
|
|
2711
|
+
)));
|
|
2712
|
+
}
|
|
2713
|
+
function mergeRefs(...refs) {
|
|
2714
|
+
return (value) => {
|
|
2715
|
+
refs.forEach((ref) => {
|
|
2716
|
+
if (typeof ref === "function") {
|
|
2717
|
+
ref(value);
|
|
2718
|
+
} else if (ref != null) {
|
|
2719
|
+
ref.current = value;
|
|
2720
|
+
}
|
|
2721
|
+
});
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
2725
|
+
try {
|
|
2726
|
+
if (isBrowser) {
|
|
2727
|
+
window.__reactRouterVersion = // @ts-expect-error
|
|
2728
|
+
"7.8.2";
|
|
2729
|
+
}
|
|
2730
|
+
} catch (e) {
|
|
2731
|
+
}
|
|
2732
|
+
function BrowserRouter({
|
|
2733
|
+
basename,
|
|
2734
|
+
children,
|
|
2735
|
+
window: window2
|
|
2736
|
+
}) {
|
|
2737
|
+
let historyRef = reactExports.useRef();
|
|
2738
|
+
if (historyRef.current == null) {
|
|
2739
|
+
historyRef.current = createBrowserHistory({ window: window2, v5Compat: true });
|
|
2740
|
+
}
|
|
2741
|
+
let history = historyRef.current;
|
|
2742
|
+
let [state, setStateImpl] = reactExports.useState({
|
|
2743
|
+
action: history.action,
|
|
2744
|
+
location: history.location
|
|
2745
|
+
});
|
|
2746
|
+
let setState = reactExports.useCallback(
|
|
2747
|
+
(newState) => {
|
|
2748
|
+
reactExports.startTransition(() => setStateImpl(newState));
|
|
2749
|
+
},
|
|
2750
|
+
[setStateImpl]
|
|
2751
|
+
);
|
|
2752
|
+
reactExports.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
2753
|
+
return /* @__PURE__ */ reactExports.createElement(
|
|
2754
|
+
Router,
|
|
2755
|
+
{
|
|
2756
|
+
basename,
|
|
2757
|
+
children,
|
|
2758
|
+
location: state.location,
|
|
2759
|
+
navigationType: state.action,
|
|
2760
|
+
navigator: history
|
|
2761
|
+
}
|
|
2762
|
+
);
|
|
2763
|
+
}
|
|
2764
|
+
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
2765
|
+
var Link = reactExports.forwardRef(
|
|
2766
|
+
function LinkWithRef({
|
|
2767
|
+
onClick,
|
|
2768
|
+
discover = "render",
|
|
2769
|
+
prefetch = "none",
|
|
2770
|
+
relative,
|
|
2771
|
+
reloadDocument,
|
|
2772
|
+
replace: replace2,
|
|
2773
|
+
state,
|
|
2774
|
+
target,
|
|
2775
|
+
to,
|
|
2776
|
+
preventScrollReset,
|
|
2777
|
+
viewTransition,
|
|
2778
|
+
...rest
|
|
2779
|
+
}, forwardedRef) {
|
|
2780
|
+
let { basename } = reactExports.useContext(NavigationContext);
|
|
2781
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
|
|
2782
|
+
let absoluteHref;
|
|
2783
|
+
let isExternal = false;
|
|
2784
|
+
if (typeof to === "string" && isAbsolute) {
|
|
2785
|
+
absoluteHref = to;
|
|
2786
|
+
if (isBrowser) {
|
|
2787
|
+
try {
|
|
2788
|
+
let currentUrl = new URL(window.location.href);
|
|
2789
|
+
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
2790
|
+
let path = stripBasename(targetUrl.pathname, basename);
|
|
2791
|
+
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
2792
|
+
to = path + targetUrl.search + targetUrl.hash;
|
|
2793
|
+
} else {
|
|
2794
|
+
isExternal = true;
|
|
2795
|
+
}
|
|
2796
|
+
} catch (e) {
|
|
2797
|
+
warning(
|
|
2798
|
+
false,
|
|
2799
|
+
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
2800
|
+
);
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
let href = useHref(to, { relative });
|
|
2805
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
2806
|
+
prefetch,
|
|
2807
|
+
rest
|
|
2808
|
+
);
|
|
2809
|
+
let internalOnClick = useLinkClickHandler(to, {
|
|
2810
|
+
replace: replace2,
|
|
2811
|
+
state,
|
|
2812
|
+
target,
|
|
2813
|
+
preventScrollReset,
|
|
2814
|
+
relative,
|
|
2815
|
+
viewTransition
|
|
2816
|
+
});
|
|
2817
|
+
function handleClick(event) {
|
|
2818
|
+
if (onClick) onClick(event);
|
|
2819
|
+
if (!event.defaultPrevented) {
|
|
2820
|
+
internalOnClick(event);
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
let link = (
|
|
2824
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
2825
|
+
/* @__PURE__ */ reactExports.createElement(
|
|
2826
|
+
"a",
|
|
2827
|
+
{
|
|
2828
|
+
...rest,
|
|
2829
|
+
...prefetchHandlers,
|
|
2830
|
+
href: absoluteHref || href,
|
|
2831
|
+
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
2832
|
+
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
2833
|
+
target,
|
|
2834
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
2835
|
+
}
|
|
2836
|
+
)
|
|
2837
|
+
);
|
|
2838
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, link, /* @__PURE__ */ reactExports.createElement(PrefetchPageLinks, { page: href })) : link;
|
|
2839
|
+
}
|
|
2840
|
+
);
|
|
2841
|
+
Link.displayName = "Link";
|
|
2842
|
+
var NavLink = reactExports.forwardRef(
|
|
2843
|
+
function NavLinkWithRef({
|
|
2844
|
+
"aria-current": ariaCurrentProp = "page",
|
|
2845
|
+
caseSensitive = false,
|
|
2846
|
+
className: classNameProp = "",
|
|
2847
|
+
end = false,
|
|
2848
|
+
style: styleProp,
|
|
2849
|
+
to,
|
|
2850
|
+
viewTransition,
|
|
2851
|
+
children,
|
|
2852
|
+
...rest
|
|
2853
|
+
}, ref) {
|
|
2854
|
+
let path = useResolvedPath(to, { relative: rest.relative });
|
|
2855
|
+
let location = useLocation();
|
|
2856
|
+
let routerState = reactExports.useContext(DataRouterStateContext);
|
|
2857
|
+
let { navigator, basename } = reactExports.useContext(NavigationContext);
|
|
2858
|
+
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
2859
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2860
|
+
useViewTransitionState(path) && viewTransition === true;
|
|
2861
|
+
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
2862
|
+
let locationPathname = location.pathname;
|
|
2863
|
+
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
2864
|
+
if (!caseSensitive) {
|
|
2865
|
+
locationPathname = locationPathname.toLowerCase();
|
|
2866
|
+
nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
|
|
2867
|
+
toPathname = toPathname.toLowerCase();
|
|
2868
|
+
}
|
|
2869
|
+
if (nextLocationPathname && basename) {
|
|
2870
|
+
nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
|
|
2871
|
+
}
|
|
2872
|
+
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
2873
|
+
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
2874
|
+
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
|
|
2875
|
+
let renderProps = {
|
|
2876
|
+
isActive,
|
|
2877
|
+
isPending,
|
|
2878
|
+
isTransitioning
|
|
2879
|
+
};
|
|
2880
|
+
let ariaCurrent = isActive ? ariaCurrentProp : void 0;
|
|
2881
|
+
let className;
|
|
2882
|
+
if (typeof classNameProp === "function") {
|
|
2883
|
+
className = classNameProp(renderProps);
|
|
2884
|
+
} else {
|
|
2885
|
+
className = [
|
|
2886
|
+
classNameProp,
|
|
2887
|
+
isActive ? "active" : null,
|
|
2888
|
+
isPending ? "pending" : null,
|
|
2889
|
+
isTransitioning ? "transitioning" : null
|
|
2890
|
+
].filter(Boolean).join(" ");
|
|
2891
|
+
}
|
|
2892
|
+
let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
|
|
2893
|
+
return /* @__PURE__ */ reactExports.createElement(
|
|
2894
|
+
Link,
|
|
2895
|
+
{
|
|
2896
|
+
...rest,
|
|
2897
|
+
"aria-current": ariaCurrent,
|
|
2898
|
+
className,
|
|
2899
|
+
ref,
|
|
2900
|
+
style,
|
|
2901
|
+
to,
|
|
2902
|
+
viewTransition
|
|
2903
|
+
},
|
|
2904
|
+
typeof children === "function" ? children(renderProps) : children
|
|
2905
|
+
);
|
|
2906
|
+
}
|
|
2907
|
+
);
|
|
2908
|
+
NavLink.displayName = "NavLink";
|
|
2909
|
+
var Form = reactExports.forwardRef(
|
|
2910
|
+
({
|
|
2911
|
+
discover = "render",
|
|
2912
|
+
fetcherKey,
|
|
2913
|
+
navigate,
|
|
2914
|
+
reloadDocument,
|
|
2915
|
+
replace: replace2,
|
|
2916
|
+
state,
|
|
2917
|
+
method = defaultMethod,
|
|
2918
|
+
action,
|
|
2919
|
+
onSubmit,
|
|
2920
|
+
relative,
|
|
2921
|
+
preventScrollReset,
|
|
2922
|
+
viewTransition,
|
|
2923
|
+
...props
|
|
2924
|
+
}, forwardedRef) => {
|
|
2925
|
+
let submit = useSubmit();
|
|
2926
|
+
let formAction = useFormAction(action, { relative });
|
|
2927
|
+
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
2928
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
|
|
2929
|
+
let submitHandler = (event) => {
|
|
2930
|
+
onSubmit && onSubmit(event);
|
|
2931
|
+
if (event.defaultPrevented) return;
|
|
2932
|
+
event.preventDefault();
|
|
2933
|
+
let submitter = event.nativeEvent.submitter;
|
|
2934
|
+
let submitMethod = submitter?.getAttribute("formmethod") || method;
|
|
2935
|
+
submit(submitter || event.currentTarget, {
|
|
2936
|
+
fetcherKey,
|
|
2937
|
+
method: submitMethod,
|
|
2938
|
+
navigate,
|
|
2939
|
+
replace: replace2,
|
|
2940
|
+
state,
|
|
2941
|
+
relative,
|
|
2942
|
+
preventScrollReset,
|
|
2943
|
+
viewTransition
|
|
2944
|
+
});
|
|
2945
|
+
};
|
|
2946
|
+
return /* @__PURE__ */ reactExports.createElement(
|
|
2947
|
+
"form",
|
|
2948
|
+
{
|
|
2949
|
+
ref: forwardedRef,
|
|
2950
|
+
method: formMethod,
|
|
2951
|
+
action: formAction,
|
|
2952
|
+
onSubmit: reloadDocument ? onSubmit : submitHandler,
|
|
2953
|
+
...props,
|
|
2954
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
2955
|
+
}
|
|
2956
|
+
);
|
|
2957
|
+
}
|
|
2958
|
+
);
|
|
2959
|
+
Form.displayName = "Form";
|
|
2960
|
+
function getDataRouterConsoleError2(hookName) {
|
|
2961
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
2962
|
+
}
|
|
2963
|
+
function useDataRouterContext3(hookName) {
|
|
2964
|
+
let ctx = reactExports.useContext(DataRouterContext);
|
|
2965
|
+
invariant(ctx, getDataRouterConsoleError2(hookName));
|
|
2966
|
+
return ctx;
|
|
2967
|
+
}
|
|
2968
|
+
function useLinkClickHandler(to, {
|
|
2969
|
+
target,
|
|
2970
|
+
replace: replaceProp,
|
|
2971
|
+
state,
|
|
2972
|
+
preventScrollReset,
|
|
2973
|
+
relative,
|
|
2974
|
+
viewTransition
|
|
2975
|
+
} = {}) {
|
|
2976
|
+
let navigate = useNavigate();
|
|
2977
|
+
let location = useLocation();
|
|
2978
|
+
let path = useResolvedPath(to, { relative });
|
|
2979
|
+
return reactExports.useCallback(
|
|
2980
|
+
(event) => {
|
|
2981
|
+
if (shouldProcessLinkClick(event, target)) {
|
|
2982
|
+
event.preventDefault();
|
|
2983
|
+
let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
2984
|
+
navigate(to, {
|
|
2985
|
+
replace: replace2,
|
|
2986
|
+
state,
|
|
2987
|
+
preventScrollReset,
|
|
2988
|
+
relative,
|
|
2989
|
+
viewTransition
|
|
2990
|
+
});
|
|
2991
|
+
}
|
|
2992
|
+
},
|
|
2993
|
+
[
|
|
2994
|
+
location,
|
|
2995
|
+
navigate,
|
|
2996
|
+
path,
|
|
2997
|
+
replaceProp,
|
|
2998
|
+
state,
|
|
2999
|
+
target,
|
|
3000
|
+
to,
|
|
3001
|
+
preventScrollReset,
|
|
3002
|
+
relative,
|
|
3003
|
+
viewTransition
|
|
3004
|
+
]
|
|
3005
|
+
);
|
|
3006
|
+
}
|
|
3007
|
+
function useSearchParams(defaultInit) {
|
|
3008
|
+
warning(
|
|
3009
|
+
typeof URLSearchParams !== "undefined",
|
|
3010
|
+
`You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
|
|
3011
|
+
);
|
|
3012
|
+
let defaultSearchParamsRef = reactExports.useRef(createSearchParams(defaultInit));
|
|
3013
|
+
let hasSetSearchParamsRef = reactExports.useRef(false);
|
|
3014
|
+
let location = useLocation();
|
|
3015
|
+
let searchParams = reactExports.useMemo(
|
|
3016
|
+
() => (
|
|
3017
|
+
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
3018
|
+
// Once we call that we want those to take precedence, otherwise you can't
|
|
3019
|
+
// remove a param with setSearchParams({}) if it has an initial value
|
|
3020
|
+
getSearchParamsForLocation(
|
|
3021
|
+
location.search,
|
|
3022
|
+
hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
|
|
3023
|
+
)
|
|
3024
|
+
),
|
|
3025
|
+
[location.search]
|
|
3026
|
+
);
|
|
3027
|
+
let navigate = useNavigate();
|
|
3028
|
+
let setSearchParams = reactExports.useCallback(
|
|
3029
|
+
(nextInit, navigateOptions) => {
|
|
3030
|
+
const newSearchParams = createSearchParams(
|
|
3031
|
+
typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
|
|
3032
|
+
);
|
|
3033
|
+
hasSetSearchParamsRef.current = true;
|
|
3034
|
+
navigate("?" + newSearchParams, navigateOptions);
|
|
3035
|
+
},
|
|
3036
|
+
[navigate, searchParams]
|
|
3037
|
+
);
|
|
3038
|
+
return [searchParams, setSearchParams];
|
|
3039
|
+
}
|
|
3040
|
+
var fetcherId = 0;
|
|
3041
|
+
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
3042
|
+
function useSubmit() {
|
|
3043
|
+
let { router } = useDataRouterContext3(
|
|
3044
|
+
"useSubmit"
|
|
3045
|
+
/* UseSubmit */
|
|
3046
|
+
);
|
|
3047
|
+
let { basename } = reactExports.useContext(NavigationContext);
|
|
3048
|
+
let currentRouteId = useRouteId();
|
|
3049
|
+
return reactExports.useCallback(
|
|
3050
|
+
async (target, options = {}) => {
|
|
3051
|
+
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
3052
|
+
target,
|
|
3053
|
+
basename
|
|
3054
|
+
);
|
|
3055
|
+
if (options.navigate === false) {
|
|
3056
|
+
let key = options.fetcherKey || getUniqueFetcherId();
|
|
3057
|
+
await router.fetch(key, currentRouteId, options.action || action, {
|
|
3058
|
+
preventScrollReset: options.preventScrollReset,
|
|
3059
|
+
formData,
|
|
3060
|
+
body,
|
|
3061
|
+
formMethod: options.method || method,
|
|
3062
|
+
formEncType: options.encType || encType,
|
|
3063
|
+
flushSync: options.flushSync
|
|
3064
|
+
});
|
|
3065
|
+
} else {
|
|
3066
|
+
await router.navigate(options.action || action, {
|
|
3067
|
+
preventScrollReset: options.preventScrollReset,
|
|
3068
|
+
formData,
|
|
3069
|
+
body,
|
|
3070
|
+
formMethod: options.method || method,
|
|
3071
|
+
formEncType: options.encType || encType,
|
|
3072
|
+
replace: options.replace,
|
|
3073
|
+
state: options.state,
|
|
3074
|
+
fromRouteId: currentRouteId,
|
|
3075
|
+
flushSync: options.flushSync,
|
|
3076
|
+
viewTransition: options.viewTransition
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
},
|
|
3080
|
+
[router, basename, currentRouteId]
|
|
3081
|
+
);
|
|
3082
|
+
}
|
|
3083
|
+
function useFormAction(action, { relative } = {}) {
|
|
3084
|
+
let { basename } = reactExports.useContext(NavigationContext);
|
|
3085
|
+
let routeContext = reactExports.useContext(RouteContext);
|
|
3086
|
+
invariant(routeContext, "useFormAction must be used inside a RouteContext");
|
|
3087
|
+
let [match] = routeContext.matches.slice(-1);
|
|
3088
|
+
let path = { ...useResolvedPath(action ? action : ".", { relative }) };
|
|
3089
|
+
let location = useLocation();
|
|
3090
|
+
if (action == null) {
|
|
3091
|
+
path.search = location.search;
|
|
3092
|
+
let params = new URLSearchParams(path.search);
|
|
3093
|
+
let indexValues = params.getAll("index");
|
|
3094
|
+
let hasNakedIndexParam = indexValues.some((v) => v === "");
|
|
3095
|
+
if (hasNakedIndexParam) {
|
|
3096
|
+
params.delete("index");
|
|
3097
|
+
indexValues.filter((v) => v).forEach((v) => params.append("index", v));
|
|
3098
|
+
let qs = params.toString();
|
|
3099
|
+
path.search = qs ? `?${qs}` : "";
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
if ((!action || action === ".") && match.route.index) {
|
|
3103
|
+
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
3104
|
+
}
|
|
3105
|
+
if (basename !== "/") {
|
|
3106
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
3107
|
+
}
|
|
3108
|
+
return createPath(path);
|
|
3109
|
+
}
|
|
3110
|
+
function useViewTransitionState(to, { relative } = {}) {
|
|
3111
|
+
let vtContext = reactExports.useContext(ViewTransitionContext);
|
|
3112
|
+
invariant(
|
|
3113
|
+
vtContext != null,
|
|
3114
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
3115
|
+
);
|
|
3116
|
+
let { basename } = useDataRouterContext3(
|
|
3117
|
+
"useViewTransitionState"
|
|
3118
|
+
/* useViewTransitionState */
|
|
3119
|
+
);
|
|
3120
|
+
let path = useResolvedPath(to, { relative });
|
|
3121
|
+
if (!vtContext.isTransitioning) {
|
|
3122
|
+
return false;
|
|
3123
|
+
}
|
|
3124
|
+
let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
3125
|
+
let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
3126
|
+
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
export { BrowserRouter as B, Link as L, NavLink as N, React$1 as R, requireReactDom as a, reactExports as b, reactDomExports as c, ReactDOM as d, React as e, useLocation as f, getDefaultExportFromCjs$1 as g, useParams as h, useSearchParams as i, Routes as j, Route as k, process$1 as p, requireReact as r, useNavigate as u };
|
|
3130
|
+
//# sourceMappingURL=vendor-Bifu43sa.js.map
|