driftjs-router 0.0.15 → 0.0.17

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-es.js CHANGED
@@ -1,16 +1,19 @@
1
1
  import { createContext as e, onUnmount as t } from "driftjs-shared";
2
+ //#region \0rolldown/runtime.js
3
+ var n = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
4
+ //#endregion
2
5
  //#region src/path.ts
3
- function n(e) {
6
+ function r(e) {
4
7
  if (!e || e === "/") return "/";
5
8
  let t = e.replace(/\/+/g, "/");
6
9
  return t.startsWith("/") || (t = "/" + t), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t;
7
10
  }
8
- function r(e) {
11
+ function i(e) {
9
12
  if (!e) return "";
10
13
  let t = e.trim();
11
14
  return t.startsWith("/") || (t = "/" + t), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t === "/" ? "" : t;
12
15
  }
13
- function i(e, t) {
16
+ function a(e, t) {
14
17
  if (!t) return e;
15
18
  if (e.startsWith(t)) {
16
19
  let n = e.slice(t.length);
@@ -18,17 +21,17 @@ function i(e, t) {
18
21
  }
19
22
  return e;
20
23
  }
21
- function a(e, t) {
24
+ function o(e, t) {
22
25
  let n = t.startsWith("/") ? t : "/" + t;
23
26
  return e ? e + n : n;
24
27
  }
25
- function o(e, t) {
28
+ function s(e, t) {
26
29
  let n = t.startsWith("/") ? t : "/" + t;
27
30
  return (e || "") + "#" + n;
28
31
  }
29
32
  //#endregion
30
33
  //#region src/history.ts
31
- function s() {
34
+ function c() {
32
35
  let e = [];
33
36
  return {
34
37
  get list() {
@@ -48,50 +51,50 @@ function s() {
48
51
  }
49
52
  };
50
53
  }
51
- function c(e) {
54
+ function l(e) {
52
55
  if (typeof window > "u") return null;
53
56
  let t = e ?? window.history.state;
54
57
  if (!t || typeof t != "object") return t ?? null;
55
58
  let { __drift_pos: n, __drift_has_data: r, ...i } = t;
56
59
  return Object.keys(i).length > 0 || r ? i : null;
57
60
  }
58
- function l(e, t) {
61
+ function u(e, t) {
59
62
  return {
60
63
  ...e || {},
61
64
  __drift_pos: t,
62
65
  ...e === void 0 ? {} : { __drift_has_data: !0 }
63
66
  };
64
67
  }
65
- function u(e = "") {
66
- let t = r(e), n = s(), o = () => typeof window > "u" ? "/" : window.location.pathname + window.location.search + window.location.hash, u = () => i(o(), t) || "/", d = u(), f = typeof window < "u" && window.history.state && typeof window.history.state.__drift_pos == "number" ? window.history.state.__drift_pos : 0;
68
+ function d(e = "") {
69
+ let t = i(e), n = c(), r = () => typeof window > "u" ? "/" : window.location.pathname + window.location.search + window.location.hash, s = () => a(r(), t) || "/", d = s(), f = typeof window < "u" && window.history.state && typeof window.history.state.__drift_pos == "number" ? window.history.state.__drift_pos : 0;
67
70
  if (typeof window < "u" && (window.history.state == null || typeof window.history.state.__drift_pos != "number")) {
68
71
  let e = window.history.state || {};
69
72
  window.history.replaceState({
70
73
  ...e,
71
74
  __drift_pos: f
72
- }, "", a(t, d));
75
+ }, "", o(t, d));
73
76
  }
74
77
  let p = (e) => {
75
- let t = d, r = u();
78
+ let t = d, r = s();
76
79
  d = r;
77
80
  let i = typeof window < "u" && window.history.state || e.state || null, a = i && typeof i.__drift_pos == "number" ? i.__drift_pos : f, o = a - f;
78
81
  f = a;
79
- let s = {
82
+ let c = {
80
83
  direction: o > 0 ? "forward" : o < 0 ? "back" : "unknown",
81
84
  delta: o,
82
85
  type: "pop"
83
86
  };
84
- n.notify(r, t, s);
87
+ n.notify(r, t, c);
85
88
  };
86
89
  return typeof window < "u" && window.addEventListener("popstate", p), {
87
90
  get base() {
88
91
  return t;
89
92
  },
90
93
  get location() {
91
- return u();
94
+ return s();
92
95
  },
93
96
  get state() {
94
- return c(window.history.state);
97
+ return l(window.history.state);
95
98
  },
96
99
  listen(e) {
97
100
  return n.listen(e);
@@ -99,12 +102,12 @@ function u(e = "") {
99
102
  push(e, n) {
100
103
  if (typeof window > "u") return;
101
104
  f++;
102
- let r = a(t, e), i = l(n, f);
105
+ let r = o(t, e), i = u(n, f);
103
106
  window.history.pushState(i, "", r), d = e;
104
107
  },
105
108
  replace(e, n) {
106
109
  if (typeof window > "u") return;
107
- let r = a(t, e), i = l(n, f);
110
+ let r = o(t, e), i = u(n, f);
108
111
  window.history.replaceState(i, "", r), d = e;
109
112
  },
110
113
  go(e) {
@@ -115,57 +118,57 @@ function u(e = "") {
115
118
  }
116
119
  };
117
120
  }
118
- function d(e = "") {
119
- let t = r(e), n = s(), i = () => {
121
+ function f(e = "") {
122
+ let t = i(e), n = c(), r = () => {
120
123
  if (typeof window > "u") return "/";
121
124
  let e = window.location.hash;
122
125
  if (!e || e === "#") return "/";
123
126
  let t = e.startsWith("#") ? e.slice(1) : e;
124
127
  return t.startsWith("/") ? t : "/" + t;
125
- }, a = i(), u = typeof window < "u" && window.history.state && typeof window.history.state.__drift_pos == "number" ? window.history.state.__drift_pos : 0;
128
+ }, a = r(), o = typeof window < "u" && window.history.state && typeof window.history.state.__drift_pos == "number" ? window.history.state.__drift_pos : 0;
126
129
  if (typeof window < "u" && (window.history.state == null || typeof window.history.state.__drift_pos != "number")) {
127
130
  let e = window.history.state || {};
128
131
  window.history.replaceState({
129
132
  ...e,
130
- __drift_pos: u
131
- }, "", o(t, a));
133
+ __drift_pos: o
134
+ }, "", s(t, a));
132
135
  }
133
136
  let d = (e) => {
134
- let t = i();
137
+ let t = r();
135
138
  if (t === a) return;
136
- let r = a;
139
+ let i = a;
137
140
  a = t;
138
- let o = typeof window < "u" && window.history.state || null, s = o && typeof o.__drift_pos == "number" ? o.__drift_pos : u, c = s - u;
139
- u = s;
140
- let l = {
141
- direction: c > 0 ? "forward" : c < 0 ? "back" : "unknown",
142
- delta: c,
141
+ let s = typeof window < "u" && window.history.state || null, c = s && typeof s.__drift_pos == "number" ? s.__drift_pos : o, l = c - o;
142
+ o = c;
143
+ let u = {
144
+ direction: l > 0 ? "forward" : l < 0 ? "back" : "unknown",
145
+ delta: l,
143
146
  type: "pop"
144
147
  };
145
- n.notify(t, r, l);
148
+ n.notify(t, i, u);
146
149
  };
147
150
  return typeof window < "u" && (window.addEventListener("popstate", d), window.addEventListener("hashchange", d)), {
148
151
  get base() {
149
152
  return t;
150
153
  },
151
154
  get location() {
152
- return i();
155
+ return r();
153
156
  },
154
157
  get state() {
155
- return c(window.history.state);
158
+ return l(window.history.state);
156
159
  },
157
160
  listen(e) {
158
161
  return n.listen(e);
159
162
  },
160
163
  push(e, n) {
161
164
  if (typeof window > "u") return;
162
- u++;
163
- let r = o(t, e), i = l(n, u);
165
+ o++;
166
+ let r = s(t, e), i = u(n, o);
164
167
  window.history.pushState(i, "", r), a = e;
165
168
  },
166
169
  replace(e, n) {
167
170
  if (typeof window > "u") return;
168
- let r = o(t, e), i = l(n, u);
171
+ let r = s(t, e), i = u(n, o);
169
172
  window.history.replaceState(i, "", r), a = e;
170
173
  },
171
174
  go(e) {
@@ -176,14 +179,14 @@ function d(e = "") {
176
179
  }
177
180
  };
178
181
  }
179
- function f(e = "/", t = "") {
180
- let n = r(t), a = [i(e.startsWith("/") ? e : "/" + e, n) || "/"], o = [null], s = 0, c = [];
182
+ function p(e = "/", t = "") {
183
+ let n = i(t), r = [a(e.startsWith("/") ? e : "/" + e, n) || "/"], o = [null], s = 0, c = [];
181
184
  return {
182
185
  get base() {
183
186
  return n;
184
187
  },
185
188
  get location() {
186
- return a[s] ?? "/";
189
+ return r[s] ?? "/";
187
190
  },
188
191
  get state() {
189
192
  return o[s] ?? null;
@@ -196,286 +199,227 @@ function f(e = "/", t = "") {
196
199
  },
197
200
  push(e, t) {
198
201
  let n = e.startsWith("/") ? e : "/" + e;
199
- a.splice(s + 1), o.splice(s + 1), a.push(n), o.push(t || null), s++;
202
+ r.splice(s + 1), o.splice(s + 1), r.push(n), o.push(t || null), s++;
200
203
  },
201
204
  replace(e, t) {
202
205
  let n = e.startsWith("/") ? e : "/" + e;
203
- a[s] = n, o[s] = t || null;
206
+ r[s] = n, o[s] = t || null;
204
207
  },
205
208
  go(e) {
206
- let t = a[s] ?? "/", n = s + e;
207
- if (n >= 0 && n < a.length) {
209
+ let t = r[s] ?? "/", n = s + e;
210
+ if (n >= 0 && n < r.length) {
208
211
  s = n;
209
- let r = a[s] ?? "/", i = {
212
+ let i = r[s] ?? "/", a = {
210
213
  direction: e > 0 ? "forward" : e < 0 ? "back" : "unknown",
211
214
  delta: e,
212
215
  type: "pop"
213
216
  };
214
- for (let e of c) e(r, t, i);
217
+ for (let e of c) e(i, t, a);
215
218
  }
216
219
  },
217
220
  destroy() {
218
- c.length = 0, a.length = 0, o.length = 0, s = 0;
221
+ c.length = 0, r.length = 0, o.length = 0, s = 0;
219
222
  }
220
223
  };
221
224
  }
222
225
  //#endregion
223
- //#region ../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist.es2015/index.js
224
- function p(e) {
225
- for (var t = [], n = 0; n < e.length;) {
226
- var r = e[n];
227
- if (r === "*" || r === "+" || r === "?") {
228
- t.push({
229
- type: "MODIFIER",
230
- index: n,
231
- value: e[n++]
232
- });
233
- continue;
234
- }
235
- if (r === "\\") {
236
- t.push({
237
- type: "ESCAPED_CHAR",
238
- index: n++,
239
- value: e[n++]
240
- });
241
- continue;
242
- }
243
- if (r === "{") {
244
- t.push({
245
- type: "OPEN",
246
- index: n,
247
- value: e[n++]
248
- });
249
- continue;
226
+ //#region src/matcher.ts
227
+ var m = (/* @__PURE__ */ n(((e) => {
228
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.PathError = e.TokenData = void 0, e.compile = l, e.pathToRegexp = f;
229
+ var t = "/", n = (e) => e, r = /^[$_\p{ID_Start}]$/u, i = /^[$\u200c\u200d\p{ID_Continue}]$/u;
230
+ function a(e) {
231
+ return e.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
232
+ }
233
+ var o = class {
234
+ constructor(e, t) {
235
+ this.tokens = e, this.originalPath = t;
250
236
  }
251
- if (r === "}") {
252
- t.push({
253
- type: "CLOSE",
254
- index: n,
255
- value: e[n++]
256
- });
257
- continue;
237
+ };
238
+ e.TokenData = o;
239
+ var s = class extends TypeError {
240
+ constructor(e, t) {
241
+ let n = e;
242
+ t && (n += `: ${t}`), n += "; visit https://git.new/pathToRegexpError for info", super(n), this.originalPath = t;
258
243
  }
259
- if (r === ":") {
260
- for (var i = "", a = n + 1; a < e.length;) {
261
- var o = e.charCodeAt(a);
262
- if (o >= 48 && o <= 57 || o >= 65 && o <= 90 || o >= 97 && o <= 122 || o === 95) {
263
- i += e[a++];
264
- continue;
265
- }
266
- break;
244
+ };
245
+ e.PathError = s;
246
+ function c(e, t = {}) {
247
+ let { encodePath: a = n } = t, c = [...e], l = 0;
248
+ function u(t) {
249
+ let n = [], o = "";
250
+ function d() {
251
+ o &&= (n.push({
252
+ type: "text",
253
+ value: a(o)
254
+ }), "");
267
255
  }
268
- if (!i) throw TypeError(`Missing parameter name at ${n}`);
269
- t.push({
270
- type: "NAME",
271
- index: n,
272
- value: i
273
- }), n = a;
274
- continue;
275
- }
276
- if (r === "(") {
277
- var s = 1, c = "", a = n + 1;
278
- if (e[a] === "?") throw TypeError(`Pattern cannot start with "?" at ${a}`);
279
- for (; a < e.length;) {
280
- if (e[a] === "\\") {
281
- c += e[a++] + e[a++];
256
+ for (; l < c.length;) {
257
+ let a = c[l++];
258
+ if (a === t) return d(), n;
259
+ if (a === "\\") {
260
+ if (l === c.length) throw new s(`Unexpected end after \\ at index ${l}`, e);
261
+ o += c[l++];
282
262
  continue;
283
263
  }
284
- if (e[a] === ")") {
285
- if (s--, s === 0) {
286
- a++;
287
- break;
264
+ if (a === ":" || a === "*") {
265
+ let t = a === ":" ? "param" : "wildcard", o = "";
266
+ if (r.test(c[l])) do
267
+ o += c[l++];
268
+ while (i.test(c[l]));
269
+ else if (c[l] === "\"") {
270
+ let t = l;
271
+ for (; l < c.length;) {
272
+ if (c[++l] === "\"") {
273
+ l++, t = 0;
274
+ break;
275
+ }
276
+ c[l] === "\\" && l++, o += c[l];
277
+ }
278
+ if (t) throw new s(`Unterminated quote at index ${t}`, e);
288
279
  }
289
- } else if (e[a] === "(" && (s++, e[a + 1] !== "?")) throw TypeError(`Capturing groups are not allowed at ${a}`);
290
- c += e[a++];
280
+ if (!o) throw new s(`Missing parameter name at index ${l}`, e);
281
+ d(), n.push({
282
+ type: t,
283
+ name: o
284
+ });
285
+ continue;
286
+ }
287
+ if (a === "{") {
288
+ d(), n.push({
289
+ type: "group",
290
+ tokens: u("}")
291
+ });
292
+ continue;
293
+ }
294
+ if (a === "}" || a === "(" || a === ")" || a === "[" || a === "]" || a === "+" || a === "?" || a === "!") throw new s(`Unexpected ${a} at index ${l - 1}`, e);
295
+ o += a;
291
296
  }
292
- if (s) throw TypeError(`Unbalanced pattern at ${n}`);
293
- if (!c) throw TypeError(`Missing pattern at ${n}`);
294
- t.push({
295
- type: "PATTERN",
296
- index: n,
297
- value: c
298
- }), n = a;
299
- continue;
297
+ if (t) throw new s(`Unexpected end at index ${l}, expected ${t}`, e);
298
+ return d(), n;
300
299
  }
301
- t.push({
302
- type: "CHAR",
303
- index: n,
304
- value: e[n++]
305
- });
300
+ return new o(u(""), e);
306
301
  }
307
- return t.push({
308
- type: "END",
309
- index: n,
310
- value: ""
311
- }), t;
312
- }
313
- function m(e, t) {
314
- t === void 0 && (t = {});
315
- for (var n = p(e), r = t.prefixes, i = r === void 0 ? "./" : r, a = t.delimiter, o = a === void 0 ? "/#?" : a, s = [], c = 0, l = 0, u = "", d = function(e) {
316
- if (l < n.length && n[l].type === e) return n[l++].value;
317
- }, f = function(e) {
318
- var t = d(e);
319
- if (t !== void 0) return t;
320
- var r = n[l], i = r.type, a = r.index;
321
- throw TypeError(`Unexpected ${i} at ${a}, expected ${e}`);
322
- }, m = function() {
323
- for (var e = "", t; t = d("CHAR") || d("ESCAPED_CHAR");) e += t;
324
- return e;
325
- }, h = function(e) {
326
- for (var t = 0, n = o; t < n.length; t++) {
327
- var r = n[t];
328
- if (e.indexOf(r) > -1) return !0;
329
- }
330
- return !1;
331
- }, g = function(e) {
332
- var t = s[s.length - 1], n = e || (t && typeof t == "string" ? t : "");
333
- if (t && !n) throw TypeError(`Must have text between two parameters, missing text after "${t.name}"`);
334
- return !n || h(n) ? `[^${_(o)}]+?` : `(?:(?!${_(n)})[^${_(o)}])+?`;
335
- }; l < n.length;) {
336
- var v = d("CHAR"), y = d("NAME"), b = d("PATTERN");
337
- if (y || b) {
338
- var x = v || "";
339
- i.indexOf(x) === -1 && (u += x, x = ""), u &&= (s.push(u), ""), s.push({
340
- name: y || c++,
341
- prefix: x,
342
- suffix: "",
343
- pattern: b || g(x),
344
- modifier: d("MODIFIER") || ""
345
- });
346
- continue;
347
- }
348
- var S = v || d("ESCAPED_CHAR");
349
- if (S) {
350
- u += S;
351
- continue;
302
+ function l(e, n = {}) {
303
+ let { encode: r = encodeURIComponent, delimiter: i = t } = n, a = u((typeof e == "object" ? e : c(e, n)).tokens, i, r);
304
+ return function(e = {}) {
305
+ let t = [], n = a(e, t);
306
+ if (t.length) throw TypeError(`Missing parameters: ${t.join(", ")}`);
307
+ return n;
308
+ };
309
+ }
310
+ function u(e, t, n) {
311
+ let r = e.map((e) => d(e, t, n));
312
+ return (e, t) => {
313
+ let n = "";
314
+ for (let i of r) n += i(e, t);
315
+ return n;
316
+ };
317
+ }
318
+ function d(e, t, r) {
319
+ if (e.type === "text") return () => e.value;
320
+ if (e.type === "group") {
321
+ let n = u(e.tokens, t, r);
322
+ return (e, t) => {
323
+ let r = t.length, i = n(e, t);
324
+ return t.length === r ? i : (t.length = r, "");
325
+ };
352
326
  }
353
- if (u &&= (s.push(u), ""), d("OPEN")) {
354
- var x = m(), C = d("NAME") || "", w = d("PATTERN") || "", T = m();
355
- f("CLOSE"), s.push({
356
- name: C || (w ? c++ : ""),
357
- pattern: C && !w ? g(x) : w,
358
- prefix: x,
359
- suffix: T,
360
- modifier: d("MODIFIER") || ""
327
+ let i = r || n;
328
+ return e.type === "wildcard" && r !== !1 ? (n, r) => {
329
+ let a = n[e.name];
330
+ if (a == null) return r.push(e.name), "";
331
+ if (!Array.isArray(a) || a.length === 0) throw TypeError(`Expected "${e.name}" to be a non-empty array`);
332
+ let o = "";
333
+ for (let n = 0; n < a.length; n++) {
334
+ if (typeof a[n] != "string") throw TypeError(`Expected "${e.name}/${n}" to be a string`);
335
+ n > 0 && (o += t), o += i(a[n]);
336
+ }
337
+ return o;
338
+ } : (t, n) => {
339
+ let r = t[e.name];
340
+ if (r == null) return n.push(e.name), "";
341
+ if (typeof r != "string") throw TypeError(`Expected "${e.name}" to be a string`);
342
+ return i(r);
343
+ };
344
+ }
345
+ function f(e, n = {}) {
346
+ let { delimiter: r = t, end: i = !0, sensitive: o = !1, trailing: l = !0 } = n, u = [], d = "", f = 0;
347
+ function h(e) {
348
+ if (Array.isArray(e)) {
349
+ for (let t of e) h(t);
350
+ return;
351
+ }
352
+ let t = typeof e == "object" ? e : c(e, n);
353
+ p(t.tokens, 0, [], (e) => {
354
+ if (f >= 256) throw new s("Too many path combinations", t.originalPath);
355
+ f > 0 && (d += "|"), d += m(e, r, u, t.originalPath), f++;
361
356
  });
362
- continue;
363
357
  }
364
- f("END");
358
+ h(e);
359
+ let g = `^(?:${d})`;
360
+ return l && (g += "(?:" + a(r) + "$)?"), g += i ? "$" : "(?=" + a(r) + "|$)", {
361
+ regexp: new RegExp(g, o ? "" : "i"),
362
+ keys: u
363
+ };
365
364
  }
366
- return s;
367
- }
368
- function h(e, t) {
369
- return g(m(e, t), t);
370
- }
371
- function g(e, t) {
372
- t === void 0 && (t = {});
373
- var n = v(t), r = t.encode, i = r === void 0 ? function(e) {
374
- return e;
375
- } : r, a = t.validate, o = a === void 0 || a, s = e.map(function(e) {
376
- if (typeof e == "object") return RegExp(`^(?:${e.pattern})\$`, n);
377
- });
378
- return function(t) {
379
- for (var n = "", r = 0; r < e.length; r++) {
380
- var a = e[r];
381
- if (typeof a == "string") {
382
- n += a;
365
+ function p(e, t, n, r) {
366
+ for (; t < e.length;) {
367
+ let i = e[t++];
368
+ if (i.type === "group") {
369
+ let a = n.length;
370
+ p(i.tokens, 0, n, (n) => p(e, t, n, r)), n.length = a;
383
371
  continue;
384
372
  }
385
- var c = t ? t[a.name] : void 0, l = a.modifier === "?" || a.modifier === "*", u = a.modifier === "*" || a.modifier === "+";
386
- if (Array.isArray(c)) {
387
- if (!u) throw TypeError(`Expected "${a.name}" to not repeat, but got an array`);
388
- if (c.length === 0) {
389
- if (l) continue;
390
- throw TypeError(`Expected "${a.name}" to not be empty`);
391
- }
392
- for (var d = 0; d < c.length; d++) {
393
- var f = i(c[d], a);
394
- if (o && !s[r].test(f)) throw TypeError(`Expected all "${a.name}" to match "${a.pattern}", but got "${f}"`);
395
- n += a.prefix + f + a.suffix;
396
- }
397
- continue;
398
- }
399
- if (typeof c == "string" || typeof c == "number") {
400
- var f = i(String(c), a);
401
- if (o && !s[r].test(f)) throw TypeError(`Expected "${a.name}" to match "${a.pattern}", but got "${f}"`);
402
- n += a.prefix + f + a.suffix;
403
- continue;
373
+ n.push(i);
374
+ }
375
+ r(n);
376
+ }
377
+ function m(e, t, n, r) {
378
+ let i = "", o = "", c = "", l = 0, u = 0, d = 0;
379
+ function f(n, r) {
380
+ for (; n < e.length;) {
381
+ let i = e[n++];
382
+ if (i.type === r) return !0;
383
+ if (i.type === "text" && i.value.includes(t)) break;
404
384
  }
405
- if (!l) {
406
- var p = u ? "an array" : "a string";
407
- throw TypeError(`Expected "${a.name}" to be ${p}`);
385
+ return !1;
386
+ }
387
+ function p(t) {
388
+ let n = "";
389
+ for (; t < e.length;) {
390
+ let r = e[t++];
391
+ if (r.type !== "text") break;
392
+ n += r.value;
408
393
  }
394
+ return n;
409
395
  }
410
- return n;
411
- };
412
- }
413
- function _(e) {
414
- return e.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
415
- }
416
- function v(e) {
417
- return e && e.sensitive ? "" : "i";
418
- }
419
- function y(e, t) {
420
- if (!t) return e;
421
- for (var n = /\((?:\?<(.*?)>)?(?!\?)/g, r = 0, i = n.exec(e.source); i;) t.push({
422
- name: i[1] || r++,
423
- prefix: "",
424
- suffix: "",
425
- modifier: "",
426
- pattern: ""
427
- }), i = n.exec(e.source);
428
- return e;
429
- }
430
- function b(e, t, n) {
431
- var r = e.map(function(e) {
432
- return C(e, t, n).source;
433
- });
434
- return RegExp(`(?:${r.join("|")})`, v(n));
435
- }
436
- function x(e, t, n) {
437
- return S(m(e, n), t, n);
438
- }
439
- function S(e, t, n) {
440
- n === void 0 && (n = {});
441
- for (var r = n.strict, i = r !== void 0 && r, a = n.start, o = a === void 0 || a, s = n.end, c = s === void 0 || s, l = n.encode, u = l === void 0 ? function(e) {
442
- return e;
443
- } : l, d = n.delimiter, f = d === void 0 ? "/#?" : d, p = n.endsWith, m = `[${_(p === void 0 ? "" : p)}]|\$`, h = `[${_(f)}]`, g = o ? "^" : "", y = 0, b = e; y < b.length; y++) {
444
- var x = b[y];
445
- if (typeof x == "string") g += _(u(x));
446
- else {
447
- var S = _(u(x.prefix)), C = _(u(x.suffix));
448
- if (x.pattern) if (t && t.push(x), S || C) if (x.modifier === "+" || x.modifier === "*") {
449
- var w = x.modifier === "*" ? "?" : "";
450
- g += `(?:${S}((?:${x.pattern})(?:${C}${S}(?:${x.pattern}))*)${C})${w}`;
451
- } else g += `(?:${S}(${x.pattern})${C})${x.modifier}`;
452
- else {
453
- if (x.modifier === "+" || x.modifier === "*") throw TypeError(`Can not repeat "${x.name}" without a prefix and suffix`);
454
- g += `(${x.pattern})${x.modifier}`;
396
+ for (; d < e.length;) {
397
+ let m = e[d++];
398
+ if (m.type === "text") {
399
+ i += a(m.value), o += m.value, l === 2 && (c += m.value), m.value.includes(t) && (u = 0);
400
+ continue;
401
+ }
402
+ if (m.type === "param" || m.type === "wildcard") {
403
+ if (l && !o) throw new s(`Missing text before "${m.name}" ${m.type}`, r);
404
+ m.type === "param" ? (i += u & 2 ? `(${h(t, o)}+)` : f(d, "wildcard") ? `(${h(t, p(d))}+)` : u & 1 ? `(${h(t, o)}+|${a(o)})` : `(${h(t, "")}+)`, u |= l = 1) : (i += u & 2 ? `(${h(o, "")}+)` : c ? `(${h(c, "")}+|${h(t, "")}+)` : "([^]+)", c = "", u |= l = 2), n.push(m), o = "";
405
+ continue;
455
406
  }
456
- else g += `(?:${S}${C})${x.modifier}`;
407
+ throw TypeError(`Unknown token type: ${m.type}`);
457
408
  }
409
+ return i;
458
410
  }
459
- if (c) i || (g += `${h}?`), g += n.endsWith ? `(?=${m})` : "$";
460
- else {
461
- var T = e[e.length - 1], E = typeof T == "string" ? h.indexOf(T[T.length - 1]) > -1 : T === void 0;
462
- i || (g += `(?:${h}(?=${m}))?`), E || (g += `(?=${h}|${m})`);
411
+ function h(e, t) {
412
+ return t.length > e.length ? h(t, e) : (e === t && (t = ""), t.length > 1 ? `(?:(?!${a(e)}|${a(t)})[^])` : e.length > 1 ? `(?:(?!${a(e)})[^${a(t)}])` : `[^${a(e + t)}]`);
463
413
  }
464
- return new RegExp(g, v(n));
465
- }
466
- function C(e, t, n) {
467
- return e instanceof RegExp ? y(e, t) : Array.isArray(e) ? b(e, t, n) : x(e, t, n);
468
- }
469
- //#endregion
470
- //#region src/matcher.ts
471
- function w(e) {
414
+ })))();
415
+ function h(e) {
472
416
  try {
473
417
  return decodeURIComponent(e);
474
418
  } catch {
475
419
  return e;
476
420
  }
477
421
  }
478
- function T(e) {
422
+ function g(e) {
479
423
  let t = Object.create(null);
480
424
  if (!e) return t;
481
425
  let n = e.startsWith("?") ? e.slice(1) : e;
@@ -495,7 +439,7 @@ function T(e) {
495
439
  }
496
440
  return t;
497
441
  }
498
- function E(e) {
442
+ function _(e) {
499
443
  let t = Object.keys(e);
500
444
  if (t.length === 0) return "";
501
445
  let n = [];
@@ -510,74 +454,75 @@ function E(e) {
510
454
  }
511
455
  return n.length > 0 ? "?" + n.join("&") : "";
512
456
  }
513
- function D(e) {
514
- let t = e.replace(/\/\*$/, "/(.*)"), n = 0, r = "";
515
- for (; n < t.length;) if (t[n] === ":" && /[a-zA-Z0-9_$]/.test(t[n + 1] || "")) {
457
+ function v(e) {
458
+ let t = e.replace(/:([a-zA-Z0-9_$]+)\(\.\*\)\*?/g, "*$1");
459
+ t = t.replace(/\/\*$/, "/*pathMatch"), t = t.replace(/\/(:[a-zA-Z0-9_$]+)\?/g, "{/$1}");
460
+ let n = [], r = "", i = 0;
461
+ for (; i < t.length;) if (t[i] === ":" && /[a-zA-Z0-9_$]/.test(t[i + 1] || "")) {
516
462
  let e = "";
517
- for (n++; n < t.length && /[a-zA-Z0-9_$]/.test(t[n]);) e += t[n], n++;
518
- if (t[n] === "(") {
519
- let i = 1, a = "";
520
- for (n++; n < t.length && i > 0;) {
521
- if (t[n] === "\\") {
522
- a += t[n] + (t[n + 1] || ""), n += 2;
523
- continue;
524
- }
525
- if (t[n] === "(") {
526
- i++, a += "(?:", n++;
463
+ for (i++; i < t.length && /[a-zA-Z0-9_$]/.test(t[i]);) e += t[i], i++;
464
+ if (r += ":" + e, t[i] === "(") {
465
+ let e = 1, r = "";
466
+ for (i++; i < t.length && e > 0;) {
467
+ if (t[i] === "\\") {
468
+ r += t[i] + (t[i + 1] || ""), i += 2;
527
469
  continue;
528
470
  }
529
- if (t[n] === ")" && (i--, i === 0)) {
530
- n++;
471
+ if (t[i] === "(") e++;
472
+ else if (t[i] === ")" && (e--, e === 0)) {
473
+ i++;
531
474
  break;
532
475
  }
533
- a += t[n], n++;
476
+ r += t[i], i++;
534
477
  }
535
- r += `:${e}(${a})`;
536
- } else r += `:${e}`;
537
- } else r += t[n], n++;
538
- return r;
478
+ r && n.push(r.replace(/(^|[^\\])\((?!\?)/g, "$1(?:"));
479
+ }
480
+ } else r += t[i], i++;
481
+ return {
482
+ normalized: r,
483
+ patterns: n
484
+ };
539
485
  }
540
- function O(e, t) {
486
+ function y(e, t) {
541
487
  let n = {};
542
- for (let [e, r] of Object.entries(t)) r != null && (n[e] = r);
488
+ for (let [e, r] of Object.entries(t)) r != null && (n[e] = Array.isArray(r) ? r.join("/") : String(r));
489
+ let { normalized: r } = v(e);
543
490
  try {
544
- return h(D(e.replace(/\/\*$/, "/:pathMatch(.*)")), {
545
- validate: !1,
546
- encode: (e) => e
547
- })(n);
491
+ return (0, m.compile)(r, { encode: !1 })(n);
548
492
  } catch {
549
- let t = e;
550
- for (let [e, r] of Object.entries(n)) t = e === "pathMatch" ? t.replace(/\/\*$/, "/" + (Array.isArray(r) ? r.join("/") : String(r))) : t.replace(RegExp(`:${e}\\b(?:\\([^)]+\\))?[?*+]?`, "g"), Array.isArray(r) ? r.join("/") : String(r));
551
- return t = t.replace(/\/:[a-zA-Z0-9_$]+\?/g, "").replace(/:[a-zA-Z0-9_$]+\?/g, ""), t;
493
+ let e = r;
494
+ for (let [t, r] of Object.entries(n)) e = e.replace(RegExp(`:${t}\\b`, "g"), String(r)), e = e.replace(RegExp(`\\*${t}\\b`, "g"), String(r));
495
+ return e = e.replace(/\{(\/[^}]+)\}/g, ""), e;
552
496
  }
553
497
  }
554
- function k(e) {
498
+ function b(e) {
555
499
  if (e === "/" || e === "") return {
556
500
  regex: /^\/?$/,
557
501
  paramNames: [],
558
502
  score: 1e3
559
503
  };
560
- let t = D(e), n = [], r = C(t, n, {
504
+ let { normalized: t, patterns: n } = v(e), { regexp: r, keys: i } = (0, m.pathToRegexp)(t, {
561
505
  sensitive: !1,
562
- strict: !1,
563
506
  end: !0
564
- }), i = n.map((e) => typeof e.name == "number" ? "pathMatch" : String(e.name)), a = 0;
565
- for (let t of e.split("/").filter(Boolean)) t === "*" || t.includes("(.*)") ? a += 1 : t.includes(":") ? t.includes("(") ? a += 30 : t.includes("?") ? a += 15 : a += 20 : a += 100;
507
+ }), a = r.source;
508
+ for (let e of n) a = a.replace("([^\\/]+)", `(${e})`);
509
+ let o = n.length > 0 ? new RegExp(a, r.flags) : r, s = i.map((e) => typeof e.name == "number" ? "pathMatch" : String(e.name)), c = 0;
510
+ for (let t of e.split("/").filter(Boolean)) t === "*" || t.includes("(.*)") || t.startsWith("*") ? c += 1 : t.includes(":") ? t.includes("(") ? c += 30 : t.includes("?") ? c += 15 : c += 20 : c += 100;
566
511
  return {
567
- regex: r,
568
- paramNames: i,
569
- score: a
512
+ regex: o,
513
+ paramNames: s,
514
+ score: c
570
515
  };
571
516
  }
572
- function A(e, t) {
573
- let r = e.path;
574
- r = t ? e.path.startsWith("/") ? n(e.path) : n(`${t.path === "/" ? "" : t.path}/${e.path}`) : n(e.path);
575
- let { regex: i, paramNames: a, score: o } = k(r), s = {};
517
+ function x(e, t) {
518
+ let n = e.path;
519
+ n = t ? e.path.startsWith("/") ? r(e.path) : r(`${t.path === "/" ? "" : t.path}/${e.path}`) : r(e.path);
520
+ let { regex: i, paramNames: a, score: o } = b(n), s = {};
576
521
  e.components ? Object.assign(s, e.components) : e.component && (s.default = e.component);
577
522
  let c = e.beforeEnter ? Array.isArray(e.beforeEnter) ? e.beforeEnter : [e.beforeEnter] : void 0, l = {};
578
523
  typeof e.props == "boolean" || typeof e.props == "function" ? l.default = e.props : e.props && typeof e.props == "object" && (l = e.props);
579
524
  let u = {
580
- path: r,
525
+ path: n,
581
526
  name: e.name,
582
527
  components: s,
583
528
  children: [],
@@ -590,16 +535,16 @@ function A(e, t) {
590
535
  score: o,
591
536
  redirect: e.redirect
592
537
  };
593
- return e.children && e.children.length > 0 && (u.children = e.children.map((e) => A(e, u))), u;
538
+ return e.children && e.children.length > 0 && (u.children = e.children.map((e) => x(e, u))), u;
594
539
  }
595
- function j(e) {
596
- let t = [], r = /* @__PURE__ */ new Map(), i = [];
540
+ function S(e) {
541
+ let t = [], n = /* @__PURE__ */ new Map(), i = [];
597
542
  function a(e, t) {
598
- t.push(e), e.name && r.set(e.name, e);
543
+ t.push(e), e.name && n.set(e.name, e);
599
544
  for (let n of e.children) a(n, t);
600
545
  }
601
546
  function o() {
602
- r.clear();
547
+ n.clear();
603
548
  let e = [];
604
549
  for (let t of i) a(t, e);
605
550
  t = e.sort((e, t) => {
@@ -607,17 +552,17 @@ function j(e) {
607
552
  return (t.score ?? 0) - n;
608
553
  });
609
554
  }
610
- for (let t of e) i.push(A(t));
555
+ for (let t of e) i.push(x(t));
611
556
  o();
612
557
  function s(e) {
613
- let r = n(e);
558
+ let n = r(e);
614
559
  for (let e of t) {
615
- let t = r.match(e.regex);
560
+ let t = n.match(e.regex);
616
561
  if (t) {
617
562
  let n = {};
618
563
  for (let r = 0; r < e.paramNames.length; r++) {
619
564
  let i = e.paramNames[r], a = t[r + 1];
620
- n[i] = a === void 0 ? "" : w(a);
565
+ n[i] = a === void 0 ? "" : h(a);
621
566
  }
622
567
  return {
623
568
  record: e,
@@ -636,19 +581,19 @@ function j(e) {
636
581
  let t = e.indexOf("#"), n = e;
637
582
  t !== -1 && (o = e.slice(t), n = e.slice(0, t));
638
583
  let r = n.indexOf("?");
639
- r === -1 ? i = n : (a = T(n.slice(r)), i = n.slice(0, r));
584
+ r === -1 ? i = n : (a = g(n.slice(r)), i = n.slice(0, r));
640
585
  } else {
641
586
  if (e.name) {
642
587
  l = e.name;
643
- let t = r.get(l);
644
- t && (i = t.path, c = { ...e.params || {} }, i = O(i, c));
588
+ let t = n.get(l);
589
+ t && (i = t.path, c = { ...e.params || {} }, i = y(i, c));
645
590
  } else e.path && (i = e.path);
646
591
  e.query && (a = { ...e.query }), e.hash && (o = e.hash.startsWith("#") ? e.hash : "#" + e.hash), e.params && (c = {
647
592
  ...c,
648
593
  ...e.params
649
594
  });
650
595
  }
651
- i = n(i);
596
+ i = r(i);
652
597
  let { record: u, params: d } = s(i), f = {
653
598
  ...d,
654
599
  ...c
@@ -657,7 +602,7 @@ function j(e) {
657
602
  let e = u;
658
603
  for (; e;) p.unshift(e), e = e.parent;
659
604
  }
660
- let m = E(a), h = i + m + o;
605
+ let m = _(a), h = i + m + o;
661
606
  return {
662
607
  path: i,
663
608
  fullPath: h,
@@ -674,16 +619,16 @@ function j(e) {
674
619
  resolve: c,
675
620
  addRoute(e, t) {
676
621
  if (typeof e == "string" && t) {
677
- let n = r.get(e);
678
- if (n) {
679
- let e = A(t, n);
680
- return n.children.push(e), o(), () => {
681
- let t = n.children.indexOf(e);
682
- t !== -1 && (n.children.splice(t, 1), o());
622
+ let r = n.get(e);
623
+ if (r) {
624
+ let e = x(t, r);
625
+ return r.children.push(e), o(), () => {
626
+ let t = r.children.indexOf(e);
627
+ t !== -1 && (r.children.splice(t, 1), o());
683
628
  };
684
629
  }
685
630
  } else if (typeof e == "object") {
686
- let t = A(e);
631
+ let t = x(e);
687
632
  return i.push(t), o(), () => {
688
633
  let e = i.indexOf(t);
689
634
  e !== -1 && (i.splice(e, 1), o());
@@ -692,7 +637,7 @@ function j(e) {
692
637
  return () => {};
693
638
  },
694
639
  removeRoute(e) {
695
- let t = r.get(e);
640
+ let t = n.get(e);
696
641
  if (t) {
697
642
  if (t.parent) {
698
643
  let e = t.parent.children.indexOf(t);
@@ -705,7 +650,7 @@ function j(e) {
705
650
  }
706
651
  },
707
652
  hasRoute(e) {
708
- return r.has(e);
653
+ return n.has(e);
709
654
  },
710
655
  getRoutes() {
711
656
  return [...t];
@@ -714,9 +659,9 @@ function j(e) {
714
659
  }
715
660
  //#endregion
716
661
  //#region types/index.ts
717
- var M = /* @__PURE__ */ function(e) {
662
+ var C = /* @__PURE__ */ function(e) {
718
663
  return e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated", e;
719
- }({}), N = e(void 0, "DriftRouter"), P = e(void 0, "DriftRoute"), F = e(0, "DriftRouterDepth"), I = Object.freeze({
664
+ }({}), w = e(void 0, "DriftRouter"), T = e(void 0, "DriftRoute"), E = e(0, "DriftRouterDepth"), D = Object.freeze({
720
665
  path: "/",
721
666
  fullPath: "/",
722
667
  query: {},
@@ -727,16 +672,16 @@ var M = /* @__PURE__ */ function(e) {
727
672
  meta: {},
728
673
  href: "/"
729
674
  });
730
- function L(e, t, n, r) {
675
+ function O(e, t, n, r) {
731
676
  let i = "Navigation failed";
732
- e === M.aborted ? i = `Navigation aborted from "${t.fullPath}" to "${n.fullPath}" via a navigation guard.` : e === M.cancelled ? i = `Navigation cancelled from "${t.fullPath}" to "${n.fullPath}" with a newer navigation.` : e === M.duplicated && (i = `Avoided redundant navigation to current location: "${n.fullPath}".`);
677
+ e === C.aborted ? i = `Navigation aborted from "${t.fullPath}" to "${n.fullPath}" via a navigation guard.` : e === C.cancelled ? i = `Navigation cancelled from "${t.fullPath}" to "${n.fullPath}" with a newer navigation.` : e === C.duplicated && (i = `Avoided redundant navigation to current location: "${n.fullPath}".`);
733
678
  let a = Error(r || i);
734
679
  return a.name = "NavigationFailure", a.type = e, a.from = t, a.to = n, a;
735
680
  }
736
- function R(e, t) {
681
+ function k(e, t) {
737
682
  return !e || typeof e != "object" || e.name !== "NavigationFailure" || typeof e.type != "number" ? !1 : t === void 0 || e.type === t;
738
683
  }
739
- async function z(e) {
684
+ async function A(e) {
740
685
  for (let t of e) for (let e of Object.keys(t.components)) {
741
686
  let n = t.components[e];
742
687
  if (typeof n == "function" && !("__drift_fn__" in n) && !n.bytecode) try {
@@ -747,7 +692,7 @@ async function z(e) {
747
692
  }
748
693
  }
749
694
  }
750
- async function B(e, t, n) {
695
+ async function j(e, t, n) {
751
696
  for (let r of e) {
752
697
  let e;
753
698
  try {
@@ -760,8 +705,8 @@ async function B(e, t, n) {
760
705
  }
761
706
  return !0;
762
707
  }
763
- function V(e) {
764
- let { history: t, routes: n, scrollBehavior: r, linkActiveClass: i, linkExactActiveClass: a } = e, o = j(n), s = [], c = [], l = [], u = [], d = [], f = I, p = null, m = null, h = null;
708
+ function M(e) {
709
+ let { history: t, routes: n, scrollBehavior: r, linkActiveClass: i, linkExactActiveClass: a } = e, o = S(n), s = [], c = [], l = [], u = [], d = [], f = D, p = null, m = null, h = null;
765
710
  p = new Promise((e, t) => {
766
711
  m = e, h = t;
767
712
  });
@@ -770,7 +715,7 @@ function V(e) {
770
715
  if (u.length > 0) for (let t of u) t(e);
771
716
  }
772
717
  function v(e, t, n) {
773
- if (!(typeof window > "u" || !r)) try {
718
+ if (typeof window < "u" && r) try {
774
719
  let i = r(e, t, n);
775
720
  if (!i) return;
776
721
  let a = (e) => {
@@ -791,32 +736,32 @@ function V(e) {
791
736
  async function y(e, n = !1, r = !1, i = 0) {
792
737
  if (i > 20) {
793
738
  let t = o.resolve(e, f);
794
- return L(M.aborted, f, t, "Infinite redirect loop detected");
739
+ return O(C.aborted, f, t, "Infinite redirect loop detected");
795
740
  }
796
741
  let a = o.resolve(e, f), u = f;
797
742
  if (a.matched.length > 0) {
798
743
  let e = a.matched[a.matched.length - 1];
799
744
  if (e.redirect) return y(typeof e.redirect == "function" ? e.redirect(a) : e.redirect, !0, r, i + 1);
800
745
  }
801
- if (u.fullPath === a.fullPath && u !== I) return L(M.duplicated, u, a);
746
+ if (u.fullPath === a.fullPath && u !== D) return O(C.duplicated, u, a);
802
747
  let p = ++g, m = [...s];
803
748
  for (let e of a.matched) e.beforeEnter && m.push(...e.beforeEnter);
804
- let h = await B(m, a, u);
805
- if (p !== g) return L(M.cancelled, u, a);
806
- if (h === !1) return L(M.aborted, u, a);
807
- if (h instanceof Error) return _(h), L(M.aborted, u, a, h.message);
749
+ let h = await j(m, a, u);
750
+ if (p !== g) return O(C.cancelled, u, a);
751
+ if (h === !1) return O(C.aborted, u, a);
752
+ if (h instanceof Error) return _(h), O(C.aborted, u, a, h.message);
808
753
  if (typeof h == "string" || typeof h == "object" && h) return y(h, n, r, i + 1);
809
754
  try {
810
- await z(a.matched);
755
+ await A(a.matched);
811
756
  } catch (e) {
812
- return _(e), L(M.aborted, u, a, String(e));
757
+ return _(e), O(C.aborted, u, a, String(e));
813
758
  }
814
- if (p !== g) return L(M.cancelled, u, a);
759
+ if (p !== g) return O(C.cancelled, u, a);
815
760
  if (c.length > 0) {
816
- let e = await B(c, a, u);
817
- if (p !== g) return L(M.cancelled, u, a);
818
- if (e === !1) return L(M.aborted, u, a);
819
- if (e instanceof Error) return _(e), L(M.aborted, u, a, e.message);
761
+ let e = await j(c, a, u);
762
+ if (p !== g) return O(C.cancelled, u, a);
763
+ if (e === !1) return O(C.aborted, u, a);
764
+ if (e instanceof Error) return _(e), O(C.aborted, u, a, e.message);
820
765
  if (typeof e == "string" || typeof e == "object" && e) return y(e, n, r, i + 1);
821
766
  }
822
767
  r || (n ? t.replace(a.fullPath) : t.push(a.fullPath));
@@ -835,10 +780,10 @@ function V(e) {
835
780
  }
836
781
  let b = t.listen(async (e, n, r) => {
837
782
  let i = await y(e, !1, r.type === "pop");
838
- i && R(i, M.aborted) && r.delta && t.go(-r.delta);
783
+ i && k(i, C.aborted) && r.delta && t.go(-r.delta);
839
784
  });
840
785
  return y(t.location || "/", !0, !0).then((e) => {
841
- e && e.type === M.aborted ? (h && h(e), _(e)) : m && m();
786
+ e && e.type === C.aborted ? (h && h(e), _(e)) : m && m();
842
787
  }).catch((e) => {
843
788
  h && h(e), _(e);
844
789
  }), {
@@ -918,7 +863,7 @@ function V(e) {
918
863
  }
919
864
  //#endregion
920
865
  //#region src/components/RouterView.drift
921
- var H = {
866
+ var N = {
922
867
  bytecode: new Uint32Array([
923
868
  6,
924
869
  0,
@@ -943,8 +888,8 @@ var H = {
943
888
  1
944
889
  ]),
945
890
  constants: [
946
- { __drift_fn__: (e, t, n, r, i, a) => {
947
- if ((e || {}).router = a(e, "RouterContext").inject(), (e || {}).depth = a(e, "RouterDepthContext").inject(0), (e || {}).CurrentComponent = null, a(e, "RouterDepthContext").provide(a(e, "depth") + 1), (e || {}).updateCurrentComponent = function() {
891
+ { __drift_fn__: (e, t, n, r, i, a, o) => {
892
+ if (typeof o == "function" && e ? o(e, "router", a(e, "RouterContext").inject()) : (e || {}).router = a(e, "RouterContext").inject(), typeof o == "function" && e ? o(e, "depth", a(e, "RouterDepthContext").inject(0)) : (e || {}).depth = a(e, "RouterDepthContext").inject(0), typeof o == "function" && e ? o(e, "CurrentComponent", null) : (e || {}).CurrentComponent = null, a(e, "RouterDepthContext").provide(a(e, "depth") + 1), (e || {}).updateCurrentComponent = function() {
948
893
  if (!a(e, "router") || !a(e, "router").currentRoute || !a(e, "router").currentRoute.matched || !a(e, "router").currentRoute.matched[a(e, "depth")]) {
949
894
  a(e, "CurrentComponent") !== null && (typeof n == "function" ? n(e, "CurrentComponent", null) : (e || {}).CurrentComponent = null);
950
895
  return;
@@ -994,11 +939,11 @@ var H = {
994
939
  derived: [],
995
940
  effects: [],
996
941
  scope: {
997
- RouterContext: N,
998
- RouterDepthContext: F,
942
+ RouterContext: w,
943
+ RouterDepthContext: E,
999
944
  onUnmount: t
1000
945
  }
1001
- }, U = {
946
+ }, P = {
1002
947
  bytecode: new Uint32Array([
1003
948
  6,
1004
949
  0,
@@ -1049,8 +994,8 @@ var H = {
1049
994
  1
1050
995
  ]),
1051
996
  constants: [
1052
- { __drift_fn__: (e, t, n, r, i, a) => {
1053
- if ((e || {}).router = a(e, "RouterContext").inject(), (e || {}).to = a(e, "props").to || "/", (e || {}).replace = a(e, "props").replace || !1, (e || {}).target = a(e, "props").target || "_self", (e || {}).rel = a(e, "props").rel || "", (e || {}).customClass = a(e, "props").class || "", (e || {}).label = a(e, "props").label || a(e, "props").title || "", (e || {}).currentPath = a(e, "router") && a(e, "router").currentRoute ? a(e, "router").currentRoute.path : "", (e || {}).getHref = function(e, t) {
997
+ { __drift_fn__: (e, t, n, r, i, a, o) => {
998
+ if (typeof o == "function" && e ? o(e, "router", a(e, "RouterContext").inject()) : (e || {}).router = a(e, "RouterContext").inject(), typeof o == "function" && e ? o(e, "to", a(e, "props").to || "/") : (e || {}).to = a(e, "props").to || "/", typeof o == "function" && e ? o(e, "replace", a(e, "props").replace || !1) : (e || {}).replace = a(e, "props").replace || !1, typeof o == "function" && e ? o(e, "target", a(e, "props").target || "_self") : (e || {}).target = a(e, "props").target || "_self", typeof o == "function" && e ? o(e, "rel", a(e, "props").rel || "") : (e || {}).rel = a(e, "props").rel || "", typeof o == "function" && e ? o(e, "customClass", a(e, "props").class || "") : (e || {}).customClass = a(e, "props").class || "", typeof o == "function" && e ? o(e, "label", a(e, "props").label || a(e, "props").title || "") : (e || {}).label = a(e, "props").label || a(e, "props").title || "", typeof o == "function" && e ? o(e, "currentPath", a(e, "router") && a(e, "router").currentRoute ? a(e, "router").currentRoute.path : "") : (e || {}).currentPath = a(e, "router") && a(e, "router").currentRoute ? a(e, "router").currentRoute.path : "", (e || {}).getHref = function(e, t) {
1054
999
  let n = e || "/";
1055
1000
  return t ? t.resolve(n).href : typeof n == "string" ? n : n && n.path ? n.path : "#";
1056
1001
  }, (e || {}).getActiveClass = function(e, t, n, r, i, a) {
@@ -1147,9 +1092,9 @@ var H = {
1147
1092
  derived: [],
1148
1093
  effects: [],
1149
1094
  scope: {
1150
- RouterContext: N,
1095
+ RouterContext: w,
1151
1096
  onUnmount: t
1152
1097
  }
1153
1098
  };
1154
1099
  //#endregion
1155
- export { U as Link, P as RouteContext, N as RouterContext, F as RouterDepthContext, H as RouterView, I as START_LOCATION_NORMALIZED, l as buildHistoryState, k as compilePathToRegex, s as createHistoryListeners, a as createHref, j as createMatcher, f as createMemoryHistory, L as createNavigationFailure, V as createRouter, d as createWebHashHistory, u as createWebHistory, c as extractHistoryState, o as formatHashHref, R as isNavigationFailure, r as normalizeBase, n as normalizePath, A as normalizeRouteRecord, T as parseQuery, E as stringifyQuery, i as stripBase };
1100
+ export { P as Link, T as RouteContext, w as RouterContext, E as RouterDepthContext, N as RouterView, D as START_LOCATION_NORMALIZED, u as buildHistoryState, b as compilePathToRegex, c as createHistoryListeners, o as createHref, S as createMatcher, p as createMemoryHistory, O as createNavigationFailure, M as createRouter, f as createWebHashHistory, d as createWebHistory, l as extractHistoryState, s as formatHashHref, k as isNavigationFailure, i as normalizeBase, r as normalizePath, x as normalizeRouteRecord, g as parseQuery, _ as stringifyQuery, a as stripBase };