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