flemo 1.3.6 → 1.3.7

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1192 -1369
  2. package/package.json +3 -5
package/dist/index.mjs CHANGED
@@ -1,12 +1,11 @@
1
- import { jsx as x, jsxs as Xt } from "react/jsx-runtime";
2
- import { c as j } from "react/compiler-runtime";
3
- import _t, { useEffect as J, createContext as zt, useContext as Wt, useReducer as we, Children as le, Suspense as Ee, useImperativeHandle as Pe, useState as ne, useRef as B, useLayoutEffect as se } from "react";
4
- import { transform as Jt, useAnimate as fe, motion as Z, useDragControls as Te, AnimatePresence as ve, MotionConfig as De } from "motion/react";
5
- var F = {}, re;
6
- function Ie() {
7
- if (re) return F;
8
- re = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.PathError = F.TokenData = void 0, F.parse = a, F.compile = d, F.match = p, F.pathToRegexp = w, F.stringify = C;
9
- const e = "/", t = (f) => f, n = /^[$_\p{ID_Start}]$/u, s = /^[$\u200c\u200d\p{ID_Continue}]$/u, r = {
1
+ import { jsx as D, jsxs as ct } from "react/jsx-runtime";
2
+ import nt, { useEffect as z, createContext as dt, useContext as pt, useReducer as Ht, Children as It, Suspense as _t, useImperativeHandle as jt, useState as mt, useRef as H, useLayoutEffect as Et } from "react";
3
+ import { transform as ft, useAnimate as Lt, motion as J, useDragControls as Ft, AnimatePresence as Qt, MotionConfig as qt } from "motion/react";
4
+ var _ = {}, wt;
5
+ function Yt() {
6
+ if (wt) return _;
7
+ wt = 1, Object.defineProperty(_, "__esModule", { value: !0 }), _.PathError = _.TokenData = void 0, _.parse = l, _.compile = m, _.match = P, _.pathToRegexp = L, _.stringify = U;
8
+ const n = "/", e = (i) => i, t = /^[$_\p{ID_Start}]$/u, r = /^[$\u200c\u200d\p{ID_Continue}]$/u, s = {
10
9
  // Groups.
11
10
  "{": "{",
12
11
  "}": "}",
@@ -19,281 +18,283 @@ function Ie() {
19
18
  "?": "?",
20
19
  "!": "!"
21
20
  };
22
- function c(f) {
23
- return f.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
21
+ function a(i) {
22
+ return i.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
24
23
  }
25
- function i(f) {
26
- return f.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
24
+ function o(i) {
25
+ return i.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
27
26
  }
28
- class u {
29
- constructor(m, P) {
30
- this.tokens = m, this.originalPath = P;
27
+ class c {
28
+ constructor(y, g) {
29
+ this.tokens = y, this.originalPath = g;
31
30
  }
32
31
  }
33
- F.TokenData = u;
34
- class l extends TypeError {
35
- constructor(m, P) {
36
- let h = m;
37
- P && (h += `: ${P}`), h += "; visit https://git.new/pathToRegexpError for info", super(h), this.originalPath = P;
32
+ _.TokenData = c;
33
+ class h extends TypeError {
34
+ constructor(y, g) {
35
+ let E = y;
36
+ g && (E += `: ${g}`), E += "; visit https://git.new/pathToRegexpError for info", super(E), this.originalPath = g;
38
37
  }
39
38
  }
40
- F.PathError = l;
41
- function a(f, m = {}) {
42
- const { encodePath: P = t } = m, h = [...f], S = [];
43
- let y = 0, v = 0;
44
- function N() {
45
- let I = "";
46
- if (n.test(h[y]))
39
+ _.PathError = h;
40
+ function l(i, y = {}) {
41
+ const { encodePath: g = e } = y, E = [...i], p = [];
42
+ let f = 0, I = 0;
43
+ function T() {
44
+ let S = "";
45
+ if (t.test(E[f]))
47
46
  do
48
- I += h[y++];
49
- while (s.test(h[y]));
50
- else if (h[y] === '"') {
51
- let _ = y;
52
- for (; y++ < h.length; ) {
53
- if (h[y] === '"') {
54
- y++, _ = 0;
47
+ S += E[f++];
48
+ while (r.test(E[f]));
49
+ else if (E[f] === '"') {
50
+ let M = f;
51
+ for (; f++ < E.length; ) {
52
+ if (E[f] === '"') {
53
+ f++, M = 0;
55
54
  break;
56
55
  }
57
- h[y] === "\\" && y++, I += h[y];
56
+ E[f] === "\\" && f++, S += E[f];
58
57
  }
59
- if (_)
60
- throw new l(`Unterminated quote at index ${_}`, f);
58
+ if (M)
59
+ throw new h(`Unterminated quote at index ${M}`, i);
61
60
  }
62
- if (!I)
63
- throw new l(`Missing parameter name at index ${y}`, f);
64
- return I;
61
+ if (!S)
62
+ throw new h(`Missing parameter name at index ${f}`, i);
63
+ return S;
65
64
  }
66
- for (; y < h.length; ) {
67
- const I = h[y], _ = r[I];
68
- _ ? S.push({ type: _, index: y++, value: I }) : I === "\\" ? S.push({ type: "escape", index: y++, value: h[y++] }) : I === ":" ? S.push({ type: "param", index: y++, value: N() }) : I === "*" ? S.push({ type: "wildcard", index: y++, value: N() }) : S.push({ type: "char", index: y++, value: I });
65
+ for (; f < E.length; ) {
66
+ const S = E[f], M = s[S];
67
+ M ? p.push({ type: M, index: f++, value: S }) : S === "\\" ? p.push({ type: "escape", index: f++, value: E[f++] }) : S === ":" ? p.push({ type: "param", index: f++, value: T() }) : S === "*" ? p.push({ type: "wildcard", index: f++, value: T() }) : p.push({ type: "char", index: f++, value: S });
69
68
  }
70
- S.push({ type: "end", index: y, value: "" });
71
- function H(I) {
72
- const _ = [];
69
+ p.push({ type: "end", index: f, value: "" });
70
+ function O(S) {
71
+ const M = [];
73
72
  for (; ; ) {
74
- const $ = S[v++];
75
- if ($.type === I)
73
+ const x = p[I++];
74
+ if (x.type === S)
76
75
  break;
77
- if ($.type === "char" || $.type === "escape") {
78
- let A = $.value, U = S[v];
79
- for (; U.type === "char" || U.type === "escape"; )
80
- A += U.value, U = S[++v];
81
- _.push({
76
+ if (x.type === "char" || x.type === "escape") {
77
+ let C = x.value, b = p[I];
78
+ for (; b.type === "char" || b.type === "escape"; )
79
+ C += b.value, b = p[++I];
80
+ M.push({
82
81
  type: "text",
83
- value: P(A)
82
+ value: g(C)
84
83
  });
85
84
  continue;
86
85
  }
87
- if ($.type === "param" || $.type === "wildcard") {
88
- _.push({
89
- type: $.type,
90
- name: $.value
86
+ if (x.type === "param" || x.type === "wildcard") {
87
+ M.push({
88
+ type: x.type,
89
+ name: x.value
91
90
  });
92
91
  continue;
93
92
  }
94
- if ($.type === "{") {
95
- _.push({
93
+ if (x.type === "{") {
94
+ M.push({
96
95
  type: "group",
97
- tokens: H("}")
96
+ tokens: O("}")
98
97
  });
99
98
  continue;
100
99
  }
101
- throw new l(`Unexpected ${$.type} at index ${$.index}, expected ${I}`, f);
100
+ throw new h(`Unexpected ${x.type} at index ${x.index}, expected ${S}`, i);
102
101
  }
103
- return _;
102
+ return M;
104
103
  }
105
- return new u(H("end"), f);
104
+ return new c(O("end"), i);
106
105
  }
107
- function d(f, m = {}) {
108
- const { encode: P = encodeURIComponent, delimiter: h = e } = m, S = typeof f == "object" ? f : a(f, m), y = g(S.tokens, h, P);
109
- return function(N = {}) {
110
- const [H, ...I] = y(N);
111
- if (I.length)
112
- throw new TypeError(`Missing parameters: ${I.join(", ")}`);
113
- return H;
106
+ function m(i, y = {}) {
107
+ const { encode: g = encodeURIComponent, delimiter: E = n } = y, p = typeof i == "object" ? i : l(i, y), f = d(p.tokens, E, g);
108
+ return function(T = {}) {
109
+ const [O, ...S] = f(T);
110
+ if (S.length)
111
+ throw new TypeError(`Missing parameters: ${S.join(", ")}`);
112
+ return O;
114
113
  };
115
114
  }
116
- function g(f, m, P) {
117
- const h = f.map((S) => o(S, m, P));
118
- return (S) => {
119
- const y = [""];
120
- for (const v of h) {
121
- const [N, ...H] = v(S);
122
- y[0] += N, y.push(...H);
115
+ function d(i, y, g) {
116
+ const E = i.map((p) => u(p, y, g));
117
+ return (p) => {
118
+ const f = [""];
119
+ for (const I of E) {
120
+ const [T, ...O] = I(p);
121
+ f[0] += T, f.push(...O);
123
122
  }
124
- return y;
123
+ return f;
125
124
  };
126
125
  }
127
- function o(f, m, P) {
128
- if (f.type === "text")
129
- return () => [f.value];
130
- if (f.type === "group") {
131
- const S = g(f.tokens, m, P);
132
- return (y) => {
133
- const [v, ...N] = S(y);
134
- return N.length ? [""] : [v];
126
+ function u(i, y, g) {
127
+ if (i.type === "text")
128
+ return () => [i.value];
129
+ if (i.type === "group") {
130
+ const p = d(i.tokens, y, g);
131
+ return (f) => {
132
+ const [I, ...T] = p(f);
133
+ return T.length ? [""] : [I];
135
134
  };
136
135
  }
137
- const h = P || t;
138
- return f.type === "wildcard" && P !== !1 ? (S) => {
139
- const y = S[f.name];
140
- if (y == null)
141
- return ["", f.name];
142
- if (!Array.isArray(y) || y.length === 0)
143
- throw new TypeError(`Expected "${f.name}" to be a non-empty array`);
136
+ const E = g || e;
137
+ return i.type === "wildcard" && g !== !1 ? (p) => {
138
+ const f = p[i.name];
139
+ if (f == null)
140
+ return ["", i.name];
141
+ if (!Array.isArray(f) || f.length === 0)
142
+ throw new TypeError(`Expected "${i.name}" to be a non-empty array`);
144
143
  return [
145
- y.map((v, N) => {
146
- if (typeof v != "string")
147
- throw new TypeError(`Expected "${f.name}/${N}" to be a string`);
148
- return h(v);
149
- }).join(m)
144
+ f.map((I, T) => {
145
+ if (typeof I != "string")
146
+ throw new TypeError(`Expected "${i.name}/${T}" to be a string`);
147
+ return E(I);
148
+ }).join(y)
150
149
  ];
151
- } : (S) => {
152
- const y = S[f.name];
153
- if (y == null)
154
- return ["", f.name];
155
- if (typeof y != "string")
156
- throw new TypeError(`Expected "${f.name}" to be a string`);
157
- return [h(y)];
150
+ } : (p) => {
151
+ const f = p[i.name];
152
+ if (f == null)
153
+ return ["", i.name];
154
+ if (typeof f != "string")
155
+ throw new TypeError(`Expected "${i.name}" to be a string`);
156
+ return [E(f)];
158
157
  };
159
158
  }
160
- function p(f, m = {}) {
161
- const { decode: P = decodeURIComponent, delimiter: h = e } = m, { regexp: S, keys: y } = w(f, m), v = y.map((N) => P === !1 ? t : N.type === "param" ? P : (H) => H.split(h).map(P));
162
- return function(H) {
163
- const I = S.exec(H);
164
- if (!I)
159
+ function P(i, y = {}) {
160
+ const { decode: g = decodeURIComponent, delimiter: E = n } = y, { regexp: p, keys: f } = L(i, y), I = f.map((T) => g === !1 ? e : T.type === "param" ? g : (O) => O.split(E).map(g));
161
+ return function(O) {
162
+ const S = p.exec(O);
163
+ if (!S)
165
164
  return !1;
166
- const _ = I[0], $ = /* @__PURE__ */ Object.create(null);
167
- for (let A = 1; A < I.length; A++) {
168
- if (I[A] === void 0)
165
+ const M = S[0], x = /* @__PURE__ */ Object.create(null);
166
+ for (let C = 1; C < S.length; C++) {
167
+ if (S[C] === void 0)
169
168
  continue;
170
- const U = y[A - 1], et = v[A - 1];
171
- $[U.name] = et(I[A]);
169
+ const b = f[C - 1], W = I[C - 1];
170
+ x[b.name] = W(S[C]);
172
171
  }
173
- return { path: _, params: $ };
172
+ return { path: M, params: x };
174
173
  };
175
174
  }
176
- function w(f, m = {}) {
177
- const { delimiter: P = e, end: h = !0, sensitive: S = !1, trailing: y = !0 } = m, v = [], N = S ? "" : "i", H = [];
178
- for (const $ of E(f, [])) {
179
- const A = typeof $ == "object" ? $ : a($, m);
180
- for (const U of T(A.tokens, 0, []))
181
- H.push(L(U, P, v, A.originalPath));
175
+ function L(i, y = {}) {
176
+ const { delimiter: g = n, end: E = !0, sensitive: p = !1, trailing: f = !0 } = y, I = [], T = p ? "" : "i", O = [];
177
+ for (const x of N(i, [])) {
178
+ const C = typeof x == "object" ? x : l(x, y);
179
+ for (const b of w(C.tokens, 0, []))
180
+ O.push(k(b, g, I, C.originalPath));
182
181
  }
183
- let I = `^(?:${H.join("|")})`;
184
- return y && (I += `(?:${i(P)}$)?`), I += h ? "$" : `(?=${i(P)}|$)`, { regexp: new RegExp(I, N), keys: v };
182
+ let S = `^(?:${O.join("|")})`;
183
+ return f && (S += `(?:${o(g)}$)?`), S += E ? "$" : `(?=${o(g)}|$)`, { regexp: new RegExp(S, T), keys: I };
185
184
  }
186
- function E(f, m) {
187
- if (Array.isArray(f))
188
- for (const P of f)
189
- E(P, m);
185
+ function N(i, y) {
186
+ if (Array.isArray(i))
187
+ for (const g of i)
188
+ N(g, y);
190
189
  else
191
- m.push(f);
192
- return m;
190
+ y.push(i);
191
+ return y;
193
192
  }
194
- function* T(f, m, P) {
195
- if (m === f.length)
196
- return yield P;
197
- const h = f[m];
198
- if (h.type === "group")
199
- for (const S of T(h.tokens, 0, P.slice()))
200
- yield* T(f, m + 1, S);
193
+ function* w(i, y, g) {
194
+ if (y === i.length)
195
+ return yield g;
196
+ const E = i[y];
197
+ if (E.type === "group")
198
+ for (const p of w(E.tokens, 0, g.slice()))
199
+ yield* w(i, y + 1, p);
201
200
  else
202
- P.push(h);
203
- yield* T(f, m + 1, P);
201
+ g.push(E);
202
+ yield* w(i, y + 1, g);
204
203
  }
205
- function L(f, m, P, h) {
206
- let S = "", y = "", v = !0;
207
- for (const N of f) {
208
- if (N.type === "text") {
209
- S += i(N.value), y += N.value, v || (v = N.value.includes(m));
204
+ function k(i, y, g, E) {
205
+ let p = "", f = "", I = !0;
206
+ for (const T of i) {
207
+ if (T.type === "text") {
208
+ p += o(T.value), f += T.value, I || (I = T.value.includes(y));
210
209
  continue;
211
210
  }
212
- if (N.type === "param" || N.type === "wildcard") {
213
- if (!v && !y)
214
- throw new l(`Missing text before "${N.name}" ${N.type}`, h);
215
- N.type === "param" ? S += `(${M(m, v ? "" : y)}+)` : S += "([\\s\\S]+)", P.push(N), y = "", v = !1;
211
+ if (T.type === "param" || T.type === "wildcard") {
212
+ if (!I && !f)
213
+ throw new h(`Missing text before "${T.name}" ${T.type}`, E);
214
+ T.type === "param" ? p += `(${F(y, I ? "" : f)}+)` : p += "([\\s\\S]+)", g.push(T), f = "", I = !1;
216
215
  continue;
217
216
  }
218
217
  }
219
- return S;
218
+ return p;
220
219
  }
221
- function M(f, m) {
222
- return m.length < 2 ? f.length < 2 ? `[^${i(f + m)}]` : `(?:(?!${i(f)})[^${i(m)}])` : f.length < 2 ? `(?:(?!${i(m)})[^${i(f)}])` : `(?:(?!${i(m)}|${i(f)})[\\s\\S])`;
220
+ function F(i, y) {
221
+ return y.length < 2 ? i.length < 2 ? `[^${o(i + y)}]` : `(?:(?!${o(i)})[^${o(y)}])` : i.length < 2 ? `(?:(?!${o(y)})[^${o(i)}])` : `(?:(?!${o(y)}|${o(i)})[\\s\\S])`;
223
222
  }
224
- function D(f) {
225
- let m = "", P = 0;
226
- function h(S) {
227
- return R(S) && b(f[P]) ? S : JSON.stringify(S);
223
+ function Q(i) {
224
+ let y = "", g = 0;
225
+ function E(p) {
226
+ return R(p) && A(i[g]) ? p : JSON.stringify(p);
228
227
  }
229
- for (; P < f.length; ) {
230
- const S = f[P++];
231
- if (S.type === "text") {
232
- m += c(S.value);
228
+ for (; g < i.length; ) {
229
+ const p = i[g++];
230
+ if (p.type === "text") {
231
+ y += a(p.value);
233
232
  continue;
234
233
  }
235
- if (S.type === "group") {
236
- m += `{${D(S.tokens)}}`;
234
+ if (p.type === "group") {
235
+ y += `{${Q(p.tokens)}}`;
237
236
  continue;
238
237
  }
239
- if (S.type === "param") {
240
- m += `:${h(S.name)}`;
238
+ if (p.type === "param") {
239
+ y += `:${E(p.name)}`;
241
240
  continue;
242
241
  }
243
- if (S.type === "wildcard") {
244
- m += `*${h(S.name)}`;
242
+ if (p.type === "wildcard") {
243
+ y += `*${E(p.name)}`;
245
244
  continue;
246
245
  }
247
- throw new TypeError(`Unknown token type: ${S.type}`);
246
+ throw new TypeError(`Unknown token type: ${p.type}`);
248
247
  }
249
- return m;
248
+ return y;
250
249
  }
251
- function C(f) {
252
- return D(f.tokens);
250
+ function U(i) {
251
+ return Q(i.tokens);
253
252
  }
254
- function R(f) {
255
- const [m, ...P] = f;
256
- return n.test(m) && P.every((h) => s.test(h));
253
+ function R(i) {
254
+ const [y, ...g] = i;
255
+ return t.test(y) && g.every((E) => r.test(E));
257
256
  }
258
- function b(f) {
259
- return f && f.type === "text" ? !s.test(f.value[0]) : !0;
257
+ function A(i) {
258
+ return i && i.type === "text" ? !r.test(i.value[0]) : !0;
260
259
  }
261
- return F;
260
+ return _;
262
261
  }
263
- var W = Ie();
264
- function Le(e, t, n) {
265
- const s = Array.isArray(e) ? e.find((u) => W.pathToRegexp(u).regexp.test(t)) || "" : W.pathToRegexp(e).regexp.test(t) ? e : "", r = W.match(s)(t), c = new URLSearchParams(n), i = Object.fromEntries(c.entries());
266
- return r ? {
267
- ...r.params,
268
- ...i
269
- } : {};
262
+ var V = Yt();
263
+ function Bt(n, e, t) {
264
+ const r = Array.isArray(n) ? n.find((c) => V.pathToRegexp(c).regexp.test(e)) || "" : V.pathToRegexp(n).regexp.test(e) ? n : "", s = V.match(r)(e), a = new URLSearchParams(t), o = Object.fromEntries(a.entries());
265
+ return s ? { ...s.params, ...o } : {};
270
266
  }
271
- function ae() {
267
+ function St() {
272
268
  return typeof document > "u";
273
269
  }
274
- class Ne {
275
- constructor() {
276
- this.tasks = /* @__PURE__ */ new Map(), this.instanceId = Date.now().toString(), this.isLocked = !1, this.currentTaskId = null, this.taskQueue = Promise.resolve(), this.signalListeners = /* @__PURE__ */ new Map(), this.pendingTaskQueue = [], this.isProcessingPending = !1;
277
- }
278
- async acquireLock(t) {
279
- for (let r = 0; r < 10; r++) {
270
+ class Xt {
271
+ tasks = /* @__PURE__ */ new Map();
272
+ instanceId = Date.now().toString();
273
+ isLocked = !1;
274
+ currentTaskId = null;
275
+ taskQueue = Promise.resolve();
276
+ signalListeners = /* @__PURE__ */ new Map();
277
+ pendingTaskQueue = [];
278
+ isProcessingPending = !1;
279
+ async acquireLock(e) {
280
+ for (let s = 0; s < 10; s++) {
280
281
  if (!this.isLocked)
281
- return this.isLocked = !0, this.currentTaskId = t, !0;
282
- await new Promise((c) => setTimeout(c, 100));
282
+ return this.isLocked = !0, this.currentTaskId = e, !0;
283
+ await new Promise((a) => setTimeout(a, 100));
283
284
  }
284
285
  return !1;
285
286
  }
286
- releaseLock(t) {
287
- this.currentTaskId === t && (this.isLocked = !1, this.currentTaskId = null);
287
+ releaseLock(e) {
288
+ this.currentTaskId === e && (this.isLocked = !1, this.currentTaskId = null);
288
289
  }
289
290
  generateTaskId() {
290
291
  return `${this.instanceId}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
291
292
  }
292
- emitSignal(t) {
293
- const n = this.signalListeners.get(t);
294
- n && (n.forEach((s) => {
295
- this.resolveTask(s);
296
- }), this.signalListeners.delete(t));
293
+ emitSignal(e) {
294
+ const t = this.signalListeners.get(e);
295
+ t && (t.forEach((r) => {
296
+ this.resolveTask(r);
297
+ }), this.signalListeners.delete(e));
297
298
  }
298
299
  // 대기 중인 태스크들을 처리하는 메서드
299
300
  async processPendingTasks() {
@@ -301,12 +302,12 @@ class Ne {
301
302
  this.isProcessingPending = !0;
302
303
  try {
303
304
  for (; this.pendingTaskQueue.length > 0; ) {
304
- const t = this.pendingTaskQueue[0];
305
- if (t.status === "COMPLETED" || t.status === "FAILED" || t.status === "ROLLEDBACK") {
305
+ const e = this.pendingTaskQueue[0];
306
+ if (e.status === "COMPLETED" || e.status === "FAILED" || e.status === "ROLLEDBACK") {
306
307
  this.pendingTaskQueue.shift();
307
308
  continue;
308
309
  }
309
- if (t.status === "MANUAL_PENDING" || t.status === "SIGNAL_PENDING" || t.status === "PROCESSING" || t.status === "PENDING")
310
+ if (e.status === "MANUAL_PENDING" || e.status === "SIGNAL_PENDING" || e.status === "PROCESSING" || e.status === "PENDING")
310
311
  break;
311
312
  }
312
313
  } finally {
@@ -316,242 +317,221 @@ class Ne {
316
317
  }
317
318
  // 모든 대기 중인 태스크가 완료될 때까지 대기
318
319
  async waitForPendingTasks() {
319
- return new Promise((t) => {
320
- const n = () => {
321
- this.pendingTaskQueue.filter((r) => r.status === "MANUAL_PENDING" || r.status === "SIGNAL_PENDING").length === 0 ? t() : setTimeout(n, 100);
320
+ return new Promise((e) => {
321
+ const t = () => {
322
+ this.pendingTaskQueue.filter(
323
+ (s) => s.status === "MANUAL_PENDING" || s.status === "SIGNAL_PENDING"
324
+ ).length === 0 ? e() : setTimeout(t, 100);
322
325
  };
323
- n();
326
+ t();
324
327
  });
325
328
  }
326
329
  // 태스크 상태 변경 시 대기 큐 처리
327
- async onTaskStatusChange(t, n) {
328
- (n === "COMPLETED" || n === "FAILED" || n === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((s) => s.id !== t), await this.processPendingTasks());
330
+ async onTaskStatusChange(e, t) {
331
+ (t === "COMPLETED" || t === "FAILED" || t === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((r) => r.id !== e), await this.processPendingTasks());
329
332
  }
330
- async addTask(t, n = {}) {
331
- const s = n.id || this.generateTaskId();
332
- return new Promise((r, c) => {
333
+ async addTask(e, t = {}) {
334
+ const r = t.id || this.generateTaskId();
335
+ return new Promise((s, a) => {
333
336
  this.taskQueue = this.taskQueue.then(async () => {
334
337
  try {
335
- const {
336
- control: i,
337
- validate: u,
338
- rollback: l,
339
- dependencies: a = [],
340
- delay: d
341
- } = n, g = new AbortController(), o = {
342
- id: s,
343
- execute: t,
338
+ const { control: o, validate: c, rollback: h, dependencies: l = [], delay: m } = t, d = new AbortController(), u = {
339
+ id: r,
340
+ execute: e,
344
341
  timestamp: Date.now(),
345
342
  retryCount: 0,
346
343
  status: "PENDING",
347
- dependencies: a,
344
+ dependencies: l,
348
345
  instanceId: this.instanceId,
349
- validate: u,
350
- rollback: l,
351
- control: i,
352
- abortController: g
346
+ validate: c,
347
+ rollback: h,
348
+ control: o,
349
+ abortController: d
353
350
  };
354
- this.tasks.set(o.id, o), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(o), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((w) => w.id !== o.id));
351
+ this.tasks.set(u.id, u), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(u), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((L) => L.id !== u.id));
355
352
  try {
356
- if (!await this.acquireLock(o.id))
357
- throw o.status = "FAILED", new Error("FAILED");
353
+ if (!await this.acquireLock(u.id))
354
+ throw u.status = "FAILED", new Error("FAILED");
358
355
  try {
359
- o.status = "PROCESSING";
360
- for (const T of o.dependencies) {
361
- const L = this.tasks.get(T);
362
- if (!L || L.status !== "COMPLETED")
363
- throw o.status = "FAILED", new Error("FAILED");
356
+ u.status = "PROCESSING";
357
+ for (const w of u.dependencies) {
358
+ const k = this.tasks.get(w);
359
+ if (!k || k.status !== "COMPLETED")
360
+ throw u.status = "FAILED", new Error("FAILED");
364
361
  }
365
- if (o.validate && !await o.validate())
366
- throw o.status = "FAILED", new Error("FAILED");
367
- d && d > 0 && await new Promise((T) => setTimeout(T, d));
368
- const E = await o.execute(o.abortController);
369
- if (o.abortController.signal.aborted) {
370
- o.status = "COMPLETED", await this.onTaskStatusChange(o.id, "COMPLETED"), r({
362
+ if (u.validate && !await u.validate())
363
+ throw u.status = "FAILED", new Error("FAILED");
364
+ m && m > 0 && await new Promise((w) => setTimeout(w, m));
365
+ const N = await u.execute(u.abortController);
366
+ if (u.abortController.signal.aborted) {
367
+ u.status = "COMPLETED", await this.onTaskStatusChange(u.id, "COMPLETED"), s({
371
368
  success: !0,
372
369
  result: void 0,
373
- taskId: o.id,
370
+ taskId: u.id,
374
371
  timestamp: Date.now(),
375
372
  instanceId: this.instanceId
376
373
  });
377
374
  return;
378
375
  }
379
- if (n.control) {
380
- const T = n.control;
381
- if (T.delay && T.delay > 0 && await new Promise((L) => setTimeout(L, T.delay)), T.manual) {
382
- o.status = "MANUAL_PENDING", o.manualResolver = {
383
- resolve: r,
384
- reject: c,
385
- result: E
386
- }, this.pendingTaskQueue.push(o), await this.onTaskStatusChange(o.id, "MANUAL_PENDING");
376
+ if (t.control) {
377
+ const w = t.control;
378
+ if (w.delay && w.delay > 0 && await new Promise((k) => setTimeout(k, w.delay)), w.manual) {
379
+ u.status = "MANUAL_PENDING", u.manualResolver = { resolve: s, reject: a, result: N }, this.pendingTaskQueue.push(u), await this.onTaskStatusChange(u.id, "MANUAL_PENDING");
387
380
  return;
388
381
  }
389
- if (T.signal) {
390
- o.status = "SIGNAL_PENDING", o.manualResolver = {
391
- resolve: r,
392
- reject: c,
393
- result: E
394
- }, this.signalListeners.has(T.signal) || this.signalListeners.set(T.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(T.signal).add(o.id), this.pendingTaskQueue.push(o), await this.onTaskStatusChange(o.id, "SIGNAL_PENDING");
382
+ if (w.signal) {
383
+ u.status = "SIGNAL_PENDING", u.manualResolver = { resolve: s, reject: a, result: N }, this.signalListeners.has(w.signal) || this.signalListeners.set(w.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(w.signal).add(u.id), this.pendingTaskQueue.push(u), await this.onTaskStatusChange(u.id, "SIGNAL_PENDING");
395
384
  return;
396
385
  }
397
- if (T.condition && !await T.condition()) {
398
- o.status = "MANUAL_PENDING", o.manualResolver = {
399
- resolve: r,
400
- reject: c,
401
- result: E
402
- }, this.pendingTaskQueue.push(o), await this.onTaskStatusChange(o.id, "MANUAL_PENDING");
386
+ if (w.condition && !await w.condition()) {
387
+ u.status = "MANUAL_PENDING", u.manualResolver = { resolve: s, reject: a, result: N }, this.pendingTaskQueue.push(u), await this.onTaskStatusChange(u.id, "MANUAL_PENDING");
403
388
  return;
404
389
  }
405
390
  }
406
- o.status = "COMPLETED", await this.onTaskStatusChange(o.id, "COMPLETED"), r({
391
+ u.status = "COMPLETED", await this.onTaskStatusChange(u.id, "COMPLETED"), s({
407
392
  success: !0,
408
- result: E,
409
- taskId: o.id,
393
+ result: N,
394
+ taskId: u.id,
410
395
  timestamp: Date.now(),
411
396
  instanceId: this.instanceId
412
397
  });
413
- } catch (E) {
414
- if (o.status = "FAILED", o.rollback)
398
+ } catch (N) {
399
+ if (u.status = "FAILED", u.rollback)
415
400
  try {
416
- await o.rollback(), o.status = "ROLLEDBACK";
401
+ await u.rollback(), u.status = "ROLLEDBACK";
417
402
  } catch {
418
403
  }
419
- throw await this.onTaskStatusChange(o.id, o.status), E;
404
+ throw await this.onTaskStatusChange(u.id, u.status), N;
420
405
  } finally {
421
- this.releaseLock(o.id);
406
+ this.releaseLock(u.id);
422
407
  }
423
- } catch (w) {
424
- c(w);
408
+ } catch (L) {
409
+ a(L);
425
410
  }
426
- } catch (i) {
427
- c(i);
411
+ } catch (o) {
412
+ a(o);
428
413
  }
429
- }).catch(c);
414
+ }).catch(a);
430
415
  });
431
416
  }
432
- async resolveTask(t) {
433
- const n = this.tasks.get(t);
434
- if (!n || n.status !== "MANUAL_PENDING")
417
+ async resolveTask(e) {
418
+ const t = this.tasks.get(e);
419
+ if (!t || t.status !== "MANUAL_PENDING")
435
420
  return !1;
436
- if (n.manualResolver) {
437
- if (n.control?.condition && !await n.control.condition())
421
+ if (t.manualResolver) {
422
+ if (t.control?.condition && !await t.control.condition())
438
423
  return !1;
439
- n.status = "COMPLETED";
440
- const s = n.manualResolver;
441
- return s.resolve({
424
+ t.status = "COMPLETED";
425
+ const r = t.manualResolver;
426
+ return r.resolve({
442
427
  success: !0,
443
- result: s.result,
444
- taskId: n.id,
428
+ result: r.result,
429
+ taskId: t.id,
445
430
  timestamp: Date.now(),
446
431
  instanceId: this.instanceId
447
- }), delete n.manualResolver, await this.onTaskStatusChange(t, "COMPLETED"), !0;
432
+ }), delete t.manualResolver, await this.onTaskStatusChange(e, "COMPLETED"), !0;
448
433
  }
449
434
  return !1;
450
435
  }
451
436
  async resolveAllPending() {
452
- const t = Array.from(this.tasks.values()).filter((n) => ["PENDING", "MANUAL_PENDING", "SIGNAL_PENDING"].includes(n.status));
453
- await Promise.all(t.map((n) => this.resolveTask(n.id)));
437
+ const e = Array.from(this.tasks.values()).filter(
438
+ (t) => ["PENDING", "MANUAL_PENDING", "SIGNAL_PENDING"].includes(t.status)
439
+ );
440
+ await Promise.all(e.map((t) => this.resolveTask(t.id)));
454
441
  }
455
442
  }
456
- const Y = new Ne(), ie = (e) => {
457
- let t;
458
- const n = /* @__PURE__ */ new Set(), s = (a, d) => {
459
- const g = typeof a == "function" ? a(t) : a;
460
- if (!Object.is(g, t)) {
461
- const o = t;
462
- t = d ?? (typeof g != "object" || g === null) ? g : Object.assign({}, t, g), n.forEach((p) => p(t, o));
443
+ const q = new Xt(), Pt = (n) => {
444
+ let e;
445
+ const t = /* @__PURE__ */ new Set(), r = (l, m) => {
446
+ const d = typeof l == "function" ? l(e) : l;
447
+ if (!Object.is(d, e)) {
448
+ const u = e;
449
+ e = m ?? (typeof d != "object" || d === null) ? d : Object.assign({}, e, d), t.forEach((P) => P(e, u));
463
450
  }
464
- }, r = () => t, u = { setState: s, getState: r, getInitialState: () => l, subscribe: (a) => (n.add(a), () => n.delete(a)) }, l = t = e(s, r, u);
465
- return u;
466
- }, xe = ((e) => e ? ie(e) : ie), ke = (e) => e;
467
- function Me(e, t = ke) {
468
- const n = _t.useSyncExternalStore(
469
- e.subscribe,
470
- _t.useCallback(() => t(e.getState()), [e, t]),
471
- _t.useCallback(() => t(e.getInitialState()), [e, t])
451
+ }, s = () => e, c = { setState: r, getState: s, getInitialState: () => h, subscribe: (l) => (t.add(l), () => t.delete(l)) }, h = e = n(r, s, c);
452
+ return c;
453
+ }, Kt = ((n) => n ? Pt(n) : Pt), Vt = (n) => n;
454
+ function zt(n, e = Vt) {
455
+ const t = nt.useSyncExternalStore(
456
+ n.subscribe,
457
+ nt.useCallback(() => e(n.getState()), [n, e]),
458
+ nt.useCallback(() => e(n.getInitialState()), [n, e])
472
459
  );
473
- return _t.useDebugValue(n), n;
460
+ return nt.useDebugValue(t), t;
474
461
  }
475
- const oe = (e) => {
476
- const t = xe(e), n = (s) => Me(t, s);
477
- return Object.assign(n, t), n;
478
- }, Ot = ((e) => e ? oe(e) : oe), X = Ot((e) => ({
462
+ const Tt = (n) => {
463
+ const e = Kt(n), t = (r) => zt(e, r);
464
+ return Object.assign(t, e), t;
465
+ }, st = ((n) => n ? Tt(n) : Tt), Y = st((n) => ({
479
466
  index: -1,
480
467
  histories: [],
481
- addHistory: (t) => e((n) => ({
482
- index: n.index + 1,
483
- histories: n.histories.concat(t)
468
+ addHistory: (e) => n((t) => ({
469
+ index: t.index + 1,
470
+ histories: t.histories.concat(e)
484
471
  })),
485
- replaceHistory: (t) => e((n) => (n.histories.splice(t, 1), {
486
- index: n.index - 1,
487
- histories: n.histories
472
+ replaceHistory: (e) => n((t) => (t.histories.splice(e, 1), {
473
+ index: t.index - 1,
474
+ histories: t.histories
488
475
  })),
489
- popHistory: (t) => e((n) => ({
490
- index: n.index - 1,
491
- histories: n.histories.filter((s, r) => r !== t)
476
+ popHistory: (e) => n((t) => ({
477
+ index: t.index - 1,
478
+ histories: t.histories.filter((r, s) => s !== e)
492
479
  }))
493
- })), Q = Ot((e) => ({
480
+ })), j = st((n) => ({
494
481
  status: "IDLE",
495
- setStatus: (t) => e({
496
- status: t
497
- })
482
+ setStatus: (e) => n({ status: e })
498
483
  }));
499
- function Ce() {
500
- const e = j(1);
501
- let t;
502
- return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = [], e[0] = t) : t = e[0], J($e, t), null;
503
- }
504
- function $e() {
505
- const e = be;
506
- return window.addEventListener("popstate", e), () => {
507
- window.removeEventListener("popstate", e);
508
- };
509
- }
510
- async function be(e) {
511
- const t = e.state?.id;
512
- (await Y.addTask(async (n) => {
513
- const s = e.state?.index, r = e.state?.status, c = e.state?.params, i = e.state?.transitionName, u = e.state?.layoutId, l = Q.getState().setStatus, {
514
- index: a,
515
- addHistory: d,
516
- popHistory: g
517
- } = X.getState(), o = s < a, p = r === "PUSHING" && s > a, w = r === "REPLACING" && s > a, E = window.location.pathname;
518
- if (!o && !p && !w) {
519
- n.abort();
520
- return;
521
- }
522
- return o ? l("POPPING") : p ? (l("PUSHING"), d({
523
- id: t,
524
- pathname: E,
525
- params: c,
526
- transitionName: i,
527
- layoutId: u
528
- })) : w && (l("REPLACING"), d({
529
- id: t,
530
- pathname: E,
531
- params: c,
532
- transitionName: i,
533
- layoutId: u
534
- })), async () => {
535
- o && g(s + 1), l("COMPLETED");
484
+ function Wt() {
485
+ return z(() => {
486
+ const n = async (e) => {
487
+ const t = e.state?.id;
488
+ (await q.addTask(
489
+ async (r) => {
490
+ const s = e.state?.index, a = e.state?.status, o = e.state?.params, c = e.state?.transitionName, h = e.state?.layoutId, l = j.getState().setStatus, { index: m, addHistory: d, popHistory: u } = Y.getState(), P = s < m, L = a === "PUSHING" && s > m, N = a === "REPLACING" && s > m, w = window.location.pathname;
491
+ if (!P && !L && !N) {
492
+ r.abort();
493
+ return;
494
+ }
495
+ return P ? l("POPPING") : L ? (l("PUSHING"), d({
496
+ id: t,
497
+ pathname: w,
498
+ params: o,
499
+ transitionName: c,
500
+ layoutId: h
501
+ })) : N && (l("REPLACING"), d({
502
+ id: t,
503
+ pathname: w,
504
+ params: o,
505
+ transitionName: c,
506
+ layoutId: h
507
+ })), async () => {
508
+ P && u(s + 1), l("COMPLETED");
509
+ };
510
+ },
511
+ {
512
+ id: t,
513
+ control: {
514
+ manual: !0
515
+ }
516
+ }
517
+ )).result?.();
536
518
  };
537
- }, {
538
- id: t,
539
- control: {
540
- manual: !0
541
- }
542
- })).result?.();
519
+ return window.addEventListener("popstate", n), () => {
520
+ window.removeEventListener("popstate", n);
521
+ };
522
+ }, []), null;
543
523
  }
544
- const de = zt({}), pe = zt(() => {
524
+ const xt = dt({}), Nt = dt(() => {
545
525
  });
546
- function Ae(e, t) {
547
- switch (t.type) {
526
+ function Jt(n, e) {
527
+ switch (e.type) {
548
528
  case "SET":
549
- return t.params;
529
+ return e.params;
550
530
  default:
551
- return e;
531
+ return n;
552
532
  }
553
533
  }
554
- const he = zt({
534
+ const kt = dt({
555
535
  id: "",
556
536
  isActive: !1,
557
537
  isRoot: !0,
@@ -563,93 +543,76 @@ const he = zt({
563
543
  prevTransitionName: "none",
564
544
  layoutId: null
565
545
  });
566
- function dt() {
567
- return Wt(he);
546
+ function tt() {
547
+ return pt(kt);
568
548
  }
569
- function Re(e) {
570
- const t = j(6), {
571
- children: n
572
- } = e, {
573
- isActive: s,
574
- params: r
575
- } = dt(), [c, i] = we(Ae, r);
576
- let u, l;
577
- t[0] !== s ? (u = () => {
578
- const d = async (g) => {
579
- g.state?.step && await Y.addTask(async () => {
580
- i({
581
- type: "SET",
582
- params: g.state?.params || {}
583
- });
549
+ function Zt({ children: n }) {
550
+ const { isActive: e, params: t } = tt(), [r, s] = Ht(Jt, t);
551
+ return z(() => {
552
+ const a = async (o) => {
553
+ o.state?.step && await q.addTask(async () => {
554
+ s({ type: "SET", params: o.state?.params || {} });
584
555
  });
585
556
  };
586
- return s && window.addEventListener("popstate", d), () => {
587
- window.removeEventListener("popstate", d);
557
+ return e && window.addEventListener("popstate", a), () => {
558
+ window.removeEventListener("popstate", a);
588
559
  };
589
- }, l = [s, i], t[0] = s, t[1] = u, t[2] = l) : (u = t[1], l = t[2]), J(u, l);
590
- let a;
591
- return t[3] !== n || t[4] !== c ? (a = /* @__PURE__ */ x(pe.Provider, { value: i, children: /* @__PURE__ */ x(de.Provider, { value: c, children: n }) }), t[3] = n, t[4] = c, t[5] = a) : a = t[5], a;
560
+ }, [e, s]), /* @__PURE__ */ D(Nt.Provider, { value: s, children: /* @__PURE__ */ D(xt.Provider, { value: r, children: n }) });
592
561
  }
593
- function _e(e) {
594
- const t = j(9), {
595
- children: n
596
- } = e, s = X(Ge), r = X(Oe);
597
- let c;
598
- if (t[0] !== n || t[1] !== r || t[2] !== s) {
599
- let i;
600
- t[4] !== n ? (i = (l) => le.toArray(n).filter((a) => W.pathToRegexp(a.props.path).regexp.test(l.pathname)), t[4] = n, t[5] = i) : i = t[5];
601
- let u;
602
- t[6] !== r || t[7] !== s ? (u = (l, a) => {
603
- const [d] = l;
604
- return /* @__PURE__ */ x(he.Provider, { value: {
605
- id: r[a].id,
606
- isActive: a === s,
607
- isRoot: a === 0,
608
- isPrev: a < s - 1,
609
- zIndex: a,
610
- pathname: r[a].pathname,
611
- params: r[a].params,
612
- transitionName: r[s].transitionName,
613
- prevTransitionName: r[s - 1]?.transitionName,
614
- layoutId: r[a].layoutId
615
- }, children: /* @__PURE__ */ x(Re, { children: d }) }, r[a].id);
616
- }, t[6] = r, t[7] = s, t[8] = u) : u = t[8], c = r.map(i).map(u), t[0] = n, t[1] = r, t[2] = s, t[3] = c;
617
- } else
618
- c = t[3];
619
- return c;
620
- }
621
- function Oe(e) {
622
- return e.histories;
623
- }
624
- function Ge(e) {
625
- return e.index;
562
+ function te({ children: n }) {
563
+ const e = Y((r) => r.index), t = Y((r) => r.histories);
564
+ return t.map(
565
+ (r) => It.toArray(n).filter(
566
+ (s) => V.pathToRegexp(s.props.path).regexp.test(
567
+ r.pathname
568
+ )
569
+ )
570
+ ).map(([r], s) => /* @__PURE__ */ D(
571
+ kt.Provider,
572
+ {
573
+ value: {
574
+ id: t[s].id,
575
+ isActive: s === e,
576
+ isRoot: s === 0,
577
+ isPrev: s < e - 1,
578
+ zIndex: s,
579
+ pathname: t[s].pathname,
580
+ params: t[s].params,
581
+ transitionName: t[e].transitionName,
582
+ prevTransitionName: t[e - 1]?.transitionName,
583
+ layoutId: t[s].layoutId
584
+ },
585
+ children: /* @__PURE__ */ D(Zt, { children: r })
586
+ },
587
+ t[s].id
588
+ ));
626
589
  }
627
- function He({
628
- name: e,
629
- initial: t,
630
- enter: n,
631
- exit: s,
632
- options: r
590
+ function ee({
591
+ name: n,
592
+ initial: e,
593
+ enter: t,
594
+ exit: r,
595
+ options: s
633
596
  }) {
634
597
  return {
635
- name: e,
636
- initial: t,
598
+ name: n,
599
+ initial: e,
637
600
  variants: {
638
- "IDLE-true": n,
639
- "IDLE-false": n,
640
- "PUSHING-false": s,
641
- "PUSHING-true": n,
642
- "REPLACING-false": s,
643
- "REPLACING-true": n,
644
- "POPPING-false": n,
645
- "POPPING-true": n,
646
- "COMPLETED-false": s,
647
- "COMPLETED-true": n
601
+ "IDLE-true": t,
602
+ "IDLE-false": t,
603
+ "PUSHING-false": r,
604
+ "PUSHING-true": t,
605
+ "REPLACING-false": r,
606
+ "REPLACING-true": t,
607
+ "POPPING-false": t,
608
+ "POPPING-true": t,
609
+ "COMPLETED-false": r,
610
+ "COMPLETED-true": t
648
611
  },
649
- ...r
612
+ ...s
650
613
  };
651
614
  }
652
- const Ue = He({
615
+ const ne = ee({
653
616
  name: "overlay",
654
617
  initial: {
655
618
  opacity: 0,
@@ -674,66 +637,67 @@ const Ue = He({
674
637
  }
675
638
  },
676
639
  options: {
677
- onSwipeStart: (e, {
678
- animate: t,
679
- prevDecorator: n
680
- }) => t(n, {
681
- opacity: e ? 1 : 0
682
- }, {
683
- duration: 0.3
684
- }),
685
- onSwipe: (e, t, {
686
- animate: n,
687
- prevDecorator: s
688
- }) => n(s, {
689
- opacity: Math.max(0, 1 - t / 100)
690
- }, {
691
- duration: 0
692
- }),
693
- onSwipeEnd: (e, {
694
- animate: t,
695
- prevDecorator: n
696
- }) => t(n, {
697
- opacity: e ? 0 : 1
698
- }, {
699
- duration: 0.3
700
- })
640
+ onSwipeStart: (n, { animate: e, prevDecorator: t }) => e(
641
+ t,
642
+ {
643
+ opacity: n ? 1 : 0
644
+ },
645
+ {
646
+ duration: 0.3
647
+ }
648
+ ),
649
+ onSwipe: (n, e, { animate: t, prevDecorator: r }) => t(
650
+ r,
651
+ {
652
+ opacity: Math.max(0, 1 - e / 100)
653
+ },
654
+ {
655
+ duration: 0
656
+ }
657
+ ),
658
+ onSwipeEnd: (n, { animate: e, prevDecorator: t }) => e(
659
+ t,
660
+ {
661
+ opacity: n ? 0 : 1
662
+ },
663
+ {
664
+ duration: 0.3
665
+ }
666
+ )
701
667
  }
702
- }), Zt = /* @__PURE__ */ new Map([["overlay", Ue]]), Kt = Ot((e) => ({
668
+ }), ht = /* @__PURE__ */ new Map([["overlay", ne]]), ut = st((n) => ({
703
669
  defaultTransitionName: "cupertino",
704
- setDefaultTransitionName: (t) => e({
705
- defaultTransitionName: t
706
- })
670
+ setDefaultTransitionName: (e) => n({ defaultTransitionName: e })
707
671
  }));
708
- function Gt({
709
- name: e,
710
- initial: t,
711
- idle: n,
712
- enter: s,
713
- enterBack: r,
714
- exit: c,
715
- exitBack: i,
716
- options: u
672
+ function rt({
673
+ name: n,
674
+ initial: e,
675
+ idle: t,
676
+ enter: r,
677
+ enterBack: s,
678
+ exit: a,
679
+ exitBack: o,
680
+ options: c
717
681
  }) {
718
682
  return {
719
- name: e,
720
- initial: t,
683
+ name: n,
684
+ initial: e,
721
685
  variants: {
722
- "IDLE-true": n,
723
- "IDLE-false": n,
724
- "PUSHING-false": c,
725
- "PUSHING-true": s,
726
- "REPLACING-false": c,
727
- "REPLACING-true": s,
728
- "POPPING-false": i,
729
- "POPPING-true": r,
730
- "COMPLETED-false": c,
731
- "COMPLETED-true": s
686
+ "IDLE-true": t,
687
+ "IDLE-false": t,
688
+ "PUSHING-false": a,
689
+ "PUSHING-true": r,
690
+ "REPLACING-false": a,
691
+ "REPLACING-true": r,
692
+ "POPPING-false": o,
693
+ "POPPING-true": s,
694
+ "COMPLETED-false": a,
695
+ "COMPLETED-true": r
732
696
  },
733
- ...u
697
+ ...c
734
698
  };
735
699
  }
736
- const Be = Gt({
700
+ const se = rt({
737
701
  name: "cupertino",
738
702
  initial: {
739
703
  x: "100%"
@@ -786,49 +750,53 @@ const Be = Gt({
786
750
  decoratorName: "overlay",
787
751
  swipeDirection: "x",
788
752
  onSwipeStart: async () => !0,
789
- onSwipe: (e, t, {
790
- animate: n,
791
- currentScreen: s,
792
- prevScreen: r,
793
- onProgress: c
794
- }) => {
795
- const {
796
- offset: i
797
- } = t, u = i.x, l = Jt(u, [0, window.innerWidth], [0, 100]);
798
- return c?.(!0, l), n(s, {
799
- x: Math.max(0, u)
800
- }, {
801
- duration: 0
802
- }), n(r, {
803
- x: -100 + l
804
- }, {
805
- duration: 0
806
- }), l;
753
+ onSwipe: (n, e, { animate: t, currentScreen: r, prevScreen: s, onProgress: a }) => {
754
+ const { offset: o } = e, c = o.x, h = ft(c, [0, window.innerWidth], [0, 100]);
755
+ return a?.(!0, h), t(
756
+ r,
757
+ {
758
+ x: Math.max(0, c)
759
+ },
760
+ {
761
+ duration: 0
762
+ }
763
+ ), t(
764
+ s,
765
+ {
766
+ x: -100 + h
767
+ },
768
+ {
769
+ duration: 0
770
+ }
771
+ ), h;
807
772
  },
808
- onSwipeEnd: async (e, t, {
809
- animate: n,
810
- currentScreen: s,
811
- prevScreen: r,
812
- onStart: c
813
- }) => {
814
- const {
815
- offset: i,
816
- velocity: u
817
- } = t, a = i.x > 50 || u.x > 20;
818
- return c?.(a), await Promise.all([n(s, {
819
- x: a ? "100%" : 0
820
- }, {
821
- duration: 0.3,
822
- ease: [0.32, 0.72, 0, 1]
823
- }), n(r, {
824
- x: a ? 0 : -100
825
- }, {
826
- duration: 0.3,
827
- ease: [0.32, 0.72, 0, 1]
828
- })]), a;
773
+ onSwipeEnd: async (n, e, { animate: t, currentScreen: r, prevScreen: s, onStart: a }) => {
774
+ const { offset: o, velocity: c } = e, l = o.x > 50 || c.x > 20;
775
+ return a?.(l), await Promise.all([
776
+ t(
777
+ r,
778
+ {
779
+ x: l ? "100%" : 0
780
+ },
781
+ {
782
+ duration: 0.3,
783
+ ease: [0.32, 0.72, 0, 1]
784
+ }
785
+ ),
786
+ t(
787
+ s,
788
+ {
789
+ x: l ? 0 : -100
790
+ },
791
+ {
792
+ duration: 0.3,
793
+ ease: [0.32, 0.72, 0, 1]
794
+ }
795
+ )
796
+ ]), l;
829
797
  }
830
798
  }
831
- }), Fe = Gt({
799
+ }), re = rt({
832
800
  name: "layout",
833
801
  initial: {
834
802
  opacity: 0.97
@@ -877,45 +845,46 @@ const Be = Gt({
877
845
  decoratorName: "overlay",
878
846
  swipeDirection: "y",
879
847
  onSwipeStart: async () => !0,
880
- onSwipe: (e, t, {
881
- animate: n,
882
- currentScreen: s,
883
- onProgress: r
884
- }) => {
885
- const {
886
- offset: c
887
- } = t, i = c.y, u = Math.max(0, Math.min(56, i)), l = Jt(u, [0, 56], [1, 0.96]), a = Math.max(0, i - 56), d = Math.min(1, a / 160), g = Math.sqrt(d) * 12, o = Math.max(0, u + g), p = Math.min(56, o);
888
- return r?.(!0, 100), n(s, {
889
- y: o,
890
- opacity: l
891
- }, {
892
- duration: 0
893
- }), p;
848
+ onSwipe: (n, e, { animate: t, currentScreen: r, onProgress: s }) => {
849
+ const { offset: a } = e, o = a.y, c = Math.max(0, Math.min(56, o)), h = ft(c, [0, 56], [1, 0.96]), l = Math.max(0, o - 56), m = Math.min(1, l / 160), d = Math.sqrt(m) * 12, u = Math.max(0, c + d), P = Math.min(56, u);
850
+ return s?.(!0, 100), t(
851
+ r,
852
+ {
853
+ y: u,
854
+ opacity: h
855
+ },
856
+ {
857
+ duration: 0
858
+ }
859
+ ), P;
894
860
  },
895
- onSwipeEnd: async (e, t, {
896
- animate: n,
897
- currentScreen: s,
898
- prevScreen: r,
899
- onStart: c
900
- }) => {
901
- const {
902
- offset: i,
903
- velocity: u
904
- } = t, a = i.y > 56 || u.y > 20;
905
- return c?.(a), await Promise.all([n(s, {
906
- y: a ? "100%" : 0,
907
- opacity: a ? 0.96 : 1
908
- }, {
909
- duration: 0.3
910
- }), n(r, {
911
- y: 0,
912
- opacity: a ? 1 : 0.97
913
- }, {
914
- duration: 0.3
915
- })]), a;
861
+ onSwipeEnd: async (n, e, { animate: t, currentScreen: r, prevScreen: s, onStart: a }) => {
862
+ const { offset: o, velocity: c } = e, l = o.y > 56 || c.y > 20;
863
+ return a?.(l), await Promise.all([
864
+ t(
865
+ r,
866
+ {
867
+ y: l ? "100%" : 0,
868
+ opacity: l ? 0.96 : 1
869
+ },
870
+ {
871
+ duration: 0.3
872
+ }
873
+ ),
874
+ t(
875
+ s,
876
+ {
877
+ y: 0,
878
+ opacity: l ? 1 : 0.97
879
+ },
880
+ {
881
+ duration: 0.3
882
+ }
883
+ )
884
+ ]), l;
916
885
  }
917
886
  }
918
- }), Qe = Gt({
887
+ }), ae = rt({
919
888
  name: "material",
920
889
  initial: {
921
890
  y: "100%",
@@ -973,53 +942,55 @@ const Be = Gt({
973
942
  options: {
974
943
  swipeDirection: "y",
975
944
  onSwipeStart: async () => !0,
976
- onSwipe: (e, t, {
977
- animate: n,
978
- currentScreen: s,
979
- prevScreen: r,
980
- onProgress: c
981
- }) => {
982
- const {
983
- offset: i
984
- } = t, u = i.y, l = Math.max(0, Math.min(56, u)), a = Jt(l, [0, 56], [1, 0.96]), d = Math.max(0, u - 56), g = Math.min(1, d / 160), o = Math.sqrt(g) * 12, p = Math.max(0, l + o), w = Math.min(56, p);
985
- return c?.(!0, w), n(s, {
986
- y: p,
987
- opacity: a
988
- }, {
989
- duration: 0
990
- }), n(r, {
991
- y: -56 + w,
992
- opacity: w / 56
993
- }, {
994
- duration: 0
995
- }), w;
945
+ onSwipe: (n, e, { animate: t, currentScreen: r, prevScreen: s, onProgress: a }) => {
946
+ const { offset: o } = e, c = o.y, h = Math.max(0, Math.min(56, c)), l = ft(h, [0, 56], [1, 0.96]), m = Math.max(0, c - 56), d = Math.min(1, m / 160), u = Math.sqrt(d) * 12, P = Math.max(0, h + u), L = Math.min(56, P);
947
+ return a?.(!0, L), t(
948
+ r,
949
+ {
950
+ y: P,
951
+ opacity: l
952
+ },
953
+ {
954
+ duration: 0
955
+ }
956
+ ), t(
957
+ s,
958
+ {
959
+ y: -56 + L,
960
+ opacity: L / 56
961
+ },
962
+ { duration: 0 }
963
+ ), L;
996
964
  },
997
- onSwipeEnd: async (e, t, {
998
- animate: n,
999
- currentScreen: s,
1000
- prevScreen: r,
1001
- onStart: c
1002
- }) => {
1003
- const {
1004
- offset: i,
1005
- velocity: u
1006
- } = t, a = i.y > 56 || u.y > 20;
1007
- return c?.(a), await Promise.all([n(s, {
1008
- y: a ? "100%" : 0,
1009
- opacity: a ? 0.96 : 1
1010
- }, {
1011
- duration: a ? 0.22 : 0.24,
1012
- ease: a ? [0.4, 0, 1, 1] : [0, 0, 0.2, 1]
1013
- }), n(r, {
1014
- y: a ? 0 : -56,
1015
- opacity: a ? 1 : 0.96
1016
- }, {
1017
- duration: a ? 0.22 : 0.24,
1018
- ease: a ? [0, 0, 0.2, 1] : [0.4, 0, 1, 1]
1019
- })]), a;
965
+ onSwipeEnd: async (n, e, { animate: t, currentScreen: r, prevScreen: s, onStart: a }) => {
966
+ const { offset: o, velocity: c } = e, l = o.y > 56 || c.y > 20;
967
+ return a?.(l), await Promise.all([
968
+ t(
969
+ r,
970
+ {
971
+ y: l ? "100%" : 0,
972
+ opacity: l ? 0.96 : 1
973
+ },
974
+ {
975
+ duration: l ? 0.22 : 0.24,
976
+ ease: l ? [0.4, 0, 1, 1] : [0, 0, 0.2, 1]
977
+ }
978
+ ),
979
+ t(
980
+ s,
981
+ {
982
+ y: l ? 0 : -56,
983
+ opacity: l ? 1 : 0.96
984
+ },
985
+ {
986
+ duration: l ? 0.22 : 0.24,
987
+ ease: l ? [0, 0, 0.2, 1] : [0.4, 0, 1, 1]
988
+ }
989
+ )
990
+ ]), l;
1020
991
  }
1021
992
  }
1022
- }), je = Gt({
993
+ }), oe = rt({
1023
994
  name: "none",
1024
995
  initial: {},
1025
996
  idle: {
@@ -1052,830 +1023,682 @@ const Be = Gt({
1052
1023
  duration: 0
1053
1024
  }
1054
1025
  }
1055
- }), ht = /* @__PURE__ */ new Map([["none", je], ["cupertino", Be], ["material", Qe], ["layout", Fe]]), qe = (() => {
1056
- const e = /* @__PURE__ */ Object.create(null), t = Object.prototype.hasOwnProperty;
1057
- for (const n of ht.values()) {
1058
- const s = n.variants["IDLE-true"].value;
1059
- for (const r in s)
1060
- t.call(s, r) && (e[r] = s[r]);
1026
+ }), et = /* @__PURE__ */ new Map([
1027
+ ["none", oe],
1028
+ ["cupertino", se],
1029
+ ["material", ae],
1030
+ ["layout", re]
1031
+ ]), ie = (() => {
1032
+ const n = /* @__PURE__ */ Object.create(null), e = Object.prototype.hasOwnProperty;
1033
+ for (const t of et.values()) {
1034
+ const r = t.variants["IDLE-true"].value;
1035
+ for (const s in r)
1036
+ e.call(r, s) && (n[s] = r[s]);
1061
1037
  }
1062
- return e;
1038
+ return n;
1063
1039
  })();
1064
- function Pn(e) {
1065
- const t = j(17), {
1066
- children: n,
1067
- initPath: s,
1068
- defaultTransitionName: r,
1069
- transitions: c,
1070
- decorators: i
1071
- } = e, u = s === void 0 ? "/" : s, l = r === void 0 ? "cupertino" : r;
1072
- let a;
1073
- t[0] !== c ? (a = c === void 0 ? [] : c, t[0] = c, t[1] = a) : a = t[1];
1074
- const d = a;
1075
- let g;
1076
- t[2] !== i ? (g = i === void 0 ? [] : i, t[2] = i, t[3] = g) : g = t[3];
1077
- const o = g, p = ae() ? u || "/" : window.location.pathname, w = ae() ? p.split("?")[1] || "" : window.location.search;
1078
- Ve().setState({
1079
- defaultTransitionName: l
1080
- }), ze().setState({
1040
+ function ye({
1041
+ children: n,
1042
+ initPath: e = "/",
1043
+ defaultTransitionName: t = "cupertino",
1044
+ transitions: r = [],
1045
+ decorators: s = []
1046
+ }) {
1047
+ const a = St() ? e || "/" : window.location.pathname, o = St() ? a.split("?")[1] || "" : window.location.search;
1048
+ return ut.setState({
1049
+ defaultTransitionName: t
1050
+ }), Y.setState({
1081
1051
  index: 0,
1082
- histories: [{
1083
- id: "root",
1084
- pathname: p,
1085
- params: Le(le.toArray(n).map(Ke).flat(), p, w),
1086
- transitionName: l,
1087
- layoutId: null
1088
- }]
1089
- });
1090
- let E, T;
1091
- t[4] !== l ? (E = () => {
1092
- window.history.state?.index || window.history.replaceState({
1093
- id: "root",
1094
- index: 0,
1095
- status: "IDLE",
1096
- params: {},
1097
- transitionName: l,
1098
- layoutId: null
1099
- }, "", window.location.pathname);
1100
- }, T = [l], t[4] = l, t[5] = E, t[6] = T) : (E = t[5], T = t[6]), J(E, T);
1101
- let L, M;
1102
- t[7] !== d ? (M = () => {
1103
- d.forEach(Xe);
1104
- }, L = [d], t[7] = d, t[8] = L, t[9] = M) : (L = t[8], M = t[9]), J(M, L);
1105
- let D, C;
1106
- t[10] !== o ? (D = () => {
1107
- o.forEach(Ye);
1108
- }, C = [o], t[10] = o, t[11] = D, t[12] = C) : (D = t[11], C = t[12]), J(D, C);
1109
- let R, b;
1110
- t[13] === Symbol.for("react.memo_cache_sentinel") ? (R = {
1111
- position: "fixed",
1112
- top: 0,
1113
- left: 0,
1114
- width: "100%",
1115
- height: "100%"
1116
- }, b = /* @__PURE__ */ x(Ce, {}), t[13] = R, t[14] = b) : (R = t[13], b = t[14]);
1117
- let f;
1118
- return t[15] !== n ? (f = /* @__PURE__ */ Xt("div", { style: R, children: [
1119
- b,
1120
- /* @__PURE__ */ x(_e, { children: n })
1121
- ] }), t[15] = n, t[16] = f) : f = t[16], f;
1122
- }
1123
- function Ye(e) {
1124
- return Zt.set(e.name, e);
1125
- }
1126
- function Xe(e) {
1127
- return ht.set(e.name, e);
1128
- }
1129
- function Ke(e) {
1130
- return e.props.path;
1131
- }
1132
- function Ve() {
1133
- return Kt;
1052
+ histories: [
1053
+ {
1054
+ id: "root",
1055
+ pathname: a,
1056
+ params: Bt(
1057
+ It.toArray(n).map((c) => c.props.path).flat(),
1058
+ a,
1059
+ o
1060
+ ),
1061
+ transitionName: t,
1062
+ layoutId: null
1063
+ }
1064
+ ]
1065
+ }), z(() => {
1066
+ window.history.state?.index || window.history.replaceState(
1067
+ {
1068
+ id: "root",
1069
+ index: 0,
1070
+ status: "IDLE",
1071
+ params: {},
1072
+ transitionName: t,
1073
+ layoutId: null
1074
+ },
1075
+ "",
1076
+ window.location.pathname
1077
+ );
1078
+ }, [t]), z(() => {
1079
+ r.forEach((c) => et.set(c.name, c));
1080
+ }, [r]), z(() => {
1081
+ s.forEach((c) => ht.set(c.name, c));
1082
+ }, [s]), /* @__PURE__ */ ct(
1083
+ "div",
1084
+ {
1085
+ style: {
1086
+ position: "fixed",
1087
+ top: 0,
1088
+ left: 0,
1089
+ width: "100%",
1090
+ height: "100%"
1091
+ },
1092
+ children: [
1093
+ /* @__PURE__ */ D(Wt, {}),
1094
+ /* @__PURE__ */ D(te, { children: n })
1095
+ ]
1096
+ }
1097
+ );
1134
1098
  }
1135
- function ze() {
1136
- return X;
1099
+ function ge({ element: n }) {
1100
+ return n;
1137
1101
  }
1138
- function Tn({
1139
- element: e
1140
- }) {
1141
- return e;
1142
- }
1143
- function vn() {
1102
+ function me() {
1144
1103
  return {
1145
- push: async (s, r, c = {}) => {
1146
- const {
1147
- status: i,
1148
- setStatus: u
1149
- } = Q.getState();
1150
- if (i !== "COMPLETED" && i !== "IDLE")
1104
+ push: async (r, s, a = {}) => {
1105
+ const { status: o, setStatus: c } = j.getState();
1106
+ if (o !== "COMPLETED" && o !== "IDLE")
1151
1107
  return;
1152
- const {
1153
- index: l,
1154
- addHistory: a
1155
- } = X.getState(), d = Kt.getState().defaultTransitionName, {
1156
- transitionName: g = d,
1157
- layoutId: o = null
1158
- } = c, p = Y.generateTaskId();
1159
- (await Y.addTask(async () => {
1160
- u("PUSHING");
1161
- const w = W.compile(s)(r), E = W.parse(s).tokens.filter((D) => D.type === "param").map((D) => D.name), T = Object.fromEntries(Object.entries(r).filter(([D]) => !E.includes(D))), L = new URLSearchParams(T).toString(), M = `${w}${L ? `?${L}` : ""}`;
1162
- return window.history.pushState({
1163
- id: p,
1164
- index: l + 1,
1165
- status: "PUSHING",
1166
- params: r,
1167
- transitionName: g,
1168
- layoutId: o
1169
- }, "", M), a({
1170
- id: p,
1171
- pathname: w,
1172
- params: r,
1173
- transitionName: g,
1174
- layoutId: o
1175
- }), () => {
1176
- u("COMPLETED");
1177
- };
1178
- }, {
1179
- id: p,
1180
- control: {
1181
- manual: !0
1108
+ const { index: h, addHistory: l } = Y.getState(), m = ut.getState().defaultTransitionName, { transitionName: d = m, layoutId: u = null } = a, P = q.generateTaskId();
1109
+ (await q.addTask(
1110
+ async () => {
1111
+ c("PUSHING");
1112
+ const L = V.compile(r), N = Object.fromEntries(
1113
+ Object.entries(s).map(([R, A]) => [R, String(A)])
1114
+ ), w = L(N), k = V.parse(r).tokens.filter((R) => R.type === "param").map((R) => R.name), F = Object.fromEntries(
1115
+ Object.entries(s).filter(([R]) => !k.includes(R))
1116
+ ), Q = new URLSearchParams(F).toString(), U = `${w}${Q ? `?${Q}` : ""}`;
1117
+ return window.history.pushState(
1118
+ {
1119
+ id: P,
1120
+ index: h + 1,
1121
+ status: "PUSHING",
1122
+ params: s,
1123
+ transitionName: d,
1124
+ layoutId: u
1125
+ },
1126
+ "",
1127
+ U
1128
+ ), l({
1129
+ id: P,
1130
+ pathname: w,
1131
+ params: s,
1132
+ transitionName: d,
1133
+ layoutId: u
1134
+ }), () => {
1135
+ c("COMPLETED");
1136
+ };
1137
+ },
1138
+ {
1139
+ id: P,
1140
+ control: {
1141
+ manual: !0
1142
+ }
1182
1143
  }
1183
- })).result?.();
1144
+ )).result?.();
1184
1145
  },
1185
- replace: async (s, r, c = {}) => {
1186
- const {
1187
- status: i,
1188
- setStatus: u
1189
- } = Q.getState();
1190
- if (i !== "COMPLETED" && i !== "IDLE")
1146
+ replace: async (r, s, a = {}) => {
1147
+ const { status: o, setStatus: c } = j.getState();
1148
+ if (o !== "COMPLETED" && o !== "IDLE")
1191
1149
  return;
1192
- const {
1193
- index: l,
1194
- addHistory: a
1195
- } = X.getState(), d = X.getState().replaceHistory, g = Kt.getState().defaultTransitionName, {
1196
- transitionName: o = g,
1197
- layoutId: p = null
1198
- } = c, w = Y.generateTaskId();
1199
- (await Y.addTask(async () => {
1200
- u("REPLACING");
1201
- const E = W.compile(s)(r), T = W.parse(s).tokens.filter((C) => C.type === "param").map((C) => C.name), L = Object.fromEntries(Object.entries(r).filter(([C]) => !T.includes(C))), M = new URLSearchParams(L).toString(), D = `${E}${M ? `?${M}` : ""}`;
1202
- return window.history.replaceState({
1203
- id: w,
1204
- index: l,
1205
- status: "REPLACING",
1206
- params: r,
1207
- transitionName: o,
1208
- layoutId: p
1209
- }, "", D), a({
1210
- id: w,
1211
- pathname: E,
1212
- params: r,
1213
- transitionName: o,
1214
- layoutId: p
1215
- }), async () => {
1216
- d(l), u("COMPLETED");
1217
- };
1218
- }, {
1219
- id: w,
1220
- control: {
1221
- manual: !0
1150
+ const { index: h, addHistory: l } = Y.getState(), m = Y.getState().replaceHistory, d = ut.getState().defaultTransitionName, { transitionName: u = d, layoutId: P = null } = a, L = q.generateTaskId();
1151
+ (await q.addTask(
1152
+ async () => {
1153
+ c("REPLACING");
1154
+ const N = V.compile(r), w = Object.fromEntries(
1155
+ Object.entries(s).map(([A, i]) => [A, String(i)])
1156
+ ), k = N(w), F = V.parse(r).tokens.filter((A) => A.type === "param").map((A) => A.name), Q = Object.fromEntries(
1157
+ Object.entries(s).filter(([A]) => !F.includes(A))
1158
+ ), U = new URLSearchParams(Q).toString(), R = `${k}${U ? `?${U}` : ""}`;
1159
+ return window.history.replaceState(
1160
+ {
1161
+ id: L,
1162
+ index: h,
1163
+ status: "REPLACING",
1164
+ params: s,
1165
+ transitionName: u,
1166
+ layoutId: P
1167
+ },
1168
+ "",
1169
+ R
1170
+ ), l({
1171
+ id: L,
1172
+ pathname: k,
1173
+ params: s,
1174
+ transitionName: u,
1175
+ layoutId: P
1176
+ }), async () => {
1177
+ m(h), c("COMPLETED");
1178
+ };
1179
+ },
1180
+ {
1181
+ id: L,
1182
+ control: {
1183
+ manual: !0
1184
+ }
1222
1185
  }
1223
- })).result?.();
1186
+ )).result?.();
1224
1187
  },
1225
1188
  pop: () => {
1226
- const s = Q.getState().status;
1227
- s !== "COMPLETED" && s !== "IDLE" || window.history.back();
1189
+ const r = j.getState().status;
1190
+ r !== "COMPLETED" && r !== "IDLE" || window.history.back();
1228
1191
  }
1229
1192
  };
1230
1193
  }
1231
- function Dn() {
1232
- const e = j(7), t = Wt(pe);
1233
- let n;
1234
- e[0] !== t ? (n = async (l) => {
1235
- const a = Q.getState().status;
1236
- a !== "COMPLETED" && a !== "IDLE" || (await Y.addTask(async () => {
1237
- const d = new URLSearchParams(l).toString(), g = `${window.location.pathname}${d ? `?${d}` : ""}`;
1238
- return window.history.state?.step || window.history.replaceState({
1239
- ...window.history.state,
1240
- step: !0
1241
- }, "", window.location.pathname), window.history.pushState({
1242
- ...window.history.state,
1243
- step: !0,
1244
- params: l
1245
- }, "", g), async () => t({
1246
- type: "SET",
1247
- params: l
1248
- });
1249
- })).result?.();
1250
- }, e[0] = t, e[1] = n) : n = e[1];
1251
- const s = n;
1252
- let r;
1253
- e[2] !== t ? (r = async (l) => {
1254
- const a = Q.getState().status;
1255
- a !== "COMPLETED" && a !== "IDLE" || (await Y.addTask(async () => {
1256
- const d = new URLSearchParams(l).toString(), g = `${window.location.pathname}${d ? `?${d}` : ""}`;
1257
- return window.history.replaceState({
1258
- ...window.history.state,
1259
- step: !0,
1260
- params: l
1261
- }, "", g), async () => t({
1262
- type: "SET",
1263
- params: l
1264
- });
1265
- })).result?.();
1266
- }, e[2] = t, e[3] = r) : r = e[3];
1267
- const c = r, i = We;
1268
- let u;
1269
- return e[4] !== s || e[5] !== c ? (u = {
1270
- pushStep: s,
1271
- replaceStep: c,
1272
- popStep: i
1273
- }, e[4] = s, e[5] = c, e[6] = u) : u = e[6], u;
1274
- }
1275
- function We() {
1276
- const e = Q.getState().status;
1277
- e !== "COMPLETED" && e !== "IDLE" || window.history.back();
1194
+ function Ee() {
1195
+ const n = pt(Nt);
1196
+ return {
1197
+ pushStep: async (s) => {
1198
+ const a = j.getState().status;
1199
+ a !== "COMPLETED" && a !== "IDLE" || (await q.addTask(async () => {
1200
+ const o = new URLSearchParams(s).toString(), c = `${window.location.pathname}${o ? `?${o}` : ""}`;
1201
+ return window.history.state?.step || window.history.replaceState(
1202
+ {
1203
+ ...window.history.state,
1204
+ step: !0
1205
+ },
1206
+ "",
1207
+ window.location.pathname
1208
+ ), window.history.pushState(
1209
+ {
1210
+ ...window.history.state,
1211
+ step: !0,
1212
+ params: s
1213
+ },
1214
+ "",
1215
+ c
1216
+ ), async () => n({ type: "SET", params: s });
1217
+ })).result?.();
1218
+ },
1219
+ replaceStep: async (s) => {
1220
+ const a = j.getState().status;
1221
+ a !== "COMPLETED" && a !== "IDLE" || (await q.addTask(async () => {
1222
+ const o = new URLSearchParams(s).toString(), c = `${window.location.pathname}${o ? `?${o}` : ""}`;
1223
+ return window.history.replaceState(
1224
+ {
1225
+ ...window.history.state,
1226
+ step: !0,
1227
+ params: s
1228
+ },
1229
+ "",
1230
+ c
1231
+ ), async () => n({ type: "SET", params: s });
1232
+ })).result?.();
1233
+ },
1234
+ popStep: () => {
1235
+ const s = j.getState().status;
1236
+ s !== "COMPLETED" && s !== "IDLE" || window.history.back();
1237
+ }
1238
+ };
1278
1239
  }
1279
- function In() {
1280
- return Wt(de);
1240
+ function we() {
1241
+ return pt(xt);
1281
1242
  }
1282
- function Ln({
1283
- name: e,
1284
- initial: t,
1285
- idle: n,
1286
- pushOnEnter: s,
1287
- pushOnExit: r,
1288
- replaceOnEnter: c,
1289
- replaceOnExit: i,
1290
- popOnEnter: u,
1291
- popOnExit: l,
1292
- completedOnExit: a,
1293
- completedOnEnter: d,
1294
- options: g
1243
+ function Se({
1244
+ name: n,
1245
+ initial: e,
1246
+ idle: t,
1247
+ pushOnEnter: r,
1248
+ pushOnExit: s,
1249
+ replaceOnEnter: a,
1250
+ replaceOnExit: o,
1251
+ popOnEnter: c,
1252
+ popOnExit: h,
1253
+ completedOnExit: l,
1254
+ completedOnEnter: m,
1255
+ options: d
1295
1256
  }) {
1296
1257
  return {
1297
- name: e,
1298
- initial: t,
1258
+ name: n,
1259
+ initial: e,
1299
1260
  variants: {
1300
- "IDLE-true": n,
1301
- "IDLE-false": n,
1302
- "PUSHING-false": r,
1303
- "PUSHING-true": s,
1304
- "REPLACING-false": i,
1305
- "REPLACING-true": c,
1306
- "POPPING-false": l,
1307
- "POPPING-true": u,
1308
- "COMPLETED-false": a,
1309
- "COMPLETED-true": d
1261
+ "IDLE-true": t,
1262
+ "IDLE-false": t,
1263
+ "PUSHING-false": s,
1264
+ "PUSHING-true": r,
1265
+ "REPLACING-false": o,
1266
+ "REPLACING-true": a,
1267
+ "POPPING-false": h,
1268
+ "POPPING-true": c,
1269
+ "COMPLETED-false": l,
1270
+ "COMPLETED-true": m
1310
1271
  },
1311
- ...g
1272
+ ...d
1312
1273
  };
1313
1274
  }
1314
- function Nn({
1315
- name: e,
1316
- initial: t,
1317
- idle: n,
1318
- pushOnEnter: s,
1319
- pushOnExit: r,
1320
- replaceOnEnter: c,
1321
- replaceOnExit: i,
1322
- popOnEnter: u,
1323
- popOnExit: l,
1324
- completedOnEnter: a,
1325
- completedOnExit: d,
1326
- options: g
1275
+ function Pe({
1276
+ name: n,
1277
+ initial: e,
1278
+ idle: t,
1279
+ pushOnEnter: r,
1280
+ pushOnExit: s,
1281
+ replaceOnEnter: a,
1282
+ replaceOnExit: o,
1283
+ popOnEnter: c,
1284
+ popOnExit: h,
1285
+ completedOnEnter: l,
1286
+ completedOnExit: m,
1287
+ options: d
1327
1288
  }) {
1328
1289
  return {
1329
- name: e,
1330
- initial: t,
1290
+ name: n,
1291
+ initial: e,
1331
1292
  variants: {
1332
- "IDLE-true": n,
1333
- "IDLE-false": n,
1334
- "PUSHING-false": r,
1335
- "PUSHING-true": s,
1336
- "REPLACING-false": i,
1337
- "REPLACING-true": c,
1338
- "POPPING-false": l,
1339
- "POPPING-true": u,
1340
- "COMPLETED-false": d,
1341
- "COMPLETED-true": a
1293
+ "IDLE-true": t,
1294
+ "IDLE-false": t,
1295
+ "PUSHING-false": s,
1296
+ "PUSHING-true": r,
1297
+ "REPLACING-false": o,
1298
+ "REPLACING-true": a,
1299
+ "POPPING-false": h,
1300
+ "POPPING-true": c,
1301
+ "COMPLETED-false": m,
1302
+ "COMPLETED-true": l
1342
1303
  },
1343
- ...g
1304
+ ...d
1344
1305
  };
1345
1306
  }
1346
- const Je = {
1347
- then() {
1348
- }
1349
- };
1350
- function Ze({
1351
- freeze: e,
1352
- children: t
1307
+ const ce = { then() {
1308
+ } };
1309
+ function ue({
1310
+ freeze: n,
1311
+ children: e
1353
1312
  }) {
1354
- if (e)
1355
- throw Je;
1356
- return t;
1313
+ if (n)
1314
+ throw ce;
1315
+ return e;
1357
1316
  }
1358
- function me(e) {
1359
- const t = j(6), {
1360
- freeze: n,
1361
- children: s,
1362
- placeholder: r
1363
- } = e;
1364
- let c;
1365
- t[0] !== s || t[1] !== n ? (c = /* @__PURE__ */ x(Ze, { freeze: n, children: s }), t[0] = s, t[1] = n, t[2] = c) : c = t[2];
1366
- let i;
1367
- return t[3] !== r || t[4] !== c ? (i = /* @__PURE__ */ x(Ee, { fallback: r, children: c }), t[3] = r, t[4] = c, t[5] = i) : i = t[5], i;
1317
+ function Mt({ freeze: n, children: e, placeholder: t }) {
1318
+ return /* @__PURE__ */ D(_t, { fallback: t, children: /* @__PURE__ */ D(ue, { freeze: n, children: e }) });
1368
1319
  }
1369
- function ce(e, t) {
1320
+ function vt(n, e) {
1370
1321
  const {
1371
- direction: n = "x",
1372
- markerSelector: s = "[data-swipe-at-edge]",
1373
- depthLimit: r = 24,
1374
- verifyByScroll: c = !1
1375
- } = t ?? {}, i = tn(e);
1376
- if (!i) return {
1377
- element: null,
1378
- hasMarker: !1
1379
- };
1380
- const u = i.closest?.(s);
1381
- if (u instanceof HTMLElement && Vt(u, n) && (!c || ue(u, n)))
1382
- return {
1383
- element: u,
1384
- hasMarker: !0
1385
- };
1386
- let l = i, a = 0;
1387
- for (; l && l !== document.body && a < r; ) {
1388
- if (Vt(l, n) && (!c || ue(l, n)))
1389
- return {
1390
- element: l,
1391
- hasMarker: !1
1392
- };
1393
- l = l.parentElement, a++;
1322
+ direction: t = "x",
1323
+ markerSelector: r = "[data-swipe-at-edge]",
1324
+ depthLimit: s = 24,
1325
+ verifyByScroll: a = !1
1326
+ } = e ?? {}, o = le(n);
1327
+ if (!o) return { element: null, hasMarker: !1 };
1328
+ const c = o.closest?.(r);
1329
+ if (c instanceof HTMLElement && lt(c, t) && (!a || Dt(c, t)))
1330
+ return { element: c, hasMarker: !0 };
1331
+ let h = o, l = 0;
1332
+ for (; h && h !== document.body && l < s; ) {
1333
+ if (lt(h, t) && (!a || Dt(h, t)))
1334
+ return { element: h, hasMarker: !1 };
1335
+ h = h.parentElement, l++;
1394
1336
  }
1395
- return {
1396
- element: null,
1397
- hasMarker: !1
1398
- };
1337
+ return { element: null, hasMarker: !1 };
1399
1338
  }
1400
- function tn(e) {
1401
- if (!e) return null;
1402
- const t = e, n = typeof t.composedPath == "function" ? t.composedPath() : void 0;
1403
- if (n && n.length) {
1404
- for (const s of n)
1405
- if (s instanceof HTMLElement) return s;
1339
+ function le(n) {
1340
+ if (!n) return null;
1341
+ const e = n, t = typeof e.composedPath == "function" ? e.composedPath() : void 0;
1342
+ if (t && t.length) {
1343
+ for (const r of t)
1344
+ if (r instanceof HTMLElement) return r;
1406
1345
  }
1407
- return e;
1346
+ return n;
1408
1347
  }
1409
- function Vt(e, t) {
1410
- return t === "y" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
1348
+ function lt(n, e) {
1349
+ return e === "y" ? n.scrollHeight - n.clientHeight > 1 : n.scrollWidth - n.clientWidth > 1;
1411
1350
  }
1412
- function ue(e, t) {
1413
- if (!Vt(e, t)) return !1;
1414
- if (t === "y") {
1415
- const n = e.scrollTop;
1416
- if (e.scrollTop = n + 1, e.scrollTop !== n)
1417
- return e.scrollTop = n, !0;
1418
- e.scrollTop = n - 1;
1419
- const r = e.scrollTop !== n;
1420
- return e.scrollTop = n, r;
1351
+ function Dt(n, e) {
1352
+ if (!lt(n, e)) return !1;
1353
+ if (e === "y") {
1354
+ const t = n.scrollTop;
1355
+ if (n.scrollTop = t + 1, n.scrollTop !== t)
1356
+ return n.scrollTop = t, !0;
1357
+ n.scrollTop = t - 1;
1358
+ const s = n.scrollTop !== t;
1359
+ return n.scrollTop = t, s;
1421
1360
  } else {
1422
- const n = e.scrollLeft;
1423
- if (e.scrollLeft = n + 1, e.scrollLeft !== n)
1424
- return e.scrollLeft = n, !0;
1425
- e.scrollLeft = n - 1;
1426
- const r = e.scrollLeft !== n;
1427
- return e.scrollLeft = n, r;
1361
+ const t = n.scrollLeft;
1362
+ if (n.scrollLeft = t + 1, n.scrollLeft !== t)
1363
+ return n.scrollLeft = t, !0;
1364
+ n.scrollLeft = t - 1;
1365
+ const s = n.scrollLeft !== t;
1366
+ return n.scrollLeft = t, s;
1428
1367
  }
1429
1368
  }
1430
- function en(e) {
1431
- const t = j(20);
1432
- let n, s;
1433
- if (t[0] !== e) {
1434
- const {
1435
- children: L,
1436
- ref: M,
1437
- ...D
1438
- } = e;
1439
- s = M, n = D, t[0] = e, t[1] = n, t[2] = s;
1440
- } else
1441
- n = t[1], s = t[2];
1442
- const {
1443
- isActive: r,
1444
- transitionName: c
1445
- } = dt(), [i, u] = fe();
1446
- let l;
1447
- t[3] !== i ? (l = () => i.current, t[3] = i, t[4] = l) : l = t[4], Pe(s, l);
1448
- const a = Q(nn);
1449
- let d;
1450
- if (t[5] !== c) {
1451
- const L = ht.get(c), {
1452
- decoratorName: M
1453
- } = L;
1454
- d = Zt.get(M), t[5] = c, t[6] = d;
1455
- } else
1456
- d = t[6];
1457
- const {
1458
- initial: g,
1459
- variants: o
1460
- } = d;
1461
- let p, w;
1462
- t[7] !== u || t[8] !== r || t[9] !== i || t[10] !== a || t[11] !== o ? (p = () => {
1463
- if (!i.current)
1464
- return;
1465
- const {
1466
- value: L,
1467
- options: M
1468
- } = o[`${a}-${r}`];
1469
- u(i.current, L, M);
1470
- }, w = [a, r, u, o, i], t[7] = u, t[8] = r, t[9] = i, t[10] = a, t[11] = o, t[12] = p, t[13] = w) : (p = t[12], w = t[13]), J(p, w);
1471
- let E;
1472
- t[14] !== n.style ? (E = {
1473
- position: "absolute",
1474
- top: 0,
1475
- left: 0,
1476
- width: "100%",
1477
- height: "100%",
1478
- pointerEvents: "none",
1479
- ...n.style
1480
- }, t[14] = n.style, t[15] = E) : E = t[15];
1481
- let T;
1482
- return t[16] !== g || t[17] !== i || t[18] !== E ? (T = /* @__PURE__ */ x(Z.div, { ref: i, initial: g, style: E, "data-decorator": !0 }), t[16] = g, t[17] = i, t[18] = E, t[19] = T) : T = t[19], T;
1483
- }
1484
- function nn(e) {
1485
- return e.status;
1369
+ function de({ children: n, ref: e, ...t }) {
1370
+ const { isActive: r, transitionName: s } = tt(), [a, o] = Lt();
1371
+ jt(e, () => a.current);
1372
+ const c = j((u) => u.status), h = et.get(s), { decoratorName: l } = h, { initial: m, variants: d } = ht.get(l);
1373
+ return z(() => {
1374
+ if (!a.current) return;
1375
+ const { value: u, options: P } = d[`${c}-${r}`];
1376
+ o(a.current, u, P);
1377
+ }, [c, r, o, d, a]), /* @__PURE__ */ D(
1378
+ J.div,
1379
+ {
1380
+ ref: a,
1381
+ initial: m,
1382
+ style: {
1383
+ position: "absolute",
1384
+ top: 0,
1385
+ left: 0,
1386
+ width: "100%",
1387
+ height: "100%",
1388
+ pointerEvents: "none",
1389
+ ...t.style
1390
+ },
1391
+ "data-decorator": !0
1392
+ }
1393
+ );
1486
1394
  }
1487
- const tt = Ot((e) => ({
1395
+ const Z = st((n) => ({
1488
1396
  dragStatus: "IDLE",
1489
1397
  replaceTransitionStatus: "IDLE",
1490
- setDragStatus: (t) => e({
1491
- dragStatus: t
1492
- }),
1493
- setReplaceTransitionStatus: (t) => e({
1494
- replaceTransitionStatus: t
1495
- })
1398
+ setDragStatus: (e) => n({ dragStatus: e }),
1399
+ setReplaceTransitionStatus: (e) => n({ replaceTransitionStatus: e })
1496
1400
  }));
1497
- function ye(e) {
1498
- const t = j(128);
1499
- let n, s, r, c, i, u, l, a, d, g;
1500
- t[0] !== e ? ({
1501
- children: s,
1502
- statusBarHeight: a,
1503
- statusBarColor: l,
1504
- systemNavigationBarHeight: g,
1505
- systemNavigationBarColor: d,
1506
- appBar: n,
1507
- navigationBar: i,
1508
- hideStatusBar: r,
1509
- hideSystemNavigationBar: c,
1510
- ...u
1511
- } = e, t[0] = e, t[1] = n, t[2] = s, t[3] = r, t[4] = c, t[5] = i, t[6] = u, t[7] = l, t[8] = a, t[9] = d, t[10] = g) : (n = t[1], s = t[2], r = t[3], c = t[4], i = t[5], u = t[6], l = t[7], a = t[8], d = t[9], g = t[10]);
1512
- const [o, p] = fe(), {
1513
- id: w,
1514
- isActive: E,
1515
- isRoot: T,
1516
- transitionName: L,
1517
- prevTransitionName: M
1518
- } = dt(), D = Te(), C = Q(on), R = tt(an), b = tt(rn), f = tt(sn);
1519
- let m, P, h, S, y;
1520
- if (t[11] !== L) {
1521
- m = ht.get(L);
1522
- const {
1523
- variants: k,
1524
- initial: O,
1525
- swipeDirection: G,
1526
- decoratorName: q
1527
- } = m;
1528
- y = k, P = O, h = G, S = Zt.get(q), t[11] = L, t[12] = m, t[13] = P, t[14] = h, t[15] = S, t[16] = y;
1529
- } else
1530
- m = t[12], P = t[13], h = t[14], S = t[15], y = t[16];
1531
- const v = S, [N, H] = ne(0), [I, _] = ne(0), $ = B(null), A = B(null), U = B(null), et = B(null), K = B(!1), pt = B(!1);
1532
- let mt;
1533
- t[17] === Symbol.for("react.memo_cache_sentinel") ? (mt = {
1534
- element: null,
1535
- hasMarker: !1
1536
- }, t[17] = mt) : mt = t[17];
1537
- const V = B(mt);
1538
- let yt;
1539
- t[18] === Symbol.for("react.memo_cache_sentinel") ? (yt = {
1401
+ function Ct({
1402
+ children: n,
1403
+ statusBarHeight: e,
1404
+ statusBarColor: t,
1405
+ systemNavigationBarHeight: r,
1406
+ systemNavigationBarColor: s,
1407
+ appBar: a,
1408
+ navigationBar: o,
1409
+ hideStatusBar: c,
1410
+ hideSystemNavigationBar: h,
1411
+ ...l
1412
+ }) {
1413
+ const [m, d] = Lt(), { id: u, isActive: P, isRoot: L, transitionName: N, prevTransitionName: w } = tt(), k = Ft(), F = j((v) => v.status), Q = Z((v) => v.dragStatus), U = Z.getState().setDragStatus, R = Z.getState().setReplaceTransitionStatus, A = et.get(N), { variants: i, initial: y, swipeDirection: g, decoratorName: E } = A, p = ht.get(E), [f, I] = mt(0), [T, O] = mt(0), S = H(null), M = H(null), x = H(null), C = H(null), b = H(!1), W = H(!1), B = H({
1540
1414
  element: null,
1541
1415
  hasMarker: !1
1542
- }, t[18] = yt) : yt = t[18];
1543
- const z = B(yt), te = B(0), ee = B(0), Ht = B(null), Ut = B(null);
1544
- let gt;
1545
- t[19] !== p || t[20] !== m || t[21] !== v || t[22] !== D || t[23] !== o || t[24] !== b || t[25] !== h ? (gt = async (k, O) => {
1546
- if (!h)
1416
+ }), X = H({ element: null, hasMarker: !1 }), yt = H(0), gt = H(0), at = H(null), ot = H(null), bt = async (v, G) => {
1417
+ if (!g)
1547
1418
  return;
1548
- const G = $.current?.previousSibling;
1549
- A.current = G?.querySelector("[data-screen]"), et.current = G?.querySelector("[data-decorator]");
1550
- const q = await m?.onSwipeStart(k, O, {
1551
- animate: p,
1552
- currentScreen: o.current,
1553
- prevScreen: A.current,
1554
- dragControls: D,
1555
- onStart: (Yt) => v?.onSwipeStart?.(Yt, {
1556
- animate: p,
1557
- currentDecorator: U.current,
1558
- prevDecorator: et.current
1419
+ const $ = S.current?.previousSibling;
1420
+ M.current = $?.querySelector("[data-screen]"), C.current = $?.querySelector("[data-decorator]");
1421
+ const K = await A?.onSwipeStart(v, G, {
1422
+ animate: d,
1423
+ currentScreen: m.current,
1424
+ prevScreen: M.current,
1425
+ dragControls: k,
1426
+ onStart: (it) => p?.onSwipeStart?.(it, {
1427
+ animate: d,
1428
+ currentDecorator: x.current,
1429
+ prevDecorator: C.current
1559
1430
  })
1560
1431
  });
1561
- b(q ? "PENDING" : "IDLE");
1562
- }, t[19] = p, t[20] = m, t[21] = v, t[22] = D, t[23] = o, t[24] = b, t[25] = h, t[26] = gt) : gt = t[26];
1563
- const Bt = gt;
1564
- let St;
1565
- t[27] !== p || t[28] !== m || t[29] !== v || t[30] !== D || t[31] !== R || t[32] !== o || t[33] !== h ? (St = (k, O) => {
1566
- !h || R !== "PENDING" || m?.onSwipe(k, O, {
1567
- animate: p,
1568
- currentScreen: o.current,
1569
- prevScreen: A.current,
1570
- dragControls: D,
1571
- onProgress: (G, q) => v?.onSwipe?.(G, q, {
1572
- animate: p,
1573
- currentDecorator: U.current,
1574
- prevDecorator: et.current
1432
+ U(K ? "PENDING" : "IDLE");
1433
+ }, At = (v, G) => {
1434
+ !g || Q !== "PENDING" || A?.onSwipe(v, G, {
1435
+ animate: d,
1436
+ currentScreen: m.current,
1437
+ prevScreen: M.current,
1438
+ dragControls: k,
1439
+ onProgress: ($, K) => p?.onSwipe?.($, K, {
1440
+ animate: d,
1441
+ currentDecorator: x.current,
1442
+ prevDecorator: C.current
1575
1443
  })
1576
1444
  });
1577
- }, t[27] = p, t[28] = m, t[29] = v, t[30] = D, t[31] = R, t[32] = o, t[33] = h, t[34] = St) : St = t[34];
1578
- const Ft = St;
1579
- let wt;
1580
- t[35] !== p || t[36] !== m || t[37] !== v || t[38] !== R || t[39] !== o || t[40] !== b || t[41] !== h ? (wt = async (k, O) => {
1581
- if (!h || R !== "PENDING")
1445
+ }, Rt = async (v, G) => {
1446
+ if (!g || Q !== "PENDING")
1582
1447
  return;
1583
- await m?.onSwipeEnd(k, O, {
1584
- animate: p,
1585
- currentScreen: o.current,
1586
- prevScreen: A.current,
1587
- onStart: (q) => v?.onSwipeEnd?.(q, {
1588
- animate: p,
1589
- currentDecorator: U.current,
1590
- prevDecorator: et.current
1448
+ await A?.onSwipeEnd(v, G, {
1449
+ animate: d,
1450
+ currentScreen: m.current,
1451
+ prevScreen: M.current,
1452
+ onStart: (K) => p?.onSwipeEnd?.(K, {
1453
+ animate: d,
1454
+ currentDecorator: x.current,
1455
+ prevDecorator: C.current
1591
1456
  })
1592
- }) ? window.history.back() : b("IDLE");
1593
- }, t[35] = p, t[36] = m, t[37] = v, t[38] = R, t[39] = o, t[40] = b, t[41] = h, t[42] = wt) : wt = t[42];
1594
- const Qt = wt;
1595
- let Et;
1596
- t[43] !== R || t[44] !== E || t[45] !== T || t[46] !== C || t[47] !== h ? (Et = (k) => {
1597
- if (!(!T && E && C === "COMPLETED" && R === "IDLE" && !!h))
1457
+ }) ? window.history.back() : U("IDLE");
1458
+ }, Ot = (v) => {
1459
+ if (!(!L && P && F === "COMPLETED" && Q === "IDLE" && !!g))
1598
1460
  return;
1599
- V.current = ce(k.target, {
1461
+ B.current = vt(v.target, {
1600
1462
  direction: "x",
1601
1463
  verifyByScroll: !0
1602
- }), z.current = ce(k.target, {
1464
+ }), X.current = vt(v.target, {
1603
1465
  direction: "y",
1604
1466
  verifyByScroll: !0
1605
- }), te.current = k.clientX, ee.current = k.clientY, (!V.current.element && !z.current.element || V.current.element || z.current.element) && (K.current = !0);
1606
- }, t[43] = R, t[44] = E, t[45] = T, t[46] = C, t[47] = h, t[48] = Et) : Et = t[48];
1607
- const jt = Et;
1608
- let Pt;
1609
- t[49] !== D || t[50] !== h ? (Pt = (k) => {
1610
- const O = !V.current.element && !z.current.element;
1611
- if (K.current && O)
1612
- K.current = !1, pt.current = !0, D.start(k);
1613
- else if (K.current && !O) {
1614
- const G = k.clientX - te.current, q = k.clientY - ee.current, Yt = z.current.element && z.current.element.scrollTop <= 0 && z.current.hasMarker, Se = V.current.element && V.current.element.scrollLeft <= 0 && V.current.hasMarker;
1615
- (h === "y" && (Yt || V.current.element) && q > 0 && Math.abs(G) < 4 || h === "x" && (Se || z.current.element) && G > 0 && Math.abs(q) < 4) && (K.current = !1, pt.current = !0, D.start(k));
1467
+ }), yt.current = v.clientX, gt.current = v.clientY, (!B.current.element && !X.current.element || B.current.element || X.current.element) && (b.current = !0);
1468
+ }, Gt = (v) => {
1469
+ const G = !B.current.element && !X.current.element;
1470
+ if (b.current && G)
1471
+ b.current = !1, W.current = !0, k.start(v);
1472
+ else if (b.current && !G) {
1473
+ const $ = v.clientX - yt.current, K = v.clientY - gt.current, it = X.current.element && X.current.element.scrollTop <= 0 && X.current.hasMarker, Ut = B.current.element && B.current.element.scrollLeft <= 0 && B.current.hasMarker;
1474
+ (g === "y" && (it || B.current.element) && K > 0 && Math.abs($) < 4 || g === "x" && (Ut || X.current.element) && $ > 0 && Math.abs(K) < 4) && (b.current = !1, W.current = !0, k.start(v));
1616
1475
  }
1617
- }, t[49] = D, t[50] = h, t[51] = Pt) : Pt = t[51];
1618
- const qt = Pt;
1619
- let Tt;
1620
- t[52] === Symbol.for("react.memo_cache_sentinel") ? (Tt = () => {
1621
- K.current = !1, pt.current = !1;
1622
- }, t[52] = Tt) : Tt = t[52];
1623
- const ge = Tt;
1624
- let vt, Dt;
1625
- t[53] !== o ? (vt = () => {
1626
- const k = o.current;
1627
- if (!k)
1628
- return;
1629
- const O = (G) => {
1630
- pt.current && G.preventDefault(), G.target?.dataset.swipeAtEdgeBar === "true" && G.preventDefault();
1476
+ }, $t = () => {
1477
+ b.current = !1, W.current = !1;
1478
+ };
1479
+ return z(() => {
1480
+ const v = m.current;
1481
+ if (!v) return;
1482
+ const G = ($) => {
1483
+ W.current && $.preventDefault(), $.target?.dataset.swipeAtEdgeBar === "true" && $.preventDefault();
1631
1484
  };
1632
- return k.addEventListener("touchmove", O, {
1485
+ return v.addEventListener("touchmove", G, {
1633
1486
  passive: !1
1634
1487
  }), () => {
1635
- k.removeEventListener("touchmove", O);
1488
+ v.removeEventListener("touchmove", G);
1636
1489
  };
1637
- }, Dt = [o], t[53] = o, t[54] = vt, t[55] = Dt) : (vt = t[54], Dt = t[55]), J(vt, Dt);
1638
- let It, Lt;
1639
- t[56] !== p || t[57] !== w || t[58] !== E || t[59] !== M || t[60] !== o || t[61] !== b || t[62] !== f || t[63] !== C || t[64] !== L || t[65] !== y ? (It = () => {
1640
- o.current && (async () => {
1641
- const {
1642
- value: k,
1643
- options: O
1644
- } = y[`${C}-${E}`];
1645
- !E && C === "REPLACING" && M !== L && (f("PENDING"), await p(o.current, qe, {
1490
+ }, [m]), z(() => {
1491
+ m.current && (async () => {
1492
+ const { value: v, options: G } = i[`${F}-${P}`];
1493
+ !P && F === "REPLACING" && w !== N && (R("PENDING"), await d(m.current, ie, {
1646
1494
  duration: 0.1
1647
- })), E && C === "COMPLETED" && (b("IDLE"), f("IDLE")), await p(o.current, k, O), await Y.resolveTask(w);
1495
+ })), P && F === "COMPLETED" && (U("IDLE"), R("IDLE")), await d(m.current, v, G), await q.resolveTask(u);
1648
1496
  })();
1649
- }, Lt = [C, E, w, M, L, p, o, y, b, f], t[56] = p, t[57] = w, t[58] = E, t[59] = M, t[60] = o, t[61] = b, t[62] = f, t[63] = C, t[64] = L, t[65] = y, t[66] = It, t[67] = Lt) : (It = t[66], Lt = t[67]), J(It, Lt);
1650
- let Nt;
1651
- t[68] === Symbol.for("react.memo_cache_sentinel") ? (Nt = () => {
1652
- Ht.current && H(Ht.current.offsetHeight);
1653
- }, t[68] = Nt) : Nt = t[68];
1654
- let xt;
1655
- t[69] !== n ? (xt = [n], t[69] = n, t[70] = xt) : xt = t[70], se(Nt, xt);
1656
- let kt;
1657
- t[71] === Symbol.for("react.memo_cache_sentinel") ? (kt = () => {
1658
- Ut.current && _(Ut.current.offsetHeight);
1659
- }, t[71] = kt) : kt = t[71];
1660
- let Mt;
1661
- t[72] !== i ? (Mt = [i], t[72] = i, t[73] = Mt) : Mt = t[73], se(kt, Mt);
1662
- let Ct;
1663
- t[74] === Symbol.for("react.memo_cache_sentinel") ? (Ct = {
1664
- position: "absolute",
1665
- top: 0,
1666
- left: 0,
1667
- width: "100%",
1668
- height: "100%",
1669
- display: "flex",
1670
- flexDirection: "column",
1671
- boxSizing: "border-box",
1672
- isolation: "isolate",
1673
- contain: "strict",
1674
- overscrollBehavior: "contain"
1675
- }, t[74] = Ct) : Ct = t[74];
1676
- let $t;
1677
- t[75] === Symbol.for("react.memo_cache_sentinel") ? ($t = /* @__PURE__ */ x("div", { "data-swipe-at-edge-bar": !0, style: {
1678
- position: "absolute",
1679
- top: 0,
1680
- left: 0,
1681
- width: 8,
1682
- height: "100%",
1683
- zIndex: 1
1684
- } }), t[75] = $t) : $t = t[75];
1685
- let nt;
1686
- t[76] !== n || t[77] !== r || t[78] !== a ? (nt = n && /* @__PURE__ */ x(Z.div, { ref: Ht, style: {
1687
- position: "absolute",
1688
- top: r ? 0 : a,
1689
- left: 0,
1690
- width: "100%"
1691
- }, children: n }), t[76] = n, t[77] = r, t[78] = a, t[79] = nt) : nt = t[79];
1692
- let st;
1693
- t[80] !== u.style ? (st = {
1694
- display: "flex",
1695
- flexDirection: "column",
1696
- height: "100%",
1697
- backgroundColor: "white",
1698
- touchAction: "none",
1699
- overflowY: "auto",
1700
- ...u.style
1701
- }, t[80] = u.style, t[81] = st) : st = t[81];
1702
- let rt;
1703
- t[82] !== r || t[83] !== l || t[84] !== a ? (rt = !r && a && /* @__PURE__ */ x(Z.div, { animate: {
1704
- backgroundColor: l
1705
- }, style: {
1706
- width: "100%",
1707
- minHeight: a
1708
- } }), t[82] = r, t[83] = l, t[84] = a, t[85] = rt) : rt = t[85];
1709
- let at;
1710
- t[86] !== n || t[87] !== N ? (at = n && /* @__PURE__ */ x("div", { style: {
1711
- width: "100%",
1712
- minHeight: N
1713
- } }), t[86] = n, t[87] = N, t[88] = at) : at = t[88];
1714
- let bt;
1715
- t[89] === Symbol.for("react.memo_cache_sentinel") ? (bt = {
1716
- display: "flex",
1717
- flexDirection: "column",
1718
- flexGrow: 1
1719
- }, t[89] = bt) : bt = t[89];
1720
- let it;
1721
- t[90] !== s ? (it = /* @__PURE__ */ x("div", { style: bt, children: s }), t[90] = s, t[91] = it) : it = t[91];
1722
- let ot;
1723
- t[92] !== i || t[93] !== I ? (ot = i && /* @__PURE__ */ x("div", { style: {
1724
- width: "100%",
1725
- minHeight: I
1726
- } }), t[92] = i, t[93] = I, t[94] = ot) : ot = t[94];
1727
- let ct;
1728
- t[95] !== c || t[96] !== d || t[97] !== g ? (ct = !c && g && /* @__PURE__ */ x(Z.div, { animate: {
1729
- backgroundColor: d
1730
- }, style: {
1731
- width: "100%",
1732
- minHeight: g
1733
- } }), t[95] = c, t[96] = d, t[97] = g, t[98] = ct) : ct = t[98];
1734
- let ut;
1735
- t[99] !== D || t[100] !== Ft || t[101] !== Qt || t[102] !== Bt || t[103] !== jt || t[104] !== qt || t[105] !== P || t[106] !== u || t[107] !== o || t[108] !== h || t[109] !== st || t[110] !== rt || t[111] !== at || t[112] !== it || t[113] !== ot || t[114] !== ct ? (ut = /* @__PURE__ */ Xt(Z.div, { ref: o, ...u, initial: P, drag: h, dragListener: !1, dragControls: D, onDragStart: Bt, onDrag: Ft, onDragEnd: Qt, onPointerDown: jt, onPointerMove: qt, onPointerUp: ge, "data-screen": !0, style: st, children: [
1736
- rt,
1737
- at,
1738
- it,
1739
- ot,
1740
- ct
1741
- ] }), t[99] = D, t[100] = Ft, t[101] = Qt, t[102] = Bt, t[103] = jt, t[104] = qt, t[105] = P, t[106] = u, t[107] = o, t[108] = h, t[109] = st, t[110] = rt, t[111] = at, t[112] = it, t[113] = ot, t[114] = ct, t[115] = ut) : ut = t[115];
1742
- let lt;
1743
- t[116] !== c || t[117] !== i || t[118] !== g ? (lt = i && /* @__PURE__ */ x(Z.div, { ref: Ut, style: {
1744
- position: "absolute",
1745
- bottom: c ? 0 : g,
1746
- left: 0,
1747
- width: "100%"
1748
- }, children: i }), t[116] = c, t[117] = i, t[118] = g, t[119] = lt) : lt = t[119];
1749
- let ft;
1750
- t[120] !== v ? (ft = v && /* @__PURE__ */ x(en, { ref: U }), t[120] = v, t[121] = ft) : ft = t[121];
1751
- let At;
1752
- t[122] === Symbol.for("react.memo_cache_sentinel") ? (At = /* @__PURE__ */ x("div", { "data-swipe-at-edge-bar": !0, style: {
1753
- position: "absolute",
1754
- top: 0,
1755
- right: 0,
1756
- width: 8,
1757
- height: "100%",
1758
- zIndex: 1
1759
- } }), t[122] = At) : At = t[122];
1760
- let Rt;
1761
- return t[123] !== nt || t[124] !== ut || t[125] !== lt || t[126] !== ft ? (Rt = /* @__PURE__ */ Xt(Z.div, { ref: $, style: Ct, children: [
1762
- $t,
1763
- nt,
1764
- ut,
1765
- lt,
1766
- ft,
1767
- At
1768
- ] }), t[123] = nt, t[124] = ut, t[125] = lt, t[126] = ft, t[127] = Rt) : Rt = t[127], Rt;
1769
- }
1770
- function sn(e) {
1771
- return e.setReplaceTransitionStatus;
1772
- }
1773
- function rn(e) {
1774
- return e.setDragStatus;
1775
- }
1776
- function an(e) {
1777
- return e.dragStatus;
1778
- }
1779
- function on(e) {
1780
- return e.status;
1781
- }
1782
- function xn(e) {
1783
- const t = j(9);
1784
- let n, s;
1785
- t[0] !== e ? ({
1786
- children: n,
1787
- ...s
1788
- } = e, t[0] = e, t[1] = n, t[2] = s) : (n = t[1], s = t[2]);
1789
- const {
1790
- isActive: r,
1791
- isPrev: c,
1792
- zIndex: i
1793
- } = dt(), u = X(fn), l = Q(ln), a = tt(un), d = tt(cn), o = !r && (l === "COMPLETED" && a === "IDLE") || c && u - 2 <= i && d === "IDLE" || c && u - 2 > i;
1794
- let p;
1795
- t[3] !== n || t[4] !== s ? (p = /* @__PURE__ */ x(ye, { ...s, children: n }), t[3] = n, t[4] = s, t[5] = p) : p = t[5];
1796
- let w;
1797
- return t[6] !== o || t[7] !== p ? (w = /* @__PURE__ */ x(me, { freeze: o, children: p }), t[6] = o, t[7] = p, t[8] = w) : w = t[8], w;
1798
- }
1799
- function cn(e) {
1800
- return e.replaceTransitionStatus;
1801
- }
1802
- function un(e) {
1803
- return e.dragStatus;
1804
- }
1805
- function ln(e) {
1806
- return e.status;
1807
- }
1808
- function fn(e) {
1809
- return e.index;
1810
- }
1811
- function kn(e) {
1812
- const t = j(14);
1813
- let n, s;
1814
- t[0] !== e ? ({
1815
- children: n,
1816
- ...s
1817
- } = e, t[0] = e, t[1] = n, t[2] = s) : (n = t[1], s = t[2]);
1818
- const {
1819
- isActive: r,
1820
- isPrev: c,
1821
- zIndex: i
1822
- } = dt(), u = X(mn), l = Q(hn), a = tt(pn), d = tt(dn), o = !r && (l === "COMPLETED" && a === "IDLE") || c && u - 2 <= i && d === "IDLE" || c && u - 2 > i;
1823
- let p;
1824
- t[3] !== s.style ? (p = {
1825
- backgroundColor: "transparent",
1826
- ...s.style
1827
- }, t[3] = s.style, t[4] = p) : p = t[4];
1828
- let w;
1829
- t[5] !== n ? (w = /* @__PURE__ */ x(ve, { children: n }), t[5] = n, t[6] = w) : w = t[6];
1830
- let E;
1831
- t[7] !== s || t[8] !== p || t[9] !== w ? (E = /* @__PURE__ */ x(ye, { ...s, style: p, children: w }), t[7] = s, t[8] = p, t[9] = w, t[10] = E) : E = t[10];
1832
- let T;
1833
- return t[11] !== o || t[12] !== E ? (T = /* @__PURE__ */ x(me, { freeze: o, children: E }), t[11] = o, t[12] = E, t[13] = T) : T = t[13], T;
1834
- }
1835
- function dn(e) {
1836
- return e.replaceTransitionStatus;
1837
- }
1838
- function pn(e) {
1839
- return e.dragStatus;
1840
- }
1841
- function hn(e) {
1842
- return e.status;
1497
+ }, [
1498
+ F,
1499
+ P,
1500
+ u,
1501
+ w,
1502
+ N,
1503
+ d,
1504
+ m,
1505
+ i,
1506
+ U,
1507
+ R
1508
+ ]), Et(() => {
1509
+ at.current && I(at.current.offsetHeight);
1510
+ }, [a]), Et(() => {
1511
+ ot.current && O(ot.current.offsetHeight);
1512
+ }, [o]), /* @__PURE__ */ ct(
1513
+ J.div,
1514
+ {
1515
+ ref: S,
1516
+ style: {
1517
+ position: "absolute",
1518
+ top: 0,
1519
+ left: 0,
1520
+ width: "100%",
1521
+ height: "100%",
1522
+ display: "flex",
1523
+ flexDirection: "column",
1524
+ boxSizing: "border-box",
1525
+ isolation: "isolate",
1526
+ contain: "strict",
1527
+ overscrollBehavior: "contain"
1528
+ },
1529
+ children: [
1530
+ /* @__PURE__ */ D(
1531
+ "div",
1532
+ {
1533
+ "data-swipe-at-edge-bar": !0,
1534
+ style: {
1535
+ position: "absolute",
1536
+ top: 0,
1537
+ left: 0,
1538
+ width: 8,
1539
+ height: "100%",
1540
+ zIndex: 1
1541
+ }
1542
+ }
1543
+ ),
1544
+ a && /* @__PURE__ */ D(
1545
+ J.div,
1546
+ {
1547
+ ref: at,
1548
+ style: {
1549
+ position: "absolute",
1550
+ top: c ? 0 : e,
1551
+ left: 0,
1552
+ width: "100%"
1553
+ },
1554
+ children: a
1555
+ }
1556
+ ),
1557
+ /* @__PURE__ */ ct(
1558
+ J.div,
1559
+ {
1560
+ ref: m,
1561
+ ...l,
1562
+ initial: y,
1563
+ drag: g,
1564
+ dragListener: !1,
1565
+ dragControls: k,
1566
+ onDragStart: bt,
1567
+ onDrag: At,
1568
+ onDragEnd: Rt,
1569
+ onPointerDown: Ot,
1570
+ onPointerMove: Gt,
1571
+ onPointerUp: $t,
1572
+ "data-screen": !0,
1573
+ style: {
1574
+ display: "flex",
1575
+ flexDirection: "column",
1576
+ height: "100%",
1577
+ backgroundColor: "white",
1578
+ touchAction: "none",
1579
+ overflowY: "auto",
1580
+ ...l.style
1581
+ },
1582
+ children: [
1583
+ !c && e && /* @__PURE__ */ D(
1584
+ J.div,
1585
+ {
1586
+ animate: {
1587
+ backgroundColor: t
1588
+ },
1589
+ style: {
1590
+ width: "100%",
1591
+ minHeight: e
1592
+ }
1593
+ }
1594
+ ),
1595
+ a && /* @__PURE__ */ D(
1596
+ "div",
1597
+ {
1598
+ style: {
1599
+ width: "100%",
1600
+ minHeight: f
1601
+ }
1602
+ }
1603
+ ),
1604
+ /* @__PURE__ */ D("div", { style: { display: "flex", flexDirection: "column", flexGrow: 1 }, children: n }),
1605
+ o && /* @__PURE__ */ D(
1606
+ "div",
1607
+ {
1608
+ style: {
1609
+ width: "100%",
1610
+ minHeight: T
1611
+ }
1612
+ }
1613
+ ),
1614
+ !h && r && /* @__PURE__ */ D(
1615
+ J.div,
1616
+ {
1617
+ animate: {
1618
+ backgroundColor: s
1619
+ },
1620
+ style: {
1621
+ width: "100%",
1622
+ minHeight: r
1623
+ }
1624
+ }
1625
+ )
1626
+ ]
1627
+ }
1628
+ ),
1629
+ o && /* @__PURE__ */ D(
1630
+ J.div,
1631
+ {
1632
+ ref: ot,
1633
+ style: {
1634
+ position: "absolute",
1635
+ bottom: h ? 0 : r,
1636
+ left: 0,
1637
+ width: "100%"
1638
+ },
1639
+ children: o
1640
+ }
1641
+ ),
1642
+ p && /* @__PURE__ */ D(de, { ref: x }),
1643
+ /* @__PURE__ */ D(
1644
+ "div",
1645
+ {
1646
+ "data-swipe-at-edge-bar": !0,
1647
+ style: {
1648
+ position: "absolute",
1649
+ top: 0,
1650
+ right: 0,
1651
+ width: 8,
1652
+ height: "100%",
1653
+ zIndex: 1
1654
+ }
1655
+ }
1656
+ )
1657
+ ]
1658
+ }
1659
+ );
1843
1660
  }
1844
- function mn(e) {
1845
- return e.index;
1661
+ function Te({ children: n, ...e }) {
1662
+ const { isActive: t, isPrev: r, zIndex: s } = tt(), a = Y((d) => d.index), o = j((d) => d.status), c = Z((d) => d.dragStatus), h = Z((d) => d.replaceTransitionStatus), m = !t && (o === "COMPLETED" && c === "IDLE") || r && a - 2 <= s && h === "IDLE" || r && a - 2 > s;
1663
+ return /* @__PURE__ */ D(Mt, { freeze: m, children: /* @__PURE__ */ D(Ct, { ...e, children: n }) });
1846
1664
  }
1847
- function Mn(e) {
1848
- const t = j(9);
1849
- let n, s;
1850
- t[0] !== e ? ({
1851
- children: n,
1852
- ...s
1853
- } = e, t[0] = e, t[1] = n, t[2] = s) : (n = t[1], s = t[2]);
1854
- const {
1855
- isActive: r,
1856
- transitionName: c
1857
- } = dt(), i = Q(yn);
1858
- let u;
1859
- t[3] !== c ? (u = ht.get(c), t[3] = c, t[4] = u) : u = t[4];
1860
- const a = u?.variants[`${i}-${r}`]?.options;
1861
- let d;
1862
- return t[5] !== n || t[6] !== s || t[7] !== a ? (d = /* @__PURE__ */ x(De, { transition: a, ...s, children: n }), t[5] = n, t[6] = s, t[7] = a, t[8] = d) : d = t[8], d;
1665
+ function ve({ children: n, ...e }) {
1666
+ const { isActive: t, isPrev: r, zIndex: s } = tt(), a = Y((d) => d.index), o = j((d) => d.status), c = Z((d) => d.dragStatus), h = Z((d) => d.replaceTransitionStatus), m = !t && (o === "COMPLETED" && c === "IDLE") || r && a - 2 <= s && h === "IDLE" || r && a - 2 > s;
1667
+ return /* @__PURE__ */ D(Mt, { freeze: m, children: /* @__PURE__ */ D(
1668
+ Ct,
1669
+ {
1670
+ ...e,
1671
+ style: {
1672
+ backgroundColor: "transparent",
1673
+ ...e.style
1674
+ },
1675
+ children: /* @__PURE__ */ D(Qt, { children: n })
1676
+ }
1677
+ ) });
1863
1678
  }
1864
- function yn(e) {
1865
- return e.status;
1679
+ function De({ children: n, ...e }) {
1680
+ const { isActive: t, transitionName: r } = tt(), s = j((o) => o.status), a = et.get(r);
1681
+ return /* @__PURE__ */ D(
1682
+ qt,
1683
+ {
1684
+ transition: a?.variants[`${s}-${t}`]?.options,
1685
+ ...e,
1686
+ children: n
1687
+ }
1688
+ );
1866
1689
  }
1867
1690
  export {
1868
- Mn as LayoutConfig,
1869
- kn as LayoutScreen,
1870
- Tn as Route,
1871
- Pn as Router,
1872
- xn as Screen,
1873
- He as createDecorator,
1874
- Nn as createRawDecorator,
1875
- Ln as createRawTransition,
1876
- Gt as createTransition,
1877
- vn as useNavigate,
1878
- In as useParams,
1879
- dt as useScreen,
1880
- Dn as useStep
1691
+ De as LayoutConfig,
1692
+ ve as LayoutScreen,
1693
+ ge as Route,
1694
+ ye as Router,
1695
+ Te as Screen,
1696
+ ee as createDecorator,
1697
+ Pe as createRawDecorator,
1698
+ Se as createRawTransition,
1699
+ rt as createTransition,
1700
+ me as useNavigate,
1701
+ we as useParams,
1702
+ tt as useScreen,
1703
+ Ee as useStep
1881
1704
  };