@argon-router/core 0.2.3 → 0.3.1

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.js CHANGED
@@ -1,6 +1,6 @@
1
- import { createEffect as N, createStore as j, createEvent as x, sample as F, split as fe, attach as H, scopeBind as ue, withFactory as le } from "effector";
2
- import { spread as de } from "patronum";
3
- function V(e, t) {
1
+ import { createEffect as V, createStore as L, createEvent as P, sample as $, split as xe, attach as Z, scopeBind as Fe, withFactory as je } from "effector";
2
+ import { spread as Se } from "patronum";
3
+ function ee(e, t) {
4
4
  var r = Object.keys(e);
5
5
  if (Object.getOwnPropertySymbols) {
6
6
  var n = Object.getOwnPropertySymbols(e);
@@ -10,488 +10,505 @@ function V(e, t) {
10
10
  }
11
11
  return r;
12
12
  }
13
- function C(e) {
13
+ function H(e) {
14
14
  for (var t = 1; t < arguments.length; t++) {
15
15
  var r = arguments[t] != null ? arguments[t] : {};
16
- t % 2 ? V(Object(r), !0).forEach(function(n) {
17
- pe(e, n, r[n]);
18
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : V(Object(r)).forEach(function(n) {
16
+ t % 2 ? ee(Object(r), !0).forEach(function(n) {
17
+ $e(e, n, r[n]);
18
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ee(Object(r)).forEach(function(n) {
19
19
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
20
20
  });
21
21
  }
22
22
  return e;
23
23
  }
24
- function pe(e, t, r) {
25
- return (t = me(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
24
+ function $e(e, t, r) {
25
+ return (t = Ee(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
26
26
  }
27
- function me(e) {
28
- var t = ye(e, "string");
27
+ function Ee(e) {
28
+ var t = Pe(e, "string");
29
29
  return typeof t == "symbol" ? t : t + "";
30
30
  }
31
- function ye(e, t) {
31
+ function Pe(e, t) {
32
32
  if (typeof e != "object" || !e) return e;
33
33
  var r = e[Symbol.toPrimitive];
34
34
  if (r !== void 0) {
35
- var n = r.call(e, t || "default");
35
+ var n = r.call(e, t);
36
36
  if (typeof n != "object") return n;
37
37
  throw new TypeError("@@toPrimitive must return a primitive value.");
38
38
  }
39
39
  return (t === "string" ? String : Number)(e);
40
40
  }
41
- function Qe(e) {
41
+ function er(e) {
42
42
  let t;
43
- const r = N(() => {
44
- var p;
45
- return (p = t) === null || p === void 0 ? void 0 : p();
43
+ const r = V(() => {
44
+ var O;
45
+ return (O = t) === null || O === void 0 ? void 0 : O();
46
46
  }, {
47
47
  name: "waitForAsyncBundleFx",
48
48
  sid: "tw7mq7"
49
- }), n = N(async () => {
50
- for (const l of (p = e.beforeOpen) !== null && p !== void 0 ? p : []) {
51
- var p;
52
- await l();
49
+ }), n = V(async () => {
50
+ for (const m of (O = e.beforeOpen) !== null && O !== void 0 ? O : []) {
51
+ var O;
52
+ await m();
53
53
  }
54
54
  }, {
55
55
  name: "beforeOpenFx",
56
56
  sid: "ls74w9"
57
- }), a = N(async (p) => (await r(), await n(), e.parent && await e.parent.internal.openFx(C(C({}, p ?? {
58
- params: {}
59
- }), {}, {
60
- historyIgnore: !0
61
- })), p), {
57
+ }), a = V(async (O) => {
58
+ await r(), await n();
59
+ const m = e.parent;
60
+ return m && await m.internal.openFx(H(H({}, O ?? {
61
+ params: {}
62
+ }), {}, {
63
+ historyIgnore: !0
64
+ })), O;
65
+ }, {
62
66
  name: "openFx",
63
67
  sid: "-hz9h5i"
64
- }), s = j({}, {
68
+ }), f = L({}, {
65
69
  name: "$params",
66
- sid: "fyp6wk"
67
- }), i = j(!1, {
70
+ sid: "rstqrf"
71
+ }), o = L(!1, {
68
72
  name: "$isOpened",
69
- sid: "nq2be0"
70
- }), o = a.pending, f = x({
73
+ sid: "-zgx6q9"
74
+ }), l = a.pending, w = P({
71
75
  name: "open",
72
- sid: "-e84o6b"
73
- }), u = x({
76
+ sid: "-cby6lj"
77
+ }), j = P({
74
78
  name: "close",
75
- sid: "5yq009"
76
- }), y = x({
79
+ sid: "7uwhl1"
80
+ }), S = P({
77
81
  name: "opened",
78
- sid: "28lguv"
79
- }), d = x({
82
+ sid: "44ryfn"
83
+ }), E = P({
80
84
  name: "openedOnServer",
81
- sid: "-rnqoit"
82
- }), b = x({
85
+ sid: "-prk6y1"
86
+ }), N = P({
83
87
  name: "openedOnClient",
84
- sid: "-rq76gu"
85
- }), w = x({
88
+ sid: "-fw2mlz"
89
+ }), I = P({
86
90
  name: "closed",
87
- sid: "-atkmcq"
91
+ sid: "10jxi5"
88
92
  });
89
- return F({
93
+ $({
90
94
  and: [{
91
- clock: f,
95
+ clock: w,
92
96
  target: a
93
97
  }],
94
98
  or: {
95
- sid: "t5oqwf"
99
+ sid: "t7vx9v"
100
+ }
101
+ });
102
+ const U = {};
103
+ return $({
104
+ and: [{
105
+ clock: a.doneData,
106
+ fn: (O) => O && "params" in O ? H({}, O.params) : U,
107
+ target: f
108
+ }],
109
+ or: {
110
+ sid: "tna5vz"
96
111
  }
97
- }), fe({
112
+ }), xe({
98
113
  and: [{
99
114
  source: a.doneData,
100
115
  match: () => typeof window > "u" ? "server" : "client",
101
116
  cases: {
102
- server: d,
103
- client: b
117
+ server: E,
118
+ client: N
104
119
  }
105
120
  }],
106
121
  or: {
107
- sid: "t8fpv8"
122
+ sid: "u5fdgw"
108
123
  }
109
- }), F({
124
+ }), $({
110
125
  and: [{
111
- clock: [b, d],
112
- target: y
126
+ clock: [N, E],
127
+ target: S
113
128
  }],
114
129
  or: {
115
- sid: "tphc9f"
130
+ sid: "ylqojg"
116
131
  }
117
- }), F({
132
+ }), $({
118
133
  and: [{
119
- clock: y,
134
+ clock: S,
120
135
  fn: () => !0,
121
- target: i
136
+ target: o
122
137
  }],
123
138
  or: {
124
- sid: "u3rzot"
139
+ sid: "yohni9"
125
140
  }
126
- }), F({
141
+ }), $({
127
142
  and: [{
128
- clock: u,
129
- target: w
143
+ clock: j,
144
+ target: I
130
145
  }],
131
146
  or: {
132
- sid: "u72r8z"
147
+ sid: "z3c3j0"
133
148
  }
134
- }), F({
149
+ }), $({
135
150
  and: [{
136
- clock: w,
151
+ clock: I,
137
152
  fn: () => !1,
138
- target: i
153
+ target: o
139
154
  }],
140
155
  or: {
141
- sid: "ykn3cq"
156
+ sid: "z632ht"
142
157
  }
143
158
  }), {
144
- $params: s,
145
- $isOpened: i,
146
- $isPending: o,
147
- open: f,
148
- closed: w,
149
- opened: y,
150
- openedOnClient: b,
151
- openedOnServer: d,
152
- internal: C({
153
- index: !1,
154
- close: u,
159
+ $params: f,
160
+ $isOpened: o,
161
+ $isPending: l,
162
+ open: w,
163
+ closed: I,
164
+ opened: S,
165
+ openedOnClient: N,
166
+ openedOnServer: E,
167
+ internal: H({
168
+ close: j,
155
169
  openFx: a,
156
- setAsyncImport: (p) => t = p
170
+ setAsyncImport: (O) => t = O
157
171
  }, e),
158
172
  "@@unitShape": () => ({
159
- params: s,
160
- isPending: o,
161
- isOpened: i,
162
- onOpen: f
173
+ params: f,
174
+ isPending: l,
175
+ isOpened: o,
176
+ onOpen: w
163
177
  })
164
178
  };
165
179
  }
166
- var E = {};
167
- Object.defineProperty(E, "__esModule", {
168
- value: !0
169
- });
170
- E.TokenData = void 0;
171
- E.parse = L;
172
- var he = E.compile = $e, ge = E.match = Oe;
173
- E.pathToRegexp = Z;
174
- E.stringify = Ae;
175
- const U = "/", _ = (e) => e, X = /^[$_\p{ID_Start}]$/u, q = /^[$\u200c\u200d\p{ID_Continue}]$/u, I = "https://git.new/pathToRegexpError", be = {
176
- // Groups.
177
- "{": "{",
178
- "}": "}",
179
- // Reserved.
180
- "(": "(",
181
- ")": ")",
182
- "[": "[",
183
- "]": "]",
184
- "+": "+",
185
- "?": "?",
186
- "!": "!"
187
- };
188
- function we(e) {
189
- return e.replace(/[{}()\[\]+?!:*]/g, "\\$&");
190
- }
191
- function $(e) {
192
- return e.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
180
+ function Ae(e) {
181
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
193
182
  }
194
- function* xe(e) {
195
- const t = [...e];
196
- let r = 0;
197
- function n() {
198
- let a = "";
199
- if (X.test(t[++r]))
200
- for (a += t[r]; q.test(t[++r]); )
201
- a += t[r];
202
- else if (t[r] === '"') {
203
- let s = r;
204
- for (; r < t.length; ) {
205
- if (t[++r] === '"') {
206
- r++, s = 0;
207
- break;
183
+ var R = {}, re;
184
+ function ve() {
185
+ if (re) return R;
186
+ re = 1, Object.defineProperty(R, "__esModule", {
187
+ value: !0
188
+ }), R.TokenData = void 0, R.parse = E, R.compile = N, R.match = O, R.pathToRegexp = m, R.stringify = B;
189
+ const e = "/", t = (c) => c, r = /^[$_\p{ID_Start}]$/u, n = /^[$\u200c\u200d\p{ID_Continue}]$/u, a = "https://git.new/pathToRegexpError", f = {
190
+ // Groups.
191
+ "{": "{",
192
+ "}": "}",
193
+ // Reserved.
194
+ "(": "(",
195
+ ")": ")",
196
+ "[": "[",
197
+ "]": "]",
198
+ "+": "+",
199
+ "?": "?",
200
+ "!": "!"
201
+ };
202
+ function o(c) {
203
+ return c.replace(/[{}()\[\]+?!:*]/g, "\\$&");
204
+ }
205
+ function l(c) {
206
+ return c.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
207
+ }
208
+ function* w(c) {
209
+ const i = [...c];
210
+ let s = 0;
211
+ function y() {
212
+ let u = "";
213
+ if (r.test(i[++s]))
214
+ for (u += i[s]; n.test(i[++s]); )
215
+ u += i[s];
216
+ else if (i[s] === '"') {
217
+ let d = s;
218
+ for (; s < i.length; ) {
219
+ if (i[++s] === '"') {
220
+ s++, d = 0;
221
+ break;
222
+ }
223
+ i[s] === "\\" ? u += i[++s] : u += i[s];
208
224
  }
209
- t[r] === "\\" ? a += t[++r] : a += t[r];
225
+ if (d)
226
+ throw new TypeError(`Unterminated quote at ${d}: ${a}`);
210
227
  }
211
- if (s)
212
- throw new TypeError(`Unterminated quote at ${s}: ${I}`);
228
+ if (!u)
229
+ throw new TypeError(`Missing parameter name at ${s}: ${a}`);
230
+ return u;
213
231
  }
214
- if (!a)
215
- throw new TypeError(`Missing parameter name at ${r}: ${I}`);
216
- return a;
217
- }
218
- for (; r < t.length; ) {
219
- const a = t[r], s = be[a];
220
- if (s)
221
- yield {
222
- type: s,
223
- index: r++,
224
- value: a
225
- };
226
- else if (a === "\\")
227
- yield {
228
- type: "ESCAPED",
229
- index: r++,
230
- value: t[r++]
231
- };
232
- else if (a === ":") {
233
- const i = n();
234
- yield {
235
- type: "PARAM",
236
- index: r,
237
- value: i
238
- };
239
- } else if (a === "*") {
240
- const i = n();
241
- yield {
242
- type: "WILDCARD",
243
- index: r,
244
- value: i
245
- };
246
- } else
247
- yield {
248
- type: "CHAR",
249
- index: r,
250
- value: t[r++]
251
- };
232
+ for (; s < i.length; ) {
233
+ const u = i[s], d = f[u];
234
+ if (d)
235
+ yield {
236
+ type: d,
237
+ index: s++,
238
+ value: u
239
+ };
240
+ else if (u === "\\")
241
+ yield {
242
+ type: "ESCAPED",
243
+ index: s++,
244
+ value: i[s++]
245
+ };
246
+ else if (u === ":") {
247
+ const b = y();
248
+ yield {
249
+ type: "PARAM",
250
+ index: s,
251
+ value: b
252
+ };
253
+ } else if (u === "*") {
254
+ const b = y();
255
+ yield {
256
+ type: "WILDCARD",
257
+ index: s,
258
+ value: b
259
+ };
260
+ } else
261
+ yield {
262
+ type: "CHAR",
263
+ index: s,
264
+ value: i[s++]
265
+ };
266
+ }
267
+ return {
268
+ type: "END",
269
+ index: s,
270
+ value: ""
271
+ };
252
272
  }
253
- return {
254
- type: "END",
255
- index: r,
256
- value: ""
257
- };
258
- }
259
- class Fe {
260
- constructor(t) {
261
- this.tokens = t;
273
+ class j {
274
+ constructor(i) {
275
+ this.tokens = i;
276
+ }
277
+ peek() {
278
+ if (!this._peek) {
279
+ const i = this.tokens.next();
280
+ this._peek = i.value;
281
+ }
282
+ return this._peek;
283
+ }
284
+ tryConsume(i) {
285
+ const s = this.peek();
286
+ if (s.type === i)
287
+ return this._peek = void 0, s.value;
288
+ }
289
+ consume(i) {
290
+ const s = this.tryConsume(i);
291
+ if (s !== void 0) return s;
292
+ const {
293
+ type: y,
294
+ index: u
295
+ } = this.peek();
296
+ throw new TypeError(`Unexpected ${y} at ${u}, expected ${i}: ${a}`);
297
+ }
298
+ text() {
299
+ let i = "", s;
300
+ for (; s = this.tryConsume("CHAR") || this.tryConsume("ESCAPED"); )
301
+ i += s;
302
+ return i;
303
+ }
262
304
  }
263
- peek() {
264
- if (!this._peek) {
265
- const t = this.tokens.next();
266
- this._peek = t.value;
305
+ class S {
306
+ constructor(i) {
307
+ this.tokens = i;
267
308
  }
268
- return this._peek;
269
309
  }
270
- tryConsume(t) {
271
- const r = this.peek();
272
- if (r.type === t)
273
- return this._peek = void 0, r.value;
310
+ R.TokenData = S;
311
+ function E(c, i = {}) {
312
+ const {
313
+ encodePath: s = t
314
+ } = i, y = new j(w(c));
315
+ function u(b) {
316
+ const g = [];
317
+ for (; ; ) {
318
+ const A = y.text();
319
+ A && g.push({
320
+ type: "text",
321
+ value: s(A)
322
+ });
323
+ const v = y.tryConsume("PARAM");
324
+ if (v) {
325
+ g.push({
326
+ type: "param",
327
+ name: v
328
+ });
329
+ continue;
330
+ }
331
+ const M = y.tryConsume("WILDCARD");
332
+ if (M) {
333
+ g.push({
334
+ type: "wildcard",
335
+ name: M
336
+ });
337
+ continue;
338
+ }
339
+ if (y.tryConsume("{")) {
340
+ g.push({
341
+ type: "group",
342
+ tokens: u("}")
343
+ });
344
+ continue;
345
+ }
346
+ return y.consume(b), g;
347
+ }
348
+ }
349
+ const d = u("END");
350
+ return new S(d);
274
351
  }
275
- consume(t) {
276
- const r = this.tryConsume(t);
277
- if (r !== void 0) return r;
352
+ function N(c, i = {}) {
278
353
  const {
279
- type: n,
280
- index: a
281
- } = this.peek();
282
- throw new TypeError(`Unexpected ${n} at ${a}, expected ${t}: ${I}`);
354
+ encode: s = encodeURIComponent,
355
+ delimiter: y = e
356
+ } = i, u = c instanceof S ? c : E(c, i), d = I(u.tokens, y, s);
357
+ return function(g = {}) {
358
+ const [A, ...v] = d(g);
359
+ if (v.length)
360
+ throw new TypeError(`Missing parameters: ${v.join(", ")}`);
361
+ return A;
362
+ };
283
363
  }
284
- text() {
285
- let t = "", r;
286
- for (; r = this.tryConsume("CHAR") || this.tryConsume("ESCAPED"); )
287
- t += r;
288
- return t;
364
+ function I(c, i, s) {
365
+ const y = c.map((u) => U(u, i, s));
366
+ return (u) => {
367
+ const d = [""];
368
+ for (const b of y) {
369
+ const [g, ...A] = b(u);
370
+ d[0] += g, d.push(...A);
371
+ }
372
+ return d;
373
+ };
289
374
  }
290
- }
291
- class k {
292
- constructor(t) {
293
- this.tokens = t;
375
+ function U(c, i, s) {
376
+ if (c.type === "text") return () => [c.value];
377
+ if (c.type === "group") {
378
+ const u = I(c.tokens, i, s);
379
+ return (d) => {
380
+ const [b, ...g] = u(d);
381
+ return g.length ? [""] : [b];
382
+ };
383
+ }
384
+ const y = s || t;
385
+ return c.type === "wildcard" && s !== !1 ? (u) => {
386
+ const d = u[c.name];
387
+ if (d == null) return ["", c.name];
388
+ if (!Array.isArray(d) || d.length === 0)
389
+ throw new TypeError(`Expected "${c.name}" to be a non-empty array`);
390
+ return [d.map((b, g) => {
391
+ if (typeof b != "string")
392
+ throw new TypeError(`Expected "${c.name}/${g}" to be a string`);
393
+ return y(b);
394
+ }).join(i)];
395
+ } : (u) => {
396
+ const d = u[c.name];
397
+ if (d == null) return ["", c.name];
398
+ if (typeof d != "string")
399
+ throw new TypeError(`Expected "${c.name}" to be a string`);
400
+ return [y(d)];
401
+ };
294
402
  }
295
- }
296
- E.TokenData = k;
297
- function L(e, t = {}) {
298
- const {
299
- encodePath: r = _
300
- } = t, n = new Fe(xe(e));
301
- function a(i) {
302
- const o = [];
303
- for (; ; ) {
304
- const f = n.text();
305
- f && o.push({
306
- type: "text",
307
- value: r(f)
308
- });
309
- const u = n.tryConsume("PARAM");
310
- if (u) {
311
- o.push({
312
- type: "param",
313
- name: u
314
- });
315
- continue;
403
+ function O(c, i = {}) {
404
+ const {
405
+ decode: s = decodeURIComponent,
406
+ delimiter: y = e
407
+ } = i, {
408
+ regexp: u,
409
+ keys: d
410
+ } = m(c, i), b = d.map((g) => s === !1 ? t : g.type === "param" ? s : (A) => A.split(y).map(s));
411
+ return function(A) {
412
+ const v = u.exec(A);
413
+ if (!v) return !1;
414
+ const M = v[0], C = /* @__PURE__ */ Object.create(null);
415
+ for (let T = 1; T < v.length; T++) {
416
+ if (v[T] === void 0) continue;
417
+ const _ = d[T - 1], K = b[T - 1];
418
+ C[_.name] = K(v[T]);
316
419
  }
317
- const y = n.tryConsume("WILDCARD");
318
- if (y) {
319
- o.push({
320
- type: "wildcard",
321
- name: y
322
- });
420
+ return {
421
+ path: M,
422
+ params: C
423
+ };
424
+ };
425
+ }
426
+ function m(c, i = {}) {
427
+ const {
428
+ delimiter: s = e,
429
+ end: y = !0,
430
+ sensitive: u = !1,
431
+ trailing: d = !0
432
+ } = i, b = [], g = [], A = u ? "" : "i", M = (Array.isArray(c) ? c : [c]).map((_) => _ instanceof S ? _ : E(_, i));
433
+ for (const {
434
+ tokens: _
435
+ } of M)
436
+ for (const K of h(_, 0, [])) {
437
+ const Oe = p(K, s, b);
438
+ g.push(Oe);
439
+ }
440
+ let C = `^(?:${g.join("|")})`;
441
+ return d && (C += `(?:${l(s)}$)?`), C += y ? "$" : `(?=${l(s)}|$)`, {
442
+ regexp: new RegExp(C, A),
443
+ keys: b
444
+ };
445
+ }
446
+ function* h(c, i, s) {
447
+ if (i === c.length)
448
+ return yield s;
449
+ const y = c[i];
450
+ if (y.type === "group") {
451
+ const u = s.slice();
452
+ for (const d of h(y.tokens, 0, u))
453
+ yield* h(c, i + 1, d);
454
+ } else
455
+ s.push(y);
456
+ yield* h(c, i + 1, s);
457
+ }
458
+ function p(c, i, s) {
459
+ let y = "", u = "", d = !0;
460
+ for (let b = 0; b < c.length; b++) {
461
+ const g = c[b];
462
+ if (g.type === "text") {
463
+ y += l(g.value), u += g.value, d || (d = g.value.includes(i));
323
464
  continue;
324
465
  }
325
- if (n.tryConsume("{")) {
326
- o.push({
327
- type: "group",
328
- tokens: a("}")
329
- });
466
+ if (g.type === "param" || g.type === "wildcard") {
467
+ if (!d && !u)
468
+ throw new TypeError(`Missing text after "${g.name}": ${a}`);
469
+ g.type === "param" ? y += `(${x(i, d ? "" : u)}+)` : y += "([\\s\\S]+)", s.push(g), u = "", d = !1;
330
470
  continue;
331
471
  }
332
- return n.consume(i), o;
333
472
  }
473
+ return y;
334
474
  }
335
- const s = a("END");
336
- return new k(s);
337
- }
338
- function $e(e, t = {}) {
339
- const {
340
- encode: r = encodeURIComponent,
341
- delimiter: n = U
342
- } = t, a = e instanceof k ? e : L(e, t), s = Y(a.tokens, n, r);
343
- return function(o = {}) {
344
- const [f, ...u] = s(o);
345
- if (u.length)
346
- throw new TypeError(`Missing parameters: ${u.join(", ")}`);
347
- return f;
348
- };
349
- }
350
- function Y(e, t, r) {
351
- const n = e.map((a) => Se(a, t, r));
352
- return (a) => {
353
- const s = [""];
354
- for (const i of n) {
355
- const [o, ...f] = i(a);
356
- s[0] += o, s.push(...f);
357
- }
358
- return s;
359
- };
360
- }
361
- function Se(e, t, r) {
362
- if (e.type === "text") return () => [e.value];
363
- if (e.type === "group") {
364
- const a = Y(e.tokens, t, r);
365
- return (s) => {
366
- const [i, ...o] = a(s);
367
- return o.length ? [""] : [i];
368
- };
475
+ function x(c, i) {
476
+ return i.length < 2 ? c.length < 2 ? `[^${l(c + i)}]` : `(?:(?!${l(c)})[^${l(i)}])` : c.length < 2 ? `(?:(?!${l(i)})[^${l(c)}])` : `(?:(?!${l(i)}|${l(c)})[\\s\\S])`;
369
477
  }
370
- const n = r || _;
371
- return e.type === "wildcard" && r !== !1 ? (a) => {
372
- const s = a[e.name];
373
- if (s == null) return ["", e.name];
374
- if (!Array.isArray(s) || s.length === 0)
375
- throw new TypeError(`Expected "${e.name}" to be a non-empty array`);
376
- return [s.map((i, o) => {
377
- if (typeof i != "string")
378
- throw new TypeError(`Expected "${e.name}/${o}" to be a string`);
379
- return n(i);
380
- }).join(t)];
381
- } : (a) => {
382
- const s = a[e.name];
383
- if (s == null) return ["", e.name];
384
- if (typeof s != "string")
385
- throw new TypeError(`Expected "${e.name}" to be a string`);
386
- return [n(s)];
387
- };
388
- }
389
- function Oe(e, t = {}) {
390
- const {
391
- decode: r = decodeURIComponent,
392
- delimiter: n = U
393
- } = t, {
394
- regexp: a,
395
- keys: s
396
- } = Z(e, t), i = s.map((o) => r === !1 ? _ : o.type === "param" ? r : (f) => f.split(n).map(r));
397
- return function(f) {
398
- const u = a.exec(f);
399
- if (!u) return !1;
400
- const y = u[0], d = /* @__PURE__ */ Object.create(null);
401
- for (let b = 1; b < u.length; b++) {
402
- if (u[b] === void 0) continue;
403
- const w = s[b - 1], p = i[b - 1];
404
- d[w.name] = p(u[b]);
405
- }
406
- return {
407
- path: y,
408
- params: d
409
- };
410
- };
411
- }
412
- function Z(e, t = {}) {
413
- const {
414
- delimiter: r = U,
415
- end: n = !0,
416
- sensitive: a = !1,
417
- trailing: s = !0
418
- } = t, i = [], o = [], f = a ? "" : "i", y = (Array.isArray(e) ? e : [e]).map((w) => w instanceof k ? w : L(w, t));
419
- for (const {
420
- tokens: w
421
- } of y)
422
- for (const p of R(w, 0, [])) {
423
- const l = Ee(p, r, i);
424
- o.push(l);
425
- }
426
- let d = `^(?:${o.join("|")})`;
427
- return s && (d += `(?:${$(r)}$)?`), d += n ? "$" : `(?=${$(r)}|$)`, {
428
- regexp: new RegExp(d, f),
429
- keys: i
430
- };
431
- }
432
- function* R(e, t, r) {
433
- if (t === e.length)
434
- return yield r;
435
- const n = e[t];
436
- if (n.type === "group") {
437
- const a = r.slice();
438
- for (const s of R(n.tokens, 0, a))
439
- yield* R(e, t + 1, s);
440
- } else
441
- r.push(n);
442
- yield* R(e, t + 1, r);
443
- }
444
- function Ee(e, t, r) {
445
- let n = "", a = "", s = !0;
446
- for (let i = 0; i < e.length; i++) {
447
- const o = e[i];
448
- if (o.type === "text") {
449
- n += $(o.value), a += o.value, s || (s = o.value.includes(t));
450
- continue;
451
- }
452
- if (o.type === "param" || o.type === "wildcard") {
453
- if (!s && !a)
454
- throw new TypeError(`Missing text after "${o.name}": ${I}`);
455
- o.type === "param" ? n += `(${je(t, s ? "" : a)}+)` : n += "([\\s\\S]+)", r.push(o), a = "", s = !1;
456
- continue;
457
- }
478
+ function B(c) {
479
+ return c.tokens.map(function i(s, y, u) {
480
+ if (s.type === "text") return o(s.value);
481
+ if (s.type === "group")
482
+ return `{${s.tokens.map(i).join("")}}`;
483
+ const b = q(s.name) && z(u[y + 1]) ? s.name : JSON.stringify(s.name);
484
+ if (s.type === "param") return `:${b}`;
485
+ if (s.type === "wildcard") return `*${b}`;
486
+ throw new TypeError(`Unexpected token: ${s}`);
487
+ }).join("");
458
488
  }
459
- return n;
460
- }
461
- function je(e, t) {
462
- return t.length < 2 ? e.length < 2 ? `[^${$(e + t)}]` : `(?:(?!${$(e)})[^${$(t)}])` : e.length < 2 ? `(?:(?!${$(t)})[^${$(e)}])` : `(?:(?!${$(t)}|${$(e)})[\\s\\S])`;
463
- }
464
- function Ae(e) {
465
- return e.tokens.map(function t(r, n, a) {
466
- if (r.type === "text") return we(r.value);
467
- if (r.type === "group")
468
- return `{${r.tokens.map(t).join("")}}`;
469
- const i = Ne(r.name) && Re(a[n + 1]) ? r.name : JSON.stringify(r.name);
470
- if (r.type === "param") return `:${i}`;
471
- if (r.type === "wildcard") return `*${i}`;
472
- throw new TypeError(`Unexpected token: ${r}`);
473
- }).join("");
474
- }
475
- function Ne(e) {
476
- const [t, ...r] = e;
477
- return X.test(t) ? r.every((n) => q.test(n)) : !1;
478
- }
479
- function Re(e) {
480
- return (e == null ? void 0 : e.type) !== "text" ? !0 : !q.test(e.value[0]);
489
+ function q(c) {
490
+ const [i, ...s] = c;
491
+ return r.test(i) ? s.every((y) => n.test(y)) : !1;
492
+ }
493
+ function z(c) {
494
+ return (c == null ? void 0 : c.type) !== "text" ? !0 : !n.test(c.value[0]);
495
+ }
496
+ return R;
481
497
  }
482
- const Ie = Symbol("any"), ke = Symbol("number"), Pe = Symbol("string"), Ce = Symbol("array"), O = {
483
- any: Ie,
484
- number: ke,
485
- string: Pe,
486
- array: Ce
498
+ var te = ve();
499
+ const Ne = Symbol("any"), Re = Symbol("number"), De = Symbol("string"), Ie = Symbol("array"), k = {
500
+ any: Ne,
501
+ number: Re,
502
+ string: De,
503
+ array: Ie
487
504
  };
488
- function K(e, t) {
505
+ function ne(e, t) {
489
506
  for (const r of e)
490
507
  if (!t.includes(r))
491
508
  return !1;
492
509
  return !0;
493
510
  }
494
- function J(e, t) {
511
+ function ae(e, t) {
495
512
  for (const r in t) {
496
513
  const n = t[r];
497
514
  if (Array.isArray(n) && (!e[r] || JSON.stringify(n) !== e[r]))
@@ -519,22 +536,22 @@ function J(e, t) {
519
536
  }
520
537
  }
521
538
  switch (n) {
522
- case O.any: {
539
+ case k.any: {
523
540
  if (!e[r])
524
541
  return !1;
525
542
  break;
526
543
  }
527
- case O.string: {
544
+ case k.string: {
528
545
  if (!e[r] || Array.isArray(e[r]))
529
546
  return !1;
530
547
  break;
531
548
  }
532
- case O.array: {
549
+ case k.array: {
533
550
  if (!e[r] || !Array.isArray(e[r]))
534
551
  return !1;
535
552
  break;
536
553
  }
537
- case O.number: {
554
+ case k.number: {
538
555
  if (!e[r] || Array.isArray(e[r]) || isNaN(parseInt(e[r])) && isNaN(parseFloat(e[r])))
539
556
  return !1;
540
557
  break;
@@ -543,117 +560,144 @@ function J(e, t) {
543
560
  }
544
561
  return !0;
545
562
  }
546
- function Te(e, t) {
563
+ function ke(e, t) {
547
564
  const r = {};
548
565
  for (const n in t) {
549
- const a = t[n], s = e[n];
566
+ const a = t[n], f = e[n];
550
567
  if (Array.isArray(a)) {
551
- r[n] = s === "1" || s === "true";
568
+ r[n] = f === "1" || f === "true";
552
569
  continue;
553
570
  }
554
571
  switch (typeof a) {
555
572
  case "number": {
556
- const i = e[n];
557
- r[n] = isNaN(parseInt(i)) ? parseFloat(i) : parseInt(i);
573
+ const o = e[n];
574
+ r[n] = isNaN(parseInt(o)) ? parseFloat(o) : parseInt(o);
558
575
  break;
559
576
  }
560
577
  case "object": {
561
- r[n] = JSON.parse(s);
578
+ r[n] = JSON.parse(f);
562
579
  break;
563
580
  }
564
581
  case "string":
565
582
  r[n] = e[n];
566
583
  case "boolean": {
567
- const i = e[n];
568
- r[n] = i === "0" ? parseFloat(i) : parseInt(i);
584
+ const o = e[n];
585
+ r[n] = o === "0" ? parseFloat(o) : parseInt(o);
569
586
  break;
570
587
  }
571
588
  }
572
589
  switch (a) {
573
- case O.any:
574
- case O.string:
575
- case O.array: {
590
+ case k.any:
591
+ case k.string:
592
+ case k.array: {
576
593
  r[n] = e[n];
577
594
  break;
578
595
  }
579
- case O.number: {
580
- const i = e[n];
581
- r[n] = isNaN(parseInt(i)) ? parseFloat(i) : parseInt(i);
596
+ case k.number: {
597
+ const o = e[n];
598
+ r[n] = isNaN(parseInt(o)) ? parseFloat(o) : parseInt(o);
582
599
  break;
583
600
  }
584
601
  }
585
602
  }
586
603
  return r;
587
604
  }
588
- function De(e, t) {
605
+ function Ce(e, t) {
589
606
  return (r) => {
590
607
  const {
591
608
  parameters: n,
592
609
  forRoutes: a
593
- } = r, s = x({
610
+ } = r, f = P({
594
611
  name: "entered",
595
612
  sid: "-d3obu6"
596
- }), i = x({
613
+ }), o = P({
597
614
  name: "exited",
598
615
  sid: "-xofyk3"
599
- }), o = x({
616
+ }), l = P({
600
617
  name: "exit",
601
618
  sid: "-673d76"
602
619
  });
603
- return F({
620
+ return $({
604
621
  and: [{
605
622
  source: {
606
623
  activeRoutes: e,
607
624
  query: t
608
625
  },
609
- filter: (f) => {
626
+ filter: (w) => {
610
627
  let {
611
- activeRoutes: u,
612
- query: y
613
- } = f;
614
- return (!a || K(a, u)) && J(y, n);
628
+ activeRoutes: j,
629
+ query: S
630
+ } = w;
631
+ return (!a || ne(a, j)) && ae(S, n);
615
632
  },
616
- fn: (f) => {
633
+ fn: (w) => {
617
634
  let {
618
- query: u
619
- } = f;
620
- return Te(u, n);
635
+ query: j
636
+ } = w;
637
+ return ke(j, n);
621
638
  }
622
639
  }],
623
640
  or: {
624
641
  sid: "-so0f9q"
625
642
  }
626
- }), F({
643
+ }), $({
627
644
  and: [{
628
645
  source: {
629
646
  activeRoutes: e,
630
647
  query: t
631
648
  },
632
- filter: (f) => {
649
+ filter: (w) => {
633
650
  let {
634
- activeRoutes: u,
635
- query: y
636
- } = f;
637
- return !((!a || K(a, u)) && J(y, n));
651
+ activeRoutes: j,
652
+ query: S
653
+ } = w;
654
+ return !((!a || ne(a, j)) && ae(S, n));
638
655
  },
639
- target: i
656
+ target: o
640
657
  }],
641
658
  or: {
642
659
  sid: "-s82e29"
643
660
  }
644
661
  }), {
645
- entered: s,
646
- exited: i,
647
- exit: o,
648
- getPayload: (f) => Object.entries(f).reduce((u, y) => {
649
- let [d, b] = y;
650
- return typeof n[d] == "symbol" ? u[d] = b : u[d] = n[d], u;
662
+ entered: f,
663
+ exited: o,
664
+ exit: l,
665
+ getPayload: (w) => Object.entries(w).reduce((j, S) => {
666
+ let [E, N] = S;
667
+ return typeof n[E] == "symbol" ? j[E] = N : j[E] = n[E], j;
651
668
  }, {})
652
669
  };
653
670
  };
654
671
  }
655
- const ee = "%[a-f0-9]{2}", Q = new RegExp("(" + ee + ")|([^%]+?)", "gi"), W = new RegExp("(" + ee + ")+", "gi");
656
- function D(e, t) {
672
+ var J, se;
673
+ function Te() {
674
+ return se || (se = 1, J = function e(t, r) {
675
+ if (t === r) return !0;
676
+ if (t && r && typeof t == "object" && typeof r == "object") {
677
+ if (t.constructor !== r.constructor) return !1;
678
+ var n, a, f;
679
+ if (Array.isArray(t)) {
680
+ if (n = t.length, n != r.length) return !1;
681
+ for (a = n; a-- !== 0; ) if (!e(t[a], r[a])) return !1;
682
+ return !0;
683
+ }
684
+ if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
685
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
686
+ if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
687
+ if (f = Object.keys(t), n = f.length, n !== Object.keys(r).length) return !1;
688
+ for (a = n; a-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(r, f[a])) return !1;
689
+ for (a = n; a-- !== 0; ) {
690
+ var o = f[a];
691
+ if (!e(t[o], r[o])) return !1;
692
+ }
693
+ return !0;
694
+ }
695
+ return t !== t && r !== r;
696
+ }), J;
697
+ }
698
+ var _e = Te();
699
+ const Ue = /* @__PURE__ */ Ae(_e), le = "%[a-f0-9]{2}", oe = new RegExp("(" + le + ")|([^%]+?)", "gi"), ie = new RegExp("(" + le + ")+", "gi");
700
+ function W(e, t) {
657
701
  try {
658
702
  return [decodeURIComponent(e.join(""))];
659
703
  } catch {
@@ -662,32 +706,32 @@ function D(e, t) {
662
706
  return e;
663
707
  t = t || 1;
664
708
  const r = e.slice(0, t), n = e.slice(t);
665
- return Array.prototype.concat.call([], D(r), D(n));
709
+ return Array.prototype.concat.call([], W(r), W(n));
666
710
  }
667
- function ve(e) {
711
+ function qe(e) {
668
712
  try {
669
713
  return decodeURIComponent(e);
670
714
  } catch {
671
- let t = e.match(Q) || [];
715
+ let t = e.match(oe) || [];
672
716
  for (let r = 1; r < t.length; r++)
673
- e = D(t, r).join(""), t = e.match(Q) || [];
717
+ e = W(t, r).join(""), t = e.match(oe) || [];
674
718
  return e;
675
719
  }
676
720
  }
677
- function Ue(e) {
721
+ function Me(e) {
678
722
  const t = {
679
723
  "%FE%FF": "��",
680
724
  "%FF%FE": "��"
681
725
  };
682
- let r = W.exec(e);
726
+ let r = ie.exec(e);
683
727
  for (; r; ) {
684
728
  try {
685
729
  t[r[0]] = decodeURIComponent(r[0]);
686
730
  } catch {
687
- const a = ve(r[0]);
731
+ const a = qe(r[0]);
688
732
  a !== r[0] && (t[r[0]] = a);
689
733
  }
690
- r = W.exec(e);
734
+ r = ie.exec(e);
691
735
  }
692
736
  t["%C2"] = "�";
693
737
  const n = Object.keys(t);
@@ -695,16 +739,16 @@ function Ue(e) {
695
739
  e = e.replace(new RegExp(a, "g"), t[a]);
696
740
  return e;
697
741
  }
698
- function _e(e) {
742
+ function Le(e) {
699
743
  if (typeof e != "string")
700
744
  throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof e + "`");
701
745
  try {
702
746
  return decodeURIComponent(e);
703
747
  } catch {
704
- return Ue(e);
748
+ return Me(e);
705
749
  }
706
750
  }
707
- function qe(e, t) {
751
+ function Be(e, t) {
708
752
  const r = {};
709
753
  if (Array.isArray(t))
710
754
  for (const n of t) {
@@ -715,13 +759,13 @@ function qe(e, t) {
715
759
  for (const n of Reflect.ownKeys(e)) {
716
760
  const a = Object.getOwnPropertyDescriptor(e, n);
717
761
  if (a.enumerable) {
718
- const s = e[n];
719
- t(n, s, e) && Object.defineProperty(r, n, a);
762
+ const f = e[n];
763
+ t(n, f, e) && Object.defineProperty(r, n, a);
720
764
  }
721
765
  }
722
766
  return r;
723
767
  }
724
- function re(e, t) {
768
+ function de(e, t) {
725
769
  if (!(typeof e == "string" && typeof t == "string"))
726
770
  throw new TypeError("Expected the arguments to be of type `string`");
727
771
  if (e === "" || t === "")
@@ -729,29 +773,29 @@ function re(e, t) {
729
773
  const r = e.indexOf(t);
730
774
  return r === -1 ? [] : [e.slice(0, r), e.slice(r + t.length)];
731
775
  }
732
- const Le = (e) => e == null, Me = (e) => encodeURIComponent(e).replaceAll(/[!'()*]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`), v = Symbol("encodeFragmentIdentifier");
733
- function ze(e) {
776
+ const ze = (e) => e == null, He = (e) => encodeURIComponent(e).replaceAll(/[!'()*]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`), G = Symbol("encodeFragmentIdentifier");
777
+ function Ve(e) {
734
778
  switch (e.arrayFormat) {
735
779
  case "index":
736
780
  return (t) => (r, n) => {
737
781
  const a = r.length;
738
- return n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [m(t, e), "[", a, "]"].join("")] : [...r, [m(t, e), "[", m(a, e), "]=", m(n, e)].join("")];
782
+ return n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [F(t, e), "[", a, "]"].join("")] : [...r, [F(t, e), "[", F(a, e), "]=", F(n, e)].join("")];
739
783
  };
740
784
  case "bracket":
741
- return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [m(t, e), "[]"].join("")] : [...r, [m(t, e), "[]=", m(n, e)].join("")];
785
+ return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [F(t, e), "[]"].join("")] : [...r, [F(t, e), "[]=", F(n, e)].join("")];
742
786
  case "colon-list-separator":
743
- return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [m(t, e), ":list="].join("")] : [...r, [m(t, e), ":list=", m(n, e)].join("")];
787
+ return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [F(t, e), ":list="].join("")] : [...r, [F(t, e), ":list=", F(n, e)].join("")];
744
788
  case "comma":
745
789
  case "separator":
746
790
  case "bracket-separator": {
747
791
  const t = e.arrayFormat === "bracket-separator" ? "[]=" : "=";
748
- return (r) => (n, a) => a === void 0 || e.skipNull && a === null || e.skipEmptyString && a === "" ? n : (a = a === null ? "" : a, n.length === 0 ? [[m(r, e), t, m(a, e)].join("")] : [[n, m(a, e)].join(e.arrayFormatSeparator)]);
792
+ return (r) => (n, a) => a === void 0 || e.skipNull && a === null || e.skipEmptyString && a === "" ? n : (a = a === null ? "" : a, n.length === 0 ? [[F(r, e), t, F(a, e)].join("")] : [[n, F(a, e)].join(e.arrayFormatSeparator)]);
749
793
  }
750
794
  default:
751
- return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, m(t, e)] : [...r, [m(t, e), "=", m(n, e)].join("")];
795
+ return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, F(t, e)] : [...r, [F(t, e), "=", F(n, e)].join("")];
752
796
  }
753
797
  }
754
- function Be(e) {
798
+ function Ke(e) {
755
799
  let t;
756
800
  switch (e.arrayFormat) {
757
801
  case "index":
@@ -789,24 +833,24 @@ function Be(e) {
789
833
  case "comma":
790
834
  case "separator":
791
835
  return (r, n, a) => {
792
- const s = typeof n == "string" && n.includes(e.arrayFormatSeparator), i = typeof n == "string" && !s && S(n, e).includes(e.arrayFormatSeparator);
793
- n = i ? S(n, e) : n;
794
- const o = s || i ? n.split(e.arrayFormatSeparator).map((f) => S(f, e)) : n === null ? n : S(n, e);
795
- a[r] = o;
836
+ const f = typeof n == "string" && n.includes(e.arrayFormatSeparator), o = typeof n == "string" && !f && D(n, e).includes(e.arrayFormatSeparator);
837
+ n = o ? D(n, e) : n;
838
+ const l = f || o ? n.split(e.arrayFormatSeparator).map((w) => D(w, e)) : n === null ? n : D(n, e);
839
+ a[r] = l;
796
840
  };
797
841
  case "bracket-separator":
798
842
  return (r, n, a) => {
799
- const s = /(\[])$/.test(r);
800
- if (r = r.replace(/\[]$/, ""), !s) {
801
- a[r] = n && S(n, e);
843
+ const f = /(\[])$/.test(r);
844
+ if (r = r.replace(/\[]$/, ""), !f) {
845
+ a[r] = n && D(n, e);
802
846
  return;
803
847
  }
804
- const i = n === null ? [] : S(n, e).split(e.arrayFormatSeparator);
848
+ const o = n === null ? [] : D(n, e).split(e.arrayFormatSeparator);
805
849
  if (a[r] === void 0) {
806
- a[r] = i;
850
+ a[r] = o;
807
851
  return;
808
852
  }
809
- a[r] = [...a[r], ...i];
853
+ a[r] = [...a[r], ...o];
810
854
  };
811
855
  default:
812
856
  return (r, n, a) => {
@@ -818,37 +862,37 @@ function Be(e) {
818
862
  };
819
863
  }
820
864
  }
821
- function te(e) {
865
+ function pe(e) {
822
866
  if (typeof e != "string" || e.length !== 1)
823
867
  throw new TypeError("arrayFormatSeparator must be single character string");
824
868
  }
825
- function m(e, t) {
826
- return t.encode ? t.strict ? Me(e) : encodeURIComponent(e) : e;
869
+ function F(e, t) {
870
+ return t.encode ? t.strict ? He(e) : encodeURIComponent(e) : e;
827
871
  }
828
- function S(e, t) {
829
- return t.decode ? _e(e) : e;
872
+ function D(e, t) {
873
+ return t.decode ? Le(e) : e;
830
874
  }
831
- function ne(e) {
832
- return Array.isArray(e) ? e.sort() : typeof e == "object" ? ne(Object.keys(e)).sort((t, r) => Number(t) - Number(r)).map((t) => e[t]) : e;
875
+ function ye(e) {
876
+ return Array.isArray(e) ? e.sort() : typeof e == "object" ? ye(Object.keys(e)).sort((t, r) => Number(t) - Number(r)).map((t) => e[t]) : e;
833
877
  }
834
- function ae(e) {
878
+ function me(e) {
835
879
  const t = e.indexOf("#");
836
880
  return t !== -1 && (e = e.slice(0, t)), e;
837
881
  }
838
- function He(e) {
882
+ function Je(e) {
839
883
  let t = "";
840
884
  const r = e.indexOf("#");
841
885
  return r !== -1 && (t = e.slice(r)), t;
842
886
  }
843
- function G(e, t, r) {
887
+ function ce(e, t, r) {
844
888
  return r === "string" && typeof e == "string" ? e : typeof r == "function" && typeof e == "string" ? r(e) : t.parseBooleans && e !== null && (e.toLowerCase() === "true" || e.toLowerCase() === "false") ? e.toLowerCase() === "true" : r === "number" && !Number.isNaN(Number(e)) && typeof e == "string" && e.trim() !== "" || t.parseNumbers && !Number.isNaN(Number(e)) && typeof e == "string" && e.trim() !== "" ? Number(e) : e;
845
889
  }
846
- function M(e) {
847
- e = ae(e);
890
+ function X(e) {
891
+ e = me(e);
848
892
  const t = e.indexOf("?");
849
893
  return t === -1 ? "" : e.slice(t + 1);
850
894
  }
851
- function z(e, t) {
895
+ function Y(e, t) {
852
896
  t = {
853
897
  decode: !0,
854
898
  sort: !0,
@@ -858,30 +902,30 @@ function z(e, t) {
858
902
  parseBooleans: !1,
859
903
  types: /* @__PURE__ */ Object.create(null),
860
904
  ...t
861
- }, te(t.arrayFormatSeparator);
862
- const r = Be(t), n = /* @__PURE__ */ Object.create(null);
905
+ }, pe(t.arrayFormatSeparator);
906
+ const r = Ke(t), n = /* @__PURE__ */ Object.create(null);
863
907
  if (typeof e != "string" || (e = e.trim().replace(/^[?#&]/, ""), !e))
864
908
  return n;
865
909
  for (const a of e.split("&")) {
866
910
  if (a === "")
867
911
  continue;
868
- const s = t.decode ? a.replaceAll("+", " ") : a;
869
- let [i, o] = re(s, "=");
870
- i === void 0 && (i = s), o = o === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(t.arrayFormat) ? o : S(o, t), r(S(i, t), o, n);
912
+ const f = t.decode ? a.replaceAll("+", " ") : a;
913
+ let [o, l] = de(f, "=");
914
+ o === void 0 && (o = f), l = l === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(t.arrayFormat) ? l : D(l, t), r(D(o, t), l, n);
871
915
  }
872
- for (const [a, s] of Object.entries(n))
873
- if (typeof s == "object" && s !== null && t.types[a] !== "string")
874
- for (const [i, o] of Object.entries(s)) {
875
- const f = t.types[a] ? t.types[a].replace("[]", "") : void 0;
876
- s[i] = G(o, t, f);
916
+ for (const [a, f] of Object.entries(n))
917
+ if (typeof f == "object" && f !== null && t.types[a] !== "string")
918
+ for (const [o, l] of Object.entries(f)) {
919
+ const w = t.types[a] ? t.types[a].replace("[]", "") : void 0;
920
+ f[o] = ce(l, t, w);
877
921
  }
878
- else typeof s == "object" && s !== null && t.types[a] === "string" ? n[a] = Object.values(s).join(t.arrayFormatSeparator) : n[a] = G(s, t, t.types[a]);
879
- return t.sort === !1 ? n : (t.sort === !0 ? Object.keys(n).sort() : Object.keys(n).sort(t.sort)).reduce((a, s) => {
880
- const i = n[s];
881
- return a[s] = i && typeof i == "object" && !Array.isArray(i) ? ne(i) : i, a;
922
+ else typeof f == "object" && f !== null && t.types[a] === "string" ? n[a] = Object.values(f).join(t.arrayFormatSeparator) : n[a] = ce(f, t, t.types[a]);
923
+ return t.sort === !1 ? n : (t.sort === !0 ? Object.keys(n).sort() : Object.keys(n).sort(t.sort)).reduce((a, f) => {
924
+ const o = n[f];
925
+ return a[f] = o && typeof o == "object" && !Array.isArray(o) ? ye(o) : o, a;
882
926
  }, /* @__PURE__ */ Object.create(null));
883
927
  }
884
- function se(e, t) {
928
+ function ge(e, t) {
885
929
  if (!e)
886
930
  return "";
887
931
  t = {
@@ -890,199 +934,240 @@ function se(e, t) {
890
934
  arrayFormat: "none",
891
935
  arrayFormatSeparator: ",",
892
936
  ...t
893
- }, te(t.arrayFormatSeparator);
894
- const r = (i) => t.skipNull && Le(e[i]) || t.skipEmptyString && e[i] === "", n = ze(t), a = {};
895
- for (const [i, o] of Object.entries(e))
896
- r(i) || (a[i] = o);
897
- const s = Object.keys(a);
898
- return t.sort !== !1 && s.sort(t.sort), s.map((i) => {
899
- const o = e[i];
900
- return o === void 0 ? "" : o === null ? m(i, t) : Array.isArray(o) ? o.length === 0 && t.arrayFormat === "bracket-separator" ? m(i, t) + "[]" : o.reduce(n(i), []).join("&") : m(i, t) + "=" + m(o, t);
901
- }).filter((i) => i.length > 0).join("&");
937
+ }, pe(t.arrayFormatSeparator);
938
+ const r = (o) => t.skipNull && ze(e[o]) || t.skipEmptyString && e[o] === "", n = Ve(t), a = {};
939
+ for (const [o, l] of Object.entries(e))
940
+ r(o) || (a[o] = l);
941
+ const f = Object.keys(a);
942
+ return t.sort !== !1 && f.sort(t.sort), f.map((o) => {
943
+ const l = e[o];
944
+ return l === void 0 ? "" : l === null ? F(o, t) : Array.isArray(l) ? l.length === 0 && t.arrayFormat === "bracket-separator" ? F(o, t) + "[]" : l.reduce(n(o), []).join("&") : F(o, t) + "=" + F(l, t);
945
+ }).filter((o) => o.length > 0).join("&");
902
946
  }
903
- function ie(e, t) {
947
+ function he(e, t) {
904
948
  var a;
905
949
  t = {
906
950
  decode: !0,
907
951
  ...t
908
952
  };
909
- let [r, n] = re(e, "#");
953
+ let [r, n] = de(e, "#");
910
954
  return r === void 0 && (r = e), {
911
955
  url: ((a = r == null ? void 0 : r.split("?")) == null ? void 0 : a[0]) ?? "",
912
- query: z(M(e), t),
956
+ query: Y(X(e), t),
913
957
  ...t && t.parseFragmentIdentifier && n ? {
914
- fragmentIdentifier: S(n, t)
958
+ fragmentIdentifier: D(n, t)
915
959
  } : {}
916
960
  };
917
961
  }
918
- function oe(e, t) {
962
+ function be(e, t) {
919
963
  t = {
920
964
  encode: !0,
921
965
  strict: !0,
922
- [v]: !0,
966
+ [G]: !0,
923
967
  ...t
924
968
  };
925
- const r = ae(e.url).split("?")[0] || "", n = M(e.url), a = {
926
- ...z(n, {
969
+ const r = me(e.url).split("?")[0] || "", n = X(e.url), a = {
970
+ ...Y(n, {
927
971
  sort: !1
928
972
  }),
929
973
  ...e.query
930
974
  };
931
- let s = se(a, t);
932
- s && (s = `?${s}`);
933
- let i = He(e.url);
975
+ let f = ge(a, t);
976
+ f && (f = `?${f}`);
977
+ let o = Je(e.url);
934
978
  if (typeof e.fragmentIdentifier == "string") {
935
- const o = new URL(r);
936
- o.hash = e.fragmentIdentifier, i = t[v] ? o.hash : `#${e.fragmentIdentifier}`;
979
+ const l = new URL(r);
980
+ l.hash = e.fragmentIdentifier, o = t[G] ? l.hash : `#${e.fragmentIdentifier}`;
937
981
  }
938
- return `${r}${s}${i}`;
982
+ return `${r}${f}${o}`;
939
983
  }
940
- function ce(e, t, r) {
984
+ function we(e, t, r) {
941
985
  r = {
942
986
  parseFragmentIdentifier: !0,
943
- [v]: !1,
987
+ [G]: !1,
944
988
  ...r
945
989
  };
946
990
  const {
947
991
  url: n,
948
992
  query: a,
949
- fragmentIdentifier: s
950
- } = ie(e, r);
951
- return oe({
993
+ fragmentIdentifier: f
994
+ } = he(e, r);
995
+ return be({
952
996
  url: n,
953
- query: qe(a, t),
954
- fragmentIdentifier: s
997
+ query: Be(a, t),
998
+ fragmentIdentifier: f
955
999
  }, r);
956
1000
  }
957
- function Ve(e, t, r) {
958
- const n = Array.isArray(t) ? (a) => !t.includes(a) : (a, s) => !t(a, s);
959
- return ce(e, n, r);
1001
+ function Qe(e, t, r) {
1002
+ const n = Array.isArray(t) ? (a) => !t.includes(a) : (a, f) => !t(a, f);
1003
+ return we(e, n, r);
960
1004
  }
961
- const T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1005
+ const Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
962
1006
  __proto__: null,
963
- exclude: Ve,
964
- extract: M,
965
- parse: z,
966
- parseUrl: ie,
967
- pick: ce,
968
- stringify: se,
969
- stringifyUrl: oe
1007
+ exclude: Qe,
1008
+ extract: X,
1009
+ parse: Y,
1010
+ parseUrl: he,
1011
+ pick: we,
1012
+ stringify: ge,
1013
+ stringifyUrl: be
970
1014
  }, Symbol.toStringTag, { value: "Module" }));
971
- function We(e) {
1015
+ function fe(e, t) {
1016
+ var r = Object.keys(e);
1017
+ if (Object.getOwnPropertySymbols) {
1018
+ var n = Object.getOwnPropertySymbols(e);
1019
+ t && (n = n.filter(function(a) {
1020
+ return Object.getOwnPropertyDescriptor(e, a).enumerable;
1021
+ })), r.push.apply(r, n);
1022
+ }
1023
+ return r;
1024
+ }
1025
+ function ue(e) {
1026
+ for (var t = 1; t < arguments.length; t++) {
1027
+ var r = arguments[t] != null ? arguments[t] : {};
1028
+ t % 2 ? fe(Object(r), !0).forEach(function(n) {
1029
+ We(e, n, r[n]);
1030
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : fe(Object(r)).forEach(function(n) {
1031
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
1032
+ });
1033
+ }
1034
+ return e;
1035
+ }
1036
+ function We(e, t, r) {
1037
+ return (t = Ge(t)) in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
1038
+ }
1039
+ function Ge(e) {
1040
+ var t = Xe(e, "string");
1041
+ return typeof t == "symbol" ? t : t + "";
1042
+ }
1043
+ function Xe(e, t) {
1044
+ if (typeof e != "object" || !e) return e;
1045
+ var r = e[Symbol.toPrimitive];
1046
+ if (r !== void 0) {
1047
+ var n = r.call(e, t);
1048
+ if (typeof n != "object") return n;
1049
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1050
+ }
1051
+ return (t === "string" ? String : Number)(e);
1052
+ }
1053
+ function rr(e) {
972
1054
  const {
973
1055
  base: t = "/",
974
1056
  routes: r
975
- } = e, n = j(null, {
1057
+ } = e, n = L(null, {
976
1058
  and: {
977
1059
  serialize: "ignore"
978
1060
  },
979
1061
  name: "$history",
980
- sid: "ftu36z"
981
- }), a = j([], {
1062
+ sid: "3inwxx"
1063
+ }), a = L([], {
982
1064
  and: {
983
1065
  serialize: "ignore"
984
1066
  },
985
1067
  name: "$activeRoutes",
986
- sid: "z30ma4"
987
- }), s = j({}, {
1068
+ sid: "mrug12"
1069
+ }), f = L({}, {
988
1070
  name: "$query",
989
- sid: "hkri52"
990
- }), i = j(null, {
1071
+ sid: "f7je63"
1072
+ }), o = L(null, {
991
1073
  name: "$path",
992
- sid: "-zgnqnj"
993
- }), o = x({
1074
+ sid: "x787cm"
1075
+ }), l = P({
994
1076
  name: "setHistory",
995
- sid: "w6xvrg"
996
- }), f = x({
1077
+ sid: "ttprsh"
1078
+ }), w = P({
1079
+ name: "navigate",
1080
+ sid: "-66otyw"
1081
+ }), j = P({
997
1082
  name: "back",
998
- sid: "-4mcm91"
999
- }), u = x({
1083
+ sid: "-ggh63w"
1084
+ }), S = P({
1000
1085
  name: "forward",
1001
- sid: "6nmzsp"
1002
- }), y = x({
1086
+ sid: "-56hk26"
1087
+ }), E = P({
1003
1088
  name: "locationUpdated",
1004
- sid: "qywvkp"
1005
- }), d = r.map((l) => {
1006
- let h = l;
1007
- const c = [];
1008
- for (c.unshift(h.internal.path); h.internal.parent; )
1009
- h = h.internal.parent, h.internal.path !== "/" && c.unshift(h.internal.path);
1010
- const g = t === "/" ? c.join("") : [t, ...c].join("");
1089
+ sid: "f4sbpu"
1090
+ }), N = r.map((m) => {
1091
+ let h = m;
1092
+ const p = [];
1093
+ for (p.unshift(h.internal.path); h.internal.parent; )
1094
+ h = h.internal.parent, h.internal.path !== "/" && p.unshift(h.internal.path);
1095
+ const x = t === "/" ? p.join("") : [t, ...p].join("");
1011
1096
  return {
1012
- route: l,
1013
- path: g,
1014
- toPath: he(g),
1015
- fromPath: ge(g)
1097
+ route: m,
1098
+ path: x,
1099
+ toPath: te.compile(x),
1100
+ fromPath: te.match(x)
1016
1101
  };
1017
- }), b = H({
1102
+ }), I = Z({
1018
1103
  and: {
1019
1104
  source: {
1020
1105
  history: n
1021
1106
  },
1022
- effect: async (l, h) => {
1107
+ effect: async (m, h) => {
1023
1108
  let {
1024
- history: c
1025
- } = l, {
1026
- path: g,
1027
- query: P,
1028
- replace: A
1109
+ history: p
1110
+ } = m, {
1111
+ path: x,
1112
+ query: B,
1113
+ replace: q
1029
1114
  } = h;
1030
- if (!c)
1115
+ if (!p)
1031
1116
  throw new Error("history not found");
1032
- const B = {
1033
- pathname: g,
1034
- search: "?".concat(T.stringify(P))
1117
+ const z = {
1118
+ pathname: x,
1119
+ search: "?".concat(Q.stringify(B))
1035
1120
  };
1036
- A ? c.replace(B) : c.push(B);
1121
+ q ? p.replace(z) : p.push(z);
1037
1122
  }
1038
1123
  },
1039
1124
  or: {
1040
1125
  name: "navigateFx",
1041
- sid: "qepxid"
1126
+ sid: "ekldni"
1042
1127
  }
1043
- }), w = N((l) => {
1044
- const h = ue(y);
1128
+ }), U = V((m) => {
1129
+ const h = Fe(E);
1045
1130
  if (h({
1046
- pathname: l.location.pathname,
1047
- query: T.parse(l.location.search)
1048
- }), !l)
1131
+ pathname: m.location.pathname,
1132
+ query: ue({}, Q.parse(m.location.search))
1133
+ }), !m)
1049
1134
  throw new Error();
1050
- l.listen((c) => {
1135
+ m.listen((p) => {
1051
1136
  let {
1052
- location: g
1053
- } = c;
1137
+ location: x
1138
+ } = p;
1054
1139
  h({
1055
- pathname: g.pathname,
1056
- query: T.parse(g.search)
1140
+ pathname: x.pathname,
1141
+ query: ue({}, Q.parse(x.search))
1057
1142
  });
1058
1143
  });
1059
1144
  }, {
1060
1145
  name: "subscribeHistoryFx",
1061
- sid: "es8v7q"
1062
- }), p = H({
1146
+ sid: "2y4bcv"
1147
+ }), O = Z({
1063
1148
  and: {
1064
1149
  source: {
1065
- query: s,
1066
- path: i
1150
+ query: f,
1151
+ path: o
1067
1152
  },
1068
- effect: async (l) => {
1153
+ effect: async (m) => {
1069
1154
  let {
1070
1155
  query: h,
1071
- path: c
1072
- } = l;
1156
+ path: p
1157
+ } = m;
1073
1158
  for (const {
1074
- route: g,
1075
- fromPath: P
1076
- } of d) {
1077
- const A = P(c);
1078
- if (A)
1079
- await g.internal.openFx({
1159
+ route: x,
1160
+ fromPath: B
1161
+ } of N) {
1162
+ const q = B(p);
1163
+ if (q)
1164
+ await x.internal.openFx({
1080
1165
  query: h,
1081
- params: A.params,
1166
+ params: q.params,
1082
1167
  historyIgnore: !0
1083
1168
  });
1084
1169
  else {
1085
- g.internal.close();
1170
+ x.internal.close();
1086
1171
  continue;
1087
1172
  }
1088
1173
  }
@@ -1090,115 +1175,146 @@ function We(e) {
1090
1175
  },
1091
1176
  or: {
1092
1177
  name: "openRoutesByPathFx",
1093
- sid: "bmwb4p"
1178
+ sid: "-788q6"
1094
1179
  }
1095
1180
  });
1096
1181
  for (const {
1097
- route: l,
1182
+ route: m,
1098
1183
  toPath: h
1099
- } of d)
1100
- F({
1184
+ } of N)
1185
+ $({
1101
1186
  and: [{
1102
- clock: l.opened,
1187
+ clock: m.opened,
1103
1188
  source: a,
1104
- filter: (c) => !c.includes(l),
1105
- fn: (c) => [...c, l],
1189
+ filter: (p) => !p.includes(m),
1190
+ fn: (p) => [...p, m],
1106
1191
  target: a
1107
1192
  }],
1108
1193
  or: {
1109
- sid: "ff1m4n"
1194
+ sid: "f1aram"
1110
1195
  }
1111
- }), F({
1196
+ }), $({
1112
1197
  and: [{
1113
- clock: l.opened,
1114
- filter: (c) => !(c != null && c.historyIgnore),
1115
- fn: (c) => {
1116
- var g;
1198
+ clock: m.opened,
1199
+ filter: (p) => !(p != null && p.historyIgnore),
1200
+ fn: (p) => {
1201
+ var x;
1117
1202
  return {
1118
- path: h(c && "params" in c ? c.params : void 0),
1119
- query: (g = c == null ? void 0 : c.query) !== null && g !== void 0 ? g : {},
1120
- replace: c == null ? void 0 : c.replace
1203
+ path: h(p && "params" in p ? p.params : void 0),
1204
+ query: (x = p == null ? void 0 : p.query) !== null && x !== void 0 ? x : {},
1205
+ replace: p == null ? void 0 : p.replace
1121
1206
  };
1122
1207
  },
1123
- target: b
1208
+ target: w
1124
1209
  }],
1125
1210
  or: {
1126
- sid: "fuznc4"
1211
+ sid: "fh8si3"
1127
1212
  }
1128
- }), F({
1213
+ }), $({
1129
1214
  and: [{
1130
- clock: l.closed,
1215
+ clock: m.closed,
1131
1216
  source: a,
1132
- fn: (c) => c.filter((g) => g !== l),
1217
+ fn: (p) => p.filter((x) => x !== m),
1133
1218
  target: a
1134
1219
  }],
1135
1220
  or: {
1136
- sid: "ges8p4"
1221
+ sid: "gcl2bo"
1137
1222
  }
1138
1223
  });
1139
- return F({
1224
+ return $({
1140
1225
  and: [{
1141
- clock: o,
1226
+ clock: l,
1142
1227
  target: n
1143
1228
  }],
1144
1229
  or: {
1145
- sid: "guq9uv"
1230
+ sid: "gsj3hf"
1146
1231
  }
1147
- }), F({
1232
+ }), $({
1148
1233
  and: [{
1149
1234
  clock: n,
1150
1235
  filter: Boolean,
1151
- target: w
1236
+ target: U
1152
1237
  }],
1153
1238
  or: {
1154
- sid: "gxh8to"
1239
+ sid: "gva2g8"
1155
1240
  }
1156
- }), F({
1241
+ }), $({
1157
1242
  and: [{
1158
- clock: y,
1159
- fn: (l) => {
1160
- var h;
1161
- return {
1162
- path: l.pathname,
1163
- query: (h = l.query) !== null && h !== void 0 ? h : {}
1164
- };
1243
+ clock: E,
1244
+ source: {
1245
+ query: f,
1246
+ path: o
1165
1247
  },
1166
- target: [le({
1167
- sid: "-38mmc2",
1168
- fn: () => de({
1248
+ filter: (m, h) => {
1249
+ let {
1250
+ query: p,
1251
+ path: x
1252
+ } = m;
1253
+ return x !== h.pathname || !Ue(p, h.query);
1254
+ },
1255
+ fn: (m, h) => ({
1256
+ path: h.pathname,
1257
+ query: h.query
1258
+ }),
1259
+ target: [je({
1260
+ sid: "-396exf",
1261
+ fn: () => Se({
1169
1262
  targets: {
1170
- path: i,
1171
- query: s
1263
+ path: o,
1264
+ query: f
1172
1265
  }
1173
1266
  }),
1174
1267
  name: "target",
1175
1268
  method: "spread"
1176
- }), p]
1269
+ }), O]
1270
+ }],
1271
+ or: {
1272
+ sid: "ha4igz"
1273
+ }
1274
+ }), $({
1275
+ and: [{
1276
+ clock: w,
1277
+ target: I
1278
+ }],
1279
+ or: {
1280
+ sid: "i87r9d"
1281
+ }
1282
+ }), $({
1283
+ and: [{
1284
+ clock: [f, o],
1285
+ source: {
1286
+ query: f,
1287
+ path: o
1288
+ },
1289
+ fn: (m) => m,
1290
+ target: w
1177
1291
  }],
1178
1292
  or: {
1179
- sid: "hcbouf"
1293
+ sid: "iayq86"
1180
1294
  }
1181
1295
  }), {
1182
- $query: s,
1183
- $path: i,
1296
+ $query: f,
1297
+ $path: o,
1184
1298
  $activeRoutes: a,
1185
- back: f,
1186
- forward: u,
1299
+ back: j,
1300
+ forward: S,
1301
+ navigate: w,
1187
1302
  routes: r,
1188
- setHistory: o,
1189
- mappedRoutes: d,
1190
- trackQuery: De(a, s),
1303
+ setHistory: l,
1304
+ mappedRoutes: N,
1305
+ trackQuery: Ce(a, f),
1191
1306
  "@@unitShape": () => ({
1192
- query: s,
1193
- path: i,
1307
+ query: f,
1308
+ path: o,
1194
1309
  activeRoutes: a,
1195
- onBack: f,
1196
- onForward: u
1310
+ onBack: j,
1311
+ onForward: S,
1312
+ onNavigate: w
1197
1313
  })
1198
1314
  };
1199
1315
  }
1200
1316
  export {
1201
- Qe as createRoute,
1202
- We as createRouter,
1203
- O as parameters
1317
+ er as createRoute,
1318
+ rr as createRouter,
1319
+ k as parameters
1204
1320
  };