@flemo/core 1.5.0 → 1.6.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.mjs CHANGED
@@ -178,17 +178,21 @@ var r = new class {
178
178
  function i(t = [], n = -1) {
179
179
  return e((e) => ({
180
180
  index: n,
181
+ pendingIndex: n,
181
182
  histories: t,
182
183
  addHistory: (t) => e((e) => ({
183
184
  index: e.index + 1,
185
+ pendingIndex: e.index + 1,
184
186
  histories: e.histories.concat(t)
185
187
  })),
186
188
  replaceHistory: (t) => e((e) => (e.histories.splice(t, 1), {
187
189
  index: e.index - 1,
190
+ pendingIndex: e.index - 1,
188
191
  histories: e.histories
189
192
  })),
190
193
  popHistory: (t) => e((e) => ({
191
194
  index: e.index - 1,
195
+ pendingIndex: e.index - 1,
192
196
  histories: e.histories.filter((e, n) => n !== t)
193
197
  })),
194
198
  popHistories: (t) => {
@@ -196,10 +200,12 @@ function i(t = [], n = -1) {
196
200
  let n = e.index;
197
201
  return {
198
202
  index: e.index - t,
203
+ pendingIndex: e.index - t,
199
204
  histories: e.histories.filter((e, r) => r < n - t || r >= n)
200
205
  };
201
206
  });
202
207
  },
208
+ setPendingIndex: (t) => e({ pendingIndex: t }),
203
209
  setTransitionName: (t, n) => e((e) => {
204
210
  let r = e.histories[t];
205
211
  if (!r || r.transitionName === n) return {};
@@ -243,64 +249,162 @@ function c() {
243
249
  }
244
250
  //#endregion
245
251
  //#region src/history/ensureWindowHistoryState.ts
246
- function l(e) {
247
- c() || window.history.state?.index || window.history.replaceState({
252
+ function l(e, t, n = {}) {
253
+ if (c()) return;
254
+ let r = {
248
255
  id: "root",
249
256
  index: 0,
250
257
  status: "IDLE",
251
- params: {},
252
- transitionName: e,
258
+ params: n,
259
+ transitionName: t,
253
260
  layoutId: null
261
+ };
262
+ if (e === null) {
263
+ if (window.history.state?.index) return;
264
+ window.history.replaceState(r, "", window.location.href);
265
+ return;
266
+ }
267
+ let i = window.history.state ?? {};
268
+ i[e]?.index || window.history.replaceState({
269
+ ...i,
270
+ [e]: r
254
271
  }, "", window.location.href);
255
272
  }
256
273
  //#endregion
257
- //#region src/navigate/selfPopGuard.ts
258
- var u = 0;
259
- function d() {
260
- u += 1;
274
+ //#region src/history/historyDriver.ts
275
+ var u = (e, t) => ({
276
+ ...window.history.state ?? {},
277
+ [e]: t
278
+ });
279
+ function d(e) {
280
+ return e === void 0 ? {
281
+ readState: () => window.history.state,
282
+ readPathname: () => window.location.pathname,
283
+ pushState: (e, t) => window.history.pushState(e, "", t),
284
+ replaceState: (e, t) => window.history.replaceState(e, "", t),
285
+ go: (e) => window.history.go(e),
286
+ back: () => window.history.back(),
287
+ subscribe: (e) => {
288
+ let t = (t) => e({
289
+ state: t.state,
290
+ pathname: window.location.pathname
291
+ });
292
+ return window.addEventListener("popstate", t), () => window.removeEventListener("popstate", t);
293
+ }
294
+ } : {
295
+ readState: () => window.history.state?.[e] ?? null,
296
+ readPathname: () => window.location.pathname,
297
+ pushState: (t, n) => window.history.pushState(u(e, t), "", n),
298
+ replaceState: (t, n) => window.history.replaceState(u(e, t), "", n),
299
+ go: (e) => window.history.go(e),
300
+ back: () => window.history.back(),
301
+ subscribe: (t) => {
302
+ let n = (n) => t({
303
+ state: n.state?.[e] ?? null,
304
+ pathname: window.location.pathname
305
+ });
306
+ return window.addEventListener("popstate", n), () => window.removeEventListener("popstate", n);
307
+ }
308
+ };
261
309
  }
310
+ //#endregion
311
+ //#region src/navigate/selfPopGuard.ts
262
312
  function f() {
263
- return u > 0 ? (--u, !0) : !1;
313
+ let e = 0;
314
+ return {
315
+ mark() {
316
+ e += 1;
317
+ },
318
+ consume() {
319
+ return e > 0 ? (--e, !0) : !1;
320
+ }
321
+ };
322
+ }
323
+ var p = f();
324
+ function m() {
325
+ p.mark();
326
+ }
327
+ function h() {
328
+ return p.consume();
264
329
  }
265
330
  //#endregion
266
331
  //#region src/history/createHistorySync.ts
267
- function p(e) {
268
- let { stores: t } = e, n = async (e) => {
269
- if (f()) return;
270
- let n = e.state?.id, i = r.generateTaskId();
332
+ function g(e) {
333
+ let { stores: t, driver: n = d(), consume: i = h } = e;
334
+ return n.subscribe(async (e) => {
335
+ if (i()) return;
336
+ let n = e.state, a = r.generateTaskId();
271
337
  (await r.addTask(async (r) => {
272
- let a = e.state?.index, o = e.state?.status, s = e.state?.params, c = e.state?.transitionName, l = e.state?.layoutId, { setStatus: u, setTransitionTaskId: d } = t.navigate.getState(), { index: f, addHistory: p, popHistory: m } = t.history.getState(), h = a < f, g = o === "PUSHING" && a > f, _ = o === "REPLACING" && a > f, v = window.location.pathname;
273
- if (!h && !g && !_) {
338
+ let { setStatus: i, setTransitionTaskId: o } = t.navigate.getState(), { index: s, addHistory: c, popHistory: l, setPendingIndex: u } = t.history.getState(), d = n?.index, f = d !== void 0 && d < s, p = n?.status === "PUSHING" && d !== void 0 && d > s, m = n?.status === "REPLACING" && d !== void 0 && d > s;
339
+ if (!f && !p && !m) {
274
340
  r.abort();
275
341
  return;
276
342
  }
277
- return d(i), h ? u("POPPING") : g ? (u("PUSHING"), p({
278
- id: n,
279
- pathname: v,
280
- params: s,
281
- transitionName: c,
282
- layoutId: l
283
- })) : (u("REPLACING"), p({
284
- id: n,
285
- pathname: v,
286
- params: s,
287
- transitionName: c,
288
- layoutId: l
289
- })), async () => {
290
- h && m(a + 1), u("COMPLETED");
343
+ if (o(a), f) u(d), i("POPPING");
344
+ else {
345
+ let t = n;
346
+ i(p ? "PUSHING" : "REPLACING"), c({
347
+ id: t.id,
348
+ pathname: e.pathname,
349
+ params: t.params,
350
+ transitionName: t.transitionName,
351
+ layoutId: t.layoutId
352
+ });
353
+ }
354
+ return async () => {
355
+ f && d !== void 0 && l(d + 1), i("COMPLETED");
291
356
  };
292
357
  }, {
293
- id: i,
358
+ id: a,
294
359
  control: { manual: !0 }
295
360
  })).result?.();
361
+ });
362
+ }
363
+ //#endregion
364
+ //#region src/history/memoryHistoryDriver.ts
365
+ function _(e) {
366
+ let t = [{
367
+ state: e?.state ?? null,
368
+ url: e?.url ?? "/"
369
+ }], n = 0, r = /* @__PURE__ */ new Set(), i = () => {
370
+ let e = t[n], i = {
371
+ state: e.state,
372
+ pathname: e.url
373
+ };
374
+ queueMicrotask(() => {
375
+ for (let e of r) e(i);
376
+ });
296
377
  };
297
- return window.addEventListener("popstate", n), () => {
298
- window.removeEventListener("popstate", n);
378
+ return {
379
+ readState: () => t[n].state,
380
+ readPathname: () => t[n].url,
381
+ pushState: (e, r) => {
382
+ t.splice(n + 1), t.push({
383
+ state: e,
384
+ url: r
385
+ }), n = t.length - 1;
386
+ },
387
+ replaceState: (e, r) => {
388
+ t[n] = {
389
+ state: e,
390
+ url: r
391
+ };
392
+ },
393
+ go: (e) => {
394
+ let r = Math.min(Math.max(n + e, 0), t.length - 1);
395
+ r !== n && (n = r, i());
396
+ },
397
+ back: () => {
398
+ n !== 0 && (--n, i());
399
+ },
400
+ subscribe: (e) => (r.add(e), () => {
401
+ r.delete(e);
402
+ })
299
403
  };
300
404
  }
301
405
  //#endregion
302
406
  //#region src/navigate/store.ts
303
- function m() {
407
+ function v() {
304
408
  return e((e) => ({
305
409
  status: "IDLE",
306
410
  transitionTaskId: null,
@@ -310,157 +414,156 @@ function m() {
310
414
  }
311
415
  //#endregion
312
416
  //#region src/navigate/createNavigationController.ts
313
- var h = (e, t, r) => {
417
+ var y = (e, t, r) => {
314
418
  let { regexp: i } = n(e);
315
419
  for (let e = t - 1; e >= 0; e--) if (i.test(r[e].pathname)) return t - e;
316
420
  return -1;
317
- }, g = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t, _ = async (e, t) => {
318
- let n, r = new Promise((e) => {
319
- n = () => e(!0), window.addEventListener("popstate", n, { once: !0 });
320
- }), i = new Promise((e) => setTimeout(() => e(!1), 200));
321
- if (d(), window.history.go(-e), !await Promise.race([r, i])) {
322
- window.removeEventListener("popstate", n);
323
- return;
324
- }
325
- t();
421
+ }, b = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t, x = async (e, t, n, r) => {
422
+ let i, a = new Promise((t) => {
423
+ i = e.subscribe(() => t(!0));
424
+ }), o = new Promise((e) => setTimeout(() => e(!1), 200));
425
+ t(), e.go(-n);
426
+ let s = await Promise.race([a, o]);
427
+ i(), s && r();
326
428
  };
327
- function v(e) {
328
- let { stores: t, buildPathname: n } = e, i = async (e, i, a) => {
329
- let { status: o } = t.navigate.getState();
330
- if (o !== "COMPLETED" && o !== "IDLE") return;
331
- let s = t.transition.getState().defaultTransitionName, { transitionName: c = s, layoutId: l = null } = a ?? {}, u = r.generateTaskId();
429
+ function S(e) {
430
+ let { stores: t, buildPathname: n, driver: i = d(), markSelfInduced: a = m } = e, o = async (e, o, s) => {
431
+ let { status: c } = t.navigate.getState();
432
+ if (c !== "COMPLETED" && c !== "IDLE") return;
433
+ let l = t.transition.getState().defaultTransitionName, { transitionName: u = l, layoutId: d = null } = s ?? {}, f = r.generateTaskId();
332
434
  (await r.addTask(async () => {
333
- let { index: r, histories: o, addHistory: s, popHistories: d } = t.history.getState(), f = (() => {
334
- if (a?.until != null) {
335
- let e = h(a.until, r, o);
435
+ let { index: r, histories: c, addHistory: l, popHistories: p } = t.history.getState(), m = (() => {
436
+ if (s?.until != null) {
437
+ let e = y(s.until, r, c);
336
438
  return e < 0 ? 0 : e;
337
439
  }
338
- return Math.min(g(a?.skip, 0), Math.max(0, r));
339
- })(), { setStatus: p, setTransitionTaskId: m } = t.navigate.getState();
340
- p("PUSHING"), m(u);
341
- let { pathname: v, toPathname: y } = n(e, i ?? {}), b = {
342
- id: u,
343
- pathname: y,
344
- params: i ?? {},
345
- transitionName: c,
346
- layoutId: l
440
+ return Math.min(b(s?.skip, 0), Math.max(0, r));
441
+ })(), { setStatus: h, setTransitionTaskId: g } = t.navigate.getState();
442
+ h("PUSHING"), g(f);
443
+ let { pathname: _, toPathname: v } = n(e, o ?? {}), S = {
444
+ id: f,
445
+ pathname: v,
446
+ params: o ?? {},
447
+ transitionName: u,
448
+ layoutId: d
347
449
  };
348
- return f === 0 ? (window.history.pushState({
349
- id: u,
450
+ return m === 0 ? (i.pushState({
451
+ id: f,
350
452
  index: r + 1,
351
453
  status: "PUSHING",
352
- params: i,
353
- transitionName: c,
354
- layoutId: l
355
- }, "", v), s(b), () => {
356
- p("COMPLETED");
357
- }) : (s(b), await _(f, () => {
358
- window.history.pushState({
359
- id: u,
360
- index: t.history.getState().index - f,
454
+ params: o,
455
+ transitionName: u,
456
+ layoutId: d
457
+ }, _), l(S), () => {
458
+ h("COMPLETED");
459
+ }) : (l(S), await x(i, a, m, () => {
460
+ i.pushState({
461
+ id: f,
462
+ index: t.history.getState().index - m,
361
463
  status: "PUSHING",
362
- params: i,
363
- transitionName: c,
364
- layoutId: l
365
- }, "", v);
464
+ params: o,
465
+ transitionName: u,
466
+ layoutId: d
467
+ }, _);
366
468
  }), async () => {
367
- d(f), p("COMPLETED");
469
+ p(m), h("COMPLETED");
368
470
  });
369
471
  }, {
370
- id: u,
472
+ id: f,
371
473
  control: { manual: !0 }
372
474
  })).result?.();
373
- }, a = async (e, i, a) => {
374
- let { status: o } = t.navigate.getState();
375
- if (o !== "COMPLETED" && o !== "IDLE") return;
376
- let s = t.transition.getState().defaultTransitionName, { transitionName: c = s, layoutId: l = null } = a ?? {}, u = r.generateTaskId();
475
+ }, s = async (e, o, s) => {
476
+ let { status: c } = t.navigate.getState();
477
+ if (c !== "COMPLETED" && c !== "IDLE") return;
478
+ let l = t.transition.getState().defaultTransitionName, { transitionName: u = l, layoutId: d = null } = s ?? {}, f = r.generateTaskId();
377
479
  (await r.addTask(async (r) => {
378
- let { index: o, histories: s, addHistory: d, replaceHistory: f, popHistories: p } = t.history.getState(), m = (() => {
379
- if (a?.until != null) {
380
- let e = h(a.until, o, s);
480
+ let { index: c, histories: l, addHistory: p, replaceHistory: m, popHistories: h } = t.history.getState(), g = (() => {
481
+ if (s?.until != null) {
482
+ let e = y(s.until, c, l);
381
483
  return e < 0 ? 0 : e + 1;
382
484
  }
383
- return Math.min(g(a?.skip, 0) + 1, o + 1);
485
+ return Math.min(b(s?.skip, 0) + 1, c + 1);
384
486
  })();
385
- if (m <= 0) {
487
+ if (g <= 0) {
386
488
  r.abort();
387
489
  return;
388
490
  }
389
- let { setStatus: v, setTransitionTaskId: y } = t.navigate.getState();
390
- v("REPLACING"), y(u);
391
- let { pathname: b, toPathname: x } = n(e, i ?? {}), S = {
392
- id: u,
393
- pathname: x,
394
- params: i ?? {},
395
- transitionName: c,
396
- layoutId: l
491
+ let { setStatus: _, setTransitionTaskId: v } = t.navigate.getState();
492
+ _("REPLACING"), v(f);
493
+ let { pathname: S, toPathname: C } = n(e, o ?? {}), w = {
494
+ id: f,
495
+ pathname: C,
496
+ params: o ?? {},
497
+ transitionName: u,
498
+ layoutId: d
397
499
  };
398
- return m === 1 ? (window.history.replaceState({
399
- id: u,
400
- index: o,
500
+ return g === 1 ? (i.replaceState({
501
+ id: f,
502
+ index: c,
401
503
  status: "REPLACING",
402
- params: i,
403
- transitionName: c,
404
- layoutId: l
405
- }, "", b), d(S), async () => {
406
- f(o), v("COMPLETED");
407
- }) : (p(m - 1), d(S), m <= o ? await _(m, () => {
408
- window.history.pushState({
409
- id: u,
504
+ params: o,
505
+ transitionName: u,
506
+ layoutId: d
507
+ }, S), p(w), async () => {
508
+ m(c), _("COMPLETED");
509
+ }) : (h(g - 1), p(w), g <= c ? await x(i, a, g, () => {
510
+ i.pushState({
511
+ id: f,
410
512
  index: t.history.getState().index - 1,
411
513
  status: "REPLACING",
412
- params: i,
413
- transitionName: c,
414
- layoutId: l
415
- }, "", b);
416
- }) : await _(o, () => {
417
- window.history.replaceState({
418
- id: u,
514
+ params: o,
515
+ transitionName: u,
516
+ layoutId: d
517
+ }, S);
518
+ }) : await x(i, a, c, () => {
519
+ i.replaceState({
520
+ id: f,
419
521
  index: 0,
420
522
  status: "REPLACING",
421
- params: i,
422
- transitionName: c,
423
- layoutId: l
424
- }, "", b);
523
+ params: o,
524
+ transitionName: u,
525
+ layoutId: d
526
+ }, S);
425
527
  }), async () => {
426
- f(t.history.getState().index - 1), v("COMPLETED");
528
+ m(t.history.getState().index - 1), _("COMPLETED");
427
529
  });
428
530
  }, {
429
- id: u,
531
+ id: f,
430
532
  control: { manual: !0 }
431
533
  })).result?.();
432
- }, o = async (e, n) => {
433
- let i = r.generateTaskId();
534
+ }, c = async (e, n) => {
535
+ let o = r.generateTaskId();
434
536
  (await r.addTask(async (r) => {
435
- let { index: a, histories: o, popHistory: s, popHistories: c, setTransitionName: l } = t.history.getState();
436
- if (a <= 0) {
537
+ let { index: s, histories: c, popHistory: l, popHistories: u, setPendingIndex: d, setTransitionName: f } = t.history.getState();
538
+ if (s <= 0) {
437
539
  r.abort();
438
540
  return;
439
541
  }
440
- let u = Math.min(e(a, o), a);
441
- if (u <= 0) {
542
+ let p = Math.min(e(s, c), s);
543
+ if (p <= 0) {
442
544
  r.abort();
443
545
  return;
444
546
  }
445
- let { setStatus: f, setTransitionTaskId: p } = t.navigate.getState();
446
- return n && l(a, n), f("POPPING"), p(i), c(u - 1), d(), u === 1 ? window.history.back() : window.history.go(-u), async () => {
447
- s(t.history.getState().index), f("COMPLETED");
547
+ d(s - p);
548
+ let { setStatus: m, setTransitionTaskId: h } = t.navigate.getState();
549
+ return n && f(s, n), m("POPPING"), h(o), u(p - 1), a(), p === 1 ? i.back() : i.go(-p), async () => {
550
+ l(t.history.getState().index), m("COMPLETED");
448
551
  };
449
552
  }, {
450
- id: i,
553
+ id: o,
451
554
  control: { manual: !0 }
452
555
  })).result?.();
453
556
  };
454
557
  return {
455
- push: i,
456
- replace: a,
558
+ push: o,
559
+ replace: s,
457
560
  pop: async (e) => {
458
- await o((t, n) => {
561
+ await c((t, n) => {
459
562
  if (e?.until != null) {
460
- let r = h(e.until, t, n);
563
+ let r = y(e.until, t, n);
461
564
  return r < 0 ? 0 : r;
462
565
  }
463
- let r = g(e?.skip, 1);
566
+ let r = b(e?.skip, 1);
464
567
  return r <= 0 ? 0 : Math.min(r, t);
465
568
  }, e?.transitionName);
466
569
  }
@@ -468,7 +571,7 @@ function v(e) {
468
571
  }
469
572
  //#endregion
470
573
  //#region src/screen/store.ts
471
- function y() {
574
+ function C() {
472
575
  return e((e) => ({
473
576
  dragStatus: "IDLE",
474
577
  replaceTransitionStatus: "IDLE",
@@ -487,7 +590,7 @@ function y() {
487
590
  }
488
591
  //#endregion
489
592
  //#region src/screen/createScreenSelector.ts
490
- function b(e, t) {
593
+ function w(e, t) {
491
594
  return e.map((n, r) => ({
492
595
  ...n,
493
596
  isActive: r === t,
@@ -500,13 +603,13 @@ function b(e, t) {
500
603
  }
501
604
  //#endregion
502
605
  //#region src/screen/computeScreenFreeze.ts
503
- function x(e) {
606
+ function ee(e) {
504
607
  let t = e.status === "COMPLETED" && e.dragStatus === "IDLE";
505
608
  return !e.isActive && t || e.isPrev && e.index - 2 <= e.zIndex && e.replaceTransitionStatus === "IDLE" || e.isPrev && e.index - 2 > e.zIndex;
506
609
  }
507
610
  //#endregion
508
611
  //#region src/transition/createTransition.ts
509
- function S({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exitBack: o, options: s }) {
612
+ function T({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exitBack: o, options: s }) {
510
613
  return {
511
614
  name: e,
512
615
  initial: t,
@@ -527,7 +630,7 @@ function S({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exit
527
630
  }
528
631
  //#endregion
529
632
  //#region src/transition/createRawTransition.ts
530
- function C({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnExit: l, completedOnEnter: u, options: d }) {
633
+ function te({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnExit: l, completedOnEnter: u, options: d }) {
531
634
  return {
532
635
  name: e,
533
636
  initial: t,
@@ -548,10 +651,10 @@ function C({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replac
548
651
  }
549
652
  //#endregion
550
653
  //#region src/transition/cupertino.ts
551
- var w = (e, t, n) => {
654
+ var ne = (e, t, n) => {
552
655
  let [r, i] = t, [a, o] = n;
553
656
  return i === r ? a : a + (e - r) / (i - r) * (o - a);
554
- }, T = S({
657
+ }, E = T({
555
658
  name: "cupertino",
556
659
  initial: { x: "100%" },
557
660
  idle: {
@@ -611,7 +714,7 @@ var w = (e, t, n) => {
611
714
  swipeDirection: "x",
612
715
  onSwipeStart: async () => !0,
613
716
  onSwipe: (e, t, { animate: n, currentScreen: r, prevScreen: i, onProgress: a }) => {
614
- let { offset: o } = t, s = o.x, c = w(s, [0, window.innerWidth], [0, 100]);
717
+ let { offset: o } = t, s = o.x, c = ne(s, [0, window.innerWidth], [0, 100]);
615
718
  return a?.(!0, c), n(r, { x: Math.max(0, s) }, { duration: 0 }), n(i, { x: `${-30 + c * .3}%` }, { duration: 0 }), c;
616
719
  },
617
720
  onSwipeEnd: async (e, t, { animate: n, currentScreen: r, prevScreen: i, onStart: a }) => {
@@ -635,10 +738,10 @@ var w = (e, t, n) => {
635
738
  })]), c;
636
739
  }
637
740
  }
638
- }), ee = (e, t, n) => {
741
+ }), re = (e, t, n) => {
639
742
  let [r, i] = t, [a, o] = n;
640
743
  return i === r ? a : a + (e - r) / (i - r) * (o - a);
641
- }, te = S({
744
+ }, ie = T({
642
745
  name: "layout",
643
746
  initial: { opacity: .97 },
644
747
  idle: {
@@ -666,7 +769,7 @@ var w = (e, t, n) => {
666
769
  swipeDirection: "y",
667
770
  onSwipeStart: async () => !0,
668
771
  onSwipe: (e, t, { animate: n, currentScreen: r, onProgress: i }) => {
669
- let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c = ee(s, [0, 56], [1, .96]), l = Math.max(0, o - 56), u = Math.min(1, l / 160), d = Math.sqrt(u) * 12, f = Math.max(0, s + d), p = Math.min(56, f);
772
+ let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c = re(s, [0, 56], [1, .96]), l = Math.max(0, o - 56), u = Math.min(1, l / 160), d = Math.sqrt(u) * 12, f = Math.max(0, s + d), p = Math.min(56, f);
670
773
  return i?.(!0, 100), n(r, {
671
774
  y: f,
672
775
  opacity: c
@@ -683,7 +786,7 @@ var w = (e, t, n) => {
683
786
  }, { duration: .3 })]), c;
684
787
  }
685
788
  }
686
- }), ne = S({
789
+ }), ae = T({
687
790
  name: "material",
688
791
  initial: { y: "100%" },
689
792
  idle: {
@@ -791,7 +894,7 @@ var w = (e, t, n) => {
791
894
  })]), c;
792
895
  }
793
896
  }
794
- }), E = S({
897
+ }), oe = T({
795
898
  name: "none",
796
899
  initial: {},
797
900
  idle: {
@@ -815,14 +918,14 @@ var w = (e, t, n) => {
815
918
  options: { duration: 0 }
816
919
  }
817
920
  }), D = new Map([
818
- ["none", E],
819
- ["cupertino", T],
820
- ["material", ne],
821
- ["layout", te]
921
+ ["none", oe],
922
+ ["cupertino", E],
923
+ ["material", ae],
924
+ ["layout", ie]
822
925
  ]);
823
926
  //#endregion
824
927
  //#region src/transition/store.ts
825
- function re(t = "cupertino") {
928
+ function se(t = "cupertino") {
826
929
  return e((e) => ({
827
930
  defaultTransitionName: t,
828
931
  setDefaultTransitionName: (t) => e({ defaultTransitionName: t })
@@ -830,7 +933,7 @@ function re(t = "cupertino") {
830
933
  }
831
934
  //#endregion
832
935
  //#region src/transition/decorator/createDecorator.ts
833
- function ie({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
936
+ function O({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
834
937
  return {
835
938
  name: e,
836
939
  initial: t,
@@ -851,7 +954,7 @@ function ie({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
851
954
  }
852
955
  //#endregion
853
956
  //#region src/transition/decorator/createRawDecorator.ts
854
- function ae({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
957
+ function ce({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
855
958
  return {
856
959
  name: e,
857
960
  initial: t,
@@ -872,30 +975,30 @@ function ae({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
872
975
  }
873
976
  //#endregion
874
977
  //#region src/transition/decorator/overlay.ts
875
- var O = "rgba(0, 0, 0, 0.3)", oe = ie({
978
+ var k = "rgba(0, 0, 0, 0.3)", le = O({
876
979
  name: "overlay",
877
980
  initial: {
878
981
  opacity: 0,
879
- backgroundColor: O
982
+ backgroundColor: k
880
983
  },
881
984
  idle: {
882
985
  value: {
883
986
  opacity: 0,
884
- backgroundColor: O
987
+ backgroundColor: k
885
988
  },
886
989
  options: { duration: 0 }
887
990
  },
888
991
  enter: {
889
992
  value: {
890
993
  opacity: 1,
891
- backgroundColor: O
994
+ backgroundColor: k
892
995
  },
893
996
  options: { duration: .7 }
894
997
  },
895
998
  exit: {
896
999
  value: {
897
1000
  opacity: 0,
898
- backgroundColor: O
1001
+ backgroundColor: k
899
1002
  },
900
1003
  options: { duration: .6 }
901
1004
  },
@@ -904,10 +1007,10 @@ var O = "rgba(0, 0, 0, 0.3)", oe = ie({
904
1007
  onSwipe: (e, t, { animate: n, prevDecorator: r }) => n(r, { opacity: Math.max(0, 1 - t / 100) }, { duration: 0 }),
905
1008
  onSwipeEnd: (e, { animate: t, prevDecorator: n }) => t(n, { opacity: +!e }, { duration: .3 })
906
1009
  }
907
- }), se = new Map([["overlay", oe]]);
1010
+ }), A = new Map([["overlay", le]]);
908
1011
  //#endregion
909
1012
  //#region src/transition/partTransition/createPartTransition.ts
910
- function ce({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
1013
+ function ue({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
911
1014
  return {
912
1015
  name: e,
913
1016
  initial: t,
@@ -928,7 +1031,7 @@ function ce({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
928
1031
  }
929
1032
  //#endregion
930
1033
  //#region src/transition/partTransition/createRawPartTransition.ts
931
- function le({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
1034
+ function de({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
932
1035
  return {
933
1036
  name: e,
934
1037
  initial: t,
@@ -949,7 +1052,7 @@ function le({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
949
1052
  }
950
1053
  //#endregion
951
1054
  //#region src/transition/partTransition/partTransition.ts
952
- var k = /* @__PURE__ */ new Map(), A = {
1055
+ var j = /* @__PURE__ */ new Map(), M = {
953
1056
  "IDLE-true": "self",
954
1057
  "IDLE-false": "self",
955
1058
  "PUSHING-true": "initial",
@@ -960,7 +1063,7 @@ var k = /* @__PURE__ */ new Map(), A = {
960
1063
  "POPPING-false": "PUSHING-false",
961
1064
  "COMPLETED-true": "self",
962
1065
  "COMPLETED-false": "self"
963
- }, ue = Object.keys(A), de = ue, fe = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_"), j = (e) => typeof e == "object" && !!e && !Array.isArray(e), pe = new Set(/* @__PURE__ */ "opacity.scale.scaleX.scaleY.scaleZ.aspectRatio.columnCount.columns.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineHeight.lineClamp.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeWidth".split(".")), me = (e, t) => t.startsWith("--") || pe.has(t) ? `${e}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${e}deg` : `${e}px`, M = (e, t) => typeof t == "number" ? me(t, e) : typeof t == "string" ? t : "", N = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), P = new Set([
1066
+ }, fe = Object.keys(M), pe = fe, me = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_"), N = (e) => typeof e == "object" && !!e && !Array.isArray(e), he = new Set(/* @__PURE__ */ "opacity.scale.scaleX.scaleY.scaleZ.aspectRatio.columnCount.columns.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineHeight.lineClamp.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeWidth".split(".")), ge = (e, t) => t.startsWith("--") || he.has(t) ? `${e}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${e}deg` : `${e}px`, P = (e, t) => typeof t == "number" ? ge(t, e) : typeof t == "string" ? t : "", F = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), I = new Set([
964
1067
  "x",
965
1068
  "y",
966
1069
  "z",
@@ -971,7 +1074,7 @@ var k = /* @__PURE__ */ new Map(), A = {
971
1074
  "rotateX",
972
1075
  "rotateY",
973
1076
  "rotateZ"
974
- ]), he = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, ge = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, _e = /^1(\.0+)?$/, ve = (e, t) => e === "scale" || e === "scaleX" || e === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? _e.test(t.trim()) : !1 : e === "rotate" || e === "rotateX" || e === "rotateY" || e === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? ge.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? he.test(t.trim()) : !1, ye = (e, t) => {
1077
+ ]), _e = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, ve = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, ye = /^1(\.0+)?$/, be = (e, t) => e === "scale" || e === "scaleX" || e === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? ye.test(t.trim()) : !1 : e === "rotate" || e === "rotateX" || e === "rotateY" || e === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? ve.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? _e.test(t.trim()) : !1, xe = (e, t) => {
975
1078
  switch (e) {
976
1079
  case "x": return `translateX(${t})`;
977
1080
  case "y": return `translateY(${t})`;
@@ -985,23 +1088,23 @@ var k = /* @__PURE__ */ new Map(), A = {
985
1088
  case "rotateY": return `rotateY(${t})`;
986
1089
  default: return "";
987
1090
  }
988
- }, F = (e) => {
1091
+ }, L = (e) => {
989
1092
  let t = /* @__PURE__ */ new Set(), n = !1, r = (e) => {
990
- if (j(e)) for (let r of Object.keys(e)) {
1093
+ if (N(e)) for (let r of Object.keys(e)) {
991
1094
  let i = e[r];
992
- M(r, i) !== "" && (P.has(r) ? n = !0 : t.add(N(r)));
1095
+ P(r, i) !== "" && (I.has(r) ? n = !0 : t.add(F(r)));
993
1096
  }
994
1097
  };
995
1098
  r(e.initial);
996
1099
  for (let t of Object.values(e.variants)) r(t.value);
997
1100
  return n && t.add("transform"), Array.from(t);
998
- }, I = (e) => {
999
- if (!j(e)) return [];
1101
+ }, R = (e) => {
1102
+ if (!N(e)) return [];
1000
1103
  let t = [], n = !0, r = [];
1001
1104
  for (let i of Object.keys(e)) {
1002
- let a = e[i], o = M(i, a);
1003
- o !== "" && (P.has(i) ? (t.push(ye(i, o)), ve(i, a) || (n = !1)) : r.push({
1004
- property: N(i),
1105
+ let a = e[i], o = P(i, a);
1106
+ o !== "" && (I.has(i) ? (t.push(xe(i, o)), be(i, a) || (n = !1)) : r.push({
1107
+ property: F(i),
1005
1108
  value: o
1006
1109
  }));
1007
1110
  }
@@ -1009,7 +1112,7 @@ var k = /* @__PURE__ */ new Map(), A = {
1009
1112
  property: "transform",
1010
1113
  value: n ? "none" : t.join(" ")
1011
1114
  }), r;
1012
- }, L = (e) => e.map((e) => ` ${e.property}: ${e.value};`).join("\n"), R = (e) => Array.isArray(e) ? e.length === 4 && e.every((e) => typeof e == "number") ? `cubic-bezier(${e.join(", ")})` : "linear" : typeof e == "string" ? {
1115
+ }, z = (e) => e.map((e) => ` ${e.property}: ${e.value};`).join("\n"), B = (e) => Array.isArray(e) ? e.length === 4 && e.every((e) => typeof e == "number") ? `cubic-bezier(${e.join(", ")})` : "linear" : typeof e == "string" ? {
1013
1116
  linear: "linear",
1014
1117
  easeIn: "ease-in",
1015
1118
  easeOut: "ease-out",
@@ -1019,33 +1122,33 @@ var k = /* @__PURE__ */ new Map(), A = {
1019
1122
  backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
1020
1123
  backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
1021
1124
  anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
1022
- }[e] ?? "ease" : "ease", z = (e) => {
1125
+ }[e] ?? "ease" : "ease", V = (e) => {
1023
1126
  if (!e) return 0;
1024
1127
  let t = e.duration;
1025
1128
  return typeof t == "number" && t >= 0 ? t : 0;
1026
- }, B = (e) => e && typeof e.delay == "number" && e.delay > 0 ? e.delay : 0, be = (e, t) => {
1129
+ }, Se = (e) => e && typeof e.delay == "number" && e.delay > 0 ? e.delay : 0, Ce = (e, t) => {
1027
1130
  let [n, r] = t.split("-");
1028
1131
  return `[data-flemo-screen][data-flemo-transition="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
1029
- }, xe = (e, t) => {
1132
+ }, we = (e, t) => {
1030
1133
  let [n, r] = t.split("-");
1031
1134
  return `[data-flemo-decorator][data-flemo-decorator-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
1032
- }, Se = (e, t) => {
1135
+ }, Te = (e, t) => {
1033
1136
  let [n, r] = t.split("-");
1034
1137
  return `[data-flemo-bar][data-flemo-bar-transition="${e}"][data-flemo-bar-status="${n}"][data-flemo-bar-active="${r}"][data-flemo-bar-riding="true"]`;
1035
- }, Ce = (e, t) => {
1138
+ }, Ee = (e, t) => {
1036
1139
  let [n, r] = t.split("-");
1037
1140
  return `[data-flemo-part-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
1038
- }, V = (e, t, n) => `flemo-${e}-${fe(t)}-${n}`, H = (e, t, n, r, i, a) => {
1039
- let o = I(r), s = I(i.value), c = z(i.options), l = B(i.options), u = R(i.options?.ease), d = a(t, n), f = e === "screen" ? `${d},\n${Se(t, n)}` : d;
1141
+ }, H = (e, t, n) => `flemo-${e}-${me(t)}-${n}`, U = (e, t, n, r, i, a) => {
1142
+ let o = R(r), s = R(i.value), c = V(i.options), l = Se(i.options), u = B(i.options?.ease), d = a(t, n), f = e === "screen" ? `${d},\n${Te(t, n)}` : d;
1040
1143
  if (s.length === 0 && o.length === 0) return "";
1041
- if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${L(s)}\n animation: none;\n}`;
1042
- let p = V(e, t, n), m = [
1144
+ if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${z(s)}\n animation: none;\n}`;
1145
+ let p = H(e, t, n), m = [
1043
1146
  `@keyframes ${p} {`,
1044
1147
  " from {",
1045
- L(o).replace(/^/gm, " "),
1148
+ z(o).replace(/^/gm, " "),
1046
1149
  " }",
1047
1150
  " to {",
1048
- L(s).replace(/^/gm, " "),
1151
+ z(s).replace(/^/gm, " "),
1049
1152
  " }",
1050
1153
  "}"
1051
1154
  ].join("\n"), h = [
@@ -1056,92 +1159,92 @@ var k = /* @__PURE__ */ new Map(), A = {
1056
1159
  "both"
1057
1160
  ].filter(Boolean).join(" "), g = Array.from(new Set([...o.map((e) => e.property), ...s.map((e) => e.property)])), _ = g.length > 0 ? ` will-change: ${g.join(", ")};\n` : "", v = n.split("-")[0];
1058
1161
  return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}`;
1059
- }, U = (e, t, n, r) => {
1060
- let i = I(r.value);
1061
- return i.length === 0 ? "" : `${e(t, n)} {\n${L(i)}\n}`;
1062
- }, we = (e, t, n = []) => {
1162
+ }, W = (e, t, n, r) => {
1163
+ let i = R(r.value);
1164
+ return i.length === 0 ? "" : `${e(t, n)} {\n${z(i)}\n}`;
1165
+ }, De = (e, t, n = []) => {
1063
1166
  let r = [];
1064
1167
  for (let t of e) {
1065
1168
  let e = t.name;
1066
- for (let n of ue) {
1067
- let i = t.variants[n], a = A[n];
1169
+ for (let n of fe) {
1170
+ let i = t.variants[n], a = M[n];
1068
1171
  if (a === "self") {
1069
- r.push(U(be, e, n, i));
1172
+ r.push(W(Ce, e, n, i));
1070
1173
  continue;
1071
1174
  }
1072
1175
  let o = a === "initial" ? t.initial : t.variants[a].value;
1073
- r.push(H("screen", e, n, o, i, be));
1176
+ r.push(U("screen", e, n, o, i, Ce));
1074
1177
  }
1075
1178
  }
1076
1179
  for (let e of t) {
1077
1180
  let t = e.name;
1078
- for (let n of de) {
1079
- let i = e.variants[n], a = A[n];
1181
+ for (let n of pe) {
1182
+ let i = e.variants[n], a = M[n];
1080
1183
  if (a === "self") {
1081
- r.push(U(xe, t, n, i));
1184
+ r.push(W(we, t, n, i));
1082
1185
  continue;
1083
1186
  }
1084
1187
  let o = a === "initial" ? e.initial : e.variants[a].value;
1085
- r.push(H("decorator", t, n, o, i, xe));
1188
+ r.push(U("decorator", t, n, o, i, we));
1086
1189
  }
1087
1190
  }
1088
1191
  for (let e of n) {
1089
1192
  let t = e.name;
1090
- for (let n of de) {
1091
- let i = e.variants[n], a = A[n];
1193
+ for (let n of pe) {
1194
+ let i = e.variants[n], a = M[n];
1092
1195
  if (a === "self") {
1093
- r.push(U(Ce, t, n, i));
1196
+ r.push(W(Ee, t, n, i));
1094
1197
  continue;
1095
1198
  }
1096
1199
  let o = a === "initial" ? e.initial : e.variants[a].value;
1097
- r.push(H("part", t, n, o, i, Ce));
1200
+ r.push(U("part", t, n, o, i, Ee));
1098
1201
  }
1099
1202
  }
1100
1203
  return r.filter((e) => e.length > 0).join("\n\n");
1101
- }, Te = (e, t) => {
1102
- let n = A[t];
1204
+ }, Oe = (e, t) => {
1205
+ let n = M[t];
1103
1206
  if (n === "self") return !1;
1104
- let r = e.variants[t], i = z(r.options), a = B(r.options);
1207
+ let r = e.variants[t], i = V(r.options), a = Se(r.options);
1105
1208
  if (i <= 0 && a <= 0) return !1;
1106
- let o = I(n === "initial" ? e.initial : e.variants[n].value), s = I(r.value);
1209
+ let o = R(n === "initial" ? e.initial : e.variants[n].value), s = R(r.value);
1107
1210
  return o.length > 0 || s.length > 0;
1108
- }, Ee = "data-flemo";
1109
- function De() {
1211
+ }, ke = "data-flemo";
1212
+ function Ae() {
1110
1213
  if (c()) return;
1111
- let e = we(D.values(), se.values(), k.values()), t = document.head.querySelector(`style[${Ee}]`);
1112
- t || (t = document.createElement("style"), t.setAttribute(Ee, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
1214
+ let e = De(D.values(), A.values(), j.values()), t = document.head.querySelector(`style[${ke}]`);
1215
+ t || (t = document.createElement("style"), t.setAttribute(ke, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
1113
1216
  }
1114
1217
  //#endregion
1115
1218
  //#region src/transition/animateInline.ts
1116
- var Oe = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, W = /* @__PURE__ */ new WeakMap(), ke = (e, t) => {
1117
- let n = W.get(e);
1118
- n || (n = /* @__PURE__ */ new Set(), W.set(e, n)), n.add(t);
1119
- }, G = (e, t) => {
1219
+ var je = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, G = /* @__PURE__ */ new WeakMap(), Me = (e, t) => {
1220
+ let n = G.get(e);
1221
+ n || (n = /* @__PURE__ */ new Set(), G.set(e, n)), n.add(t);
1222
+ }, K = (e, t) => {
1120
1223
  if (e.style.transition = "", t) {
1121
- let n = W.get(e);
1224
+ let n = G.get(e);
1122
1225
  for (let r of t) e.style.removeProperty(r), n?.delete(r);
1123
1226
  return;
1124
1227
  }
1125
- let n = W.get(e);
1228
+ let n = G.get(e);
1126
1229
  if (n && n.size > 0) {
1127
1230
  for (let t of n) e.style.removeProperty(t);
1128
1231
  n.clear();
1129
1232
  return;
1130
1233
  }
1131
1234
  e.style.removeProperty("transform"), e.style.removeProperty("opacity");
1132
- }, K = (e, t, n = {}) => {
1133
- if (!Oe(e)) return Promise.resolve();
1134
- let r = e, i = I(t);
1235
+ }, q = (e, t, n = {}) => {
1236
+ if (!je(e)) return Promise.resolve();
1237
+ let r = e, i = R(t);
1135
1238
  if (i.length === 0) return Promise.resolve();
1136
- let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = R(n.ease);
1239
+ let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = B(n.ease);
1137
1240
  if (a <= 0 && o <= 0) {
1138
1241
  r.style.transition = "none";
1139
- for (let e of i) r.style.setProperty(e.property, e.value), ke(r, e.property);
1242
+ for (let e of i) r.style.setProperty(e.property, e.value), Me(r, e.property);
1140
1243
  return Promise.resolve();
1141
1244
  }
1142
1245
  let c = i.map((e) => `${e.property} ${a}s ${s} ${o}s`).join(", ");
1143
1246
  r.style.transition = c, r.offsetWidth;
1144
- for (let e of i) r.style.setProperty(e.property, e.value), ke(r, e.property);
1247
+ for (let e of i) r.style.setProperty(e.property, e.value), Me(r, e.property);
1145
1248
  return new Promise((e) => {
1146
1249
  let t = !1, n = () => {
1147
1250
  t || (t = !0, r.removeEventListener("transitionend", i), e());
@@ -1150,27 +1253,27 @@ var Oe = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, W = /* @__
1150
1253
  };
1151
1254
  r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
1152
1255
  });
1153
- }, q = "data-flemo-skip-animation", J = () => {};
1154
- function Ae(e) {
1256
+ }, J = "data-flemo-skip-animation", Y = () => {};
1257
+ function Ne(e) {
1155
1258
  return { driveScreenLifecycle: (t) => {
1156
1259
  let { getElements: n, transitionName: i, prevTransitionName: a, status: o, isActive: s } = t;
1157
- if (!s) return o === "REPLACING" && a !== i && e.setReplaceTransitionStatus("PENDING"), J;
1260
+ if (!s) return o === "REPLACING" && a !== i && e.setReplaceTransitionStatus("PENDING"), Y;
1158
1261
  if (o === "COMPLETED") {
1159
1262
  e.setDragStatus("IDLE"), e.setReplaceTransitionStatus("IDLE");
1160
1263
  let { scope: t, decorator: r, bars: i } = n();
1161
- t && (G(t), t.removeAttribute(q)), r && (G(r), r.removeAttribute(q));
1162
- for (let e of i ?? []) e && (G(e), e.style.removeProperty("will-change"));
1163
- return J;
1264
+ t && (K(t), t.removeAttribute(J)), r && (K(r), r.removeAttribute(J));
1265
+ for (let e of i ?? []) e && (K(e), e.style.removeProperty("will-change"));
1266
+ return Y;
1164
1267
  }
1165
- if (o === "IDLE") return J;
1268
+ if (o === "IDLE") return Y;
1166
1269
  let { scope: c } = n();
1167
- if (!c) return J;
1270
+ if (!c) return Y;
1168
1271
  let l = () => {
1169
1272
  let t = e.getTransitionTaskId();
1170
1273
  t && r.resolveTask(t);
1171
1274
  }, u = D.get(i) ?? D.get("none"), d = `${o}-true`;
1172
- if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && Te(u, d))) return queueMicrotask(l), J;
1173
- let f = V("screen", i, d), p = (e) => {
1275
+ if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && Oe(u, d))) return queueMicrotask(l), Y;
1276
+ let f = H("screen", i, d), p = (e) => {
1174
1277
  e.target === c && e.animationName === f && (c.removeEventListener("animationend", p), l());
1175
1278
  };
1176
1279
  return c.addEventListener("animationend", p), () => {
@@ -1180,20 +1283,20 @@ function Ae(e) {
1180
1283
  }
1181
1284
  //#endregion
1182
1285
  //#region src/utils/findScrollable.ts
1183
- function Y(e, t) {
1184
- let { direction: n = "x", markerSelector: r = "[data-swipe-at-edge]", depthLimit: i = 24, verifyByScroll: a = !1 } = t ?? {}, o = je(e);
1286
+ function X(e, t) {
1287
+ let { direction: n = "x", markerSelector: r = "[data-swipe-at-edge]", depthLimit: i = 24, verifyByScroll: a = !1 } = t ?? {}, o = Pe(e);
1185
1288
  if (!o) return {
1186
1289
  element: null,
1187
1290
  hasMarker: !1
1188
1291
  };
1189
1292
  let s = o.closest?.(r);
1190
- if (s instanceof HTMLElement && X(s, n) && (!a || Z(s, n))) return {
1293
+ if (s instanceof HTMLElement && Z(s, n) && (!a || Q(s, n))) return {
1191
1294
  element: s,
1192
1295
  hasMarker: !0
1193
1296
  };
1194
1297
  let c = o, l = 0;
1195
1298
  for (; c && l < i;) {
1196
- if (X(c, n) && (!a || Z(c, n))) return {
1299
+ if (Z(c, n) && (!a || Q(c, n))) return {
1197
1300
  element: c,
1198
1301
  hasMarker: !1
1199
1302
  };
@@ -1204,7 +1307,7 @@ function Y(e, t) {
1204
1307
  hasMarker: !1
1205
1308
  };
1206
1309
  }
1207
- function je(e) {
1310
+ function Pe(e) {
1208
1311
  if (!e) return null;
1209
1312
  let t = e, n = typeof t.composedPath == "function" ? t.composedPath() : void 0;
1210
1313
  if (n && n.length) {
@@ -1212,18 +1315,18 @@ function je(e) {
1212
1315
  }
1213
1316
  return e instanceof HTMLElement ? e : null;
1214
1317
  }
1215
- function X(e, t) {
1318
+ function Z(e, t) {
1216
1319
  return t === "y" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
1217
1320
  }
1218
- function Z(e, t) {
1219
- if (!X(e, t) || typeof window > "u") return !1;
1321
+ function Q(e, t) {
1322
+ if (!Z(e, t) || typeof window > "u") return !1;
1220
1323
  let n = window.getComputedStyle(e), r = t === "y" ? n.overflowY : n.overflowX;
1221
1324
  return r === "auto" || r === "scroll" || r === "overlay";
1222
1325
  }
1223
1326
  //#endregion
1224
1327
  //#region src/core/engine/createSwipeController.ts
1225
- var Q = "data-flemo-skip-animation";
1226
- function Me(e) {
1328
+ var Fe = "data-flemo-skip-animation";
1329
+ function Ie(e) {
1227
1330
  let t = null, n = null, r = {
1228
1331
  current: [],
1229
1332
  prev: []
@@ -1269,28 +1372,28 @@ function Me(e) {
1269
1372
  y: e.clientY
1270
1373
  }, u = t;
1271
1374
  }, v = (n, i, a) => {
1272
- let o = K(n, i, a);
1273
- if (n === e.getElements().scope) for (let e of r.current) K(e, i, a);
1274
- else if (n === t) for (let e of r.prev) K(e, i, a);
1375
+ let o = q(n, i, a);
1376
+ if (n === e.getElements().scope) for (let e of r.current) q(e, i, a);
1377
+ else if (n === t) for (let e of r.prev) q(e, i, a);
1275
1378
  return o;
1276
1379
  }, y = (t) => {
1277
- let n = e.getPartnerBars(), i = [], { sharedAppBar: a, sharedNavigationBar: o } = e.getElements();
1278
- a && e.hasSharedAppBar() && !n?.appBar && i.push(a), o && e.hasSharedNavigationBar() && !n?.navigationBar && i.push(o);
1380
+ let n = e.getPartnerBars(), i = [], { sharedTopBar: a, sharedBottomBar: o } = e.getElements();
1381
+ a && e.hasSharedTopBar() && !n?.topBar && i.push(a), o && e.hasSharedBottomBar() && !n?.bottomBar && i.push(o);
1279
1382
  let s = [];
1280
1383
  if (t) {
1281
1384
  let n = t.querySelector("[data-flemo-bar=\"app\"]"), r = t.querySelector("[data-flemo-bar=\"nav\"]");
1282
- n && !e.hasSharedAppBar() && s.push(n), r && !e.hasSharedNavigationBar() && s.push(r);
1385
+ n && !e.hasSharedTopBar() && s.push(n), r && !e.hasSharedBottomBar() && s.push(r);
1283
1386
  }
1284
1387
  r = {
1285
1388
  current: i,
1286
1389
  prev: s
1287
1390
  };
1288
- let c = F(e.getTransition()).join(", ");
1391
+ let c = L(e.getTransition()).join(", ");
1289
1392
  for (let e of i) e.style.willChange = c;
1290
1393
  for (let e of s) e.style.willChange = c;
1291
1394
  }, b = () => {
1292
- for (let e of r.current) G(e), e.style.removeProperty("will-change");
1293
- for (let e of r.prev) G(e), e.style.removeProperty("will-change");
1395
+ for (let e of r.current) K(e), e.style.removeProperty("will-change");
1396
+ for (let e of r.prev) K(e), e.style.removeProperty("will-change");
1294
1397
  r = {
1295
1398
  current: [],
1296
1399
  prev: []
@@ -1303,10 +1406,10 @@ function Me(e) {
1303
1406
  };
1304
1407
  }, S = (e, t, n) => {
1305
1408
  let r = (r, i) => {
1306
- let a = k.get(r.getAttribute("data-flemo-part-name"));
1409
+ let a = j.get(r.getAttribute("data-flemo-part-name"));
1307
1410
  if (!a) return;
1308
1411
  let o = {
1309
- animate: K,
1412
+ animate: q,
1310
1413
  element: r,
1311
1414
  active: i
1312
1415
  };
@@ -1315,7 +1418,7 @@ function Me(e) {
1315
1418
  for (let e of i.current) r(e, !0);
1316
1419
  for (let e of i.prev) r(e, !1);
1317
1420
  }, C = () => {
1318
- for (let e of [...i.current, ...i.prev]) G(e);
1421
+ for (let e of [...i.current, ...i.prev]) K(e);
1319
1422
  i = {
1320
1423
  current: [],
1321
1424
  prev: []
@@ -1325,7 +1428,7 @@ function Me(e) {
1325
1428
  if (!i.swipeDirection || e.getViewportScrollHeight() > 10) return;
1326
1429
  let { scope: a, screenContainer: o, decorator: f } = e.getElements();
1327
1430
  if (!a) return;
1328
- let p = o?.parentElement?.previousElementSibling ?? null;
1431
+ let p = o?.previousElementSibling ?? null;
1329
1432
  if (t = p?.querySelector("[data-flemo-screen]") ?? null, n = p?.querySelector("[data-flemo-decorator]") ?? null, !t) return;
1330
1433
  s = !0, c = {
1331
1434
  x: r.clientX,
@@ -1344,13 +1447,13 @@ function Me(e) {
1344
1447
  prevScreen: t,
1345
1448
  onStart: (e) => {
1346
1449
  m?.onSwipeStart?.(e, {
1347
- animate: K,
1450
+ animate: q,
1348
1451
  currentDecorator: f,
1349
1452
  prevDecorator: n
1350
1453
  }), S("start", e, 0);
1351
1454
  }
1352
1455
  }) ? e.setDragStatus("PENDING") : (e.setDragStatus("IDLE"), s = !1, b());
1353
- }, T = (r) => {
1456
+ }, ee = (r) => {
1354
1457
  let i = e.getTransition();
1355
1458
  if (!i.swipeDirection || !s || e.getViewportScrollHeight() > 10) return;
1356
1459
  _(r);
@@ -1361,13 +1464,13 @@ function Me(e) {
1361
1464
  prevScreen: t,
1362
1465
  onProgress: (e, t) => {
1363
1466
  c?.onSwipe?.(e, t, {
1364
- animate: K,
1467
+ animate: q,
1365
1468
  currentDecorator: o,
1366
1469
  prevDecorator: n
1367
1470
  }), S("swipe", e, t);
1368
1471
  }
1369
1472
  });
1370
- }, ee = async (a) => {
1473
+ }, T = async (a) => {
1371
1474
  let o = e.getTransition();
1372
1475
  if (!o.swipeDirection || !s) return;
1373
1476
  s = !1;
@@ -1380,32 +1483,32 @@ function Me(e) {
1380
1483
  prevScreen: t,
1381
1484
  onStart: (e) => {
1382
1485
  u?.onSwipeEnd?.(e, {
1383
- animate: K,
1486
+ animate: q,
1384
1487
  currentDecorator: l,
1385
1488
  prevDecorator: n
1386
1489
  }), S("end", e, 0);
1387
1490
  }
1388
1491
  })) {
1389
- c?.setAttribute(Q, "true"), l?.setAttribute(Q, "true");
1492
+ c?.setAttribute(Fe, "true"), l?.setAttribute(Fe, "true");
1390
1493
  for (let e of r.current) e.style.removeProperty("will-change");
1391
- for (let e of r.prev) G(e), e.style.removeProperty("will-change");
1494
+ for (let e of r.prev) K(e), e.style.removeProperty("will-change");
1392
1495
  r = {
1393
1496
  current: [],
1394
1497
  prev: []
1395
1498
  };
1396
- for (let e of i.prev) G(e);
1499
+ for (let e of i.prev) K(e);
1397
1500
  i = {
1398
1501
  current: [],
1399
1502
  prev: []
1400
1503
  }, e.back();
1401
- } else c && G(c), t && G(t), l && G(l), n && G(n), b(), C(), e.setDragStatus("IDLE");
1504
+ } else c && K(c), t && K(t), l && K(l), n && K(n), b(), C(), e.setDragStatus("IDLE");
1402
1505
  };
1403
1506
  return {
1404
1507
  pointerDown: (t) => {
1405
- e.isReadyForDrag() && (f = Y(t.target, {
1508
+ e.isReadyForDrag() && (f = X(t.target, {
1406
1509
  direction: "x",
1407
1510
  verifyByScroll: !0
1408
- }), p = Y(t.target, {
1511
+ }), p = X(t.target, {
1409
1512
  direction: "y",
1410
1513
  verifyByScroll: !0
1411
1514
  }), m = t.clientX, h = t.clientY, (!f.element && !p.element || f.element || p.element) && (a = !0));
@@ -1413,7 +1516,7 @@ function Me(e) {
1413
1516
  pointerMove: (t) => {
1414
1517
  if (e.getViewportScrollHeight() > 10) return;
1415
1518
  if (s) {
1416
- T(t);
1519
+ ee(t);
1417
1520
  return;
1418
1521
  }
1419
1522
  let n = e.getTransition().swipeDirection, r = !f.element && !p.element;
@@ -1427,7 +1530,7 @@ function Me(e) {
1427
1530
  }
1428
1531
  },
1429
1532
  pointerUp: (e) => {
1430
- a = !1, o = !1, s && ee(e);
1533
+ a = !1, o = !1, s && T(e);
1431
1534
  },
1432
1535
  shouldPreventTouch: () => o
1433
1536
  };
@@ -1435,8 +1538,8 @@ function Me(e) {
1435
1538
  //#endregion
1436
1539
  //#region src/core/engine/barRiding.ts
1437
1540
  var $ = "data-flemo-bar-riding";
1438
- function Ne(e) {
1439
- let { appBar: t, navBar: n } = e;
1541
+ function Le(e) {
1542
+ let { topBar: t, navBar: n } = e;
1440
1543
  if (!t && !n) return () => {};
1441
1544
  let r = () => {
1442
1545
  let r = e.getStatus();
@@ -1444,7 +1547,7 @@ function Ne(e) {
1444
1547
  t?.removeAttribute($), n?.removeAttribute($);
1445
1548
  return;
1446
1549
  }
1447
- let i = e.getHistories(), a = e.isActive ? i[e.index - 1]?.id : i[e.index]?.id, o = a ? e.getSharedBars()[a] : void 0, s = e.hasAppBar && !o?.appBar, c = e.hasNavBar && !o?.navigationBar;
1550
+ let i = e.getHistories(), a = e.isActive ? i[e.index - 1]?.id : i[e.index]?.id, o = a ? e.getSharedBars()[a] : void 0, s = e.hasTopBar && !o?.topBar, c = e.hasNavBar && !o?.bottomBar;
1448
1551
  t && t.setAttribute($, s ? "true" : "false"), n && n.setAttribute($, c ? "true" : "false");
1449
1552
  };
1450
1553
  r();
@@ -1454,4 +1557,4 @@ function Ne(e) {
1454
1557
  };
1455
1558
  }
1456
1559
  //#endregion
1457
- export { q as SKIP_ANIMATION_ATTR, r as TaskManger, K as animateInline, V as animationName, De as applyTransitionStyles, Z as canProgrammaticallyScroll, G as clearInlineAnimation, F as collectAnimatedProperties, we as compileTransitionStyles, x as computeScreenFreeze, f as consumeSelfInducedPop, ie as createDecorator, i as createHistoryStore, p as createHistorySync, m as createNavigateStore, v as createNavigationController, ce as createPartTransition, ae as createRawDecorator, le as createRawPartTransition, C as createRawTransition, b as createScreenSelector, y as createScreenStore, Me as createSwipeController, S as createTransition, Ae as createTransitionEngine, re as createTransitionStore, T as cupertino, se as decoratorMap, Ne as driveBarRiding, R as easingToCss, l as ensureWindowHistoryState, Y as findScrollable, a as getMatchedPathPattern, o as getParams, c as isServer, te as layout, d as markSelfInducedPop, ne as material, E as none, X as overflowsAxis, oe as overlay, k as partTransitionMap, s as seedInitialHistory, I as targetToDecls, D as transitionMap, Te as variantHasAnimation };
1560
+ export { J as SKIP_ANIMATION_ATTR, r as TaskManger, q as animateInline, H as animationName, Ae as applyTransitionStyles, Q as canProgrammaticallyScroll, K as clearInlineAnimation, L as collectAnimatedProperties, De as compileTransitionStyles, ee as computeScreenFreeze, h as consumeSelfInducedPop, d as createBrowserHistoryDriver, O as createDecorator, i as createHistoryStore, g as createHistorySync, _ as createMemoryHistoryDriver, v as createNavigateStore, S as createNavigationController, ue as createPartTransition, ce as createRawDecorator, de as createRawPartTransition, te as createRawTransition, w as createScreenSelector, C as createScreenStore, f as createSelfPopGuard, Ie as createSwipeController, T as createTransition, Ne as createTransitionEngine, se as createTransitionStore, E as cupertino, A as decoratorMap, Le as driveBarRiding, B as easingToCss, l as ensureWindowHistoryState, X as findScrollable, a as getMatchedPathPattern, o as getParams, c as isServer, ie as layout, m as markSelfInducedPop, ae as material, oe as none, Z as overflowsAxis, le as overlay, j as partTransitionMap, s as seedInitialHistory, R as targetToDecls, D as transitionMap, Oe as variantHasAnimation };