@lvetechs/micro-app 1.0.1 → 1.0.3

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/index.mjs ADDED
@@ -0,0 +1,2526 @@
1
+ var xr = Object.defineProperty;
2
+ var br = (e, t, r) => t in e ? xr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var I = (e, t, r) => br(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import * as h from "react";
5
+ import Tt, { useState as At, useCallback as Fe, useReducer as wr, useEffect as Be, Component as jt, useRef as Ie, Suspense as Rr, useMemo as Cr } from "react";
6
+ import "react-dom";
7
+ class Sr {
8
+ constructor(t, r) {
9
+ I(this, "manager");
10
+ I(this, "name");
11
+ this.name = t, this.manager = r;
12
+ }
13
+ getStatus() {
14
+ return this.manager.getAppStatus(this.name);
15
+ }
16
+ getInfo() {
17
+ return this.manager.getAppInfo(this.name);
18
+ }
19
+ start() {
20
+ this.manager.startApp(this.name);
21
+ }
22
+ stop() {
23
+ this.manager.stopApp(this.name);
24
+ }
25
+ restart() {
26
+ this.manager.restartApp(this.name);
27
+ }
28
+ updateStatus(t, r) {
29
+ this.manager.updateAppStatus(this.name, t, r);
30
+ }
31
+ onStatusChange(t) {
32
+ return this.manager.onStatusChange(this.name, t);
33
+ }
34
+ async checkHealth() {
35
+ return this.manager.checkAppHealth(this.name);
36
+ }
37
+ }
38
+ class Nr {
39
+ constructor(t) {
40
+ I(this, "apps", /* @__PURE__ */ new Map());
41
+ I(this, "configMap", /* @__PURE__ */ new Map());
42
+ I(this, "instances", /* @__PURE__ */ new Map());
43
+ I(this, "statusListeners", /* @__PURE__ */ new Map());
44
+ I(this, "appChangeListeners", /* @__PURE__ */ new Set());
45
+ I(this, "options");
46
+ I(this, "initialized", !1);
47
+ this.options = t, this.initialize();
48
+ }
49
+ /**
50
+ * 初始化应用配置
51
+ */
52
+ initialize() {
53
+ this.initialized && (console.warn("[MicroApp] 已初始化,重新初始化..."), this.apps.clear(), this.configMap.clear(), this.instances.clear());
54
+ const t = [...this.options.apps].sort(
55
+ (r, n) => (n.priority ?? 0) - (r.priority ?? 0)
56
+ );
57
+ for (const r of t)
58
+ if (r.enabled !== !1) {
59
+ this.configMap.set(r.name, r);
60
+ const n = r.container;
61
+ this.apps.set(r.name, {
62
+ name: r.name,
63
+ status: "idle",
64
+ entry: r.entry,
65
+ container: n
66
+ }), this.instances.set(r.name, new Sr(r.name, this));
67
+ }
68
+ this.initialized = !0, console.log("[MicroApp] 初始化完成", this.getAppNames());
69
+ }
70
+ /**
71
+ * 获取所有应用名称
72
+ */
73
+ getAppNames() {
74
+ return Array.from(this.apps.keys());
75
+ }
76
+ /**
77
+ * 获取所有应用
78
+ */
79
+ getApps() {
80
+ const t = {};
81
+ return this.apps.forEach((r, n) => {
82
+ t[n] = r;
83
+ }), t;
84
+ }
85
+ /**
86
+ * 获取单个应用
87
+ */
88
+ getApp(t) {
89
+ return this.apps.get(t);
90
+ }
91
+ /**
92
+ * 获取应用状态
93
+ */
94
+ getAppStatus(t) {
95
+ var r;
96
+ return ((r = this.apps.get(t)) == null ? void 0 : r.status) ?? "idle";
97
+ }
98
+ /**
99
+ * 获取应用信息
100
+ */
101
+ getAppInfo(t) {
102
+ return this.apps.get(t);
103
+ }
104
+ /**
105
+ * 获取应用实例
106
+ */
107
+ getAppInstance(t) {
108
+ return this.instances.get(t);
109
+ }
110
+ /**
111
+ * 获取所有应用实例
112
+ */
113
+ getAllAppInstances() {
114
+ return this.instances;
115
+ }
116
+ /**
117
+ * 启动应用
118
+ */
119
+ startApp(t) {
120
+ const r = this.apps.get(t), n = this.configMap.get(t);
121
+ if (!r || !n) {
122
+ console.warn(`[MicroApp] 应用 ${t} 不存在`);
123
+ return;
124
+ }
125
+ if (r.status === "running") {
126
+ console.log(`[MicroApp] 应用 ${t} 已在运行中`);
127
+ return;
128
+ }
129
+ this.updateAppStatus(t, "starting"), console.log(t, n, r, 9999), this.loadApp(t, n, r);
130
+ }
131
+ /**
132
+ * 加载应用(创建 iframe 或动态加载)
133
+ */
134
+ async loadApp(t, r, n) {
135
+ var i, s, c, l, u, p;
136
+ const o = n.container;
137
+ if (!o) {
138
+ const f = new Error(`[MicroApp] 应用 ${t} 的容器不存在`);
139
+ this.updateAppStatus(t, "error", f.message), (s = (i = this.options).onError) == null || s.call(i, f, t);
140
+ return;
141
+ }
142
+ try {
143
+ await this.loadIframe(t, r.entry, o), this.updateAppStatus(t, "running"), (l = (c = this.options).onLoad) == null || l.call(c, t);
144
+ } catch (f) {
145
+ const m = f instanceof Error ? f : new Error(String(f));
146
+ this.updateAppStatus(t, "error", m.message), (p = (u = this.options).onError) == null || p.call(u, m, t);
147
+ }
148
+ }
149
+ /**
150
+ * 加载 iframe 模式
151
+ */
152
+ loadIframe(t, r, n) {
153
+ async function o(i) {
154
+ try {
155
+ const s = await fetch(i, {
156
+ method: "HEAD",
157
+ // 只获取头部信息
158
+ mode: "no-cors"
159
+ // 允许跨域请求(但只能知道是否可达,不能知道状态码)
160
+ });
161
+ return !!(s.status === 0 || s.ok);
162
+ } catch {
163
+ }
164
+ }
165
+ return new Promise(async (i, s) => {
166
+ if (!await o(r))
167
+ throw new Error(`iframe 加载失败: ${r}`);
168
+ const l = document.createElement("iframe");
169
+ l.src = r, l.style.width = "100%", l.style.height = "100%", l.style.border = "none", l.setAttribute(
170
+ "sandbox",
171
+ "allow-scripts allow-forms allow-popups allow-top-navigation"
172
+ );
173
+ const u = document.querySelector(n);
174
+ if (!u) {
175
+ s(new Error(`容器不存在: ${n}`));
176
+ return;
177
+ }
178
+ u.innerHTML = "", u.appendChild(l), l.onload = () => {
179
+ console.log(`[MicroApp] ${t} iframe 加载成功`), i();
180
+ }, l.onerror = () => {
181
+ s(new Error(`iframe 加载失败: ${r}`));
182
+ };
183
+ });
184
+ }
185
+ /**
186
+ * 停止应用
187
+ */
188
+ stopApp(t) {
189
+ const r = this.apps.get(t);
190
+ if (!r) {
191
+ console.warn(`[MicroApp] 应用 ${t} 不存在`);
192
+ return;
193
+ }
194
+ if (!(r.status === "stopped" || r.status === "idle")) {
195
+ if (r.container) {
196
+ const n = document.querySelector(r.container);
197
+ n && (n.innerHTML = "");
198
+ }
199
+ this.updateAppStatus(t, "stopped");
200
+ }
201
+ }
202
+ /**
203
+ * 重启应用
204
+ */
205
+ restartApp(t) {
206
+ if (!this.configMap.get(t)) {
207
+ console.warn(`[MicroApp] 应用 ${t} 不存在`);
208
+ return;
209
+ }
210
+ this.stopApp(t), setTimeout(() => {
211
+ this.startApp(t);
212
+ }, 300);
213
+ }
214
+ /**
215
+ * 更新应用状态
216
+ */
217
+ updateAppStatus(t, r, n) {
218
+ var c, l;
219
+ const o = this.apps.get(t);
220
+ if (!o) return;
221
+ const i = {
222
+ ...o,
223
+ status: r,
224
+ error: n,
225
+ lastCheckTime: Date.now()
226
+ };
227
+ r === "running" && !o.startTime && (i.startTime = Date.now()), this.apps.set(t, i);
228
+ const s = this.statusListeners.get(t);
229
+ s && s.forEach((u) => u(r, i)), this.appChangeListeners.forEach((u) => {
230
+ u(t, r, i);
231
+ }), (l = (c = this.options).onStatusChange) == null || l.call(c, t, r);
232
+ }
233
+ /**
234
+ * 监听应用状态变化
235
+ */
236
+ onStatusChange(t, r) {
237
+ return this.statusListeners.has(t) || this.statusListeners.set(t, /* @__PURE__ */ new Set()), this.statusListeners.get(t).add(r), () => {
238
+ const n = this.statusListeners.get(t);
239
+ n && (n.delete(r), n.size === 0 && this.statusListeners.delete(t));
240
+ };
241
+ }
242
+ /**
243
+ * 监听所有应用状态变化
244
+ */
245
+ onAppChange(t) {
246
+ return this.appChangeListeners.add(t), () => {
247
+ this.appChangeListeners.delete(t);
248
+ };
249
+ }
250
+ /**
251
+ * 健康检查
252
+ */
253
+ async checkAppHealth(t) {
254
+ const r = this.apps.get(t);
255
+ if (!r) return !1;
256
+ try {
257
+ return await new Promise((n) => setTimeout(n, 100)), r.status === "running" ? (this.updateAppStatus(t, "running"), !0) : !1;
258
+ } catch (n) {
259
+ return this.updateAppStatus(
260
+ t,
261
+ "error",
262
+ n instanceof Error ? n.message : "健康检查失败"
263
+ ), !1;
264
+ }
265
+ }
266
+ /**
267
+ * 销毁管理器
268
+ */
269
+ destroy() {
270
+ this.apps.forEach((t, r) => {
271
+ this.stopApp(r);
272
+ }), this.apps.clear(), this.configMap.clear(), this.instances.clear(), this.statusListeners.clear(), this.appChangeListeners.clear(), this.initialized = !1, console.log("[MicroApp] 已销毁");
273
+ }
274
+ }
275
+ function _r(e) {
276
+ const t = new Nr(e);
277
+ return {
278
+ start: () => {
279
+ Object.values(t.getApps()).forEach((n) => {
280
+ n.status !== "running" && t.startApp(n.name);
281
+ });
282
+ },
283
+ stop: () => {
284
+ const r = t.getApps();
285
+ Object.keys(r).forEach((n) => {
286
+ t.stopApp(n);
287
+ });
288
+ },
289
+ startApp: (r) => {
290
+ var n;
291
+ try {
292
+ t.startApp(r);
293
+ } catch (o) {
294
+ (n = e.onError) == null || n.call(
295
+ e,
296
+ o instanceof Error ? o : new Error(String(o)),
297
+ r
298
+ );
299
+ }
300
+ },
301
+ stopApp: (r) => {
302
+ var n;
303
+ try {
304
+ t.stopApp(r);
305
+ } catch (o) {
306
+ (n = e.onError) == null || n.call(
307
+ e,
308
+ o instanceof Error ? o : new Error(String(o)),
309
+ r
310
+ );
311
+ }
312
+ },
313
+ restartApp: (r) => {
314
+ var n;
315
+ try {
316
+ t.restartApp(r);
317
+ } catch (o) {
318
+ (n = e.onError) == null || n.call(
319
+ e,
320
+ o instanceof Error ? o : new Error(String(o)),
321
+ r
322
+ );
323
+ }
324
+ },
325
+ getApp: (r) => t.getAppInstance(r) || null,
326
+ getAllApps: () => t.getAllAppInstances(),
327
+ onAppChange: (r) => t.onAppChange((n, o) => {
328
+ r(n, o);
329
+ }),
330
+ onStatusChange: (r, n) => t.onStatusChange(r, (o) => {
331
+ n(o);
332
+ }),
333
+ destroy: () => {
334
+ t.destroy();
335
+ }
336
+ };
337
+ }
338
+ var Ve = { exports: {} }, ae = {};
339
+ /**
340
+ * @license React
341
+ * react-jsx-runtime.production.min.js
342
+ *
343
+ * Copyright (c) Facebook, Inc. and its affiliates.
344
+ *
345
+ * This source code is licensed under the MIT license found in the
346
+ * LICENSE file in the root directory of this source tree.
347
+ */
348
+ var yt;
349
+ function Or() {
350
+ if (yt) return ae;
351
+ yt = 1;
352
+ var e = Tt, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
353
+ function s(c, l, u) {
354
+ var p, f = {}, m = null, w = null;
355
+ u !== void 0 && (m = "" + u), l.key !== void 0 && (m = "" + l.key), l.ref !== void 0 && (w = l.ref);
356
+ for (p in l) n.call(l, p) && !i.hasOwnProperty(p) && (f[p] = l[p]);
357
+ if (c && c.defaultProps) for (p in l = c.defaultProps, l) f[p] === void 0 && (f[p] = l[p]);
358
+ return { $$typeof: t, type: c, key: m, ref: w, props: f, _owner: o.current };
359
+ }
360
+ return ae.Fragment = r, ae.jsx = s, ae.jsxs = s, ae;
361
+ }
362
+ var oe = {};
363
+ /**
364
+ * @license React
365
+ * react-jsx-runtime.development.js
366
+ *
367
+ * Copyright (c) Facebook, Inc. and its affiliates.
368
+ *
369
+ * This source code is licensed under the MIT license found in the
370
+ * LICENSE file in the root directory of this source tree.
371
+ */
372
+ var Et;
373
+ function Pr() {
374
+ return Et || (Et = 1, process.env.NODE_ENV !== "production" && function() {
375
+ var e = Tt, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), c = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), u = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), C = Symbol.iterator, _ = "@@iterator";
376
+ function y(a) {
377
+ if (a === null || typeof a != "object")
378
+ return null;
379
+ var d = C && a[C] || a[_];
380
+ return typeof d == "function" ? d : null;
381
+ }
382
+ var N = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
383
+ function v(a) {
384
+ {
385
+ for (var d = arguments.length, g = new Array(d > 1 ? d - 1 : 0), x = 1; x < d; x++)
386
+ g[x - 1] = arguments[x];
387
+ O("error", a, g);
388
+ }
389
+ }
390
+ function O(a, d, g) {
391
+ {
392
+ var x = N.ReactDebugCurrentFrame, P = x.getStackAddendum();
393
+ P !== "" && (d += "%s", g = g.concat([P]));
394
+ var T = g.map(function(S) {
395
+ return String(S);
396
+ });
397
+ T.unshift("Warning: " + d), Function.prototype.apply.call(console[a], console, T);
398
+ }
399
+ }
400
+ var A = !1, U = !1, Q = !1, he = !1, ee = !1, me;
401
+ me = Symbol.for("react.module.reference");
402
+ function te(a) {
403
+ return !!(typeof a == "string" || typeof a == "function" || a === n || a === i || ee || a === o || a === u || a === p || he || a === w || A || U || Q || typeof a == "object" && a !== null && (a.$$typeof === m || a.$$typeof === f || a.$$typeof === s || a.$$typeof === c || a.$$typeof === l || // This needs to include all possible module reference object
404
+ // types supported by any Flight configuration anywhere since
405
+ // we don't know which Flight build this will end up being used
406
+ // with.
407
+ a.$$typeof === me || a.getModuleId !== void 0));
408
+ }
409
+ function Se(a, d, g) {
410
+ var x = a.displayName;
411
+ if (x)
412
+ return x;
413
+ var P = d.displayName || d.name || "";
414
+ return P !== "" ? g + "(" + P + ")" : g;
415
+ }
416
+ function He(a) {
417
+ return a.displayName || "Context";
418
+ }
419
+ function W(a) {
420
+ if (a == null)
421
+ return null;
422
+ if (typeof a.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof a == "function")
423
+ return a.displayName || a.name || null;
424
+ if (typeof a == "string")
425
+ return a;
426
+ switch (a) {
427
+ case n:
428
+ return "Fragment";
429
+ case r:
430
+ return "Portal";
431
+ case i:
432
+ return "Profiler";
433
+ case o:
434
+ return "StrictMode";
435
+ case u:
436
+ return "Suspense";
437
+ case p:
438
+ return "SuspenseList";
439
+ }
440
+ if (typeof a == "object")
441
+ switch (a.$$typeof) {
442
+ case c:
443
+ var d = a;
444
+ return He(d) + ".Consumer";
445
+ case s:
446
+ var g = a;
447
+ return He(g._context) + ".Provider";
448
+ case l:
449
+ return Se(a, a.render, "ForwardRef");
450
+ case f:
451
+ var x = a.displayName || null;
452
+ return x !== null ? x : W(a.type) || "Memo";
453
+ case m: {
454
+ var P = a, T = P._payload, S = P._init;
455
+ try {
456
+ return W(S(T));
457
+ } catch {
458
+ return null;
459
+ }
460
+ }
461
+ }
462
+ return null;
463
+ }
464
+ var K = Object.assign, re = 0, Je, Ge, Xe, Ze, Qe, et, tt;
465
+ function rt() {
466
+ }
467
+ rt.__reactDisabledLog = !0;
468
+ function qt() {
469
+ {
470
+ if (re === 0) {
471
+ Je = console.log, Ge = console.info, Xe = console.warn, Ze = console.error, Qe = console.group, et = console.groupCollapsed, tt = console.groupEnd;
472
+ var a = {
473
+ configurable: !0,
474
+ enumerable: !0,
475
+ value: rt,
476
+ writable: !0
477
+ };
478
+ Object.defineProperties(console, {
479
+ info: a,
480
+ log: a,
481
+ warn: a,
482
+ error: a,
483
+ group: a,
484
+ groupCollapsed: a,
485
+ groupEnd: a
486
+ });
487
+ }
488
+ re++;
489
+ }
490
+ }
491
+ function Ht() {
492
+ {
493
+ if (re--, re === 0) {
494
+ var a = {
495
+ configurable: !0,
496
+ enumerable: !0,
497
+ writable: !0
498
+ };
499
+ Object.defineProperties(console, {
500
+ log: K({}, a, {
501
+ value: Je
502
+ }),
503
+ info: K({}, a, {
504
+ value: Ge
505
+ }),
506
+ warn: K({}, a, {
507
+ value: Xe
508
+ }),
509
+ error: K({}, a, {
510
+ value: Ze
511
+ }),
512
+ group: K({}, a, {
513
+ value: Qe
514
+ }),
515
+ groupCollapsed: K({}, a, {
516
+ value: et
517
+ }),
518
+ groupEnd: K({}, a, {
519
+ value: tt
520
+ })
521
+ });
522
+ }
523
+ re < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
524
+ }
525
+ }
526
+ var Ne = N.ReactCurrentDispatcher, _e;
527
+ function ve(a, d, g) {
528
+ {
529
+ if (_e === void 0)
530
+ try {
531
+ throw Error();
532
+ } catch (P) {
533
+ var x = P.stack.trim().match(/\n( *(at )?)/);
534
+ _e = x && x[1] || "";
535
+ }
536
+ return `
537
+ ` + _e + a;
538
+ }
539
+ }
540
+ var Oe = !1, ge;
541
+ {
542
+ var Jt = typeof WeakMap == "function" ? WeakMap : Map;
543
+ ge = new Jt();
544
+ }
545
+ function nt(a, d) {
546
+ if (!a || Oe)
547
+ return "";
548
+ {
549
+ var g = ge.get(a);
550
+ if (g !== void 0)
551
+ return g;
552
+ }
553
+ var x;
554
+ Oe = !0;
555
+ var P = Error.prepareStackTrace;
556
+ Error.prepareStackTrace = void 0;
557
+ var T;
558
+ T = Ne.current, Ne.current = null, qt();
559
+ try {
560
+ if (d) {
561
+ var S = function() {
562
+ throw Error();
563
+ };
564
+ if (Object.defineProperty(S.prototype, "props", {
565
+ set: function() {
566
+ throw Error();
567
+ }
568
+ }), typeof Reflect == "object" && Reflect.construct) {
569
+ try {
570
+ Reflect.construct(S, []);
571
+ } catch (L) {
572
+ x = L;
573
+ }
574
+ Reflect.construct(a, [], S);
575
+ } else {
576
+ try {
577
+ S.call();
578
+ } catch (L) {
579
+ x = L;
580
+ }
581
+ a.call(S.prototype);
582
+ }
583
+ } else {
584
+ try {
585
+ throw Error();
586
+ } catch (L) {
587
+ x = L;
588
+ }
589
+ a();
590
+ }
591
+ } catch (L) {
592
+ if (L && x && typeof L.stack == "string") {
593
+ for (var R = L.stack.split(`
594
+ `), k = x.stack.split(`
595
+ `), j = R.length - 1, D = k.length - 1; j >= 1 && D >= 0 && R[j] !== k[D]; )
596
+ D--;
597
+ for (; j >= 1 && D >= 0; j--, D--)
598
+ if (R[j] !== k[D]) {
599
+ if (j !== 1 || D !== 1)
600
+ do
601
+ if (j--, D--, D < 0 || R[j] !== k[D]) {
602
+ var F = `
603
+ ` + R[j].replace(" at new ", " at ");
604
+ return a.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", a.displayName)), typeof a == "function" && ge.set(a, F), F;
605
+ }
606
+ while (j >= 1 && D >= 0);
607
+ break;
608
+ }
609
+ }
610
+ } finally {
611
+ Oe = !1, Ne.current = T, Ht(), Error.prepareStackTrace = P;
612
+ }
613
+ var J = a ? a.displayName || a.name : "", q = J ? ve(J) : "";
614
+ return typeof a == "function" && ge.set(a, q), q;
615
+ }
616
+ function Gt(a, d, g) {
617
+ return nt(a, !1);
618
+ }
619
+ function Xt(a) {
620
+ var d = a.prototype;
621
+ return !!(d && d.isReactComponent);
622
+ }
623
+ function ye(a, d, g) {
624
+ if (a == null)
625
+ return "";
626
+ if (typeof a == "function")
627
+ return nt(a, Xt(a));
628
+ if (typeof a == "string")
629
+ return ve(a);
630
+ switch (a) {
631
+ case u:
632
+ return ve("Suspense");
633
+ case p:
634
+ return ve("SuspenseList");
635
+ }
636
+ if (typeof a == "object")
637
+ switch (a.$$typeof) {
638
+ case l:
639
+ return Gt(a.render);
640
+ case f:
641
+ return ye(a.type, d, g);
642
+ case m: {
643
+ var x = a, P = x._payload, T = x._init;
644
+ try {
645
+ return ye(T(P), d, g);
646
+ } catch {
647
+ }
648
+ }
649
+ }
650
+ return "";
651
+ }
652
+ var ne = Object.prototype.hasOwnProperty, at = {}, ot = N.ReactDebugCurrentFrame;
653
+ function Ee(a) {
654
+ if (a) {
655
+ var d = a._owner, g = ye(a.type, a._source, d ? d.type : null);
656
+ ot.setExtraStackFrame(g);
657
+ } else
658
+ ot.setExtraStackFrame(null);
659
+ }
660
+ function Zt(a, d, g, x, P) {
661
+ {
662
+ var T = Function.call.bind(ne);
663
+ for (var S in a)
664
+ if (T(a, S)) {
665
+ var R = void 0;
666
+ try {
667
+ if (typeof a[S] != "function") {
668
+ var k = Error((x || "React class") + ": " + g + " type `" + S + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[S] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
669
+ throw k.name = "Invariant Violation", k;
670
+ }
671
+ R = a[S](d, S, x, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
672
+ } catch (j) {
673
+ R = j;
674
+ }
675
+ R && !(R instanceof Error) && (Ee(P), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", x || "React class", g, S, typeof R), Ee(null)), R instanceof Error && !(R.message in at) && (at[R.message] = !0, Ee(P), v("Failed %s type: %s", g, R.message), Ee(null));
676
+ }
677
+ }
678
+ }
679
+ var Qt = Array.isArray;
680
+ function Pe(a) {
681
+ return Qt(a);
682
+ }
683
+ function er(a) {
684
+ {
685
+ var d = typeof Symbol == "function" && Symbol.toStringTag, g = d && a[Symbol.toStringTag] || a.constructor.name || "Object";
686
+ return g;
687
+ }
688
+ }
689
+ function tr(a) {
690
+ try {
691
+ return it(a), !1;
692
+ } catch {
693
+ return !0;
694
+ }
695
+ }
696
+ function it(a) {
697
+ return "" + a;
698
+ }
699
+ function st(a) {
700
+ if (tr(a))
701
+ return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(a)), it(a);
702
+ }
703
+ var lt = N.ReactCurrentOwner, rr = {
704
+ key: !0,
705
+ ref: !0,
706
+ __self: !0,
707
+ __source: !0
708
+ }, ut, ct;
709
+ function nr(a) {
710
+ if (ne.call(a, "ref")) {
711
+ var d = Object.getOwnPropertyDescriptor(a, "ref").get;
712
+ if (d && d.isReactWarning)
713
+ return !1;
714
+ }
715
+ return a.ref !== void 0;
716
+ }
717
+ function ar(a) {
718
+ if (ne.call(a, "key")) {
719
+ var d = Object.getOwnPropertyDescriptor(a, "key").get;
720
+ if (d && d.isReactWarning)
721
+ return !1;
722
+ }
723
+ return a.key !== void 0;
724
+ }
725
+ function or(a, d) {
726
+ typeof a.ref == "string" && lt.current;
727
+ }
728
+ function ir(a, d) {
729
+ {
730
+ var g = function() {
731
+ ut || (ut = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
732
+ };
733
+ g.isReactWarning = !0, Object.defineProperty(a, "key", {
734
+ get: g,
735
+ configurable: !0
736
+ });
737
+ }
738
+ }
739
+ function sr(a, d) {
740
+ {
741
+ var g = function() {
742
+ ct || (ct = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", d));
743
+ };
744
+ g.isReactWarning = !0, Object.defineProperty(a, "ref", {
745
+ get: g,
746
+ configurable: !0
747
+ });
748
+ }
749
+ }
750
+ var lr = function(a, d, g, x, P, T, S) {
751
+ var R = {
752
+ // This tag allows us to uniquely identify this as a React Element
753
+ $$typeof: t,
754
+ // Built-in properties that belong on the element
755
+ type: a,
756
+ key: d,
757
+ ref: g,
758
+ props: S,
759
+ // Record the component responsible for creating this element.
760
+ _owner: T
761
+ };
762
+ return R._store = {}, Object.defineProperty(R._store, "validated", {
763
+ configurable: !1,
764
+ enumerable: !1,
765
+ writable: !0,
766
+ value: !1
767
+ }), Object.defineProperty(R, "_self", {
768
+ configurable: !1,
769
+ enumerable: !1,
770
+ writable: !1,
771
+ value: x
772
+ }), Object.defineProperty(R, "_source", {
773
+ configurable: !1,
774
+ enumerable: !1,
775
+ writable: !1,
776
+ value: P
777
+ }), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
778
+ };
779
+ function ur(a, d, g, x, P) {
780
+ {
781
+ var T, S = {}, R = null, k = null;
782
+ g !== void 0 && (st(g), R = "" + g), ar(d) && (st(d.key), R = "" + d.key), nr(d) && (k = d.ref, or(d, P));
783
+ for (T in d)
784
+ ne.call(d, T) && !rr.hasOwnProperty(T) && (S[T] = d[T]);
785
+ if (a && a.defaultProps) {
786
+ var j = a.defaultProps;
787
+ for (T in j)
788
+ S[T] === void 0 && (S[T] = j[T]);
789
+ }
790
+ if (R || k) {
791
+ var D = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
792
+ R && ir(S, D), k && sr(S, D);
793
+ }
794
+ return lr(a, R, k, P, x, lt.current, S);
795
+ }
796
+ }
797
+ var Te = N.ReactCurrentOwner, ft = N.ReactDebugCurrentFrame;
798
+ function H(a) {
799
+ if (a) {
800
+ var d = a._owner, g = ye(a.type, a._source, d ? d.type : null);
801
+ ft.setExtraStackFrame(g);
802
+ } else
803
+ ft.setExtraStackFrame(null);
804
+ }
805
+ var Ae;
806
+ Ae = !1;
807
+ function je(a) {
808
+ return typeof a == "object" && a !== null && a.$$typeof === t;
809
+ }
810
+ function dt() {
811
+ {
812
+ if (Te.current) {
813
+ var a = W(Te.current.type);
814
+ if (a)
815
+ return `
816
+
817
+ Check the render method of \`` + a + "`.";
818
+ }
819
+ return "";
820
+ }
821
+ }
822
+ function cr(a) {
823
+ return "";
824
+ }
825
+ var pt = {};
826
+ function fr(a) {
827
+ {
828
+ var d = dt();
829
+ if (!d) {
830
+ var g = typeof a == "string" ? a : a.displayName || a.name;
831
+ g && (d = `
832
+
833
+ Check the top-level render call using <` + g + ">.");
834
+ }
835
+ return d;
836
+ }
837
+ }
838
+ function ht(a, d) {
839
+ {
840
+ if (!a._store || a._store.validated || a.key != null)
841
+ return;
842
+ a._store.validated = !0;
843
+ var g = fr(d);
844
+ if (pt[g])
845
+ return;
846
+ pt[g] = !0;
847
+ var x = "";
848
+ a && a._owner && a._owner !== Te.current && (x = " It was passed a child from " + W(a._owner.type) + "."), H(a), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, x), H(null);
849
+ }
850
+ }
851
+ function mt(a, d) {
852
+ {
853
+ if (typeof a != "object")
854
+ return;
855
+ if (Pe(a))
856
+ for (var g = 0; g < a.length; g++) {
857
+ var x = a[g];
858
+ je(x) && ht(x, d);
859
+ }
860
+ else if (je(a))
861
+ a._store && (a._store.validated = !0);
862
+ else if (a) {
863
+ var P = y(a);
864
+ if (typeof P == "function" && P !== a.entries)
865
+ for (var T = P.call(a), S; !(S = T.next()).done; )
866
+ je(S.value) && ht(S.value, d);
867
+ }
868
+ }
869
+ }
870
+ function dr(a) {
871
+ {
872
+ var d = a.type;
873
+ if (d == null || typeof d == "string")
874
+ return;
875
+ var g;
876
+ if (typeof d == "function")
877
+ g = d.propTypes;
878
+ else if (typeof d == "object" && (d.$$typeof === l || // Note: Memo only checks outer props here.
879
+ // Inner props are checked in the reconciler.
880
+ d.$$typeof === f))
881
+ g = d.propTypes;
882
+ else
883
+ return;
884
+ if (g) {
885
+ var x = W(d);
886
+ Zt(g, a.props, "prop", x, a);
887
+ } else if (d.PropTypes !== void 0 && !Ae) {
888
+ Ae = !0;
889
+ var P = W(d);
890
+ v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", P || "Unknown");
891
+ }
892
+ typeof d.getDefaultProps == "function" && !d.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
893
+ }
894
+ }
895
+ function pr(a) {
896
+ {
897
+ for (var d = Object.keys(a.props), g = 0; g < d.length; g++) {
898
+ var x = d[g];
899
+ if (x !== "children" && x !== "key") {
900
+ H(a), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", x), H(null);
901
+ break;
902
+ }
903
+ }
904
+ a.ref !== null && (H(a), v("Invalid attribute `ref` supplied to `React.Fragment`."), H(null));
905
+ }
906
+ }
907
+ var vt = {};
908
+ function gt(a, d, g, x, P, T) {
909
+ {
910
+ var S = te(a);
911
+ if (!S) {
912
+ var R = "";
913
+ (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
914
+ var k = cr();
915
+ k ? R += k : R += dt();
916
+ var j;
917
+ a === null ? j = "null" : Pe(a) ? j = "array" : a !== void 0 && a.$$typeof === t ? (j = "<" + (W(a.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : j = typeof a, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", j, R);
918
+ }
919
+ var D = ur(a, d, g, P, T);
920
+ if (D == null)
921
+ return D;
922
+ if (S) {
923
+ var F = d.children;
924
+ if (F !== void 0)
925
+ if (x)
926
+ if (Pe(F)) {
927
+ for (var J = 0; J < F.length; J++)
928
+ mt(F[J], a);
929
+ Object.freeze && Object.freeze(F);
930
+ } else
931
+ v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
932
+ else
933
+ mt(F, a);
934
+ }
935
+ if (ne.call(d, "key")) {
936
+ var q = W(a), L = Object.keys(d).filter(function(Er) {
937
+ return Er !== "key";
938
+ }), De = L.length > 0 ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}";
939
+ if (!vt[q + De]) {
940
+ var yr = L.length > 0 ? "{" + L.join(": ..., ") + ": ...}" : "{}";
941
+ v(`A props object containing a "key" prop is being spread into JSX:
942
+ let props = %s;
943
+ <%s {...props} />
944
+ React keys must be passed directly to JSX without using spread:
945
+ let props = %s;
946
+ <%s key={someKey} {...props} />`, De, q, yr, q), vt[q + De] = !0;
947
+ }
948
+ }
949
+ return a === n ? pr(D) : dr(D), D;
950
+ }
951
+ }
952
+ function hr(a, d, g) {
953
+ return gt(a, d, g, !0);
954
+ }
955
+ function mr(a, d, g) {
956
+ return gt(a, d, g, !1);
957
+ }
958
+ var vr = mr, gr = hr;
959
+ oe.Fragment = n, oe.jsx = vr, oe.jsxs = gr;
960
+ }()), oe;
961
+ }
962
+ process.env.NODE_ENV === "production" ? Ve.exports = Or() : Ve.exports = Pr();
963
+ var E = Ve.exports;
964
+ /**
965
+ * @remix-run/router v1.23.2
966
+ *
967
+ * Copyright (c) Remix Software Inc.
968
+ *
969
+ * This source code is licensed under the MIT license found in the
970
+ * LICENSE.md file in the root directory of this source tree.
971
+ *
972
+ * @license MIT
973
+ */
974
+ function ie() {
975
+ return ie = Object.assign ? Object.assign.bind() : function(e) {
976
+ for (var t = 1; t < arguments.length; t++) {
977
+ var r = arguments[t];
978
+ for (var n in r)
979
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
980
+ }
981
+ return e;
982
+ }, ie.apply(this, arguments);
983
+ }
984
+ var Y;
985
+ (function(e) {
986
+ e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
987
+ })(Y || (Y = {}));
988
+ const xt = "popstate";
989
+ function Tr(e) {
990
+ e === void 0 && (e = {});
991
+ function t(n, o) {
992
+ let {
993
+ pathname: i,
994
+ search: s,
995
+ hash: c
996
+ } = n.location;
997
+ return Me(
998
+ "",
999
+ {
1000
+ pathname: i,
1001
+ search: s,
1002
+ hash: c
1003
+ },
1004
+ // state defaults to `null` because `window.history.state` does
1005
+ o.state && o.state.usr || null,
1006
+ o.state && o.state.key || "default"
1007
+ );
1008
+ }
1009
+ function r(n, o) {
1010
+ return typeof o == "string" ? o : se(o);
1011
+ }
1012
+ return jr(t, r, null, e);
1013
+ }
1014
+ function b(e, t) {
1015
+ if (e === !1 || e === null || typeof e > "u")
1016
+ throw new Error(t);
1017
+ }
1018
+ function V(e, t) {
1019
+ if (!e) {
1020
+ typeof console < "u" && console.warn(t);
1021
+ try {
1022
+ throw new Error(t);
1023
+ } catch {
1024
+ }
1025
+ }
1026
+ }
1027
+ function Ar() {
1028
+ return Math.random().toString(36).substr(2, 8);
1029
+ }
1030
+ function bt(e, t) {
1031
+ return {
1032
+ usr: e.state,
1033
+ key: e.key,
1034
+ idx: t
1035
+ };
1036
+ }
1037
+ function Me(e, t, r, n) {
1038
+ return r === void 0 && (r = null), ie({
1039
+ pathname: typeof e == "string" ? e : e.pathname,
1040
+ search: "",
1041
+ hash: ""
1042
+ }, typeof t == "string" ? X(t) : t, {
1043
+ state: r,
1044
+ // TODO: This could be cleaned up. push/replace should probably just take
1045
+ // full Locations now and avoid the need to run through this flow at all
1046
+ // But that's a pretty big refactor to the current test suite so going to
1047
+ // keep as is for the time being and just let any incoming keys take precedence
1048
+ key: t && t.key || n || Ar()
1049
+ });
1050
+ }
1051
+ function se(e) {
1052
+ let {
1053
+ pathname: t = "/",
1054
+ search: r = "",
1055
+ hash: n = ""
1056
+ } = e;
1057
+ return r && r !== "?" && (t += r.charAt(0) === "?" ? r : "?" + r), n && n !== "#" && (t += n.charAt(0) === "#" ? n : "#" + n), t;
1058
+ }
1059
+ function X(e) {
1060
+ let t = {};
1061
+ if (e) {
1062
+ let r = e.indexOf("#");
1063
+ r >= 0 && (t.hash = e.substr(r), e = e.substr(0, r));
1064
+ let n = e.indexOf("?");
1065
+ n >= 0 && (t.search = e.substr(n), e = e.substr(0, n)), e && (t.pathname = e);
1066
+ }
1067
+ return t;
1068
+ }
1069
+ function jr(e, t, r, n) {
1070
+ n === void 0 && (n = {});
1071
+ let {
1072
+ window: o = document.defaultView,
1073
+ v5Compat: i = !1
1074
+ } = n, s = o.history, c = Y.Pop, l = null, u = p();
1075
+ u == null && (u = 0, s.replaceState(ie({}, s.state, {
1076
+ idx: u
1077
+ }), ""));
1078
+ function p() {
1079
+ return (s.state || {
1080
+ idx: null
1081
+ }).idx;
1082
+ }
1083
+ function f() {
1084
+ c = Y.Pop;
1085
+ let y = p(), N = y == null ? null : y - u;
1086
+ u = y, l && l({
1087
+ action: c,
1088
+ location: _.location,
1089
+ delta: N
1090
+ });
1091
+ }
1092
+ function m(y, N) {
1093
+ c = Y.Push;
1094
+ let v = Me(_.location, y, N);
1095
+ u = p() + 1;
1096
+ let O = bt(v, u), A = _.createHref(v);
1097
+ try {
1098
+ s.pushState(O, "", A);
1099
+ } catch (U) {
1100
+ if (U instanceof DOMException && U.name === "DataCloneError")
1101
+ throw U;
1102
+ o.location.assign(A);
1103
+ }
1104
+ i && l && l({
1105
+ action: c,
1106
+ location: _.location,
1107
+ delta: 1
1108
+ });
1109
+ }
1110
+ function w(y, N) {
1111
+ c = Y.Replace;
1112
+ let v = Me(_.location, y, N);
1113
+ u = p();
1114
+ let O = bt(v, u), A = _.createHref(v);
1115
+ s.replaceState(O, "", A), i && l && l({
1116
+ action: c,
1117
+ location: _.location,
1118
+ delta: 0
1119
+ });
1120
+ }
1121
+ function C(y) {
1122
+ let N = o.location.origin !== "null" ? o.location.origin : o.location.href, v = typeof y == "string" ? y : se(y);
1123
+ return v = v.replace(/ $/, "%20"), b(N, "No window.location.(origin|href) available to create URL for href: " + v), new URL(v, N);
1124
+ }
1125
+ let _ = {
1126
+ get action() {
1127
+ return c;
1128
+ },
1129
+ get location() {
1130
+ return e(o, s);
1131
+ },
1132
+ listen(y) {
1133
+ if (l)
1134
+ throw new Error("A history only accepts one active listener");
1135
+ return o.addEventListener(xt, f), l = y, () => {
1136
+ o.removeEventListener(xt, f), l = null;
1137
+ };
1138
+ },
1139
+ createHref(y) {
1140
+ return t(o, y);
1141
+ },
1142
+ createURL: C,
1143
+ encodeLocation(y) {
1144
+ let N = C(y);
1145
+ return {
1146
+ pathname: N.pathname,
1147
+ search: N.search,
1148
+ hash: N.hash
1149
+ };
1150
+ },
1151
+ push: m,
1152
+ replace: w,
1153
+ go(y) {
1154
+ return s.go(y);
1155
+ }
1156
+ };
1157
+ return _;
1158
+ }
1159
+ var wt;
1160
+ (function(e) {
1161
+ e.data = "data", e.deferred = "deferred", e.redirect = "redirect", e.error = "error";
1162
+ })(wt || (wt = {}));
1163
+ function Dr(e, t, r) {
1164
+ return r === void 0 && (r = "/"), kr(e, t, r);
1165
+ }
1166
+ function kr(e, t, r, n) {
1167
+ let o = typeof t == "string" ? X(t) : t, i = z(o.pathname || "/", r);
1168
+ if (i == null)
1169
+ return null;
1170
+ let s = Dt(e);
1171
+ Lr(s);
1172
+ let c = null;
1173
+ for (let l = 0; c == null && l < s.length; ++l) {
1174
+ let u = Kr(i);
1175
+ c = Yr(s[l], u);
1176
+ }
1177
+ return c;
1178
+ }
1179
+ function Dt(e, t, r, n) {
1180
+ t === void 0 && (t = []), r === void 0 && (r = []), n === void 0 && (n = "");
1181
+ let o = (i, s, c) => {
1182
+ let l = {
1183
+ relativePath: c === void 0 ? i.path || "" : c,
1184
+ caseSensitive: i.caseSensitive === !0,
1185
+ childrenIndex: s,
1186
+ route: i
1187
+ };
1188
+ l.relativePath.startsWith("/") && (b(l.relativePath.startsWith(n), 'Absolute route path "' + l.relativePath + '" nested under path ' + ('"' + n + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes."), l.relativePath = l.relativePath.slice(n.length));
1189
+ let u = $([n, l.relativePath]), p = r.concat(l);
1190
+ i.children && i.children.length > 0 && (b(
1191
+ // Our types know better, but runtime JS may not!
1192
+ // @ts-expect-error
1193
+ i.index !== !0,
1194
+ "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + u + '".')
1195
+ ), Dt(i.children, t, p, u)), !(i.path == null && !i.index) && t.push({
1196
+ path: u,
1197
+ score: Br(u, i.index),
1198
+ routesMeta: p
1199
+ });
1200
+ };
1201
+ return e.forEach((i, s) => {
1202
+ var c;
1203
+ if (i.path === "" || !((c = i.path) != null && c.includes("?")))
1204
+ o(i, s);
1205
+ else
1206
+ for (let l of kt(i.path))
1207
+ o(i, s, l);
1208
+ }), t;
1209
+ }
1210
+ function kt(e) {
1211
+ let t = e.split("/");
1212
+ if (t.length === 0) return [];
1213
+ let [r, ...n] = t, o = r.endsWith("?"), i = r.replace(/\?$/, "");
1214
+ if (n.length === 0)
1215
+ return o ? [i, ""] : [i];
1216
+ let s = kt(n.join("/")), c = [];
1217
+ return c.push(...s.map((l) => l === "" ? i : [i, l].join("/"))), o && c.push(...s), c.map((l) => e.startsWith("/") && l === "" ? "/" : l);
1218
+ }
1219
+ function Lr(e) {
1220
+ e.sort((t, r) => t.score !== r.score ? r.score - t.score : Wr(t.routesMeta.map((n) => n.childrenIndex), r.routesMeta.map((n) => n.childrenIndex)));
1221
+ }
1222
+ const Fr = /^:[\w-]+$/, Ir = 3, Vr = 2, Mr = 1, Ur = 10, $r = -2, Rt = (e) => e === "*";
1223
+ function Br(e, t) {
1224
+ let r = e.split("/"), n = r.length;
1225
+ return r.some(Rt) && (n += $r), t && (n += Vr), r.filter((o) => !Rt(o)).reduce((o, i) => o + (Fr.test(i) ? Ir : i === "" ? Mr : Ur), n);
1226
+ }
1227
+ function Wr(e, t) {
1228
+ return e.length === t.length && e.slice(0, -1).every((n, o) => n === t[o]) ? (
1229
+ // If two routes are siblings, we should try to match the earlier sibling
1230
+ // first. This allows people to have fine-grained control over the matching
1231
+ // behavior by simply putting routes with identical paths in the order they
1232
+ // want them tried.
1233
+ e[e.length - 1] - t[t.length - 1]
1234
+ ) : (
1235
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
1236
+ // so they sort equally.
1237
+ 0
1238
+ );
1239
+ }
1240
+ function Yr(e, t, r) {
1241
+ let {
1242
+ routesMeta: n
1243
+ } = e, o = {}, i = "/", s = [];
1244
+ for (let c = 0; c < n.length; ++c) {
1245
+ let l = n[c], u = c === n.length - 1, p = i === "/" ? t : t.slice(i.length) || "/", f = Ue({
1246
+ path: l.relativePath,
1247
+ caseSensitive: l.caseSensitive,
1248
+ end: u
1249
+ }, p), m = l.route;
1250
+ if (!f)
1251
+ return null;
1252
+ Object.assign(o, f.params), s.push({
1253
+ // TODO: Can this as be avoided?
1254
+ params: o,
1255
+ pathname: $([i, f.pathname]),
1256
+ pathnameBase: Xr($([i, f.pathnameBase])),
1257
+ route: m
1258
+ }), f.pathnameBase !== "/" && (i = $([i, f.pathnameBase]));
1259
+ }
1260
+ return s;
1261
+ }
1262
+ function Ue(e, t) {
1263
+ typeof e == "string" && (e = {
1264
+ path: e,
1265
+ caseSensitive: !1,
1266
+ end: !0
1267
+ });
1268
+ let [r, n] = zr(e.path, e.caseSensitive, e.end), o = t.match(r);
1269
+ if (!o) return null;
1270
+ let i = o[0], s = i.replace(/(.)\/+$/, "$1"), c = o.slice(1);
1271
+ return {
1272
+ params: n.reduce((u, p, f) => {
1273
+ let {
1274
+ paramName: m,
1275
+ isOptional: w
1276
+ } = p;
1277
+ if (m === "*") {
1278
+ let _ = c[f] || "";
1279
+ s = i.slice(0, i.length - _.length).replace(/(.)\/+$/, "$1");
1280
+ }
1281
+ const C = c[f];
1282
+ return w && !C ? u[m] = void 0 : u[m] = (C || "").replace(/%2F/g, "/"), u;
1283
+ }, {}),
1284
+ pathname: i,
1285
+ pathnameBase: s,
1286
+ pattern: e
1287
+ };
1288
+ }
1289
+ function zr(e, t, r) {
1290
+ t === void 0 && (t = !1), r === void 0 && (r = !0), V(e === "*" || !e.endsWith("*") || e.endsWith("/*"), 'Route path "' + e + '" will be treated as if it were ' + ('"' + e.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + e.replace(/\*$/, "/*") + '".'));
1291
+ let n = [], o = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (s, c, l) => (n.push({
1292
+ paramName: c,
1293
+ isOptional: l != null
1294
+ }), l ? "/?([^\\/]+)?" : "/([^\\/]+)"));
1295
+ return e.endsWith("*") ? (n.push({
1296
+ paramName: "*"
1297
+ }), o += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? o += "\\/*$" : e !== "" && e !== "/" && (o += "(?:(?=\\/|$))"), [new RegExp(o, t ? void 0 : "i"), n];
1298
+ }
1299
+ function Kr(e) {
1300
+ try {
1301
+ return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
1302
+ } catch (t) {
1303
+ return V(!1, 'The URL path "' + e + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + t + ").")), e;
1304
+ }
1305
+ }
1306
+ function z(e, t) {
1307
+ if (t === "/") return e;
1308
+ if (!e.toLowerCase().startsWith(t.toLowerCase()))
1309
+ return null;
1310
+ let r = t.endsWith("/") ? t.length - 1 : t.length, n = e.charAt(r);
1311
+ return n && n !== "/" ? null : e.slice(r) || "/";
1312
+ }
1313
+ const qr = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, Hr = (e) => qr.test(e);
1314
+ function Jr(e, t) {
1315
+ t === void 0 && (t = "/");
1316
+ let {
1317
+ pathname: r,
1318
+ search: n = "",
1319
+ hash: o = ""
1320
+ } = typeof e == "string" ? X(e) : e, i;
1321
+ if (r)
1322
+ if (Hr(r))
1323
+ i = r;
1324
+ else {
1325
+ if (r.includes("//")) {
1326
+ let s = r;
1327
+ r = r.replace(/\/\/+/g, "/"), V(!1, "Pathnames cannot have embedded double slashes - normalizing " + (s + " -> " + r));
1328
+ }
1329
+ r.startsWith("/") ? i = Ct(r.substring(1), "/") : i = Ct(r, t);
1330
+ }
1331
+ else
1332
+ i = t;
1333
+ return {
1334
+ pathname: i,
1335
+ search: Zr(n),
1336
+ hash: Qr(o)
1337
+ };
1338
+ }
1339
+ function Ct(e, t) {
1340
+ let r = t.replace(/\/+$/, "").split("/");
1341
+ return e.split("/").forEach((o) => {
1342
+ o === ".." ? r.length > 1 && r.pop() : o !== "." && r.push(o);
1343
+ }), r.length > 1 ? r.join("/") : "/";
1344
+ }
1345
+ function ke(e, t, r, n) {
1346
+ return "Cannot include a '" + e + "' character in a manually specified " + ("`to." + t + "` field [" + JSON.stringify(n) + "]. Please separate it out to the ") + ("`to." + r + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
1347
+ }
1348
+ function Gr(e) {
1349
+ return e.filter((t, r) => r === 0 || t.route.path && t.route.path.length > 0);
1350
+ }
1351
+ function Lt(e, t) {
1352
+ let r = Gr(e);
1353
+ return t ? r.map((n, o) => o === r.length - 1 ? n.pathname : n.pathnameBase) : r.map((n) => n.pathnameBase);
1354
+ }
1355
+ function Ft(e, t, r, n) {
1356
+ n === void 0 && (n = !1);
1357
+ let o;
1358
+ typeof e == "string" ? o = X(e) : (o = ie({}, e), b(!o.pathname || !o.pathname.includes("?"), ke("?", "pathname", "search", o)), b(!o.pathname || !o.pathname.includes("#"), ke("#", "pathname", "hash", o)), b(!o.search || !o.search.includes("#"), ke("#", "search", "hash", o)));
1359
+ let i = e === "" || o.pathname === "", s = i ? "/" : o.pathname, c;
1360
+ if (s == null)
1361
+ c = r;
1362
+ else {
1363
+ let f = t.length - 1;
1364
+ if (!n && s.startsWith("..")) {
1365
+ let m = s.split("/");
1366
+ for (; m[0] === ".."; )
1367
+ m.shift(), f -= 1;
1368
+ o.pathname = m.join("/");
1369
+ }
1370
+ c = f >= 0 ? t[f] : "/";
1371
+ }
1372
+ let l = Jr(o, c), u = s && s !== "/" && s.endsWith("/"), p = (i || s === ".") && r.endsWith("/");
1373
+ return !l.pathname.endsWith("/") && (u || p) && (l.pathname += "/"), l;
1374
+ }
1375
+ const $ = (e) => e.join("/").replace(/\/\/+/g, "/"), Xr = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), Zr = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, Qr = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
1376
+ function en(e) {
1377
+ return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
1378
+ }
1379
+ const It = ["post", "put", "patch", "delete"];
1380
+ new Set(It);
1381
+ const tn = ["get", ...It];
1382
+ new Set(tn);
1383
+ /**
1384
+ * React Router v6.30.3
1385
+ *
1386
+ * Copyright (c) Remix Software Inc.
1387
+ *
1388
+ * This source code is licensed under the MIT license found in the
1389
+ * LICENSE.md file in the root directory of this source tree.
1390
+ *
1391
+ * @license MIT
1392
+ */
1393
+ function le() {
1394
+ return le = Object.assign ? Object.assign.bind() : function(e) {
1395
+ for (var t = 1; t < arguments.length; t++) {
1396
+ var r = arguments[t];
1397
+ for (var n in r)
1398
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
1399
+ }
1400
+ return e;
1401
+ }, le.apply(this, arguments);
1402
+ }
1403
+ const ce = /* @__PURE__ */ h.createContext(null);
1404
+ process.env.NODE_ENV !== "production" && (ce.displayName = "DataRouter");
1405
+ const We = /* @__PURE__ */ h.createContext(null);
1406
+ process.env.NODE_ENV !== "production" && (We.displayName = "DataRouterState");
1407
+ const rn = /* @__PURE__ */ h.createContext(null);
1408
+ process.env.NODE_ENV !== "production" && (rn.displayName = "Await");
1409
+ const M = /* @__PURE__ */ h.createContext(null);
1410
+ process.env.NODE_ENV !== "production" && (M.displayName = "Navigation");
1411
+ const fe = /* @__PURE__ */ h.createContext(null);
1412
+ process.env.NODE_ENV !== "production" && (fe.displayName = "Location");
1413
+ const B = /* @__PURE__ */ h.createContext({
1414
+ outlet: null,
1415
+ matches: [],
1416
+ isDataRoute: !1
1417
+ });
1418
+ process.env.NODE_ENV !== "production" && (B.displayName = "Route");
1419
+ const Ye = /* @__PURE__ */ h.createContext(null);
1420
+ process.env.NODE_ENV !== "production" && (Ye.displayName = "RouteError");
1421
+ function nn(e, t) {
1422
+ let {
1423
+ relative: r
1424
+ } = t === void 0 ? {} : t;
1425
+ de() || (process.env.NODE_ENV !== "production" ? b(
1426
+ !1,
1427
+ // TODO: This error is probably because they somehow have 2 versions of the
1428
+ // router loaded. We can help them understand how to avoid that.
1429
+ "useHref() may be used only in the context of a <Router> component."
1430
+ ) : b(!1));
1431
+ let {
1432
+ basename: n,
1433
+ navigator: o
1434
+ } = h.useContext(M), {
1435
+ hash: i,
1436
+ pathname: s,
1437
+ search: c
1438
+ } = pe(e, {
1439
+ relative: r
1440
+ }), l = s;
1441
+ return n !== "/" && (l = s === "/" ? n : $([n, s])), o.createHref({
1442
+ pathname: l,
1443
+ search: c,
1444
+ hash: i
1445
+ });
1446
+ }
1447
+ function de() {
1448
+ return h.useContext(fe) != null;
1449
+ }
1450
+ function Z() {
1451
+ return de() || (process.env.NODE_ENV !== "production" ? b(
1452
+ !1,
1453
+ // TODO: This error is probably because they somehow have 2 versions of the
1454
+ // router loaded. We can help them understand how to avoid that.
1455
+ "useLocation() may be used only in the context of a <Router> component."
1456
+ ) : b(!1)), h.useContext(fe).location;
1457
+ }
1458
+ const Vt = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
1459
+ function Mt(e) {
1460
+ h.useContext(M).static || h.useLayoutEffect(e);
1461
+ }
1462
+ function Ut() {
1463
+ let {
1464
+ isDataRoute: e
1465
+ } = h.useContext(B);
1466
+ return e ? yn() : an();
1467
+ }
1468
+ function an() {
1469
+ de() || (process.env.NODE_ENV !== "production" ? b(
1470
+ !1,
1471
+ // TODO: This error is probably because they somehow have 2 versions of the
1472
+ // router loaded. We can help them understand how to avoid that.
1473
+ "useNavigate() may be used only in the context of a <Router> component."
1474
+ ) : b(!1));
1475
+ let e = h.useContext(ce), {
1476
+ basename: t,
1477
+ future: r,
1478
+ navigator: n
1479
+ } = h.useContext(M), {
1480
+ matches: o
1481
+ } = h.useContext(B), {
1482
+ pathname: i
1483
+ } = Z(), s = JSON.stringify(Lt(o, r.v7_relativeSplatPath)), c = h.useRef(!1);
1484
+ return Mt(() => {
1485
+ c.current = !0;
1486
+ }), h.useCallback(function(u, p) {
1487
+ if (p === void 0 && (p = {}), process.env.NODE_ENV !== "production" && V(c.current, Vt), !c.current) return;
1488
+ if (typeof u == "number") {
1489
+ n.go(u);
1490
+ return;
1491
+ }
1492
+ let f = Ft(u, JSON.parse(s), i, p.relative === "path");
1493
+ e == null && t !== "/" && (f.pathname = f.pathname === "/" ? t : $([t, f.pathname])), (p.replace ? n.replace : n.push)(f, p.state, p);
1494
+ }, [t, n, s, i, e]);
1495
+ }
1496
+ function pe(e, t) {
1497
+ let {
1498
+ relative: r
1499
+ } = t === void 0 ? {} : t, {
1500
+ future: n
1501
+ } = h.useContext(M), {
1502
+ matches: o
1503
+ } = h.useContext(B), {
1504
+ pathname: i
1505
+ } = Z(), s = JSON.stringify(Lt(o, n.v7_relativeSplatPath));
1506
+ return h.useMemo(() => Ft(e, JSON.parse(s), i, r === "path"), [e, s, i, r]);
1507
+ }
1508
+ function on(e, t) {
1509
+ return sn(e, t);
1510
+ }
1511
+ function sn(e, t, r, n) {
1512
+ de() || (process.env.NODE_ENV !== "production" ? b(
1513
+ !1,
1514
+ // TODO: This error is probably because they somehow have 2 versions of the
1515
+ // router loaded. We can help them understand how to avoid that.
1516
+ "useRoutes() may be used only in the context of a <Router> component."
1517
+ ) : b(!1));
1518
+ let {
1519
+ navigator: o
1520
+ } = h.useContext(M), {
1521
+ matches: i
1522
+ } = h.useContext(B), s = i[i.length - 1], c = s ? s.params : {}, l = s ? s.pathname : "/", u = s ? s.pathnameBase : "/", p = s && s.route;
1523
+ if (process.env.NODE_ENV !== "production") {
1524
+ let v = p && p.path || "";
1525
+ Bt(l, !p || v.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ('"' + l + '" (under <Route path="' + v + '">) 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.
1526
+
1527
+ ` + ('Please change the parent <Route path="' + v + '"> to <Route ') + ('path="' + (v === "/" ? "*" : v + "/*") + '">.'));
1528
+ }
1529
+ let f = Z(), m;
1530
+ if (t) {
1531
+ var w;
1532
+ let v = typeof t == "string" ? X(t) : t;
1533
+ u === "/" || (w = v.pathname) != null && w.startsWith(u) || (process.env.NODE_ENV !== "production" ? b(!1, "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 "' + u + '" ') + ('but pathname "' + v.pathname + '" was given in the `location` prop.')) : b(!1)), m = v;
1534
+ } else
1535
+ m = f;
1536
+ let C = m.pathname || "/", _ = C;
1537
+ if (u !== "/") {
1538
+ let v = u.replace(/^\//, "").split("/");
1539
+ _ = "/" + C.replace(/^\//, "").split("/").slice(v.length).join("/");
1540
+ }
1541
+ let y = Dr(e, {
1542
+ pathname: _
1543
+ });
1544
+ process.env.NODE_ENV !== "production" && (process.env.NODE_ENV !== "production" && V(p || y != null, 'No routes matched location "' + m.pathname + m.search + m.hash + '" '), process.env.NODE_ENV !== "production" && V(y == null || y[y.length - 1].route.element !== void 0 || y[y.length - 1].route.Component !== void 0 || y[y.length - 1].route.lazy !== void 0, 'Matched leaf route at location "' + m.pathname + m.search + m.hash + '" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.'));
1545
+ let N = dn(y && y.map((v) => Object.assign({}, v, {
1546
+ params: Object.assign({}, c, v.params),
1547
+ pathname: $([
1548
+ u,
1549
+ // Re-encode pathnames that were decoded inside matchRoutes
1550
+ o.encodeLocation ? o.encodeLocation(v.pathname).pathname : v.pathname
1551
+ ]),
1552
+ pathnameBase: v.pathnameBase === "/" ? u : $([
1553
+ u,
1554
+ // Re-encode pathnames that were decoded inside matchRoutes
1555
+ o.encodeLocation ? o.encodeLocation(v.pathnameBase).pathname : v.pathnameBase
1556
+ ])
1557
+ })), i, r, n);
1558
+ return t && N ? /* @__PURE__ */ h.createElement(fe.Provider, {
1559
+ value: {
1560
+ location: le({
1561
+ pathname: "/",
1562
+ search: "",
1563
+ hash: "",
1564
+ state: null,
1565
+ key: "default"
1566
+ }, m),
1567
+ navigationType: Y.Pop
1568
+ }
1569
+ }, N) : N;
1570
+ }
1571
+ function ln() {
1572
+ let e = gn(), t = en(e) ? e.status + " " + e.statusText : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, n = "rgba(200,200,200, 0.5)", o = {
1573
+ padding: "0.5rem",
1574
+ backgroundColor: n
1575
+ }, i = {
1576
+ padding: "2px 4px",
1577
+ backgroundColor: n
1578
+ }, s = null;
1579
+ return process.env.NODE_ENV !== "production" && (console.error("Error handled by React Router default ErrorBoundary:", e), s = /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ h.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ h.createElement("code", {
1580
+ style: i
1581
+ }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ h.createElement("code", {
1582
+ style: i
1583
+ }, "errorElement"), " prop on your route."))), /* @__PURE__ */ h.createElement(h.Fragment, null, /* @__PURE__ */ h.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ h.createElement("h3", {
1584
+ style: {
1585
+ fontStyle: "italic"
1586
+ }
1587
+ }, t), r ? /* @__PURE__ */ h.createElement("pre", {
1588
+ style: o
1589
+ }, r) : null, s);
1590
+ }
1591
+ const un = /* @__PURE__ */ h.createElement(ln, null);
1592
+ class cn extends h.Component {
1593
+ constructor(t) {
1594
+ super(t), this.state = {
1595
+ location: t.location,
1596
+ revalidation: t.revalidation,
1597
+ error: t.error
1598
+ };
1599
+ }
1600
+ static getDerivedStateFromError(t) {
1601
+ return {
1602
+ error: t
1603
+ };
1604
+ }
1605
+ static getDerivedStateFromProps(t, r) {
1606
+ return r.location !== t.location || r.revalidation !== "idle" && t.revalidation === "idle" ? {
1607
+ error: t.error,
1608
+ location: t.location,
1609
+ revalidation: t.revalidation
1610
+ } : {
1611
+ error: t.error !== void 0 ? t.error : r.error,
1612
+ location: r.location,
1613
+ revalidation: t.revalidation || r.revalidation
1614
+ };
1615
+ }
1616
+ componentDidCatch(t, r) {
1617
+ console.error("React Router caught the following error during render", t, r);
1618
+ }
1619
+ render() {
1620
+ return this.state.error !== void 0 ? /* @__PURE__ */ h.createElement(B.Provider, {
1621
+ value: this.props.routeContext
1622
+ }, /* @__PURE__ */ h.createElement(Ye.Provider, {
1623
+ value: this.state.error,
1624
+ children: this.props.component
1625
+ })) : this.props.children;
1626
+ }
1627
+ }
1628
+ function fn(e) {
1629
+ let {
1630
+ routeContext: t,
1631
+ match: r,
1632
+ children: n
1633
+ } = e, o = h.useContext(ce);
1634
+ return o && o.static && o.staticContext && (r.route.errorElement || r.route.ErrorBoundary) && (o.staticContext._deepestRenderedBoundaryId = r.route.id), /* @__PURE__ */ h.createElement(B.Provider, {
1635
+ value: t
1636
+ }, n);
1637
+ }
1638
+ function dn(e, t, r, n) {
1639
+ var o;
1640
+ if (t === void 0 && (t = []), r === void 0 && (r = null), n === void 0 && (n = null), e == null) {
1641
+ var i;
1642
+ if (!r)
1643
+ return null;
1644
+ if (r.errors)
1645
+ e = r.matches;
1646
+ else if ((i = n) != null && i.v7_partialHydration && t.length === 0 && !r.initialized && r.matches.length > 0)
1647
+ e = r.matches;
1648
+ else
1649
+ return null;
1650
+ }
1651
+ let s = e, c = (o = r) == null ? void 0 : o.errors;
1652
+ if (c != null) {
1653
+ let p = s.findIndex((f) => f.route.id && (c == null ? void 0 : c[f.route.id]) !== void 0);
1654
+ p >= 0 || (process.env.NODE_ENV !== "production" ? b(!1, "Could not find a matching route for errors on route IDs: " + Object.keys(c).join(",")) : b(!1)), s = s.slice(0, Math.min(s.length, p + 1));
1655
+ }
1656
+ let l = !1, u = -1;
1657
+ if (r && n && n.v7_partialHydration)
1658
+ for (let p = 0; p < s.length; p++) {
1659
+ let f = s[p];
1660
+ if ((f.route.HydrateFallback || f.route.hydrateFallbackElement) && (u = p), f.route.id) {
1661
+ let {
1662
+ loaderData: m,
1663
+ errors: w
1664
+ } = r, C = f.route.loader && m[f.route.id] === void 0 && (!w || w[f.route.id] === void 0);
1665
+ if (f.route.lazy || C) {
1666
+ l = !0, u >= 0 ? s = s.slice(0, u + 1) : s = [s[0]];
1667
+ break;
1668
+ }
1669
+ }
1670
+ }
1671
+ return s.reduceRight((p, f, m) => {
1672
+ let w, C = !1, _ = null, y = null;
1673
+ r && (w = c && f.route.id ? c[f.route.id] : void 0, _ = f.route.errorElement || un, l && (u < 0 && m === 0 ? (Bt("route-fallback", !1, "No `HydrateFallback` element provided to render during initial hydration"), C = !0, y = null) : u === m && (C = !0, y = f.route.hydrateFallbackElement || null)));
1674
+ let N = t.concat(s.slice(0, m + 1)), v = () => {
1675
+ let O;
1676
+ return w ? O = _ : C ? O = y : f.route.Component ? O = /* @__PURE__ */ h.createElement(f.route.Component, null) : f.route.element ? O = f.route.element : O = p, /* @__PURE__ */ h.createElement(fn, {
1677
+ match: f,
1678
+ routeContext: {
1679
+ outlet: p,
1680
+ matches: N,
1681
+ isDataRoute: r != null
1682
+ },
1683
+ children: O
1684
+ });
1685
+ };
1686
+ return r && (f.route.ErrorBoundary || f.route.errorElement || m === 0) ? /* @__PURE__ */ h.createElement(cn, {
1687
+ location: r.location,
1688
+ revalidation: r.revalidation,
1689
+ component: _,
1690
+ error: w,
1691
+ children: v(),
1692
+ routeContext: {
1693
+ outlet: null,
1694
+ matches: N,
1695
+ isDataRoute: !0
1696
+ }
1697
+ }) : v();
1698
+ }, null);
1699
+ }
1700
+ var $t = /* @__PURE__ */ function(e) {
1701
+ return e.UseBlocker = "useBlocker", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e;
1702
+ }($t || {}), ue = /* @__PURE__ */ function(e) {
1703
+ return e.UseBlocker = "useBlocker", e.UseLoaderData = "useLoaderData", e.UseActionData = "useActionData", e.UseRouteError = "useRouteError", e.UseNavigation = "useNavigation", e.UseRouteLoaderData = "useRouteLoaderData", e.UseMatches = "useMatches", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e.UseRouteId = "useRouteId", e;
1704
+ }(ue || {});
1705
+ function ze(e) {
1706
+ return e + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
1707
+ }
1708
+ function pn(e) {
1709
+ let t = h.useContext(ce);
1710
+ return t || (process.env.NODE_ENV !== "production" ? b(!1, ze(e)) : b(!1)), t;
1711
+ }
1712
+ function hn(e) {
1713
+ let t = h.useContext(We);
1714
+ return t || (process.env.NODE_ENV !== "production" ? b(!1, ze(e)) : b(!1)), t;
1715
+ }
1716
+ function mn(e) {
1717
+ let t = h.useContext(B);
1718
+ return t || (process.env.NODE_ENV !== "production" ? b(!1, ze(e)) : b(!1)), t;
1719
+ }
1720
+ function Ke(e) {
1721
+ let t = mn(e), r = t.matches[t.matches.length - 1];
1722
+ return r.route.id || (process.env.NODE_ENV !== "production" ? b(!1, e + ' can only be used on routes that contain a unique "id"') : b(!1)), r.route.id;
1723
+ }
1724
+ function vn() {
1725
+ return Ke(ue.UseRouteId);
1726
+ }
1727
+ function gn() {
1728
+ var e;
1729
+ let t = h.useContext(Ye), r = hn(ue.UseRouteError), n = Ke(ue.UseRouteError);
1730
+ return t !== void 0 ? t : (e = r.errors) == null ? void 0 : e[n];
1731
+ }
1732
+ function yn() {
1733
+ let {
1734
+ router: e
1735
+ } = pn($t.UseNavigateStable), t = Ke(ue.UseNavigateStable), r = h.useRef(!1);
1736
+ return Mt(() => {
1737
+ r.current = !0;
1738
+ }), h.useCallback(function(o, i) {
1739
+ i === void 0 && (i = {}), process.env.NODE_ENV !== "production" && V(r.current, Vt), r.current && (typeof o == "number" ? e.navigate(o) : e.navigate(o, le({
1740
+ fromRouteId: t
1741
+ }, i)));
1742
+ }, [e, t]);
1743
+ }
1744
+ const St = {};
1745
+ function Bt(e, t, r) {
1746
+ !t && !St[e] && (St[e] = !0, process.env.NODE_ENV !== "production" && V(!1, r));
1747
+ }
1748
+ const Nt = {};
1749
+ function En(e, t) {
1750
+ process.env.NODE_ENV !== "production" && !Nt[t] && (Nt[t] = !0, console.warn(t));
1751
+ }
1752
+ const _t = (e, t, r) => En(e, "⚠️ React Router Future Flag Warning: " + t + ". " + ("You can use the `" + e + "` future flag to opt-in early. ") + ("For more information, see " + r + "."));
1753
+ function xn(e, t) {
1754
+ (e == null ? void 0 : e.v7_startTransition) === void 0 && _t("v7_startTransition", "React Router will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/v6/upgrading/future#v7_starttransition"), (e == null ? void 0 : e.v7_relativeSplatPath) === void 0 && _t("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath");
1755
+ }
1756
+ function Wt(e) {
1757
+ process.env.NODE_ENV !== "production" ? b(!1, "A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.") : b(!1);
1758
+ }
1759
+ function bn(e) {
1760
+ let {
1761
+ basename: t = "/",
1762
+ children: r = null,
1763
+ location: n,
1764
+ navigationType: o = Y.Pop,
1765
+ navigator: i,
1766
+ static: s = !1,
1767
+ future: c
1768
+ } = e;
1769
+ de() && (process.env.NODE_ENV !== "production" ? b(!1, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : b(!1));
1770
+ let l = t.replace(/^\/*/, "/"), u = h.useMemo(() => ({
1771
+ basename: l,
1772
+ navigator: i,
1773
+ static: s,
1774
+ future: le({
1775
+ v7_relativeSplatPath: !1
1776
+ }, c)
1777
+ }), [l, c, i, s]);
1778
+ typeof n == "string" && (n = X(n));
1779
+ let {
1780
+ pathname: p = "/",
1781
+ search: f = "",
1782
+ hash: m = "",
1783
+ state: w = null,
1784
+ key: C = "default"
1785
+ } = n, _ = h.useMemo(() => {
1786
+ let y = z(p, l);
1787
+ return y == null ? null : {
1788
+ location: {
1789
+ pathname: y,
1790
+ search: f,
1791
+ hash: m,
1792
+ state: w,
1793
+ key: C
1794
+ },
1795
+ navigationType: o
1796
+ };
1797
+ }, [l, p, f, m, w, C, o]);
1798
+ return process.env.NODE_ENV !== "production" && V(_ != null, '<Router basename="' + l + '"> is not able to match the URL ' + ('"' + p + f + m + '" because it does not start with the ') + "basename, so the <Router> won't render anything."), _ == null ? null : /* @__PURE__ */ h.createElement(M.Provider, {
1799
+ value: u
1800
+ }, /* @__PURE__ */ h.createElement(fe.Provider, {
1801
+ children: r,
1802
+ value: _
1803
+ }));
1804
+ }
1805
+ function wn(e) {
1806
+ let {
1807
+ children: t,
1808
+ location: r
1809
+ } = e;
1810
+ return on($e(t), r);
1811
+ }
1812
+ new Promise(() => {
1813
+ });
1814
+ function $e(e, t) {
1815
+ t === void 0 && (t = []);
1816
+ let r = [];
1817
+ return h.Children.forEach(e, (n, o) => {
1818
+ if (!/* @__PURE__ */ h.isValidElement(n))
1819
+ return;
1820
+ let i = [...t, o];
1821
+ if (n.type === h.Fragment) {
1822
+ r.push.apply(r, $e(n.props.children, i));
1823
+ return;
1824
+ }
1825
+ n.type !== Wt && (process.env.NODE_ENV !== "production" ? b(!1, "[" + (typeof n.type == "string" ? n.type : n.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : b(!1)), !n.props.index || !n.props.children || (process.env.NODE_ENV !== "production" ? b(!1, "An index route cannot have child routes.") : b(!1));
1826
+ let s = {
1827
+ id: n.props.id || i.join("-"),
1828
+ caseSensitive: n.props.caseSensitive,
1829
+ element: n.props.element,
1830
+ Component: n.props.Component,
1831
+ index: n.props.index,
1832
+ path: n.props.path,
1833
+ loader: n.props.loader,
1834
+ action: n.props.action,
1835
+ errorElement: n.props.errorElement,
1836
+ ErrorBoundary: n.props.ErrorBoundary,
1837
+ hasErrorBoundary: n.props.ErrorBoundary != null || n.props.errorElement != null,
1838
+ shouldRevalidate: n.props.shouldRevalidate,
1839
+ handle: n.props.handle,
1840
+ lazy: n.props.lazy
1841
+ };
1842
+ n.props.children && (s.children = $e(n.props.children, i)), r.push(s);
1843
+ }), r;
1844
+ }
1845
+ /**
1846
+ * React Router DOM v6.30.3
1847
+ *
1848
+ * Copyright (c) Remix Software Inc.
1849
+ *
1850
+ * This source code is licensed under the MIT license found in the
1851
+ * LICENSE.md file in the root directory of this source tree.
1852
+ *
1853
+ * @license MIT
1854
+ */
1855
+ function G() {
1856
+ return G = Object.assign ? Object.assign.bind() : function(e) {
1857
+ for (var t = 1; t < arguments.length; t++) {
1858
+ var r = arguments[t];
1859
+ for (var n in r)
1860
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
1861
+ }
1862
+ return e;
1863
+ }, G.apply(this, arguments);
1864
+ }
1865
+ function qe(e, t) {
1866
+ if (e == null) return {};
1867
+ var r = {}, n = Object.keys(e), o, i;
1868
+ for (i = 0; i < n.length; i++)
1869
+ o = n[i], !(t.indexOf(o) >= 0) && (r[o] = e[o]);
1870
+ return r;
1871
+ }
1872
+ const be = "get", we = "application/x-www-form-urlencoded";
1873
+ function Ce(e) {
1874
+ return e != null && typeof e.tagName == "string";
1875
+ }
1876
+ function Rn(e) {
1877
+ return Ce(e) && e.tagName.toLowerCase() === "button";
1878
+ }
1879
+ function Cn(e) {
1880
+ return Ce(e) && e.tagName.toLowerCase() === "form";
1881
+ }
1882
+ function Sn(e) {
1883
+ return Ce(e) && e.tagName.toLowerCase() === "input";
1884
+ }
1885
+ function Nn(e) {
1886
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
1887
+ }
1888
+ function _n(e, t) {
1889
+ return e.button === 0 && // Ignore everything but left clicks
1890
+ (!t || t === "_self") && // Let browser handle "target=_blank" etc.
1891
+ !Nn(e);
1892
+ }
1893
+ let xe = null;
1894
+ function On() {
1895
+ if (xe === null)
1896
+ try {
1897
+ new FormData(
1898
+ document.createElement("form"),
1899
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
1900
+ 0
1901
+ ), xe = !1;
1902
+ } catch {
1903
+ xe = !0;
1904
+ }
1905
+ return xe;
1906
+ }
1907
+ const Pn = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
1908
+ function Le(e) {
1909
+ return e != null && !Pn.has(e) ? (process.env.NODE_ENV !== "production" && V(!1, '"' + e + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + we + '"')), null) : e;
1910
+ }
1911
+ function Tn(e, t) {
1912
+ let r, n, o, i, s;
1913
+ if (Cn(e)) {
1914
+ let c = e.getAttribute("action");
1915
+ n = c ? z(c, t) : null, r = e.getAttribute("method") || be, o = Le(e.getAttribute("enctype")) || we, i = new FormData(e);
1916
+ } else if (Rn(e) || Sn(e) && (e.type === "submit" || e.type === "image")) {
1917
+ let c = e.form;
1918
+ if (c == null)
1919
+ throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');
1920
+ let l = e.getAttribute("formaction") || c.getAttribute("action");
1921
+ if (n = l ? z(l, t) : null, r = e.getAttribute("formmethod") || c.getAttribute("method") || be, o = Le(e.getAttribute("formenctype")) || Le(c.getAttribute("enctype")) || we, i = new FormData(c, e), !On()) {
1922
+ let {
1923
+ name: u,
1924
+ type: p,
1925
+ value: f
1926
+ } = e;
1927
+ if (p === "image") {
1928
+ let m = u ? u + "." : "";
1929
+ i.append(m + "x", "0"), i.append(m + "y", "0");
1930
+ } else u && i.append(u, f);
1931
+ }
1932
+ } else {
1933
+ if (Ce(e))
1934
+ throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');
1935
+ r = be, n = null, o = we, s = e;
1936
+ }
1937
+ return i && o === "text/plain" && (s = i, i = void 0), {
1938
+ action: n,
1939
+ method: r.toLowerCase(),
1940
+ encType: o,
1941
+ formData: i,
1942
+ body: s
1943
+ };
1944
+ }
1945
+ const An = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "viewTransition"], jn = ["aria-current", "caseSensitive", "className", "end", "style", "to", "viewTransition", "children"], Dn = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "viewTransition"], kn = "6";
1946
+ try {
1947
+ window.__reactRouterVersion = kn;
1948
+ } catch {
1949
+ }
1950
+ const Yt = /* @__PURE__ */ h.createContext({
1951
+ isTransitioning: !1
1952
+ });
1953
+ process.env.NODE_ENV !== "production" && (Yt.displayName = "ViewTransition");
1954
+ const Ln = /* @__PURE__ */ h.createContext(/* @__PURE__ */ new Map());
1955
+ process.env.NODE_ENV !== "production" && (Ln.displayName = "Fetchers");
1956
+ const Fn = "startTransition", Ot = h[Fn];
1957
+ function In(e) {
1958
+ let {
1959
+ basename: t,
1960
+ children: r,
1961
+ future: n,
1962
+ window: o
1963
+ } = e, i = h.useRef();
1964
+ i.current == null && (i.current = Tr({
1965
+ window: o,
1966
+ v5Compat: !0
1967
+ }));
1968
+ let s = i.current, [c, l] = h.useState({
1969
+ action: s.action,
1970
+ location: s.location
1971
+ }), {
1972
+ v7_startTransition: u
1973
+ } = n || {}, p = h.useCallback((f) => {
1974
+ u && Ot ? Ot(() => l(f)) : l(f);
1975
+ }, [l, u]);
1976
+ return h.useLayoutEffect(() => s.listen(p), [s, p]), h.useEffect(() => xn(n), [n]), /* @__PURE__ */ h.createElement(bn, {
1977
+ basename: t,
1978
+ children: r,
1979
+ location: c.location,
1980
+ navigationType: c.action,
1981
+ navigator: s,
1982
+ future: n
1983
+ });
1984
+ }
1985
+ process.env.NODE_ENV;
1986
+ const Vn = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", Mn = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, zt = /* @__PURE__ */ h.forwardRef(function(t, r) {
1987
+ let {
1988
+ onClick: n,
1989
+ relative: o,
1990
+ reloadDocument: i,
1991
+ replace: s,
1992
+ state: c,
1993
+ target: l,
1994
+ to: u,
1995
+ preventScrollReset: p,
1996
+ viewTransition: f
1997
+ } = t, m = qe(t, An), {
1998
+ basename: w
1999
+ } = h.useContext(M), C, _ = !1;
2000
+ if (typeof u == "string" && Mn.test(u) && (C = u, Vn))
2001
+ try {
2002
+ let O = new URL(window.location.href), A = u.startsWith("//") ? new URL(O.protocol + u) : new URL(u), U = z(A.pathname, w);
2003
+ A.origin === O.origin && U != null ? u = U + A.search + A.hash : _ = !0;
2004
+ } catch {
2005
+ process.env.NODE_ENV !== "production" && V(!1, '<Link to="' + u + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.');
2006
+ }
2007
+ let y = nn(u, {
2008
+ relative: o
2009
+ }), N = Wn(u, {
2010
+ replace: s,
2011
+ state: c,
2012
+ target: l,
2013
+ preventScrollReset: p,
2014
+ relative: o,
2015
+ viewTransition: f
2016
+ });
2017
+ function v(O) {
2018
+ n && n(O), O.defaultPrevented || N(O);
2019
+ }
2020
+ return (
2021
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
2022
+ /* @__PURE__ */ h.createElement("a", G({}, m, {
2023
+ href: C || y,
2024
+ onClick: _ || i ? n : v,
2025
+ ref: r,
2026
+ target: l
2027
+ }))
2028
+ );
2029
+ });
2030
+ process.env.NODE_ENV !== "production" && (zt.displayName = "Link");
2031
+ const Un = /* @__PURE__ */ h.forwardRef(function(t, r) {
2032
+ let {
2033
+ "aria-current": n = "page",
2034
+ caseSensitive: o = !1,
2035
+ className: i = "",
2036
+ end: s = !1,
2037
+ style: c,
2038
+ to: l,
2039
+ viewTransition: u,
2040
+ children: p
2041
+ } = t, f = qe(t, jn), m = pe(l, {
2042
+ relative: f.relative
2043
+ }), w = Z(), C = h.useContext(We), {
2044
+ navigator: _,
2045
+ basename: y
2046
+ } = h.useContext(M), N = C != null && // Conditional usage is OK here because the usage of a data router is static
2047
+ // eslint-disable-next-line react-hooks/rules-of-hooks
2048
+ Jn(m) && u === !0, v = _.encodeLocation ? _.encodeLocation(m).pathname : m.pathname, O = w.pathname, A = C && C.navigation && C.navigation.location ? C.navigation.location.pathname : null;
2049
+ o || (O = O.toLowerCase(), A = A ? A.toLowerCase() : null, v = v.toLowerCase()), A && y && (A = z(A, y) || A);
2050
+ const U = v !== "/" && v.endsWith("/") ? v.length - 1 : v.length;
2051
+ let Q = O === v || !s && O.startsWith(v) && O.charAt(U) === "/", he = A != null && (A === v || !s && A.startsWith(v) && A.charAt(v.length) === "/"), ee = {
2052
+ isActive: Q,
2053
+ isPending: he,
2054
+ isTransitioning: N
2055
+ }, me = Q ? n : void 0, te;
2056
+ typeof i == "function" ? te = i(ee) : te = [i, Q ? "active" : null, he ? "pending" : null, N ? "transitioning" : null].filter(Boolean).join(" ");
2057
+ let Se = typeof c == "function" ? c(ee) : c;
2058
+ return /* @__PURE__ */ h.createElement(zt, G({}, f, {
2059
+ "aria-current": me,
2060
+ className: te,
2061
+ ref: r,
2062
+ style: Se,
2063
+ to: l,
2064
+ viewTransition: u
2065
+ }), typeof p == "function" ? p(ee) : p);
2066
+ });
2067
+ process.env.NODE_ENV !== "production" && (Un.displayName = "NavLink");
2068
+ const $n = /* @__PURE__ */ h.forwardRef((e, t) => {
2069
+ let {
2070
+ fetcherKey: r,
2071
+ navigate: n,
2072
+ reloadDocument: o,
2073
+ replace: i,
2074
+ state: s,
2075
+ method: c = be,
2076
+ action: l,
2077
+ onSubmit: u,
2078
+ relative: p,
2079
+ preventScrollReset: f,
2080
+ viewTransition: m
2081
+ } = e, w = qe(e, Dn), C = qn(), _ = Hn(l, {
2082
+ relative: p
2083
+ }), y = c.toLowerCase() === "get" ? "get" : "post", N = (v) => {
2084
+ if (u && u(v), v.defaultPrevented) return;
2085
+ v.preventDefault();
2086
+ let O = v.nativeEvent.submitter, A = (O == null ? void 0 : O.getAttribute("formmethod")) || c;
2087
+ C(O || v.currentTarget, {
2088
+ fetcherKey: r,
2089
+ method: A,
2090
+ navigate: n,
2091
+ replace: i,
2092
+ state: s,
2093
+ relative: p,
2094
+ preventScrollReset: f,
2095
+ viewTransition: m
2096
+ });
2097
+ };
2098
+ return /* @__PURE__ */ h.createElement("form", G({
2099
+ ref: t,
2100
+ method: y,
2101
+ action: _,
2102
+ onSubmit: o ? u : N
2103
+ }, w));
2104
+ });
2105
+ process.env.NODE_ENV !== "production" && ($n.displayName = "Form");
2106
+ process.env.NODE_ENV;
2107
+ var Re;
2108
+ (function(e) {
2109
+ e.UseScrollRestoration = "useScrollRestoration", e.UseSubmit = "useSubmit", e.UseSubmitFetcher = "useSubmitFetcher", e.UseFetcher = "useFetcher", e.useViewTransitionState = "useViewTransitionState";
2110
+ })(Re || (Re = {}));
2111
+ var Pt;
2112
+ (function(e) {
2113
+ e.UseFetcher = "useFetcher", e.UseFetchers = "useFetchers", e.UseScrollRestoration = "useScrollRestoration";
2114
+ })(Pt || (Pt = {}));
2115
+ function Bn(e) {
2116
+ return e + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
2117
+ }
2118
+ function Kt(e) {
2119
+ let t = h.useContext(ce);
2120
+ return t || (process.env.NODE_ENV !== "production" ? b(!1, Bn(e)) : b(!1)), t;
2121
+ }
2122
+ function Wn(e, t) {
2123
+ let {
2124
+ target: r,
2125
+ replace: n,
2126
+ state: o,
2127
+ preventScrollReset: i,
2128
+ relative: s,
2129
+ viewTransition: c
2130
+ } = t === void 0 ? {} : t, l = Ut(), u = Z(), p = pe(e, {
2131
+ relative: s
2132
+ });
2133
+ return h.useCallback((f) => {
2134
+ if (_n(f, r)) {
2135
+ f.preventDefault();
2136
+ let m = n !== void 0 ? n : se(u) === se(p);
2137
+ l(e, {
2138
+ replace: m,
2139
+ state: o,
2140
+ preventScrollReset: i,
2141
+ relative: s,
2142
+ viewTransition: c
2143
+ });
2144
+ }
2145
+ }, [u, l, p, n, o, r, e, i, s, c]);
2146
+ }
2147
+ function Yn() {
2148
+ if (typeof document > "u")
2149
+ throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
2150
+ }
2151
+ let zn = 0, Kn = () => "__" + String(++zn) + "__";
2152
+ function qn() {
2153
+ let {
2154
+ router: e
2155
+ } = Kt(Re.UseSubmit), {
2156
+ basename: t
2157
+ } = h.useContext(M), r = vn();
2158
+ return h.useCallback(function(n, o) {
2159
+ o === void 0 && (o = {}), Yn();
2160
+ let {
2161
+ action: i,
2162
+ method: s,
2163
+ encType: c,
2164
+ formData: l,
2165
+ body: u
2166
+ } = Tn(n, t);
2167
+ if (o.navigate === !1) {
2168
+ let p = o.fetcherKey || Kn();
2169
+ e.fetch(p, r, o.action || i, {
2170
+ preventScrollReset: o.preventScrollReset,
2171
+ formData: l,
2172
+ body: u,
2173
+ formMethod: o.method || s,
2174
+ formEncType: o.encType || c,
2175
+ flushSync: o.flushSync
2176
+ });
2177
+ } else
2178
+ e.navigate(o.action || i, {
2179
+ preventScrollReset: o.preventScrollReset,
2180
+ formData: l,
2181
+ body: u,
2182
+ formMethod: o.method || s,
2183
+ formEncType: o.encType || c,
2184
+ replace: o.replace,
2185
+ state: o.state,
2186
+ fromRouteId: r,
2187
+ flushSync: o.flushSync,
2188
+ viewTransition: o.viewTransition
2189
+ });
2190
+ }, [e, t, r]);
2191
+ }
2192
+ function Hn(e, t) {
2193
+ let {
2194
+ relative: r
2195
+ } = t === void 0 ? {} : t, {
2196
+ basename: n
2197
+ } = h.useContext(M), o = h.useContext(B);
2198
+ o || (process.env.NODE_ENV !== "production" ? b(!1, "useFormAction must be used inside a RouteContext") : b(!1));
2199
+ let [i] = o.matches.slice(-1), s = G({}, pe(e || ".", {
2200
+ relative: r
2201
+ })), c = Z();
2202
+ if (e == null) {
2203
+ s.search = c.search;
2204
+ let l = new URLSearchParams(s.search), u = l.getAll("index");
2205
+ if (u.some((f) => f === "")) {
2206
+ l.delete("index"), u.filter((m) => m).forEach((m) => l.append("index", m));
2207
+ let f = l.toString();
2208
+ s.search = f ? "?" + f : "";
2209
+ }
2210
+ }
2211
+ return (!e || e === ".") && i.route.index && (s.search = s.search ? s.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (s.pathname = s.pathname === "/" ? n : $([n, s.pathname])), se(s);
2212
+ }
2213
+ function Jn(e, t) {
2214
+ t === void 0 && (t = {});
2215
+ let r = h.useContext(Yt);
2216
+ r == null && (process.env.NODE_ENV !== "production" ? b(!1, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?") : b(!1));
2217
+ let {
2218
+ basename: n
2219
+ } = Kt(Re.useViewTransitionState), o = pe(e, {
2220
+ relative: t.relative
2221
+ });
2222
+ if (!r.isTransitioning)
2223
+ return !1;
2224
+ let i = z(r.currentLocation.pathname, n) || r.currentLocation.pathname, s = z(r.nextLocation.pathname, n) || r.nextLocation.pathname;
2225
+ return Ue(o.pathname, s) != null || Ue(o.pathname, i) != null;
2226
+ }
2227
+ function Gn({
2228
+ appName: e,
2229
+ appPath: t,
2230
+ children: r,
2231
+ onStatusChange: n
2232
+ }) {
2233
+ return /* @__PURE__ */ E.jsx(E.Fragment, { children: r });
2234
+ }
2235
+ class Xn extends jt {
2236
+ constructor(t) {
2237
+ super(t), this.state = { hasError: !1, error: null, errorInfo: null };
2238
+ }
2239
+ /**
2240
+ * 静态方法:子组件抛出错误时被调用
2241
+ * 返回新 state → 触发重新渲染 → 显示降级 UI
2242
+ */
2243
+ static getDerivedStateFromError(t) {
2244
+ return { hasError: !0, error: t };
2245
+ }
2246
+ /**
2247
+ * 生命周期:错误被捕获后执行副作用
2248
+ * 在这里做日志记录和状态同步
2249
+ */
2250
+ componentDidCatch(t, r) {
2251
+ const { appName: n, onError: o } = this.props;
2252
+ this.setState({ errorInfo: r }), console.error(`[ErrorBoundary][${n}] 🛡️ 捕获到运行时错误:`, t), console.error(`[ErrorBoundary][${n}] 组件栈:`, r.componentStack), o == null || o(t, r);
2253
+ }
2254
+ render() {
2255
+ const { hasError: t, error: r, errorInfo: n } = this.state, { appName: o, children: i, onReset: s } = this.props;
2256
+ return t ? /* @__PURE__ */ E.jsx("div", { className: "flex items-center justify-center min-h-[400px] p-6", children: /* @__PURE__ */ E.jsx("div", { className: "w-full max-w-lg", children: /* @__PURE__ */ E.jsxs("div", { className: "bg-white rounded-lg shadow-lg border border-red-200 overflow-hidden", children: [
2257
+ /* @__PURE__ */ E.jsx("div", { className: "bg-red-50 border-b border-red-200 px-6 py-4", children: /* @__PURE__ */ E.jsxs("div", { className: "flex items-center gap-3", children: [
2258
+ /* @__PURE__ */ E.jsx("span", { className: "text-2xl", children: "🛡️" }),
2259
+ /* @__PURE__ */ E.jsxs("div", { children: [
2260
+ /* @__PURE__ */ E.jsxs("h3", { className: "text-lg font-semibold text-red-800", children: [
2261
+ "子应用 [",
2262
+ o,
2263
+ "] 运行出错"
2264
+ ] }),
2265
+ /* @__PURE__ */ E.jsx("p", { className: "text-sm text-red-600 mt-0.5", children: "该错误已被隔离,不影响其他子应用的正常运行" })
2266
+ ] })
2267
+ ] }) }),
2268
+ /* @__PURE__ */ E.jsxs("div", { className: "px-6 py-4 space-y-4", children: [
2269
+ r && /* @__PURE__ */ E.jsxs("div", { children: [
2270
+ /* @__PURE__ */ E.jsx("p", { className: "text-sm font-medium text-gray-700 mb-1", children: "错误信息:" }),
2271
+ /* @__PURE__ */ E.jsx("div", { className: "bg-red-50 rounded-md px-4 py-3 text-sm text-red-700 font-mono break-all", children: r.message })
2272
+ ] }),
2273
+ (n == null ? void 0 : n.componentStack) && /* @__PURE__ */ E.jsxs("details", { className: "group", children: [
2274
+ /* @__PURE__ */ E.jsxs("summary", { className: "text-sm font-medium text-gray-700 cursor-pointer hover:text-gray-900 select-none", children: [
2275
+ /* @__PURE__ */ E.jsx("span", { className: "group-open:hidden", children: "▶ 展开错误堆栈" }),
2276
+ /* @__PURE__ */ E.jsx("span", { className: "hidden group-open:inline", children: "▼ 收起错误堆栈" })
2277
+ ] }),
2278
+ /* @__PURE__ */ E.jsx("pre", { className: "mt-2 bg-gray-50 rounded-md px-4 py-3 text-xs text-gray-600 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap", children: n.componentStack })
2279
+ ] }),
2280
+ /* @__PURE__ */ E.jsx("div", { className: "bg-blue-50 rounded-md px-4 py-3", children: /* @__PURE__ */ E.jsx("p", { className: "text-sm text-blue-700", children: "点击重试会完整重载该子应用,或返回继续使用其他功能。" }) })
2281
+ ] }),
2282
+ /* @__PURE__ */ E.jsxs("div", { className: "px-6 py-4 bg-gray-50 border-t border-gray-200 flex gap-3", children: [
2283
+ /* @__PURE__ */ E.jsx(
2284
+ "button",
2285
+ {
2286
+ onClick: s,
2287
+ className: "px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 transition-colors",
2288
+ children: "重试加载"
2289
+ }
2290
+ ),
2291
+ /* @__PURE__ */ E.jsx(
2292
+ "button",
2293
+ {
2294
+ onClick: () => window.history.back(),
2295
+ className: "px-4 py-2 bg-white text-gray-700 text-sm font-medium rounded-md border border-gray-300 hover:bg-gray-50 transition-colors",
2296
+ children: "返回上一页"
2297
+ }
2298
+ )
2299
+ ] })
2300
+ ] }) }) }) : i;
2301
+ }
2302
+ }
2303
+ function Zn({
2304
+ appName: e,
2305
+ children: t,
2306
+ onError: r
2307
+ }) {
2308
+ const [n, o] = At(0), i = Fe(() => {
2309
+ console.log(`[ErrorBoundary][${e}] 触发 key 重置,完整重建子应用`), o((l) => l + 1);
2310
+ }, [e]), s = Fe((l, u) => {
2311
+ c({ type: "SET_ERROR", error: l }), r == null || r(l, u);
2312
+ }, [r]), [, c] = wr(
2313
+ (l, u) => {
2314
+ switch (u.type) {
2315
+ case "SET_ERROR":
2316
+ return { ...l, hasError: !0, error: u.error ?? null };
2317
+ case "RESET_ERROR":
2318
+ return { ...l, hasError: !1, error: null };
2319
+ case "ROUTE_CHANGED":
2320
+ return l.hasError ? (i(), { ...l, hasError: !1, error: null }) : l;
2321
+ default:
2322
+ return l;
2323
+ }
2324
+ },
2325
+ { hasError: !1, error: null, errorInfo: null }
2326
+ );
2327
+ return Be(() => {
2328
+ c({ type: "ROUTE_CHANGED" });
2329
+ }, [location.pathname]), /* @__PURE__ */ E.jsx(
2330
+ Xn,
2331
+ {
2332
+ appName: e,
2333
+ onError: s,
2334
+ onReset: i,
2335
+ children: t
2336
+ },
2337
+ n
2338
+ );
2339
+ }
2340
+ function Qn() {
2341
+ const [e, t] = At(null), r = Fe((n) => {
2342
+ const o = n instanceof Error ? n : new Error(n);
2343
+ t(o);
2344
+ }, []);
2345
+ if (e)
2346
+ throw e;
2347
+ return r;
2348
+ }
2349
+ function ea({
2350
+ url: e,
2351
+ containerId: t,
2352
+ mode: r = "iframe",
2353
+ iframeStyle: n,
2354
+ onError: o,
2355
+ onLoad: i
2356
+ }) {
2357
+ const s = Ie(null), c = Qn();
2358
+ async function l(u) {
2359
+ try {
2360
+ const p = await fetch(u, {
2361
+ method: "HEAD",
2362
+ // 只获取头部信息
2363
+ mode: "no-cors"
2364
+ // 允许跨域请求(但只能知道是否可达,不能知道状态码)
2365
+ });
2366
+ return !!(p.status === 0 || p.ok);
2367
+ } catch (p) {
2368
+ c(p instanceof Error ? p : new Error("请求失败"));
2369
+ }
2370
+ }
2371
+ return Be(() => {
2372
+ if (!s.current) return;
2373
+ const u = s.current;
2374
+ r === "iframe" && (async () => {
2375
+ const f = document.createElement("iframe"), m = document.querySelector(".micro-app-container");
2376
+ return await l(e) && (f.src = e, f.style.width = "100%", f.style.height = m ? m.offsetHeight + "px" : "100%", f.style.border = "none", f.setAttribute("sandbox", "allow-same-origin allow-scripts allow-forms allow-popups allow-top-navigation"), Object.assign(f.style, n || {})), u.appendChild(f), () => {
2377
+ u.contains(f) && u.removeChild(f);
2378
+ };
2379
+ })();
2380
+ }, [e, t, r, n, o, i]), /* @__PURE__ */ E.jsx(
2381
+ "div",
2382
+ {
2383
+ ref: s,
2384
+ id: t,
2385
+ style: {
2386
+ width: "100%",
2387
+ height: "100%",
2388
+ position: "relative"
2389
+ }
2390
+ }
2391
+ );
2392
+ }
2393
+ function ta({ apps: e }) {
2394
+ return /* @__PURE__ */ E.jsx(wn, { children: e.map((t) => {
2395
+ const r = t.active_rule ? t.active_rule : `/${t.name}/*`, n = t.active_rule || `/app/${t.name}`;
2396
+ return /* @__PURE__ */ E.jsx(
2397
+ Wt,
2398
+ {
2399
+ path: r,
2400
+ element: /* @__PURE__ */ E.jsx(
2401
+ Gn,
2402
+ {
2403
+ appName: t.name,
2404
+ appPath: n,
2405
+ children: /* @__PURE__ */ E.jsx(Zn, { appName: t.name, children: /* @__PURE__ */ E.jsx(
2406
+ Rr,
2407
+ {
2408
+ fallback: /* @__PURE__ */ E.jsx("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ E.jsx("div", { className: "text-center", children: /* @__PURE__ */ E.jsxs("p", { className: "mt-4 text-gray-600", children: [
2409
+ "正在加载 ",
2410
+ t.name,
2411
+ "..."
2412
+ ] }) }) }),
2413
+ children: /* @__PURE__ */ E.jsx(
2414
+ "div",
2415
+ {
2416
+ id: t.container.replace("#", ""),
2417
+ "data-micro-app": t.name,
2418
+ className: "micro-app-container w-full h-full flex-1",
2419
+ children: t.entry && /* @__PURE__ */ E.jsx(
2420
+ ea,
2421
+ {
2422
+ url: t.entry,
2423
+ containerId: t.container.replace("#", ""),
2424
+ mode: "iframe"
2425
+ }
2426
+ )
2427
+ }
2428
+ )
2429
+ }
2430
+ ) })
2431
+ }
2432
+ )
2433
+ },
2434
+ t.name
2435
+ );
2436
+ }) });
2437
+ }
2438
+ function ra(e) {
2439
+ return e.active_rule ? e.active_rule : `/${e.name}/*`;
2440
+ }
2441
+ function na({
2442
+ apps: e,
2443
+ activeApp: t,
2444
+ onError: r,
2445
+ onStatusChange: n,
2446
+ onLoad: o,
2447
+ children: i
2448
+ }) {
2449
+ const s = Ut(), c = Ie(/* @__PURE__ */ new Set()), l = Ie({ onError: r, onStatusChange: n, onLoad: o });
2450
+ l.current = { onError: r, onStatusChange: n, onLoad: o };
2451
+ const u = Cr(() => _r({
2452
+ apps: e,
2453
+ onError: l.current.onError,
2454
+ onStatusChange: (f, m) => {
2455
+ var w, C;
2456
+ (C = (w = l.current).onStatusChange) == null || C.call(w, f, m);
2457
+ },
2458
+ onLoad: l.current.onLoad
2459
+ }), [e]);
2460
+ return Be(() => {
2461
+ if (!t) return;
2462
+ const p = e.find((w) => w.name === t);
2463
+ if (!p) return;
2464
+ const f = ra(p);
2465
+ s(f);
2466
+ const m = () => {
2467
+ if (!document.querySelector(p.container)) {
2468
+ requestAnimationFrame(m);
2469
+ return;
2470
+ }
2471
+ c.current.has(t) || (u.startApp(t), c.current.add(t));
2472
+ };
2473
+ requestAnimationFrame(m), e.forEach((w) => {
2474
+ w.name !== t && c.current.has(w.name) && (u.stopApp(w.name), c.current.delete(w.name));
2475
+ });
2476
+ }, [t, e, u, s]), /* @__PURE__ */ E.jsxs("div", { className: "micro-app-wrapper", children: [
2477
+ /* @__PURE__ */ E.jsx(ta, { apps: e }),
2478
+ i
2479
+ ] });
2480
+ }
2481
+ function sa(e) {
2482
+ return /* @__PURE__ */ E.jsx(In, { children: /* @__PURE__ */ E.jsx(na, { ...e }) });
2483
+ }
2484
+ class la extends jt {
2485
+ constructor(r) {
2486
+ super(r);
2487
+ I(this, "handleRetry", () => {
2488
+ var r, n;
2489
+ this.setState({ hasError: !1, error: null }), (n = (r = this.props).onRetry) == null || n.call(r, this.props.appName);
2490
+ });
2491
+ this.state = { hasError: !1, error: null };
2492
+ }
2493
+ static getDerivedStateFromError(r) {
2494
+ return { hasError: !0, error: r };
2495
+ }
2496
+ componentDidCatch(r, n) {
2497
+ var o, i;
2498
+ console.error(`[${this.props.appName || "ErrorBoundary"}] 捕获错误:`, r, n), (i = (o = this.props).onError) == null || i.call(o, r, this.props.appName);
2499
+ }
2500
+ render() {
2501
+ var r;
2502
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ E.jsx("div", { className: "micro-app-error flex flex-col items-center justify-center h-full p-4 bg-gray-50 rounded", children: /* @__PURE__ */ E.jsxs("div", { className: "text-center", children: [
2503
+ /* @__PURE__ */ E.jsx("div", { className: "text-red-500 text-4xl mb-2", children: "⚠️" }),
2504
+ /* @__PURE__ */ E.jsxs("h3", { className: "text-lg font-semibold text-gray-800 mb-2", children: [
2505
+ this.props.appName || "应用",
2506
+ " 加载失败"
2507
+ ] }),
2508
+ /* @__PURE__ */ E.jsx("p", { className: "text-sm text-gray-500 mb-4", children: ((r = this.state.error) == null ? void 0 : r.message) || "应用渲染时发生错误" }),
2509
+ /* @__PURE__ */ E.jsx(
2510
+ "button",
2511
+ {
2512
+ onClick: this.handleRetry,
2513
+ className: "px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",
2514
+ children: "重试"
2515
+ }
2516
+ )
2517
+ ] }) }) : this.props.children;
2518
+ }
2519
+ }
2520
+ const ua = "1.0.0";
2521
+ export {
2522
+ la as ErrorBoundary,
2523
+ sa as MicroApp,
2524
+ _r as createMicroApp,
2525
+ ua as version
2526
+ };