@argon-router/core 0.1.4 → 0.2.0

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 R, createStore as E, createEvent as x, sample as F, split as fe, attach as V, scopeBind as ue, withFactory as le } from "effector";
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
2
  import { spread as de } from "patronum";
3
- function z(e, t) {
3
+ function V(e, t) {
4
4
  var r = Object.keys(e);
5
5
  if (Object.getOwnPropertySymbols) {
6
6
  var n = Object.getOwnPropertySymbols(e);
@@ -13,9 +13,9 @@ function z(e, t) {
13
13
  function C(e) {
14
14
  for (var t = 1; t < arguments.length; t++) {
15
15
  var r = arguments[t] != null ? arguments[t] : {};
16
- t % 2 ? z(Object(r), !0).forEach(function(n) {
16
+ t % 2 ? V(Object(r), !0).forEach(function(n) {
17
17
  pe(e, n, r[n]);
18
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : z(Object(r)).forEach(function(n) {
18
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : V(Object(r)).forEach(function(n) {
19
19
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
20
20
  });
21
21
  }
@@ -40,57 +40,59 @@ function ye(e, t) {
40
40
  }
41
41
  function Qe(e) {
42
42
  let t;
43
- const r = R(() => {
44
- var h;
45
- return (h = t) === null || h === void 0 ? void 0 : h();
43
+ const r = N(() => {
44
+ var p;
45
+ return (p = t) === null || p === void 0 ? void 0 : p();
46
46
  }, {
47
47
  name: "waitForAsyncBundleFx",
48
- sid: "hl1gh5"
49
- }), n = R(async () => {
50
- for (const u of (h = e.beforeOpen) !== null && h !== void 0 ? h : []) {
51
- var h;
52
- await u();
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();
53
53
  }
54
54
  }, {
55
55
  name: "beforeOpenFx",
56
- sid: "jez0xa"
57
- }), a = R(async (h) => (await r(), await n(), e.parent && await e.parent.internal.openFx(C(C({}, h), {}, {
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
+ }), {}, {
58
60
  historyIgnore: !0
59
- })), h), {
61
+ })), p), {
60
62
  name: "openFx",
61
- sid: "-uafnek"
62
- }), s = E({}, {
63
+ sid: "-hz9h5i"
64
+ }), s = j({}, {
63
65
  name: "$params",
64
- sid: "dlh2xl"
65
- }), o = E(!1, {
66
+ sid: "fyp6wk"
67
+ }), i = j(!1, {
66
68
  name: "$isOpened",
67
- sid: "lcu7f1"
68
- }), i = a.pending, c = x({
69
+ sid: "nq2be0"
70
+ }), o = a.pending, f = x({
69
71
  name: "open",
70
- sid: "-qjaufd"
71
- }), f = x({
72
+ sid: "-e84o6b"
73
+ }), u = x({
72
74
  name: "close",
73
- sid: "-6cg68t"
74
- }), m = x({
75
+ sid: "5yq009"
76
+ }), y = x({
75
77
  name: "opened",
76
- sid: "-a2kpe7"
78
+ sid: "28lguv"
77
79
  }), d = x({
78
80
  name: "openedOnServer",
79
- sid: "-u0yshs"
81
+ sid: "-rnqoit"
80
82
  }), b = x({
81
83
  name: "openedOnClient",
82
- sid: "-u3faft"
84
+ sid: "-rq76gu"
83
85
  }), w = x({
84
86
  name: "closed",
85
- sid: "-d6sqbp"
87
+ sid: "-atkmcq"
86
88
  });
87
89
  return F({
88
90
  and: [{
89
- clock: c,
91
+ clock: f,
90
92
  target: a
91
93
  }],
92
94
  or: {
93
- sid: "sre3h1"
95
+ sid: "t5oqwf"
94
96
  }
95
97
  }), fe({
96
98
  and: [{
@@ -102,75 +104,75 @@ function Qe(e) {
102
104
  }
103
105
  }],
104
106
  or: {
105
- sid: "t5oqwf"
107
+ sid: "t8fpv8"
106
108
  }
107
109
  }), F({
108
110
  and: [{
109
111
  clock: [b, d],
110
- target: m
112
+ target: y
111
113
  }],
112
114
  or: {
113
- sid: "tamw8o"
115
+ sid: "tphc9f"
114
116
  }
115
117
  }), F({
116
118
  and: [{
117
- clock: m,
119
+ clock: y,
118
120
  fn: () => !0,
119
- target: o
121
+ target: i
120
122
  }],
121
123
  or: {
122
- sid: "toxjo2"
124
+ sid: "u3rzot"
123
125
  }
124
126
  }), F({
125
127
  and: [{
126
- clock: f,
128
+ clock: u,
127
129
  target: w
128
130
  }],
129
131
  or: {
130
- sid: "u3rzot"
132
+ sid: "u72r8z"
131
133
  }
132
134
  }), F({
133
135
  and: [{
134
136
  clock: w,
135
137
  fn: () => !1,
136
- target: o
138
+ target: i
137
139
  }],
138
140
  or: {
139
- sid: "u6iynm"
141
+ sid: "ykn3cq"
140
142
  }
141
143
  }), {
142
144
  $params: s,
143
- $isOpened: o,
144
- $isPending: i,
145
- open: c,
145
+ $isOpened: i,
146
+ $isPending: o,
147
+ open: f,
146
148
  closed: w,
147
- opened: m,
149
+ opened: y,
148
150
  openedOnClient: b,
149
151
  openedOnServer: d,
150
152
  internal: C({
151
153
  index: !1,
152
- close: f,
154
+ close: u,
153
155
  openFx: a,
154
- setAsyncImport: (h) => t = h
156
+ setAsyncImport: (p) => t = p
155
157
  }, e),
156
158
  "@@unitShape": () => ({
157
159
  params: s,
158
- isPending: i,
159
- isOpened: o,
160
- onOpen: c
160
+ isPending: o,
161
+ isOpened: i,
162
+ onOpen: f
161
163
  })
162
164
  };
163
165
  }
164
- var j = {};
165
- Object.defineProperty(j, "__esModule", {
166
+ var E = {};
167
+ Object.defineProperty(E, "__esModule", {
166
168
  value: !0
167
169
  });
168
- j.TokenData = void 0;
169
- j.parse = L;
170
- var he = j.compile = $e, ge = j.match = Oe;
171
- j.pathToRegexp = Z;
172
- j.stringify = Ae;
173
- const _ = "/", v = (e) => e, X = /^[$_\p{ID_Start}]$/u, q = /^[$\u200c\u200d\p{ID_Continue}]$/u, I = "https://git.new/pathToRegexpError", be = {
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 = {
174
176
  // Groups.
175
177
  "{": "{",
176
178
  "}": "}",
@@ -228,18 +230,18 @@ function* xe(e) {
228
230
  value: t[r++]
229
231
  };
230
232
  else if (a === ":") {
231
- const o = n();
233
+ const i = n();
232
234
  yield {
233
235
  type: "PARAM",
234
236
  index: r,
235
- value: o
237
+ value: i
236
238
  };
237
239
  } else if (a === "*") {
238
- const o = n();
240
+ const i = n();
239
241
  yield {
240
242
  type: "WILDCARD",
241
243
  index: r,
242
- value: o
244
+ value: i
243
245
  };
244
246
  } else
245
247
  yield {
@@ -286,72 +288,72 @@ class Fe {
286
288
  return t;
287
289
  }
288
290
  }
289
- class P {
291
+ class k {
290
292
  constructor(t) {
291
293
  this.tokens = t;
292
294
  }
293
295
  }
294
- j.TokenData = P;
296
+ E.TokenData = k;
295
297
  function L(e, t = {}) {
296
298
  const {
297
- encodePath: r = v
299
+ encodePath: r = _
298
300
  } = t, n = new Fe(xe(e));
299
- function a(o) {
300
- const i = [];
301
+ function a(i) {
302
+ const o = [];
301
303
  for (; ; ) {
302
- const c = n.text();
303
- c && i.push({
304
+ const f = n.text();
305
+ f && o.push({
304
306
  type: "text",
305
- value: r(c)
307
+ value: r(f)
306
308
  });
307
- const f = n.tryConsume("PARAM");
308
- if (f) {
309
- i.push({
309
+ const u = n.tryConsume("PARAM");
310
+ if (u) {
311
+ o.push({
310
312
  type: "param",
311
- name: f
313
+ name: u
312
314
  });
313
315
  continue;
314
316
  }
315
- const m = n.tryConsume("WILDCARD");
316
- if (m) {
317
- i.push({
317
+ const y = n.tryConsume("WILDCARD");
318
+ if (y) {
319
+ o.push({
318
320
  type: "wildcard",
319
- name: m
321
+ name: y
320
322
  });
321
323
  continue;
322
324
  }
323
325
  if (n.tryConsume("{")) {
324
- i.push({
326
+ o.push({
325
327
  type: "group",
326
328
  tokens: a("}")
327
329
  });
328
330
  continue;
329
331
  }
330
- return n.consume(o), i;
332
+ return n.consume(i), o;
331
333
  }
332
334
  }
333
335
  const s = a("END");
334
- return new P(s);
336
+ return new k(s);
335
337
  }
336
338
  function $e(e, t = {}) {
337
339
  const {
338
340
  encode: r = encodeURIComponent,
339
- delimiter: n = _
340
- } = t, a = e instanceof P ? e : L(e, t), s = Y(a.tokens, n, r);
341
- return function(i = {}) {
342
- const [c, ...f] = s(i);
343
- if (f.length)
344
- throw new TypeError(`Missing parameters: ${f.join(", ")}`);
345
- return c;
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;
346
348
  };
347
349
  }
348
350
  function Y(e, t, r) {
349
351
  const n = e.map((a) => Se(a, t, r));
350
352
  return (a) => {
351
353
  const s = [""];
352
- for (const o of n) {
353
- const [i, ...c] = o(a);
354
- s[0] += i, s.push(...c);
354
+ for (const i of n) {
355
+ const [o, ...f] = i(a);
356
+ s[0] += o, s.push(...f);
355
357
  }
356
358
  return s;
357
359
  };
@@ -361,20 +363,20 @@ function Se(e, t, r) {
361
363
  if (e.type === "group") {
362
364
  const a = Y(e.tokens, t, r);
363
365
  return (s) => {
364
- const [o, ...i] = a(s);
365
- return i.length ? [""] : [o];
366
+ const [i, ...o] = a(s);
367
+ return o.length ? [""] : [i];
366
368
  };
367
369
  }
368
- const n = r || v;
370
+ const n = r || _;
369
371
  return e.type === "wildcard" && r !== !1 ? (a) => {
370
372
  const s = a[e.name];
371
373
  if (s == null) return ["", e.name];
372
374
  if (!Array.isArray(s) || s.length === 0)
373
375
  throw new TypeError(`Expected "${e.name}" to be a non-empty array`);
374
- return [s.map((o, i) => {
375
- if (typeof o != "string")
376
- throw new TypeError(`Expected "${e.name}/${i}" to be a string`);
377
- return n(o);
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);
378
380
  }).join(t)];
379
381
  } : (a) => {
380
382
  const s = a[e.name];
@@ -387,76 +389,76 @@ function Se(e, t, r) {
387
389
  function Oe(e, t = {}) {
388
390
  const {
389
391
  decode: r = decodeURIComponent,
390
- delimiter: n = _
392
+ delimiter: n = U
391
393
  } = t, {
392
394
  regexp: a,
393
395
  keys: s
394
- } = Z(e, t), o = s.map((i) => r === !1 ? v : i.type === "param" ? r : (c) => c.split(n).map(r));
395
- return function(c) {
396
- const f = a.exec(c);
397
- if (!f) return !1;
398
- const m = f[0], d = /* @__PURE__ */ Object.create(null);
399
- for (let b = 1; b < f.length; b++) {
400
- if (f[b] === void 0) continue;
401
- const w = s[b - 1], h = o[b - 1];
402
- d[w.name] = h(f[b]);
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]);
403
405
  }
404
406
  return {
405
- path: m,
407
+ path: y,
406
408
  params: d
407
409
  };
408
410
  };
409
411
  }
410
412
  function Z(e, t = {}) {
411
413
  const {
412
- delimiter: r = _,
414
+ delimiter: r = U,
413
415
  end: n = !0,
414
416
  sensitive: a = !1,
415
417
  trailing: s = !0
416
- } = t, o = [], i = [], c = a ? "" : "i", m = (Array.isArray(e) ? e : [e]).map((w) => w instanceof P ? w : L(w, t));
418
+ } = t, i = [], o = [], f = a ? "" : "i", y = (Array.isArray(e) ? e : [e]).map((w) => w instanceof k ? w : L(w, t));
417
419
  for (const {
418
420
  tokens: w
419
- } of m)
420
- for (const h of k(w, 0, [])) {
421
- const u = je(h, r, o);
422
- i.push(u);
421
+ } of y)
422
+ for (const p of R(w, 0, [])) {
423
+ const l = Ee(p, r, i);
424
+ o.push(l);
423
425
  }
424
- let d = `^(?:${i.join("|")})`;
426
+ let d = `^(?:${o.join("|")})`;
425
427
  return s && (d += `(?:${$(r)}$)?`), d += n ? "$" : `(?=${$(r)}|$)`, {
426
- regexp: new RegExp(d, c),
427
- keys: o
428
+ regexp: new RegExp(d, f),
429
+ keys: i
428
430
  };
429
431
  }
430
- function* k(e, t, r) {
432
+ function* R(e, t, r) {
431
433
  if (t === e.length)
432
434
  return yield r;
433
435
  const n = e[t];
434
436
  if (n.type === "group") {
435
437
  const a = r.slice();
436
- for (const s of k(n.tokens, 0, a))
437
- yield* k(e, t + 1, s);
438
+ for (const s of R(n.tokens, 0, a))
439
+ yield* R(e, t + 1, s);
438
440
  } else
439
441
  r.push(n);
440
- yield* k(e, t + 1, r);
442
+ yield* R(e, t + 1, r);
441
443
  }
442
- function je(e, t, r) {
444
+ function Ee(e, t, r) {
443
445
  let n = "", a = "", s = !0;
444
- for (let o = 0; o < e.length; o++) {
445
- const i = e[o];
446
- if (i.type === "text") {
447
- n += $(i.value), a += i.value, s || (s = i.value.includes(t));
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));
448
450
  continue;
449
451
  }
450
- if (i.type === "param" || i.type === "wildcard") {
452
+ if (o.type === "param" || o.type === "wildcard") {
451
453
  if (!s && !a)
452
- throw new TypeError(`Missing text after "${i.name}": ${I}`);
453
- i.type === "param" ? n += `(${Ee(t, s ? "" : a)}+)` : n += "([\\s\\S]+)", r.push(i), a = "", s = !1;
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;
454
456
  continue;
455
457
  }
456
458
  }
457
459
  return n;
458
460
  }
459
- function Ee(e, t) {
461
+ function je(e, t) {
460
462
  return t.length < 2 ? e.length < 2 ? `[^${$(e + t)}]` : `(?:(?!${$(e)})[^${$(t)}])` : e.length < 2 ? `(?:(?!${$(t)})[^${$(e)}])` : `(?:(?!${$(t)}|${$(e)})[\\s\\S])`;
461
463
  }
462
464
  function Ae(e) {
@@ -464,9 +466,9 @@ function Ae(e) {
464
466
  if (r.type === "text") return we(r.value);
465
467
  if (r.type === "group")
466
468
  return `{${r.tokens.map(t).join("")}}`;
467
- const o = Ne(r.name) && Re(a[n + 1]) ? r.name : JSON.stringify(r.name);
468
- if (r.type === "param") return `:${o}`;
469
- if (r.type === "wildcard") return `*${o}`;
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}`;
470
472
  throw new TypeError(`Unexpected token: ${r}`);
471
473
  }).join("");
472
474
  }
@@ -477,9 +479,9 @@ function Ne(e) {
477
479
  function Re(e) {
478
480
  return (e == null ? void 0 : e.type) !== "text" ? !0 : !q.test(e.value[0]);
479
481
  }
480
- const ke = Symbol("any"), Ie = Symbol("number"), Pe = Symbol("string"), Ce = Symbol("array"), O = {
481
- any: ke,
482
- number: Ie,
482
+ const Ie = Symbol("any"), ke = Symbol("number"), Pe = Symbol("string"), Ce = Symbol("array"), O = {
483
+ any: Ie,
484
+ number: ke,
483
485
  string: Pe,
484
486
  array: Ce
485
487
  };
@@ -551,8 +553,8 @@ function Te(e, t) {
551
553
  }
552
554
  switch (typeof a) {
553
555
  case "number": {
554
- const o = e[n];
555
- r[n] = isNaN(parseInt(o)) ? parseFloat(o) : parseInt(o);
556
+ const i = e[n];
557
+ r[n] = isNaN(parseInt(i)) ? parseFloat(i) : parseInt(i);
556
558
  break;
557
559
  }
558
560
  case "object": {
@@ -562,8 +564,8 @@ function Te(e, t) {
562
564
  case "string":
563
565
  r[n] = e[n];
564
566
  case "boolean": {
565
- const o = e[n];
566
- r[n] = o === "0" ? parseFloat(o) : parseInt(o);
567
+ const i = e[n];
568
+ r[n] = i === "0" ? parseFloat(i) : parseInt(i);
567
569
  break;
568
570
  }
569
571
  }
@@ -575,8 +577,8 @@ function Te(e, t) {
575
577
  break;
576
578
  }
577
579
  case O.number: {
578
- const o = e[n];
579
- r[n] = isNaN(parseInt(o)) ? parseFloat(o) : parseInt(o);
580
+ const i = e[n];
581
+ r[n] = isNaN(parseInt(i)) ? parseFloat(i) : parseInt(i);
580
582
  break;
581
583
  }
582
584
  }
@@ -591,10 +593,10 @@ function De(e, t) {
591
593
  } = r, s = x({
592
594
  name: "entered",
593
595
  sid: "-d3obu6"
594
- }), o = x({
596
+ }), i = x({
595
597
  name: "exited",
596
598
  sid: "-xofyk3"
597
- }), i = x({
599
+ }), o = x({
598
600
  name: "exit",
599
601
  sid: "-673d76"
600
602
  });
@@ -604,18 +606,18 @@ function De(e, t) {
604
606
  activeRoutes: e,
605
607
  query: t
606
608
  },
607
- filter: (c) => {
609
+ filter: (f) => {
608
610
  let {
609
- activeRoutes: f,
610
- query: m
611
- } = c;
612
- return (!a || K(a, f)) && J(m, n);
611
+ activeRoutes: u,
612
+ query: y
613
+ } = f;
614
+ return (!a || K(a, u)) && J(y, n);
613
615
  },
614
- fn: (c) => {
616
+ fn: (f) => {
615
617
  let {
616
- query: f
617
- } = c;
618
- return Te(f, n);
618
+ query: u
619
+ } = f;
620
+ return Te(u, n);
619
621
  }
620
622
  }],
621
623
  or: {
@@ -627,25 +629,25 @@ function De(e, t) {
627
629
  activeRoutes: e,
628
630
  query: t
629
631
  },
630
- filter: (c) => {
632
+ filter: (f) => {
631
633
  let {
632
- activeRoutes: f,
633
- query: m
634
- } = c;
635
- return !((!a || K(a, f)) && J(m, n));
634
+ activeRoutes: u,
635
+ query: y
636
+ } = f;
637
+ return !((!a || K(a, u)) && J(y, n));
636
638
  },
637
- target: o
639
+ target: i
638
640
  }],
639
641
  or: {
640
642
  sid: "-s82e29"
641
643
  }
642
644
  }), {
643
645
  entered: s,
644
- exited: o,
645
- exit: i,
646
- getPayload: (c) => Object.entries(c).reduce((f, m) => {
647
- let [d, b] = m;
648
- return typeof n[d] == "symbol" ? f[d] = b : f[d] = n[d], f;
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;
649
651
  }, {})
650
652
  };
651
653
  };
@@ -662,7 +664,7 @@ function D(e, t) {
662
664
  const r = e.slice(0, t), n = e.slice(t);
663
665
  return Array.prototype.concat.call([], D(r), D(n));
664
666
  }
665
- function Ue(e) {
667
+ function ve(e) {
666
668
  try {
667
669
  return decodeURIComponent(e);
668
670
  } catch {
@@ -672,7 +674,7 @@ function Ue(e) {
672
674
  return e;
673
675
  }
674
676
  }
675
- function _e(e) {
677
+ function Ue(e) {
676
678
  const t = {
677
679
  "%FE%FF": "��",
678
680
  "%FF%FE": "��"
@@ -682,7 +684,7 @@ function _e(e) {
682
684
  try {
683
685
  t[r[0]] = decodeURIComponent(r[0]);
684
686
  } catch {
685
- const a = Ue(r[0]);
687
+ const a = ve(r[0]);
686
688
  a !== r[0] && (t[r[0]] = a);
687
689
  }
688
690
  r = W.exec(e);
@@ -693,13 +695,13 @@ function _e(e) {
693
695
  e = e.replace(new RegExp(a, "g"), t[a]);
694
696
  return e;
695
697
  }
696
- function ve(e) {
698
+ function _e(e) {
697
699
  if (typeof e != "string")
698
700
  throw new TypeError("Expected `encodedURI` to be of type `string`, got `" + typeof e + "`");
699
701
  try {
700
702
  return decodeURIComponent(e);
701
703
  } catch {
702
- return _e(e);
704
+ return Ue(e);
703
705
  }
704
706
  }
705
707
  function qe(e, t) {
@@ -727,29 +729,29 @@ function re(e, t) {
727
729
  const r = e.indexOf(t);
728
730
  return r === -1 ? [] : [e.slice(0, r), e.slice(r + t.length)];
729
731
  }
730
- const Le = (e) => e == null, Me = (e) => encodeURIComponent(e).replaceAll(/[!'()*]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`), U = Symbol("encodeFragmentIdentifier");
731
- function Be(e) {
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) {
732
734
  switch (e.arrayFormat) {
733
735
  case "index":
734
736
  return (t) => (r, n) => {
735
737
  const a = r.length;
736
- return n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [p(t, e), "[", a, "]"].join("")] : [...r, [p(t, e), "[", p(a, e), "]=", p(n, e)].join("")];
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("")];
737
739
  };
738
740
  case "bracket":
739
- return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [p(t, e), "[]"].join("")] : [...r, [p(t, e), "[]=", p(n, e)].join("")];
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("")];
740
742
  case "colon-list-separator":
741
- return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, [p(t, e), ":list="].join("")] : [...r, [p(t, e), ":list=", p(n, e)].join("")];
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("")];
742
744
  case "comma":
743
745
  case "separator":
744
746
  case "bracket-separator": {
745
747
  const t = e.arrayFormat === "bracket-separator" ? "[]=" : "=";
746
- return (r) => (n, a) => a === void 0 || e.skipNull && a === null || e.skipEmptyString && a === "" ? n : (a = a === null ? "" : a, n.length === 0 ? [[p(r, e), t, p(a, e)].join("")] : [[n, p(a, e)].join(e.arrayFormatSeparator)]);
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)]);
747
749
  }
748
750
  default:
749
- return (t) => (r, n) => n === void 0 || e.skipNull && n === null || e.skipEmptyString && n === "" ? r : n === null ? [...r, p(t, e)] : [...r, [p(t, e), "=", p(n, e)].join("")];
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("")];
750
752
  }
751
753
  }
752
- function He(e) {
754
+ function Be(e) {
753
755
  let t;
754
756
  switch (e.arrayFormat) {
755
757
  case "index":
@@ -787,10 +789,10 @@ function He(e) {
787
789
  case "comma":
788
790
  case "separator":
789
791
  return (r, n, a) => {
790
- const s = typeof n == "string" && n.includes(e.arrayFormatSeparator), o = typeof n == "string" && !s && S(n, e).includes(e.arrayFormatSeparator);
791
- n = o ? S(n, e) : n;
792
- const i = s || o ? n.split(e.arrayFormatSeparator).map((c) => S(c, e)) : n === null ? n : S(n, e);
793
- a[r] = i;
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;
794
796
  };
795
797
  case "bracket-separator":
796
798
  return (r, n, a) => {
@@ -799,12 +801,12 @@ function He(e) {
799
801
  a[r] = n && S(n, e);
800
802
  return;
801
803
  }
802
- const o = n === null ? [] : S(n, e).split(e.arrayFormatSeparator);
804
+ const i = n === null ? [] : S(n, e).split(e.arrayFormatSeparator);
803
805
  if (a[r] === void 0) {
804
- a[r] = o;
806
+ a[r] = i;
805
807
  return;
806
808
  }
807
- a[r] = [...a[r], ...o];
809
+ a[r] = [...a[r], ...i];
808
810
  };
809
811
  default:
810
812
  return (r, n, a) => {
@@ -820,11 +822,11 @@ function te(e) {
820
822
  if (typeof e != "string" || e.length !== 1)
821
823
  throw new TypeError("arrayFormatSeparator must be single character string");
822
824
  }
823
- function p(e, t) {
825
+ function m(e, t) {
824
826
  return t.encode ? t.strict ? Me(e) : encodeURIComponent(e) : e;
825
827
  }
826
828
  function S(e, t) {
827
- return t.decode ? ve(e) : e;
829
+ return t.decode ? _e(e) : e;
828
830
  }
829
831
  function ne(e) {
830
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;
@@ -833,7 +835,7 @@ function ae(e) {
833
835
  const t = e.indexOf("#");
834
836
  return t !== -1 && (e = e.slice(0, t)), e;
835
837
  }
836
- function Ve(e) {
838
+ function He(e) {
837
839
  let t = "";
838
840
  const r = e.indexOf("#");
839
841
  return r !== -1 && (t = e.slice(r)), t;
@@ -846,7 +848,7 @@ function M(e) {
846
848
  const t = e.indexOf("?");
847
849
  return t === -1 ? "" : e.slice(t + 1);
848
850
  }
849
- function B(e, t) {
851
+ function z(e, t) {
850
852
  t = {
851
853
  decode: !0,
852
854
  sort: !0,
@@ -857,26 +859,26 @@ function B(e, t) {
857
859
  types: /* @__PURE__ */ Object.create(null),
858
860
  ...t
859
861
  }, te(t.arrayFormatSeparator);
860
- const r = He(t), n = /* @__PURE__ */ Object.create(null);
862
+ const r = Be(t), n = /* @__PURE__ */ Object.create(null);
861
863
  if (typeof e != "string" || (e = e.trim().replace(/^[?#&]/, ""), !e))
862
864
  return n;
863
865
  for (const a of e.split("&")) {
864
866
  if (a === "")
865
867
  continue;
866
868
  const s = t.decode ? a.replaceAll("+", " ") : a;
867
- let [o, i] = re(s, "=");
868
- o === void 0 && (o = s), i = i === void 0 ? null : ["comma", "separator", "bracket-separator"].includes(t.arrayFormat) ? i : S(i, t), r(S(o, t), i, n);
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);
869
871
  }
870
872
  for (const [a, s] of Object.entries(n))
871
873
  if (typeof s == "object" && s !== null && t.types[a] !== "string")
872
- for (const [o, i] of Object.entries(s)) {
873
- const c = t.types[a] ? t.types[a].replace("[]", "") : void 0;
874
- s[o] = G(i, t, c);
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);
875
877
  }
876
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]);
877
879
  return t.sort === !1 ? n : (t.sort === !0 ? Object.keys(n).sort() : Object.keys(n).sort(t.sort)).reduce((a, s) => {
878
- const o = n[s];
879
- return a[s] = o && typeof o == "object" && !Array.isArray(o) ? ne(o) : o, a;
880
+ const i = n[s];
881
+ return a[s] = i && typeof i == "object" && !Array.isArray(i) ? ne(i) : i, a;
880
882
  }, /* @__PURE__ */ Object.create(null));
881
883
  }
882
884
  function se(e, t) {
@@ -889,16 +891,16 @@ function se(e, t) {
889
891
  arrayFormatSeparator: ",",
890
892
  ...t
891
893
  }, te(t.arrayFormatSeparator);
892
- const r = (o) => t.skipNull && Le(e[o]) || t.skipEmptyString && e[o] === "", n = Be(t), a = {};
893
- for (const [o, i] of Object.entries(e))
894
- r(o) || (a[o] = i);
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);
895
897
  const s = Object.keys(a);
896
- return t.sort !== !1 && s.sort(t.sort), s.map((o) => {
897
- const i = e[o];
898
- return i === void 0 ? "" : i === null ? p(o, t) : Array.isArray(i) ? i.length === 0 && t.arrayFormat === "bracket-separator" ? p(o, t) + "[]" : i.reduce(n(o), []).join("&") : p(o, t) + "=" + p(i, t);
899
- }).filter((o) => o.length > 0).join("&");
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("&");
900
902
  }
901
- function oe(e, t) {
903
+ function ie(e, t) {
902
904
  var a;
903
905
  t = {
904
906
  decode: !0,
@@ -907,176 +909,176 @@ function oe(e, t) {
907
909
  let [r, n] = re(e, "#");
908
910
  return r === void 0 && (r = e), {
909
911
  url: ((a = r == null ? void 0 : r.split("?")) == null ? void 0 : a[0]) ?? "",
910
- query: B(M(e), t),
912
+ query: z(M(e), t),
911
913
  ...t && t.parseFragmentIdentifier && n ? {
912
914
  fragmentIdentifier: S(n, t)
913
915
  } : {}
914
916
  };
915
917
  }
916
- function ie(e, t) {
918
+ function oe(e, t) {
917
919
  t = {
918
920
  encode: !0,
919
921
  strict: !0,
920
- [U]: !0,
922
+ [v]: !0,
921
923
  ...t
922
924
  };
923
925
  const r = ae(e.url).split("?")[0] || "", n = M(e.url), a = {
924
- ...B(n, {
926
+ ...z(n, {
925
927
  sort: !1
926
928
  }),
927
929
  ...e.query
928
930
  };
929
931
  let s = se(a, t);
930
932
  s && (s = `?${s}`);
931
- let o = Ve(e.url);
933
+ let i = He(e.url);
932
934
  if (typeof e.fragmentIdentifier == "string") {
933
- const i = new URL(r);
934
- i.hash = e.fragmentIdentifier, o = t[U] ? i.hash : `#${e.fragmentIdentifier}`;
935
+ const o = new URL(r);
936
+ o.hash = e.fragmentIdentifier, i = t[v] ? o.hash : `#${e.fragmentIdentifier}`;
935
937
  }
936
- return `${r}${s}${o}`;
938
+ return `${r}${s}${i}`;
937
939
  }
938
940
  function ce(e, t, r) {
939
941
  r = {
940
942
  parseFragmentIdentifier: !0,
941
- [U]: !1,
943
+ [v]: !1,
942
944
  ...r
943
945
  };
944
946
  const {
945
947
  url: n,
946
948
  query: a,
947
949
  fragmentIdentifier: s
948
- } = oe(e, r);
949
- return ie({
950
+ } = ie(e, r);
951
+ return oe({
950
952
  url: n,
951
953
  query: qe(a, t),
952
954
  fragmentIdentifier: s
953
955
  }, r);
954
956
  }
955
- function ze(e, t, r) {
957
+ function Ve(e, t, r) {
956
958
  const n = Array.isArray(t) ? (a) => !t.includes(a) : (a, s) => !t(a, s);
957
959
  return ce(e, n, r);
958
960
  }
959
961
  const T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
960
962
  __proto__: null,
961
- exclude: ze,
963
+ exclude: Ve,
962
964
  extract: M,
963
- parse: B,
964
- parseUrl: oe,
965
+ parse: z,
966
+ parseUrl: ie,
965
967
  pick: ce,
966
968
  stringify: se,
967
- stringifyUrl: ie
969
+ stringifyUrl: oe
968
970
  }, Symbol.toStringTag, { value: "Module" }));
969
971
  function We(e) {
970
972
  const {
971
973
  base: t = "/",
972
974
  routes: r
973
- } = e, n = E(null, {
975
+ } = e, n = j(null, {
974
976
  and: {
975
977
  serialize: "ignore"
976
978
  },
977
979
  name: "$history",
978
- sid: "31majq"
979
- }), a = E([], {
980
+ sid: "ftu36z"
981
+ }), a = j([], {
980
982
  and: {
981
983
  serialize: "ignore"
982
984
  },
983
985
  name: "$activeRoutes",
984
- sid: "mastmv"
985
- }), s = E({}, {
986
+ sid: "z30ma4"
987
+ }), s = j({}, {
986
988
  name: "$query",
987
- sid: "4sjpht"
988
- }), o = E(null, {
989
+ sid: "hkri52"
990
+ }), i = j(null, {
989
991
  name: "$path",
990
- sid: "wq6kyf"
991
- }), i = x({
992
+ sid: "-zgnqnj"
993
+ }), o = x({
992
994
  name: "setHistory",
993
- sid: "tco5ea"
994
- }), c = x({
995
- name: "back",
996
- sid: "-hekewa"
995
+ sid: "w6xvrg"
997
996
  }), f = x({
997
+ name: "back",
998
+ sid: "-4mcm91"
999
+ }), u = x({
998
1000
  name: "forward",
999
- sid: "-64ksuk"
1000
- }), m = x({
1001
+ sid: "6nmzsp"
1002
+ }), y = x({
1001
1003
  name: "locationUpdated",
1002
- sid: "e6p2xg"
1003
- }), d = r.map((u) => {
1004
- let y = u;
1005
- const l = [];
1006
- for (l.unshift(y.internal.path); y.internal.parent; )
1007
- y = y.internal.parent, y.internal.path !== "/" && l.unshift(y.internal.path);
1008
- const g = t === "/" ? l.join("") : [t, ...l].join("");
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("");
1009
1011
  return {
1010
- route: u,
1012
+ route: l,
1011
1013
  path: g,
1012
1014
  toPath: he(g),
1013
1015
  fromPath: ge(g)
1014
1016
  };
1015
- }), b = V({
1017
+ }), b = H({
1016
1018
  and: {
1017
1019
  source: {
1018
1020
  history: n
1019
1021
  },
1020
- effect: async (u, y) => {
1022
+ effect: async (l, h) => {
1021
1023
  let {
1022
- history: l
1023
- } = u, {
1024
+ history: c
1025
+ } = l, {
1024
1026
  path: g,
1025
- query: A,
1026
- replace: N
1027
- } = y;
1028
- if (!l)
1027
+ query: P,
1028
+ replace: A
1029
+ } = h;
1030
+ if (!c)
1029
1031
  throw new Error("history not found");
1030
- const H = {
1032
+ const B = {
1031
1033
  pathname: g,
1032
- search: "?".concat(T.stringify(A))
1034
+ search: "?".concat(T.stringify(P))
1033
1035
  };
1034
- N ? l.replace(H) : l.push(H);
1036
+ A ? c.replace(B) : c.push(B);
1035
1037
  }
1036
1038
  },
1037
1039
  or: {
1038
1040
  name: "navigateFx",
1039
- sid: "dmi4v4"
1041
+ sid: "qepxid"
1040
1042
  }
1041
- }), w = R((u) => {
1042
- const y = ue(m);
1043
- if (y({
1044
- pathname: u.location.pathname,
1045
- query: T.parse(u.location.search)
1046
- }), !u)
1043
+ }), w = N((l) => {
1044
+ const h = ue(y);
1045
+ if (h({
1046
+ pathname: l.location.pathname,
1047
+ query: T.parse(l.location.search)
1048
+ }), !l)
1047
1049
  throw new Error();
1048
- u.listen((l) => {
1050
+ l.listen((c) => {
1049
1051
  let {
1050
1052
  location: g
1051
- } = l;
1052
- y({
1053
+ } = c;
1054
+ h({
1053
1055
  pathname: g.pathname,
1054
1056
  query: T.parse(g.search)
1055
1057
  });
1056
1058
  });
1057
1059
  }, {
1058
1060
  name: "subscribeHistoryFx",
1059
- sid: "h5gz6p"
1060
- }), h = V({
1061
+ sid: "es8v7q"
1062
+ }), p = H({
1061
1063
  and: {
1062
1064
  source: {
1063
1065
  query: s,
1064
- path: o
1066
+ path: i
1065
1067
  },
1066
- effect: async (u) => {
1068
+ effect: async (l) => {
1067
1069
  let {
1068
- query: y,
1069
- path: l
1070
- } = u;
1070
+ query: h,
1071
+ path: c
1072
+ } = l;
1071
1073
  for (const {
1072
1074
  route: g,
1073
- fromPath: A
1075
+ fromPath: P
1074
1076
  } of d) {
1075
- const N = A(l);
1076
- if (N)
1077
+ const A = P(c);
1078
+ if (A)
1077
1079
  await g.internal.openFx({
1078
- query: y,
1079
- params: N.params,
1080
+ query: h,
1081
+ params: A.params,
1080
1082
  historyIgnore: !0
1081
1083
  });
1082
1084
  else {
@@ -1088,65 +1090,59 @@ function We(e) {
1088
1090
  },
1089
1091
  or: {
1090
1092
  name: "openRoutesByPathFx",
1091
- sid: "e04f3o"
1093
+ sid: "bmwb4p"
1092
1094
  }
1093
1095
  });
1094
1096
  for (const {
1095
- route: u,
1096
- toPath: y
1097
+ route: l,
1098
+ toPath: h
1097
1099
  } of d)
1098
1100
  F({
1099
1101
  and: [{
1100
- clock: u.opened,
1102
+ clock: l.opened,
1101
1103
  source: a,
1102
- filter: (l) => !l.includes(u),
1103
- fn: (l) => [...l, u],
1104
+ filter: (c) => !c.includes(l),
1105
+ fn: (c) => [...c, l],
1104
1106
  target: a
1105
1107
  }],
1106
1108
  or: {
1107
- sid: "fhsl3g"
1109
+ sid: "ff1m4n"
1108
1110
  }
1109
1111
  }), F({
1110
1112
  and: [{
1111
- clock: u.opened,
1112
- filter: (l) => !l.historyIgnore,
1113
- fn: function() {
1114
- let {
1115
- params: l,
1116
- query: g,
1117
- replace: A
1118
- } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
1119
- params: {}
1120
- };
1113
+ clock: l.opened,
1114
+ filter: (c) => !(c != null && c.historyIgnore),
1115
+ fn: (c) => {
1116
+ var g;
1121
1117
  return {
1122
- path: y(l),
1123
- query: g ?? {},
1124
- replace: A
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
1125
1121
  };
1126
1122
  },
1127
1123
  target: b
1128
1124
  }],
1129
1125
  or: {
1130
- sid: "fxqmax"
1126
+ sid: "fuznc4"
1131
1127
  }
1132
1128
  }), F({
1133
1129
  and: [{
1134
- clock: u.closed,
1130
+ clock: l.closed,
1135
1131
  source: a,
1136
- fn: (l) => l.filter((g) => g !== u),
1132
+ fn: (c) => c.filter((g) => g !== l),
1137
1133
  target: a
1138
1134
  }],
1139
1135
  or: {
1140
- sid: "gfc1ah"
1136
+ sid: "ges8p4"
1141
1137
  }
1142
1138
  });
1143
1139
  return F({
1144
1140
  and: [{
1145
- clock: i,
1141
+ clock: o,
1146
1142
  target: n
1147
1143
  }],
1148
1144
  or: {
1149
- sid: "gva2g8"
1145
+ sid: "guq9uv"
1150
1146
  }
1151
1147
  }), F({
1152
1148
  and: [{
@@ -1155,49 +1151,49 @@ function We(e) {
1155
1151
  target: w
1156
1152
  }],
1157
1153
  or: {
1158
- sid: "h9kpvm"
1154
+ sid: "gxh8to"
1159
1155
  }
1160
1156
  }), F({
1161
1157
  and: [{
1162
- clock: m,
1163
- fn: (u) => {
1164
- var y;
1158
+ clock: y,
1159
+ fn: (l) => {
1160
+ var h;
1165
1161
  return {
1166
- path: u.pathname,
1167
- query: (y = u.query) !== null && y !== void 0 ? y : {}
1162
+ path: l.pathname,
1163
+ query: (h = l.query) !== null && h !== void 0 ? h : {}
1168
1164
  };
1169
1165
  },
1170
1166
  target: [le({
1171
- sid: "-382tqp",
1167
+ sid: "-38mmc2",
1172
1168
  fn: () => de({
1173
1169
  targets: {
1174
- path: o,
1170
+ path: i,
1175
1171
  query: s
1176
1172
  }
1177
1173
  }),
1178
1174
  name: "target",
1179
1175
  method: "spread"
1180
- }), h]
1176
+ }), p]
1181
1177
  }],
1182
1178
  or: {
1183
- sid: "hcvhfs"
1179
+ sid: "hcbouf"
1184
1180
  }
1185
1181
  }), {
1186
1182
  $query: s,
1187
- $path: o,
1183
+ $path: i,
1188
1184
  $activeRoutes: a,
1189
- back: c,
1190
- forward: f,
1185
+ back: f,
1186
+ forward: u,
1191
1187
  routes: r,
1192
- setHistory: i,
1188
+ setHistory: o,
1193
1189
  mappedRoutes: d,
1194
1190
  trackQuery: De(a, s),
1195
1191
  "@@unitShape": () => ({
1196
1192
  query: s,
1197
- path: o,
1193
+ path: i,
1198
1194
  activeRoutes: a,
1199
- onBack: c,
1200
- onForward: f
1195
+ onBack: f,
1196
+ onForward: u
1201
1197
  })
1202
1198
  };
1203
1199
  }