@kamiui/kami 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -0
- package/dist/index-CVNk3zin.js +4163 -0
- package/dist/kami.js +75 -0
- package/dist/kami.umd.cjs +16 -0
- package/dist/web-4j5o-jby.js +42 -0
- package/package.json +48 -0
|
@@ -0,0 +1,4163 @@
|
|
|
1
|
+
import { jsx as o, jsxs as y, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import mt, { createContext as se, forwardRef as gt, useState as B, useRef as L, useCallback as $, useImperativeHandle as bt, useLayoutEffect as xt, useEffect as _, useContext as Z, Component as yt, useId as Ze, useMemo as he } from "react";
|
|
3
|
+
import { createPortal as wt } from "react-dom";
|
|
4
|
+
const Re = "cubic-bezier(0.16, 1, 0.3, 1)", q = "cubic-bezier(0.16, 1, 0.3, 1)", $e = "cubic-bezier(0.34, 1.28, 0.64, 1)", et = se(null);
|
|
5
|
+
function tt() {
|
|
6
|
+
const e = Z(et);
|
|
7
|
+
if (!e) throw new Error("useNavigation must be used within <NavigationStack>");
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
const nt = se(0);
|
|
11
|
+
function kt() {
|
|
12
|
+
return Z(nt);
|
|
13
|
+
}
|
|
14
|
+
function A(e, t, n = "none") {
|
|
15
|
+
e && (e.style.transition = n, e.style.transform = `translate3d(${t}px,0,0)`);
|
|
16
|
+
}
|
|
17
|
+
const St = gt(
|
|
18
|
+
function({ initialPage: t }, n) {
|
|
19
|
+
const r = window.innerWidth, [a, i] = B([
|
|
20
|
+
{ id: "root", page: t }
|
|
21
|
+
]), c = L(/* @__PURE__ */ new Map()), s = L(null), d = L(a);
|
|
22
|
+
d.current = a;
|
|
23
|
+
const l = L(!1);
|
|
24
|
+
l.current = a.length > 1;
|
|
25
|
+
const u = (g) => c.current.get(g) ?? null, f = () => d.current[d.current.length - 1].id, v = () => d.current.length > 1 ? d.current[d.current.length - 2].id : null, b = $(
|
|
26
|
+
() => i((g) => g.length > 1 ? g.slice(0, -1) : g),
|
|
27
|
+
[]
|
|
28
|
+
), E = $(() => {
|
|
29
|
+
const g = f(), x = v();
|
|
30
|
+
A(u(g), r, `transform 0.28s ${q}`), A(x ? u(x) : null, 0, `transform 0.28s ${q}`), setTimeout(b, 280);
|
|
31
|
+
}, [r, b]), k = $((g) => {
|
|
32
|
+
i((x) => [...x, { id: crypto.randomUUID(), page: g }]);
|
|
33
|
+
}, []), h = $((g = !0) => {
|
|
34
|
+
if (d.current.length <= 1) return;
|
|
35
|
+
const x = d.current[0], w = d.current[d.current.length - 1], N = u(x.id), T = u(w.id);
|
|
36
|
+
if (!g) {
|
|
37
|
+
N && A(N, 0), i([x]);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
N && A(N, -r * 0.3), A(T, r, `transform 0.28s ${q}`), N && A(N, 0, `transform 0.28s ${q}`), setTimeout(() => i([x]), 285);
|
|
41
|
+
}, [r]);
|
|
42
|
+
bt(n, () => ({ popToRoot: h }), [h]);
|
|
43
|
+
const p = L(a.length);
|
|
44
|
+
xt(() => {
|
|
45
|
+
const g = a.length;
|
|
46
|
+
if (g <= p.current) {
|
|
47
|
+
p.current = g;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
p.current = g;
|
|
51
|
+
const x = f(), w = v(), N = u(x), T = w ? u(w) : null;
|
|
52
|
+
A(N, r), N?.getBoundingClientRect(), A(N, 0, `transform 0.38s ${Re}`), A(T, -r * 0.3, `transform 0.38s ${Re}`);
|
|
53
|
+
}, [a.length, r]);
|
|
54
|
+
const m = L({
|
|
55
|
+
active: !1,
|
|
56
|
+
startX: 0,
|
|
57
|
+
startY: 0,
|
|
58
|
+
startTime: 0,
|
|
59
|
+
locked: !1,
|
|
60
|
+
// horizontal direction confirmed
|
|
61
|
+
cancelled: !1
|
|
62
|
+
// vertical — let scroll win
|
|
63
|
+
});
|
|
64
|
+
_(() => {
|
|
65
|
+
const g = s.current;
|
|
66
|
+
if (!g) return;
|
|
67
|
+
const x = (T) => {
|
|
68
|
+
if (!l.current) return;
|
|
69
|
+
const C = T.touches[0];
|
|
70
|
+
C.clientX > 44 || (m.current = {
|
|
71
|
+
active: !0,
|
|
72
|
+
startX: C.clientX,
|
|
73
|
+
startY: C.clientY,
|
|
74
|
+
startTime: Date.now(),
|
|
75
|
+
locked: !1,
|
|
76
|
+
cancelled: !1
|
|
77
|
+
});
|
|
78
|
+
}, w = (T) => {
|
|
79
|
+
const C = m.current;
|
|
80
|
+
if (!C.active || C.cancelled) return;
|
|
81
|
+
const P = T.touches[0], I = P.clientX - C.startX, R = Math.abs(P.clientY - C.startY);
|
|
82
|
+
if (!C.locked) {
|
|
83
|
+
if (Math.abs(I) < 6 && R < 6) return;
|
|
84
|
+
if (I > 0 && I >= R)
|
|
85
|
+
C.locked = !0;
|
|
86
|
+
else {
|
|
87
|
+
C.cancelled = !0, C.active = !1;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
T.preventDefault();
|
|
92
|
+
const D = Math.max(0, I), O = f(), j = v();
|
|
93
|
+
A(u(O), D), A(j ? u(j) : null, -r * 0.3 + D * 0.3);
|
|
94
|
+
}, N = (T) => {
|
|
95
|
+
const C = m.current;
|
|
96
|
+
if (!C.active || C.cancelled) {
|
|
97
|
+
C.active = !1;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
C.active = !1;
|
|
101
|
+
const P = T.changedTouches[0], I = Math.max(0, P.clientX - C.startX), R = Math.max(Date.now() - C.startTime, 1), D = I / R, O = f(), j = v(), le = u(O), M = j ? u(j) : null;
|
|
102
|
+
I > r * 0.35 || D > 0.4 ? (A(le, r, `transform 0.22s ${q}`), A(M, 0, `transform 0.22s ${q}`), setTimeout(b, 220)) : (A(le, 0, `transform 0.3s ${$e}`), A(M, -r * 0.3, `transform 0.3s ${$e}`));
|
|
103
|
+
};
|
|
104
|
+
return g.addEventListener("touchstart", x, { passive: !0 }), g.addEventListener("touchmove", w, { passive: !1 }), g.addEventListener("touchend", N, { passive: !0 }), g.addEventListener("touchcancel", N, { passive: !0 }), () => {
|
|
105
|
+
g.removeEventListener("touchstart", x), g.removeEventListener("touchmove", w), g.removeEventListener("touchend", N), g.removeEventListener("touchcancel", N);
|
|
106
|
+
};
|
|
107
|
+
}, [r, b]);
|
|
108
|
+
const S = a.length > 1;
|
|
109
|
+
return /* @__PURE__ */ o(et.Provider, { value: { push: k, pop: E, canGoBack: S }, children: /* @__PURE__ */ o("div", { ref: s, className: "h-dvh overflow-hidden relative", children: a.map((g, x) => {
|
|
110
|
+
const w = x === a.length - 1, N = x === a.length - 2, T = !w && !N;
|
|
111
|
+
return (
|
|
112
|
+
// Each page gets its own depth — Navbar reads this, not global canGoBack
|
|
113
|
+
/* @__PURE__ */ o(nt.Provider, { value: x, children: /* @__PURE__ */ o(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
ref: (C) => {
|
|
117
|
+
C ? c.current.set(g.id, C) : c.current.delete(g.id);
|
|
118
|
+
},
|
|
119
|
+
className: "absolute inset-0 will-change-transform",
|
|
120
|
+
style: {
|
|
121
|
+
visibility: T ? "hidden" : "visible",
|
|
122
|
+
transform: w ? "translate3d(0,0,0)" : `translate3d(${-r * 0.3}px,0,0)`,
|
|
123
|
+
zIndex: x
|
|
124
|
+
},
|
|
125
|
+
children: g.page
|
|
126
|
+
}
|
|
127
|
+
) }, g.id)
|
|
128
|
+
);
|
|
129
|
+
}) }) });
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
var Q;
|
|
133
|
+
(function(e) {
|
|
134
|
+
e.Unimplemented = "UNIMPLEMENTED", e.Unavailable = "UNAVAILABLE";
|
|
135
|
+
})(Q || (Q = {}));
|
|
136
|
+
class we extends Error {
|
|
137
|
+
constructor(t, n, r) {
|
|
138
|
+
super(t), this.message = t, this.code = n, this.data = r;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const Et = (e) => {
|
|
142
|
+
var t, n;
|
|
143
|
+
return e?.androidBridge ? "android" : !((n = (t = e?.webkit) === null || t === void 0 ? void 0 : t.messageHandlers) === null || n === void 0) && n.bridge ? "ios" : "web";
|
|
144
|
+
}, Pt = (e) => {
|
|
145
|
+
const t = e.CapacitorCustomPlatform || null, n = e.Capacitor || {}, r = n.Plugins = n.Plugins || {}, a = () => t !== null ? t.name : Et(e), i = () => a() !== "web", c = (f) => {
|
|
146
|
+
const v = l.get(f);
|
|
147
|
+
return !!(v?.platforms.has(a()) || s(f));
|
|
148
|
+
}, s = (f) => {
|
|
149
|
+
var v;
|
|
150
|
+
return (v = n.PluginHeaders) === null || v === void 0 ? void 0 : v.find((b) => b.name === f);
|
|
151
|
+
}, d = (f) => e.console.error(f), l = /* @__PURE__ */ new Map(), u = (f, v = {}) => {
|
|
152
|
+
const b = l.get(f);
|
|
153
|
+
if (b)
|
|
154
|
+
return console.warn(`Capacitor plugin "${f}" already registered. Cannot register plugins twice.`), b.proxy;
|
|
155
|
+
const E = a(), k = s(f);
|
|
156
|
+
let h;
|
|
157
|
+
const p = async () => (!h && E in v ? h = typeof v[E] == "function" ? h = await v[E]() : h = v[E] : t !== null && !h && "web" in v && (h = typeof v.web == "function" ? h = await v.web() : h = v.web), h), m = (T, C) => {
|
|
158
|
+
var P, I;
|
|
159
|
+
if (k) {
|
|
160
|
+
const R = k?.methods.find((D) => C === D.name);
|
|
161
|
+
if (R)
|
|
162
|
+
return R.rtype === "promise" ? (D) => n.nativePromise(f, C.toString(), D) : (D, O) => n.nativeCallback(f, C.toString(), D, O);
|
|
163
|
+
if (T)
|
|
164
|
+
return (P = T[C]) === null || P === void 0 ? void 0 : P.bind(T);
|
|
165
|
+
} else {
|
|
166
|
+
if (T)
|
|
167
|
+
return (I = T[C]) === null || I === void 0 ? void 0 : I.bind(T);
|
|
168
|
+
throw new we(`"${f}" plugin is not implemented on ${E}`, Q.Unimplemented);
|
|
169
|
+
}
|
|
170
|
+
}, S = (T) => {
|
|
171
|
+
let C;
|
|
172
|
+
const P = (...I) => {
|
|
173
|
+
const R = p().then((D) => {
|
|
174
|
+
const O = m(D, T);
|
|
175
|
+
if (O) {
|
|
176
|
+
const j = O(...I);
|
|
177
|
+
return C = j?.remove, j;
|
|
178
|
+
} else
|
|
179
|
+
throw new we(`"${f}.${T}()" is not implemented on ${E}`, Q.Unimplemented);
|
|
180
|
+
});
|
|
181
|
+
return T === "addListener" && (R.remove = async () => C()), R;
|
|
182
|
+
};
|
|
183
|
+
return P.toString = () => `${T.toString()}() { [capacitor code] }`, Object.defineProperty(P, "name", {
|
|
184
|
+
value: T,
|
|
185
|
+
writable: !1,
|
|
186
|
+
configurable: !1
|
|
187
|
+
}), P;
|
|
188
|
+
}, g = S("addListener"), x = S("removeListener"), w = (T, C) => {
|
|
189
|
+
const P = g({ eventName: T }, C), I = async () => {
|
|
190
|
+
const D = await P;
|
|
191
|
+
x({
|
|
192
|
+
eventName: T,
|
|
193
|
+
callbackId: D
|
|
194
|
+
}, C);
|
|
195
|
+
}, R = new Promise((D) => P.then(() => D({ remove: I })));
|
|
196
|
+
return R.remove = async () => {
|
|
197
|
+
console.warn("Using addListener() without 'await' is deprecated."), await I();
|
|
198
|
+
}, R;
|
|
199
|
+
}, N = new Proxy({}, {
|
|
200
|
+
get(T, C) {
|
|
201
|
+
switch (C) {
|
|
202
|
+
// https://github.com/facebook/react/issues/20030
|
|
203
|
+
case "$$typeof":
|
|
204
|
+
return;
|
|
205
|
+
case "toJSON":
|
|
206
|
+
return () => ({});
|
|
207
|
+
case "addListener":
|
|
208
|
+
return k ? w : g;
|
|
209
|
+
case "removeListener":
|
|
210
|
+
return x;
|
|
211
|
+
default:
|
|
212
|
+
return S(C);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
return r[f] = N, l.set(f, {
|
|
217
|
+
name: f,
|
|
218
|
+
proxy: N,
|
|
219
|
+
platforms: /* @__PURE__ */ new Set([...Object.keys(v), ...k ? [E] : []])
|
|
220
|
+
}), N;
|
|
221
|
+
};
|
|
222
|
+
return n.convertFileSrc || (n.convertFileSrc = (f) => f), n.getPlatform = a, n.handleError = d, n.isNativePlatform = i, n.isPluginAvailable = c, n.registerPlugin = u, n.Exception = we, n.DEBUG = !!n.DEBUG, n.isLoggingEnabled = !!n.isLoggingEnabled, n;
|
|
223
|
+
}, Lt = (e) => e.Capacitor = Pt(e), Ee = /* @__PURE__ */ Lt(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {}), be = Ee.registerPlugin;
|
|
224
|
+
class Ne {
|
|
225
|
+
constructor() {
|
|
226
|
+
this.listeners = {}, this.retainedEventArguments = {}, this.windowListeners = {};
|
|
227
|
+
}
|
|
228
|
+
addListener(t, n) {
|
|
229
|
+
let r = !1;
|
|
230
|
+
this.listeners[t] || (this.listeners[t] = [], r = !0), this.listeners[t].push(n);
|
|
231
|
+
const i = this.windowListeners[t];
|
|
232
|
+
i && !i.registered && this.addWindowListener(i), r && this.sendRetainedArgumentsForEvent(t);
|
|
233
|
+
const c = async () => this.removeListener(t, n);
|
|
234
|
+
return Promise.resolve({ remove: c });
|
|
235
|
+
}
|
|
236
|
+
async removeAllListeners() {
|
|
237
|
+
this.listeners = {};
|
|
238
|
+
for (const t in this.windowListeners)
|
|
239
|
+
this.removeWindowListener(this.windowListeners[t]);
|
|
240
|
+
this.windowListeners = {};
|
|
241
|
+
}
|
|
242
|
+
notifyListeners(t, n, r) {
|
|
243
|
+
const a = this.listeners[t];
|
|
244
|
+
if (!a) {
|
|
245
|
+
if (r) {
|
|
246
|
+
let i = this.retainedEventArguments[t];
|
|
247
|
+
i || (i = []), i.push(n), this.retainedEventArguments[t] = i;
|
|
248
|
+
}
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
a.forEach((i) => i(n));
|
|
252
|
+
}
|
|
253
|
+
hasListeners(t) {
|
|
254
|
+
var n;
|
|
255
|
+
return !!(!((n = this.listeners[t]) === null || n === void 0) && n.length);
|
|
256
|
+
}
|
|
257
|
+
registerWindowListener(t, n) {
|
|
258
|
+
this.windowListeners[n] = {
|
|
259
|
+
registered: !1,
|
|
260
|
+
windowEventName: t,
|
|
261
|
+
pluginEventName: n,
|
|
262
|
+
handler: (r) => {
|
|
263
|
+
this.notifyListeners(n, r);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
unimplemented(t = "not implemented") {
|
|
268
|
+
return new Ee.Exception(t, Q.Unimplemented);
|
|
269
|
+
}
|
|
270
|
+
unavailable(t = "not available") {
|
|
271
|
+
return new Ee.Exception(t, Q.Unavailable);
|
|
272
|
+
}
|
|
273
|
+
async removeListener(t, n) {
|
|
274
|
+
const r = this.listeners[t];
|
|
275
|
+
if (!r)
|
|
276
|
+
return;
|
|
277
|
+
const a = r.indexOf(n);
|
|
278
|
+
this.listeners[t].splice(a, 1), this.listeners[t].length || this.removeWindowListener(this.windowListeners[t]);
|
|
279
|
+
}
|
|
280
|
+
addWindowListener(t) {
|
|
281
|
+
window.addEventListener(t.windowEventName, t.handler), t.registered = !0;
|
|
282
|
+
}
|
|
283
|
+
removeWindowListener(t) {
|
|
284
|
+
t && (window.removeEventListener(t.windowEventName, t.handler), t.registered = !1);
|
|
285
|
+
}
|
|
286
|
+
sendRetainedArgumentsForEvent(t) {
|
|
287
|
+
const n = this.retainedEventArguments[t];
|
|
288
|
+
n && (delete this.retainedEventArguments[t], n.forEach((r) => {
|
|
289
|
+
this.notifyListeners(t, r);
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const je = (e) => encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape), _e = (e) => e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
294
|
+
class Ct extends Ne {
|
|
295
|
+
async getCookies() {
|
|
296
|
+
const t = document.cookie, n = {};
|
|
297
|
+
return t.split(";").forEach((r) => {
|
|
298
|
+
if (r.length <= 0)
|
|
299
|
+
return;
|
|
300
|
+
let [a, i] = r.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
|
|
301
|
+
a = _e(a).trim(), i = _e(i).trim(), n[a] = i;
|
|
302
|
+
}), n;
|
|
303
|
+
}
|
|
304
|
+
async setCookie(t) {
|
|
305
|
+
try {
|
|
306
|
+
const n = je(t.key), r = je(t.value), a = t.expires ? `; expires=${t.expires.replace("expires=", "")}` : "", i = (t.path || "/").replace("path=", ""), c = t.url != null && t.url.length > 0 ? `domain=${t.url}` : "";
|
|
307
|
+
document.cookie = `${n}=${r || ""}${a}; path=${i}; ${c};`;
|
|
308
|
+
} catch (n) {
|
|
309
|
+
return Promise.reject(n);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
async deleteCookie(t) {
|
|
313
|
+
try {
|
|
314
|
+
document.cookie = `${t.key}=; Max-Age=0`;
|
|
315
|
+
} catch (n) {
|
|
316
|
+
return Promise.reject(n);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
async clearCookies() {
|
|
320
|
+
try {
|
|
321
|
+
const t = document.cookie.split(";") || [];
|
|
322
|
+
for (const n of t)
|
|
323
|
+
document.cookie = n.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
|
|
324
|
+
} catch (t) {
|
|
325
|
+
return Promise.reject(t);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async clearAllCookies() {
|
|
329
|
+
try {
|
|
330
|
+
await this.clearCookies();
|
|
331
|
+
} catch (t) {
|
|
332
|
+
return Promise.reject(t);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
be("CapacitorCookies", {
|
|
337
|
+
web: () => new Ct()
|
|
338
|
+
});
|
|
339
|
+
const Nt = async (e) => new Promise((t, n) => {
|
|
340
|
+
const r = new FileReader();
|
|
341
|
+
r.onload = () => {
|
|
342
|
+
const a = r.result;
|
|
343
|
+
t(a.indexOf(",") >= 0 ? a.split(",")[1] : a);
|
|
344
|
+
}, r.onerror = (a) => n(a), r.readAsDataURL(e);
|
|
345
|
+
}), Tt = (e = {}) => {
|
|
346
|
+
const t = Object.keys(e);
|
|
347
|
+
return Object.keys(e).map((a) => a.toLocaleLowerCase()).reduce((a, i, c) => (a[i] = e[t[c]], a), {});
|
|
348
|
+
}, It = (e, t = !0) => e ? Object.entries(e).reduce((r, a) => {
|
|
349
|
+
const [i, c] = a;
|
|
350
|
+
let s, d;
|
|
351
|
+
return Array.isArray(c) ? (d = "", c.forEach((l) => {
|
|
352
|
+
s = t ? encodeURIComponent(l) : l, d += `${i}=${s}&`;
|
|
353
|
+
}), d.slice(0, -1)) : (s = t ? encodeURIComponent(c) : c, d = `${i}=${s}`), `${r}&${d}`;
|
|
354
|
+
}, "").substr(1) : null, Dt = (e, t = {}) => {
|
|
355
|
+
const n = Object.assign({ method: e.method || "GET", headers: e.headers }, t), a = Tt(e.headers)["content-type"] || "";
|
|
356
|
+
if (typeof e.data == "string")
|
|
357
|
+
n.body = e.data;
|
|
358
|
+
else if (a.includes("application/x-www-form-urlencoded")) {
|
|
359
|
+
const i = new URLSearchParams();
|
|
360
|
+
for (const [c, s] of Object.entries(e.data || {}))
|
|
361
|
+
i.set(c, s);
|
|
362
|
+
n.body = i.toString();
|
|
363
|
+
} else if (a.includes("multipart/form-data") || e.data instanceof FormData) {
|
|
364
|
+
const i = new FormData();
|
|
365
|
+
if (e.data instanceof FormData)
|
|
366
|
+
e.data.forEach((s, d) => {
|
|
367
|
+
i.append(d, s);
|
|
368
|
+
});
|
|
369
|
+
else
|
|
370
|
+
for (const s of Object.keys(e.data))
|
|
371
|
+
i.append(s, e.data[s]);
|
|
372
|
+
n.body = i;
|
|
373
|
+
const c = new Headers(n.headers);
|
|
374
|
+
c.delete("content-type"), n.headers = c;
|
|
375
|
+
} else (a.includes("application/json") || typeof e.data == "object") && (n.body = JSON.stringify(e.data));
|
|
376
|
+
return n;
|
|
377
|
+
};
|
|
378
|
+
class Rt extends Ne {
|
|
379
|
+
/**
|
|
380
|
+
* Perform an Http request given a set of options
|
|
381
|
+
* @param options Options to build the HTTP request
|
|
382
|
+
*/
|
|
383
|
+
async request(t) {
|
|
384
|
+
const n = Dt(t, t.webFetchExtra), r = It(t.params, t.shouldEncodeUrlParams), a = r ? `${t.url}?${r}` : t.url, i = await fetch(a, n), c = i.headers.get("content-type") || "";
|
|
385
|
+
let { responseType: s = "text" } = i.ok ? t : {};
|
|
386
|
+
c.includes("application/json") && (s = "json");
|
|
387
|
+
let d, l;
|
|
388
|
+
switch (s) {
|
|
389
|
+
case "arraybuffer":
|
|
390
|
+
case "blob":
|
|
391
|
+
l = await i.blob(), d = await Nt(l);
|
|
392
|
+
break;
|
|
393
|
+
case "json":
|
|
394
|
+
d = await i.json();
|
|
395
|
+
break;
|
|
396
|
+
default:
|
|
397
|
+
d = await i.text();
|
|
398
|
+
}
|
|
399
|
+
const u = {};
|
|
400
|
+
return i.headers.forEach((f, v) => {
|
|
401
|
+
u[v] = f;
|
|
402
|
+
}), {
|
|
403
|
+
data: d,
|
|
404
|
+
headers: u,
|
|
405
|
+
status: i.status,
|
|
406
|
+
url: i.url
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Perform an Http GET request given a set of options
|
|
411
|
+
* @param options Options to build the HTTP request
|
|
412
|
+
*/
|
|
413
|
+
async get(t) {
|
|
414
|
+
return this.request(Object.assign(Object.assign({}, t), { method: "GET" }));
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Perform an Http POST request given a set of options
|
|
418
|
+
* @param options Options to build the HTTP request
|
|
419
|
+
*/
|
|
420
|
+
async post(t) {
|
|
421
|
+
return this.request(Object.assign(Object.assign({}, t), { method: "POST" }));
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Perform an Http PUT request given a set of options
|
|
425
|
+
* @param options Options to build the HTTP request
|
|
426
|
+
*/
|
|
427
|
+
async put(t) {
|
|
428
|
+
return this.request(Object.assign(Object.assign({}, t), { method: "PUT" }));
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Perform an Http PATCH request given a set of options
|
|
432
|
+
* @param options Options to build the HTTP request
|
|
433
|
+
*/
|
|
434
|
+
async patch(t) {
|
|
435
|
+
return this.request(Object.assign(Object.assign({}, t), { method: "PATCH" }));
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Perform an Http DELETE request given a set of options
|
|
439
|
+
* @param options Options to build the HTTP request
|
|
440
|
+
*/
|
|
441
|
+
async delete(t) {
|
|
442
|
+
return this.request(Object.assign(Object.assign({}, t), { method: "DELETE" }));
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
be("CapacitorHttp", {
|
|
446
|
+
web: () => new Rt()
|
|
447
|
+
});
|
|
448
|
+
var Ae;
|
|
449
|
+
(function(e) {
|
|
450
|
+
e.Dark = "DARK", e.Light = "LIGHT", e.Default = "DEFAULT";
|
|
451
|
+
})(Ae || (Ae = {}));
|
|
452
|
+
var Oe;
|
|
453
|
+
(function(e) {
|
|
454
|
+
e.StatusBar = "StatusBar", e.NavigationBar = "NavigationBar";
|
|
455
|
+
})(Oe || (Oe = {}));
|
|
456
|
+
class $t extends Ne {
|
|
457
|
+
async setStyle() {
|
|
458
|
+
this.unavailable("not available for web");
|
|
459
|
+
}
|
|
460
|
+
async setAnimation() {
|
|
461
|
+
this.unavailable("not available for web");
|
|
462
|
+
}
|
|
463
|
+
async show() {
|
|
464
|
+
this.unavailable("not available for web");
|
|
465
|
+
}
|
|
466
|
+
async hide() {
|
|
467
|
+
this.unavailable("not available for web");
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
be("SystemBars", {
|
|
471
|
+
web: () => new $t()
|
|
472
|
+
});
|
|
473
|
+
var oe;
|
|
474
|
+
(function(e) {
|
|
475
|
+
e.Heavy = "HEAVY", e.Medium = "MEDIUM", e.Light = "LIGHT";
|
|
476
|
+
})(oe || (oe = {}));
|
|
477
|
+
var ie;
|
|
478
|
+
(function(e) {
|
|
479
|
+
e.Success = "SUCCESS", e.Warning = "WARNING", e.Error = "ERROR";
|
|
480
|
+
})(ie || (ie = {}));
|
|
481
|
+
const K = be("Haptics", {
|
|
482
|
+
web: () => import("./web-4j5o-jby.js").then((e) => new e.HapticsWeb())
|
|
483
|
+
}), V = (e) => {
|
|
484
|
+
e().catch(() => {
|
|
485
|
+
});
|
|
486
|
+
}, Y = () => V(() => K.impact({ style: oe.Light })), xe = () => V(() => K.impact({ style: oe.Medium })), rt = () => V(() => K.impact({ style: oe.Heavy })), at = () => V(() => K.notification({ type: ie.Success })), jt = () => V(() => K.notification({ type: ie.Warning })), _t = () => V(() => K.notification({ type: ie.Error })), me = () => V(() => K.selectionStart()), At = {
|
|
487
|
+
// Brand primitives
|
|
488
|
+
ink: "var(--color-ink)",
|
|
489
|
+
paper: "var(--color-paper)",
|
|
490
|
+
accent: "var(--color-accent)",
|
|
491
|
+
// Grammar colors
|
|
492
|
+
noun: "var(--color-noun)",
|
|
493
|
+
topic: "var(--color-topic)",
|
|
494
|
+
subject: "var(--color-subject)",
|
|
495
|
+
object: "var(--color-object)",
|
|
496
|
+
verb: "var(--color-verb)",
|
|
497
|
+
particle: "var(--color-particle)",
|
|
498
|
+
// Semantic status
|
|
499
|
+
success: "var(--color-success)",
|
|
500
|
+
warning: "var(--color-warning)",
|
|
501
|
+
danger: "var(--color-danger)",
|
|
502
|
+
muted: "var(--color-muted)"
|
|
503
|
+
}, Ot = {
|
|
504
|
+
bg: "var(--surface-bg)",
|
|
505
|
+
border: "var(--surface-border)",
|
|
506
|
+
active: "var(--surface-active)",
|
|
507
|
+
solid: "var(--surface-solid)",
|
|
508
|
+
solidHover: "var(--surface-solid-hover)",
|
|
509
|
+
divider: "var(--surface-divider)",
|
|
510
|
+
inputBg: "var(--input-bg)",
|
|
511
|
+
success: "var(--surface-success)",
|
|
512
|
+
warning: "var(--surface-warning)",
|
|
513
|
+
danger: "var(--surface-danger)",
|
|
514
|
+
info: "var(--surface-info)"
|
|
515
|
+
}, Ht = {
|
|
516
|
+
"2xs": "var(--text-2xs)",
|
|
517
|
+
// 11px
|
|
518
|
+
xs: "var(--text-xs)",
|
|
519
|
+
// 12px
|
|
520
|
+
sm: "var(--text-sm)",
|
|
521
|
+
// 13px
|
|
522
|
+
base: "var(--text-base)",
|
|
523
|
+
// 15px — iOS body
|
|
524
|
+
md: "var(--text-md)",
|
|
525
|
+
// 17px — iOS headline
|
|
526
|
+
lg: "var(--text-lg)",
|
|
527
|
+
// 20px
|
|
528
|
+
xl: "var(--text-xl)",
|
|
529
|
+
// 24px
|
|
530
|
+
"2xl": "var(--text-2xl)",
|
|
531
|
+
// 28px
|
|
532
|
+
"3xl": "var(--text-3xl)"
|
|
533
|
+
// 34px — iOS large title
|
|
534
|
+
}, Mt = {
|
|
535
|
+
sans: "var(--font-sans)",
|
|
536
|
+
mono: "var(--font-mono)"
|
|
537
|
+
}, Bt = {
|
|
538
|
+
0: "var(--space-0)",
|
|
539
|
+
0.5: "var(--space-0-5)",
|
|
540
|
+
// 2px
|
|
541
|
+
1: "var(--space-1)",
|
|
542
|
+
// 4px
|
|
543
|
+
1.5: "var(--space-1-5)",
|
|
544
|
+
// 6px
|
|
545
|
+
2: "var(--space-2)",
|
|
546
|
+
// 8px
|
|
547
|
+
2.5: "var(--space-2-5)",
|
|
548
|
+
// 10px
|
|
549
|
+
3: "var(--space-3)",
|
|
550
|
+
// 12px
|
|
551
|
+
3.5: "var(--space-3-5)",
|
|
552
|
+
// 14px
|
|
553
|
+
4: "var(--space-4)",
|
|
554
|
+
// 16px
|
|
555
|
+
5: "var(--space-5)",
|
|
556
|
+
// 20px
|
|
557
|
+
6: "var(--space-6)",
|
|
558
|
+
// 24px
|
|
559
|
+
7: "var(--space-7)",
|
|
560
|
+
// 28px
|
|
561
|
+
8: "var(--space-8)",
|
|
562
|
+
// 32px
|
|
563
|
+
10: "var(--space-10)",
|
|
564
|
+
// 40px
|
|
565
|
+
12: "var(--space-12)",
|
|
566
|
+
// 48px
|
|
567
|
+
16: "var(--space-16)"
|
|
568
|
+
// 64px
|
|
569
|
+
}, Wt = "var(--touch-target)", Yt = {
|
|
570
|
+
xs: "var(--radius-xs)",
|
|
571
|
+
// 6px
|
|
572
|
+
sm: "var(--radius-sm)",
|
|
573
|
+
// 10px
|
|
574
|
+
md: "var(--radius-md)",
|
|
575
|
+
// 14px
|
|
576
|
+
lg: "var(--radius-lg)",
|
|
577
|
+
// 20px
|
|
578
|
+
xl: "var(--radius-xl)",
|
|
579
|
+
// 28px
|
|
580
|
+
full: "var(--radius-full)"
|
|
581
|
+
// 9999px
|
|
582
|
+
}, zt = {
|
|
583
|
+
xs: "var(--shadow-xs)",
|
|
584
|
+
sm: "var(--shadow-sm)",
|
|
585
|
+
md: "var(--shadow-md)",
|
|
586
|
+
lg: "var(--shadow-lg)",
|
|
587
|
+
float: "var(--shadow-float)",
|
|
588
|
+
// floating UI (tab bar, sheets)
|
|
589
|
+
glow: "var(--shadow-glow)"
|
|
590
|
+
// accent glow / focus
|
|
591
|
+
}, Ut = {
|
|
592
|
+
accent: "var(--ring-accent)",
|
|
593
|
+
// accent focus ring (red)
|
|
594
|
+
input: "var(--ring-input)"
|
|
595
|
+
// input focus ring (blue)
|
|
596
|
+
}, Xt = {
|
|
597
|
+
fast: "var(--duration-fast)",
|
|
598
|
+
// 150ms
|
|
599
|
+
base: "var(--duration-base)",
|
|
600
|
+
// 220ms
|
|
601
|
+
slow: "var(--duration-slow)"
|
|
602
|
+
// 380ms
|
|
603
|
+
}, Ft = {
|
|
604
|
+
out: "var(--ease-out)",
|
|
605
|
+
spring: "var(--ease-spring)",
|
|
606
|
+
inOut: "var(--ease-in-out)"
|
|
607
|
+
}, Gt = {
|
|
608
|
+
fast: "var(--transition-fast)",
|
|
609
|
+
base: "var(--transition-base)",
|
|
610
|
+
spring: "var(--transition-spring)"
|
|
611
|
+
}, z = {
|
|
612
|
+
base: 0,
|
|
613
|
+
raised: 10,
|
|
614
|
+
overlay: 40,
|
|
615
|
+
modal: 50,
|
|
616
|
+
toast: 60,
|
|
617
|
+
navbar: 20,
|
|
618
|
+
tabBar: 30,
|
|
619
|
+
sheetBackdrop: 70,
|
|
620
|
+
sheet: 80,
|
|
621
|
+
actionSheetBackdrop: 70,
|
|
622
|
+
actionSheet: 80,
|
|
623
|
+
top: 9999
|
|
624
|
+
}, Zn = {
|
|
625
|
+
color: At,
|
|
626
|
+
surface: Ot,
|
|
627
|
+
text: Ht,
|
|
628
|
+
font: Mt,
|
|
629
|
+
space: Bt,
|
|
630
|
+
touchTarget: Wt,
|
|
631
|
+
radius: Yt,
|
|
632
|
+
shadow: zt,
|
|
633
|
+
ring: Ut,
|
|
634
|
+
duration: Xt,
|
|
635
|
+
ease: Ft,
|
|
636
|
+
transition: Gt,
|
|
637
|
+
z
|
|
638
|
+
};
|
|
639
|
+
function er({ tabs: e, activeTab: t, onChange: n }) {
|
|
640
|
+
return (
|
|
641
|
+
// outer div is full-width pointer-events-none so content underneath is still tappable
|
|
642
|
+
/* @__PURE__ */ o(
|
|
643
|
+
"div",
|
|
644
|
+
{
|
|
645
|
+
className: "fixed bottom-0 left-0 right-0 flex justify-center pointer-events-none",
|
|
646
|
+
style: {
|
|
647
|
+
zIndex: z.tabBar,
|
|
648
|
+
paddingBottom: "calc(env(safe-area-inset-bottom) + 10px)"
|
|
649
|
+
},
|
|
650
|
+
children: /* @__PURE__ */ o("div", { className: "pointer-events-auto flex bg-[var(--surface-bg)] backdrop-blur-2xl rounded-full shadow-[0_4px_32px_rgba(0,0,0,0.18)] border border-[var(--surface-border)] p-1.5 gap-1", children: e.map((r) => /* @__PURE__ */ o(
|
|
651
|
+
Kt,
|
|
652
|
+
{
|
|
653
|
+
icon: r.icon,
|
|
654
|
+
label: r.label,
|
|
655
|
+
active: t === r.id,
|
|
656
|
+
onClick: () => {
|
|
657
|
+
xe(), n(r.id);
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
r.id
|
|
661
|
+
)) })
|
|
662
|
+
}
|
|
663
|
+
)
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
function Kt({
|
|
667
|
+
icon: e,
|
|
668
|
+
label: t,
|
|
669
|
+
active: n,
|
|
670
|
+
onClick: r
|
|
671
|
+
}) {
|
|
672
|
+
return /* @__PURE__ */ y(
|
|
673
|
+
"button",
|
|
674
|
+
{
|
|
675
|
+
onClick: r,
|
|
676
|
+
className: [
|
|
677
|
+
"flex flex-col items-center gap-0.5 px-5 py-2 rounded-full min-w-[72px]",
|
|
678
|
+
"transition-all duration-200 select-none active:scale-[0.93]",
|
|
679
|
+
n ? "bg-[var(--color-ink)]" : "bg-transparent"
|
|
680
|
+
].join(" "),
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ o("span", { className: `text-lg leading-none font-black ${n ? "text-white" : "text-gray-400"}`, children: e }),
|
|
683
|
+
/* @__PURE__ */ o("span", { className: `text-[10px] font-mono uppercase tracking-widest ${n ? "text-white/70" : "text-gray-400"}`, children: t })
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
const Te = se(null);
|
|
689
|
+
function Vt() {
|
|
690
|
+
const e = Z(Te);
|
|
691
|
+
return () => e?.current?.();
|
|
692
|
+
}
|
|
693
|
+
function qt({ children: e, className: t = "" }) {
|
|
694
|
+
const n = L(() => {
|
|
695
|
+
});
|
|
696
|
+
return /* @__PURE__ */ o(Te.Provider, { value: n, children: /* @__PURE__ */ o("div", { className: `h-full flex flex-col bg-[var(--color-paper)] ${t}`, children: e }) });
|
|
697
|
+
}
|
|
698
|
+
function Jt({
|
|
699
|
+
children: e,
|
|
700
|
+
className: t = "",
|
|
701
|
+
includeTabBarInset: n = !0
|
|
702
|
+
}) {
|
|
703
|
+
const r = L(null), a = Z(Te);
|
|
704
|
+
return _(() => {
|
|
705
|
+
if (a)
|
|
706
|
+
return a.current = () => r.current?.scrollTo({ top: 0, behavior: "smooth" }), () => {
|
|
707
|
+
a && (a.current = () => {
|
|
708
|
+
});
|
|
709
|
+
};
|
|
710
|
+
}, [a]), /* @__PURE__ */ o(
|
|
711
|
+
"div",
|
|
712
|
+
{
|
|
713
|
+
ref: r,
|
|
714
|
+
className: `flex-1 overflow-y-auto overscroll-contain ${t}`,
|
|
715
|
+
style: {
|
|
716
|
+
paddingBottom: n ? "calc(env(safe-area-inset-bottom) + 80px)" : "env(safe-area-inset-bottom)"
|
|
717
|
+
},
|
|
718
|
+
children: e
|
|
719
|
+
}
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
function tr({ children: e, className: t = "" }) {
|
|
723
|
+
return /* @__PURE__ */ o(qt, { className: t, children: e });
|
|
724
|
+
}
|
|
725
|
+
function nr({ children: e, className: t = "" }) {
|
|
726
|
+
return /* @__PURE__ */ o(Jt, { includeTabBarInset: !1, className: t, children: e });
|
|
727
|
+
}
|
|
728
|
+
function rr({ title: e, left: t, right: n }) {
|
|
729
|
+
const { pop: r } = tt(), a = kt(), i = Vt(), c = a > 0;
|
|
730
|
+
return /* @__PURE__ */ y(
|
|
731
|
+
"header",
|
|
732
|
+
{
|
|
733
|
+
className: "shrink-0 bg-[var(--surface-bg)] backdrop-blur-2xl flex flex-col",
|
|
734
|
+
style: { paddingTop: "env(safe-area-inset-top)" },
|
|
735
|
+
children: [
|
|
736
|
+
/* @__PURE__ */ y("div", { className: "h-11 flex items-center px-3 gap-1", children: [
|
|
737
|
+
/* @__PURE__ */ o("div", { className: "w-24 flex items-center", children: t !== void 0 ? t : c ? /* @__PURE__ */ o(
|
|
738
|
+
"button",
|
|
739
|
+
{
|
|
740
|
+
onClick: () => {
|
|
741
|
+
xe(), r();
|
|
742
|
+
},
|
|
743
|
+
className: "flex items-center gap-1 text-[var(--color-accent)] font-mono text-xs tracking-wider min-h-[44px] min-w-[44px] active:opacity-40 transition-opacity",
|
|
744
|
+
children: "← back"
|
|
745
|
+
}
|
|
746
|
+
) : null }),
|
|
747
|
+
/* @__PURE__ */ o("div", { className: "flex-1 flex justify-center", children: /* @__PURE__ */ o(
|
|
748
|
+
"button",
|
|
749
|
+
{
|
|
750
|
+
onClick: i,
|
|
751
|
+
className: "text-[15px] font-semibold text-[var(--color-ink)] truncate active:opacity-60 transition-opacity",
|
|
752
|
+
children: e
|
|
753
|
+
}
|
|
754
|
+
) }),
|
|
755
|
+
/* @__PURE__ */ o("div", { className: "w-24 flex items-center justify-end", children: n })
|
|
756
|
+
] }),
|
|
757
|
+
/* @__PURE__ */ o("div", { className: "h-px bg-[var(--surface-divider)]" })
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
function ar({ children: e, className: t = "", onClick: n }) {
|
|
763
|
+
return /* @__PURE__ */ o(
|
|
764
|
+
"div",
|
|
765
|
+
{
|
|
766
|
+
onClick: n,
|
|
767
|
+
className: [
|
|
768
|
+
"bg-[var(--surface-solid)] rounded-2xl border border-[var(--surface-border)] shadow-sm p-5",
|
|
769
|
+
!!n ? "cursor-pointer active:scale-[0.98] active:shadow-none active:bg-[var(--surface-active)] transition-all select-none" : "",
|
|
770
|
+
t
|
|
771
|
+
].join(" "),
|
|
772
|
+
children: e
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
const He = [
|
|
777
|
+
"a[href]",
|
|
778
|
+
"button:not([disabled])",
|
|
779
|
+
"input:not([disabled])",
|
|
780
|
+
"select:not([disabled])",
|
|
781
|
+
"textarea:not([disabled])",
|
|
782
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
783
|
+
"summary",
|
|
784
|
+
'[contenteditable="true"]'
|
|
785
|
+
].join(", ");
|
|
786
|
+
function Qt(e, t, n) {
|
|
787
|
+
const r = L(null);
|
|
788
|
+
_(() => {
|
|
789
|
+
if (!t) {
|
|
790
|
+
r.current && r.current instanceof HTMLElement && r.current.focus({ preventScroll: !0 }), r.current = null;
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
r.current = document.activeElement;
|
|
794
|
+
const i = setTimeout(() => {
|
|
795
|
+
const s = e.current;
|
|
796
|
+
if (!s) return;
|
|
797
|
+
const d = Array.from(
|
|
798
|
+
s.querySelectorAll(He)
|
|
799
|
+
).filter((l) => !l.closest('[aria-hidden="true"]'));
|
|
800
|
+
d.length > 0 ? d[0].focus({ preventScroll: !0 }) : (s.tabIndex = -1, s.focus({ preventScroll: !0 }));
|
|
801
|
+
}, 80), c = (s) => {
|
|
802
|
+
if (s.key === "Escape") {
|
|
803
|
+
s.preventDefault(), n?.();
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
if (s.key !== "Tab") return;
|
|
807
|
+
const d = e.current;
|
|
808
|
+
if (!d) return;
|
|
809
|
+
const l = Array.from(
|
|
810
|
+
d.querySelectorAll(He)
|
|
811
|
+
).filter((v) => !v.closest('[aria-hidden="true"]'));
|
|
812
|
+
if (l.length === 0) return;
|
|
813
|
+
const u = l[0], f = l[l.length - 1];
|
|
814
|
+
s.shiftKey ? document.activeElement === u && (s.preventDefault(), f.focus({ preventScroll: !0 })) : document.activeElement === f && (s.preventDefault(), u.focus({ preventScroll: !0 }));
|
|
815
|
+
};
|
|
816
|
+
return document.addEventListener("keydown", c), () => {
|
|
817
|
+
clearTimeout(i), document.removeEventListener("keydown", c);
|
|
818
|
+
};
|
|
819
|
+
}, [t, e, n]);
|
|
820
|
+
}
|
|
821
|
+
const Zt = {
|
|
822
|
+
sm: 16,
|
|
823
|
+
md: 24,
|
|
824
|
+
lg: 36
|
|
825
|
+
}, en = {
|
|
826
|
+
sm: 2,
|
|
827
|
+
md: 2.5,
|
|
828
|
+
lg: 3
|
|
829
|
+
};
|
|
830
|
+
function ot({
|
|
831
|
+
size: e,
|
|
832
|
+
color: t,
|
|
833
|
+
ariaLabel: n,
|
|
834
|
+
className: r = ""
|
|
835
|
+
}) {
|
|
836
|
+
const a = Zt[e], i = en[e], c = (a - i * 2) / 2, s = a / 2, d = 2 * Math.PI * c, l = d * 0.75, u = d * 0.25;
|
|
837
|
+
return /* @__PURE__ */ y(
|
|
838
|
+
"svg",
|
|
839
|
+
{
|
|
840
|
+
role: "progressbar",
|
|
841
|
+
"aria-label": n,
|
|
842
|
+
"aria-valuetext": n,
|
|
843
|
+
width: a,
|
|
844
|
+
height: a,
|
|
845
|
+
viewBox: `0 0 ${a} ${a}`,
|
|
846
|
+
fill: "none",
|
|
847
|
+
className: ["kami-spinner", r].filter(Boolean).join(" "),
|
|
848
|
+
style: {
|
|
849
|
+
animationName: "kami-spin",
|
|
850
|
+
animationDuration: "0.8s",
|
|
851
|
+
animationTimingFunction: "linear",
|
|
852
|
+
animationIterationCount: "infinite",
|
|
853
|
+
flexShrink: 0,
|
|
854
|
+
display: "block"
|
|
855
|
+
},
|
|
856
|
+
children: [
|
|
857
|
+
/* @__PURE__ */ o(
|
|
858
|
+
"circle",
|
|
859
|
+
{
|
|
860
|
+
cx: s,
|
|
861
|
+
cy: s,
|
|
862
|
+
r: c,
|
|
863
|
+
stroke: t,
|
|
864
|
+
strokeWidth: i,
|
|
865
|
+
strokeOpacity: 0.2
|
|
866
|
+
}
|
|
867
|
+
),
|
|
868
|
+
/* @__PURE__ */ o(
|
|
869
|
+
"circle",
|
|
870
|
+
{
|
|
871
|
+
cx: s,
|
|
872
|
+
cy: s,
|
|
873
|
+
r: c,
|
|
874
|
+
stroke: t,
|
|
875
|
+
strokeWidth: i,
|
|
876
|
+
strokeLinecap: "round",
|
|
877
|
+
strokeDasharray: `${l} ${u}`,
|
|
878
|
+
strokeDashoffset: 0
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
function it({
|
|
886
|
+
size: e = "md",
|
|
887
|
+
color: t = "var(--color-accent)",
|
|
888
|
+
"aria-label": n = "Loading",
|
|
889
|
+
className: r = ""
|
|
890
|
+
}) {
|
|
891
|
+
return /* @__PURE__ */ o(
|
|
892
|
+
ot,
|
|
893
|
+
{
|
|
894
|
+
size: e,
|
|
895
|
+
color: t,
|
|
896
|
+
ariaLabel: n,
|
|
897
|
+
className: r
|
|
898
|
+
}
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
function tn({ visible: e, label: t, backdropOpacity: n = 0.5 }) {
|
|
902
|
+
const r = L(null);
|
|
903
|
+
return Qt(r, e), _(() => {
|
|
904
|
+
if (!e) return;
|
|
905
|
+
const a = document.body.style.overflow;
|
|
906
|
+
return document.body.style.overflow = "hidden", () => {
|
|
907
|
+
document.body.style.overflow = a;
|
|
908
|
+
};
|
|
909
|
+
}, [e]), e ? /* @__PURE__ */ o(
|
|
910
|
+
"div",
|
|
911
|
+
{
|
|
912
|
+
role: "dialog",
|
|
913
|
+
"aria-modal": "true",
|
|
914
|
+
"aria-label": t ?? "Loading",
|
|
915
|
+
"aria-busy": "true",
|
|
916
|
+
ref: r,
|
|
917
|
+
style: {
|
|
918
|
+
position: "fixed",
|
|
919
|
+
inset: 0,
|
|
920
|
+
zIndex: 9999,
|
|
921
|
+
display: "flex",
|
|
922
|
+
alignItems: "center",
|
|
923
|
+
justifyContent: "center",
|
|
924
|
+
flexDirection: "column",
|
|
925
|
+
gap: 16,
|
|
926
|
+
backgroundColor: `rgba(0, 0, 0, ${n})`,
|
|
927
|
+
backdropFilter: "blur(4px)",
|
|
928
|
+
WebkitBackdropFilter: "blur(4px)"
|
|
929
|
+
},
|
|
930
|
+
children: /* @__PURE__ */ y(
|
|
931
|
+
"div",
|
|
932
|
+
{
|
|
933
|
+
style: {
|
|
934
|
+
background: "var(--surface-solid)",
|
|
935
|
+
borderRadius: 20,
|
|
936
|
+
padding: "28px 36px",
|
|
937
|
+
display: "flex",
|
|
938
|
+
flexDirection: "column",
|
|
939
|
+
alignItems: "center",
|
|
940
|
+
gap: 14,
|
|
941
|
+
boxShadow: "var(--shadow-float)",
|
|
942
|
+
minWidth: 120
|
|
943
|
+
},
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ o(ot, { size: "lg", color: "var(--color-accent)", ariaLabel: t ?? "Loading" }),
|
|
946
|
+
t && /* @__PURE__ */ o("p", { style: {
|
|
947
|
+
fontSize: 15,
|
|
948
|
+
fontWeight: 500,
|
|
949
|
+
color: "var(--color-ink)",
|
|
950
|
+
margin: 0,
|
|
951
|
+
lineHeight: 1.3,
|
|
952
|
+
textAlign: "center"
|
|
953
|
+
}, children: t })
|
|
954
|
+
]
|
|
955
|
+
}
|
|
956
|
+
)
|
|
957
|
+
}
|
|
958
|
+
) : null;
|
|
959
|
+
}
|
|
960
|
+
it.Overlay = tn;
|
|
961
|
+
const nn = {
|
|
962
|
+
primary: "bg-[var(--color-ink)] text-[var(--color-paper)] active:opacity-75",
|
|
963
|
+
secondary: "bg-[var(--input-bg)] text-[var(--color-ink)] active:bg-[var(--surface-divider)]",
|
|
964
|
+
ghost: "text-[var(--color-accent)] active:opacity-50"
|
|
965
|
+
}, rn = {
|
|
966
|
+
primary: "var(--color-paper)",
|
|
967
|
+
secondary: "var(--color-ink)",
|
|
968
|
+
ghost: "var(--color-accent)"
|
|
969
|
+
};
|
|
970
|
+
function an({
|
|
971
|
+
children: e,
|
|
972
|
+
onClick: t,
|
|
973
|
+
variant: n = "primary",
|
|
974
|
+
disabled: r = !1,
|
|
975
|
+
loading: a = !1,
|
|
976
|
+
className: i = "",
|
|
977
|
+
fullWidth: c = !1,
|
|
978
|
+
type: s = "button",
|
|
979
|
+
"aria-label": d,
|
|
980
|
+
"aria-pressed": l,
|
|
981
|
+
"aria-expanded": u,
|
|
982
|
+
"aria-controls": f
|
|
983
|
+
}) {
|
|
984
|
+
const v = r || a;
|
|
985
|
+
return /* @__PURE__ */ y(
|
|
986
|
+
"button",
|
|
987
|
+
{
|
|
988
|
+
type: s,
|
|
989
|
+
onClick: t,
|
|
990
|
+
disabled: v,
|
|
991
|
+
"aria-label": d,
|
|
992
|
+
"aria-pressed": l,
|
|
993
|
+
"aria-expanded": u,
|
|
994
|
+
"aria-controls": f,
|
|
995
|
+
"aria-busy": a || void 0,
|
|
996
|
+
className: [
|
|
997
|
+
// 44px min touch target (Apple HIG)
|
|
998
|
+
"min-h-[44px] px-5 rounded-xl font-semibold text-[15px]",
|
|
999
|
+
"transition-all select-none",
|
|
1000
|
+
// Use relative + flex to position spinner without layout shift
|
|
1001
|
+
"relative flex items-center justify-center gap-2",
|
|
1002
|
+
c ? "w-full" : "",
|
|
1003
|
+
nn[n],
|
|
1004
|
+
v ? "opacity-40 pointer-events-none" : "",
|
|
1005
|
+
i
|
|
1006
|
+
].join(" "),
|
|
1007
|
+
children: [
|
|
1008
|
+
a && /* @__PURE__ */ o(
|
|
1009
|
+
it,
|
|
1010
|
+
{
|
|
1011
|
+
size: "sm",
|
|
1012
|
+
color: rn[n],
|
|
1013
|
+
"aria-label": "Loading"
|
|
1014
|
+
}
|
|
1015
|
+
),
|
|
1016
|
+
/* @__PURE__ */ o("span", { className: a ? "opacity-0 select-none pointer-events-none absolute" : "", children: e })
|
|
1017
|
+
]
|
|
1018
|
+
}
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
function or({ children: e, className: t = "", inset: n = !1 }) {
|
|
1022
|
+
return /* @__PURE__ */ o(
|
|
1023
|
+
"div",
|
|
1024
|
+
{
|
|
1025
|
+
className: [
|
|
1026
|
+
"bg-white overflow-hidden",
|
|
1027
|
+
n ? "mx-4 rounded-2xl border border-gray-100 shadow-sm" : "border-y border-gray-100",
|
|
1028
|
+
t
|
|
1029
|
+
].join(" "),
|
|
1030
|
+
children: /* @__PURE__ */ o("div", { className: "divide-y divide-gray-100", children: e })
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
function ir({
|
|
1035
|
+
title: e,
|
|
1036
|
+
subtitle: t,
|
|
1037
|
+
media: n,
|
|
1038
|
+
after: r,
|
|
1039
|
+
chevron: a = !1,
|
|
1040
|
+
onClick: i,
|
|
1041
|
+
className: c = ""
|
|
1042
|
+
}) {
|
|
1043
|
+
return /* @__PURE__ */ y(
|
|
1044
|
+
i ? "button" : "div",
|
|
1045
|
+
{
|
|
1046
|
+
onClick: i,
|
|
1047
|
+
className: [
|
|
1048
|
+
"w-full text-left flex items-center gap-3 px-4 py-3",
|
|
1049
|
+
"min-h-[44px] select-none",
|
|
1050
|
+
// 44px Apple HIG touch target
|
|
1051
|
+
i ? "active:bg-gray-50 transition-colors cursor-pointer" : "",
|
|
1052
|
+
c
|
|
1053
|
+
].join(" "),
|
|
1054
|
+
children: [
|
|
1055
|
+
n && /* @__PURE__ */ o("div", { className: "shrink-0 flex items-center justify-center", children: n }),
|
|
1056
|
+
/* @__PURE__ */ y("div", { className: "flex-1 min-w-0 text-left", children: [
|
|
1057
|
+
/* @__PURE__ */ o("p", { className: "text-[15px] font-medium text-[var(--color-ink)] leading-snug", children: e }),
|
|
1058
|
+
t && /* @__PURE__ */ o("p", { className: "text-[13px] text-gray-500 mt-0.5 leading-snug", children: t })
|
|
1059
|
+
] }),
|
|
1060
|
+
r && /* @__PURE__ */ o("div", { className: "shrink-0 text-[13px] text-gray-400", children: r }),
|
|
1061
|
+
a && /* @__PURE__ */ o("span", { className: "shrink-0 text-gray-300 text-lg leading-none", children: "›" })
|
|
1062
|
+
]
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
function sr({ children: e, className: t = "" }) {
|
|
1067
|
+
return /* @__PURE__ */ o("p", { className: `text-xs font-mono text-gray-400 uppercase tracking-widest px-4 pt-6 pb-2 ${t}`, children: e });
|
|
1068
|
+
}
|
|
1069
|
+
function H({ className: e = "", style: t }) {
|
|
1070
|
+
return /* @__PURE__ */ o(
|
|
1071
|
+
"div",
|
|
1072
|
+
{
|
|
1073
|
+
"aria-hidden": "true",
|
|
1074
|
+
className: [
|
|
1075
|
+
"animate-pulse rounded-lg bg-[var(--input-bg)]",
|
|
1076
|
+
e
|
|
1077
|
+
].join(" "),
|
|
1078
|
+
style: t
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
function st({ lines: e = 1, className: t = "" }) {
|
|
1083
|
+
return /* @__PURE__ */ o("div", { className: ["space-y-2", t].join(" "), "aria-hidden": "true", children: Array.from({ length: e }).map((n, r) => /* @__PURE__ */ o(
|
|
1084
|
+
H,
|
|
1085
|
+
{
|
|
1086
|
+
className: [
|
|
1087
|
+
"h-3",
|
|
1088
|
+
r === e - 1 && e > 1 ? "w-3/5" : "w-full"
|
|
1089
|
+
].join(" ")
|
|
1090
|
+
},
|
|
1091
|
+
r
|
|
1092
|
+
)) });
|
|
1093
|
+
}
|
|
1094
|
+
function on({ size: e = 40, className: t = "" }) {
|
|
1095
|
+
return /* @__PURE__ */ o(
|
|
1096
|
+
H,
|
|
1097
|
+
{
|
|
1098
|
+
className: ["rounded-full shrink-0", t].join(" "),
|
|
1099
|
+
style: { width: e, height: e }
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
function sn({ width: e = "100%", height: t = 12, className: n = "", style: r }) {
|
|
1104
|
+
return /* @__PURE__ */ o(
|
|
1105
|
+
H,
|
|
1106
|
+
{
|
|
1107
|
+
className: n,
|
|
1108
|
+
style: { width: e, height: t, ...r }
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
function lt({ className: e = "" }) {
|
|
1113
|
+
return /* @__PURE__ */ y(
|
|
1114
|
+
"div",
|
|
1115
|
+
{
|
|
1116
|
+
"aria-hidden": "true",
|
|
1117
|
+
className: [
|
|
1118
|
+
"bg-[var(--surface-bg)] rounded-3xl border border-[var(--surface-border)]",
|
|
1119
|
+
"shadow-[0_2px_16px_rgba(0,0,0,0.06)] p-5 space-y-3",
|
|
1120
|
+
e
|
|
1121
|
+
].join(" "),
|
|
1122
|
+
children: [
|
|
1123
|
+
/* @__PURE__ */ y("div", { className: "flex items-center gap-2", children: [
|
|
1124
|
+
/* @__PURE__ */ o(H, { className: "w-2 h-2 rounded-full" }),
|
|
1125
|
+
/* @__PURE__ */ o(H, { className: "h-2.5 w-20" })
|
|
1126
|
+
] }),
|
|
1127
|
+
/* @__PURE__ */ o(H, { className: "h-4 w-4/5" }),
|
|
1128
|
+
/* @__PURE__ */ o(H, { className: "h-3 w-3/5" })
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
function ln({ className: e = "" }) {
|
|
1134
|
+
return /* @__PURE__ */ y(
|
|
1135
|
+
"div",
|
|
1136
|
+
{
|
|
1137
|
+
"aria-hidden": "true",
|
|
1138
|
+
className: [
|
|
1139
|
+
"bg-[var(--surface-bg)] rounded-3xl border border-[var(--surface-border)]",
|
|
1140
|
+
"shadow-[0_2px_16px_rgba(0,0,0,0.06)] p-5 space-y-2.5",
|
|
1141
|
+
e
|
|
1142
|
+
].join(" "),
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ o(H, { className: "h-2.5 w-24" }),
|
|
1145
|
+
/* @__PURE__ */ o(H, { className: "h-7 w-2/3" }),
|
|
1146
|
+
/* @__PURE__ */ o(H, { className: "h-2.5 w-1/2" }),
|
|
1147
|
+
/* @__PURE__ */ o(H, { className: "h-3 w-4/5" })
|
|
1148
|
+
]
|
|
1149
|
+
}
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
function cn({ className: e = "" }) {
|
|
1153
|
+
return /* @__PURE__ */ y(
|
|
1154
|
+
"div",
|
|
1155
|
+
{
|
|
1156
|
+
"aria-hidden": "true",
|
|
1157
|
+
className: [
|
|
1158
|
+
"bg-[var(--surface-solid)] rounded-2xl border border-[var(--surface-border)]",
|
|
1159
|
+
"shadow-sm p-5 space-y-3",
|
|
1160
|
+
e
|
|
1161
|
+
].join(" "),
|
|
1162
|
+
children: [
|
|
1163
|
+
/* @__PURE__ */ o(H, { className: "h-4 w-3/4" }),
|
|
1164
|
+
/* @__PURE__ */ o(st, { lines: 2 })
|
|
1165
|
+
]
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
function dn({ count: e = 6, className: t = "" }) {
|
|
1170
|
+
return /* @__PURE__ */ o("div", { className: ["grid grid-cols-1 md:grid-cols-2 gap-3", t].join(" "), children: Array.from({ length: e }).map((n, r) => /* @__PURE__ */ o(lt, {}, r)) });
|
|
1171
|
+
}
|
|
1172
|
+
const lr = {
|
|
1173
|
+
/** Shimmer rectangle — use for arbitrary shapes. */
|
|
1174
|
+
Box: H,
|
|
1175
|
+
/** One or more text lines (last line shorter for realism). */
|
|
1176
|
+
Text: st,
|
|
1177
|
+
/** Circle — for avatars, icons. */
|
|
1178
|
+
Circle: on,
|
|
1179
|
+
/** Single horizontal bar at arbitrary width/height. */
|
|
1180
|
+
Line: sn,
|
|
1181
|
+
/** Full lesson card placeholder (matches LessonCard shape). */
|
|
1182
|
+
LessonCard: lt,
|
|
1183
|
+
/** SOS phrase card placeholder. */
|
|
1184
|
+
PhraseCard: ln,
|
|
1185
|
+
/** Generic white card placeholder (matches Card component). */
|
|
1186
|
+
Card: cn,
|
|
1187
|
+
/** Full two-column responsive grid of LessonCard skeletons. */
|
|
1188
|
+
LessonGrid: dn
|
|
1189
|
+
};
|
|
1190
|
+
function un({
|
|
1191
|
+
title: e = "Something went wrong",
|
|
1192
|
+
message: t,
|
|
1193
|
+
onRetry: n,
|
|
1194
|
+
className: r = ""
|
|
1195
|
+
}) {
|
|
1196
|
+
return /* @__PURE__ */ y(
|
|
1197
|
+
"div",
|
|
1198
|
+
{
|
|
1199
|
+
className: [
|
|
1200
|
+
"flex flex-col items-center justify-center text-center py-12 px-6 space-y-3",
|
|
1201
|
+
r
|
|
1202
|
+
].join(" "),
|
|
1203
|
+
children: [
|
|
1204
|
+
/* @__PURE__ */ o("span", { className: "text-4xl select-none", "aria-hidden": "true", children: "⚠️" }),
|
|
1205
|
+
/* @__PURE__ */ o("p", { className: "font-bold text-[var(--color-ink)] text-base", children: e }),
|
|
1206
|
+
t && /* @__PURE__ */ o("p", { className: "text-sm text-[var(--color-muted)] font-mono leading-snug max-w-xs", children: t }),
|
|
1207
|
+
n && /* @__PURE__ */ o(
|
|
1208
|
+
"button",
|
|
1209
|
+
{
|
|
1210
|
+
onClick: n,
|
|
1211
|
+
className: [
|
|
1212
|
+
"mt-2 px-5 py-2 rounded-xl text-sm font-semibold",
|
|
1213
|
+
"bg-[var(--color-accent)] text-white",
|
|
1214
|
+
"active:opacity-70 transition-opacity"
|
|
1215
|
+
].join(" "),
|
|
1216
|
+
children: "Try again"
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
]
|
|
1220
|
+
}
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
class cr extends yt {
|
|
1224
|
+
constructor(t) {
|
|
1225
|
+
super(t), this.state = { hasError: !1, error: null };
|
|
1226
|
+
}
|
|
1227
|
+
static getDerivedStateFromError(t) {
|
|
1228
|
+
return { hasError: !0, error: t };
|
|
1229
|
+
}
|
|
1230
|
+
componentDidCatch(t, n) {
|
|
1231
|
+
this.props.onError?.(t, n), Promise.resolve().then(() => {
|
|
1232
|
+
}).catch(() => {
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
handleRetry = () => {
|
|
1236
|
+
this.setState({ hasError: !1, error: null });
|
|
1237
|
+
};
|
|
1238
|
+
render() {
|
|
1239
|
+
return this.state.hasError ? this.props.fallback !== void 0 ? this.props.fallback : /* @__PURE__ */ o(
|
|
1240
|
+
un,
|
|
1241
|
+
{
|
|
1242
|
+
title: "Something went wrong",
|
|
1243
|
+
message: this.state.error?.message,
|
|
1244
|
+
onRetry: this.handleRetry
|
|
1245
|
+
}
|
|
1246
|
+
) : this.props.children;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
const ct = se(null);
|
|
1250
|
+
function dr() {
|
|
1251
|
+
const e = Z(ct);
|
|
1252
|
+
if (!e) throw new Error("useToast must be used within <ToastProvider>");
|
|
1253
|
+
return e;
|
|
1254
|
+
}
|
|
1255
|
+
const fn = {
|
|
1256
|
+
default: { bg: "bg-[var(--color-ink)] text-white dark:bg-[var(--surface-solid)]", icon: "" },
|
|
1257
|
+
success: { bg: "bg-[var(--surface-success)] text-[var(--color-success)]", icon: "✓" },
|
|
1258
|
+
error: { bg: "bg-[var(--surface-danger)] text-[var(--color-danger)]", icon: "✕" },
|
|
1259
|
+
info: { bg: "bg-[var(--surface-info)] text-[var(--color-subject)]", icon: "ℹ" },
|
|
1260
|
+
warning: { bg: "bg-[var(--surface-warning)] text-[var(--color-warning)]", icon: "⚠" }
|
|
1261
|
+
};
|
|
1262
|
+
function Me({
|
|
1263
|
+
item: e,
|
|
1264
|
+
onDismiss: t
|
|
1265
|
+
}) {
|
|
1266
|
+
const n = fn[e.variant], r = L(null), a = $((i) => {
|
|
1267
|
+
i && i.animate(
|
|
1268
|
+
[
|
|
1269
|
+
{ opacity: 0, transform: "translateY(16px) scale(0.96)" },
|
|
1270
|
+
{ opacity: 1, transform: "translateY(0) scale(1)" }
|
|
1271
|
+
],
|
|
1272
|
+
{ duration: 260, easing: "cubic-bezier(0.34, 1.28, 0.64, 1)", fill: "forwards" }
|
|
1273
|
+
);
|
|
1274
|
+
}, []);
|
|
1275
|
+
return /* @__PURE__ */ o(
|
|
1276
|
+
"div",
|
|
1277
|
+
{
|
|
1278
|
+
ref: r,
|
|
1279
|
+
style: { opacity: e.exiting ? 0 : void 0, transition: e.exiting ? "opacity 200ms ease" : void 0 },
|
|
1280
|
+
children: /* @__PURE__ */ y(
|
|
1281
|
+
"div",
|
|
1282
|
+
{
|
|
1283
|
+
ref: a,
|
|
1284
|
+
className: [
|
|
1285
|
+
"flex items-center gap-2 px-4 py-3 rounded-2xl shadow-[var(--shadow-md)]",
|
|
1286
|
+
"max-w-[calc(100vw-48px)] min-w-[180px]",
|
|
1287
|
+
n.bg
|
|
1288
|
+
].join(" "),
|
|
1289
|
+
children: [
|
|
1290
|
+
n.icon && /* @__PURE__ */ o("span", { className: "text-base font-bold shrink-0 leading-none", children: n.icon }),
|
|
1291
|
+
/* @__PURE__ */ o("span", { className: "text-sm font-semibold leading-snug flex-1", children: e.message }),
|
|
1292
|
+
e.action && /* @__PURE__ */ o(
|
|
1293
|
+
"button",
|
|
1294
|
+
{
|
|
1295
|
+
onClick: () => {
|
|
1296
|
+
e.action.onPress(), t(e.id);
|
|
1297
|
+
},
|
|
1298
|
+
className: "text-xs font-bold opacity-70 hover:opacity-100 uppercase tracking-wide shrink-0 active:opacity-50 pl-2",
|
|
1299
|
+
children: e.action.label
|
|
1300
|
+
}
|
|
1301
|
+
)
|
|
1302
|
+
]
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
}
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
let hn = 1;
|
|
1309
|
+
function ur({ children: e }) {
|
|
1310
|
+
const [t, n] = B([]), r = $((s) => {
|
|
1311
|
+
n((d) => d.map((l) => l.id === s ? { ...l, exiting: !0 } : l)), setTimeout(() => {
|
|
1312
|
+
n((d) => d.filter((l) => l.id !== s));
|
|
1313
|
+
}, 220);
|
|
1314
|
+
}, []), a = $((s, d = {}) => {
|
|
1315
|
+
const l = hn++, u = d.duration ?? 2600, f = {
|
|
1316
|
+
id: l,
|
|
1317
|
+
message: s,
|
|
1318
|
+
variant: d.variant ?? "default",
|
|
1319
|
+
duration: u,
|
|
1320
|
+
position: d.position ?? "bottom",
|
|
1321
|
+
action: d.action,
|
|
1322
|
+
exiting: !1
|
|
1323
|
+
};
|
|
1324
|
+
n((v) => [...v.slice(-3), f]), setTimeout(() => r(l), u);
|
|
1325
|
+
}, [r]), i = t.filter((s) => s.position === "bottom"), c = t.filter((s) => s.position === "top");
|
|
1326
|
+
return /* @__PURE__ */ y(ct.Provider, { value: { show: a }, children: [
|
|
1327
|
+
e,
|
|
1328
|
+
i.length > 0 && /* @__PURE__ */ o(
|
|
1329
|
+
"div",
|
|
1330
|
+
{
|
|
1331
|
+
className: "fixed inset-x-0 bottom-0 flex flex-col items-center gap-2 pb-[calc(env(safe-area-inset-bottom)+68px)] pointer-events-none",
|
|
1332
|
+
style: { zIndex: z.toast },
|
|
1333
|
+
"aria-live": "polite",
|
|
1334
|
+
"aria-atomic": "true",
|
|
1335
|
+
children: i.map((s) => /* @__PURE__ */ o("div", { className: "pointer-events-auto", children: /* @__PURE__ */ o(Me, { item: s, onDismiss: r }) }, s.id))
|
|
1336
|
+
}
|
|
1337
|
+
),
|
|
1338
|
+
c.length > 0 && /* @__PURE__ */ o(
|
|
1339
|
+
"div",
|
|
1340
|
+
{
|
|
1341
|
+
className: "fixed inset-x-0 top-0 flex flex-col items-center gap-2 pt-[calc(env(safe-area-inset-top)+12px)] pointer-events-none",
|
|
1342
|
+
style: { zIndex: z.toast },
|
|
1343
|
+
"aria-live": "polite",
|
|
1344
|
+
"aria-atomic": "true",
|
|
1345
|
+
children: c.map((s) => /* @__PURE__ */ o("div", { className: "pointer-events-auto", children: /* @__PURE__ */ o(Me, { item: s, onDismiss: r }) }, s.id))
|
|
1346
|
+
}
|
|
1347
|
+
)
|
|
1348
|
+
] });
|
|
1349
|
+
}
|
|
1350
|
+
const de = {
|
|
1351
|
+
enter: { duration: 360, easing: "cubic-bezier(0.34, 1.28, 0.64, 1)" },
|
|
1352
|
+
exit: { duration: 240, easing: "cubic-bezier(0.4, 0, 0.6, 1)" }
|
|
1353
|
+
};
|
|
1354
|
+
function dt({ open: e, onClose: t, title: n, children: r }) {
|
|
1355
|
+
const a = L(null), i = L(null), c = L(!1);
|
|
1356
|
+
_(() => {
|
|
1357
|
+
const u = a.current, f = i.current;
|
|
1358
|
+
if (!(!u || !f)) {
|
|
1359
|
+
if (e && !c.current)
|
|
1360
|
+
u.style.display = "block", f.style.display = "block", u.animate(
|
|
1361
|
+
[{ opacity: 0 }, { opacity: 1 }],
|
|
1362
|
+
{ ...de.enter, fill: "forwards" }
|
|
1363
|
+
), f.animate(
|
|
1364
|
+
[
|
|
1365
|
+
{ transform: "translateY(100%)" },
|
|
1366
|
+
{ transform: "translateY(0)" }
|
|
1367
|
+
],
|
|
1368
|
+
{ ...de.enter, fill: "forwards" }
|
|
1369
|
+
);
|
|
1370
|
+
else if (!e && c.current) {
|
|
1371
|
+
const v = u.animate(
|
|
1372
|
+
[{ opacity: 1 }, { opacity: 0 }],
|
|
1373
|
+
{ ...de.exit, fill: "forwards" }
|
|
1374
|
+
);
|
|
1375
|
+
f.animate(
|
|
1376
|
+
[
|
|
1377
|
+
{ transform: "translateY(0)" },
|
|
1378
|
+
{ transform: "translateY(100%)" }
|
|
1379
|
+
],
|
|
1380
|
+
{ ...de.exit, fill: "forwards" }
|
|
1381
|
+
), v.onfinish = () => {
|
|
1382
|
+
u.style.display = "none", f.style.display = "none";
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
c.current = e;
|
|
1386
|
+
}
|
|
1387
|
+
}, [e]);
|
|
1388
|
+
const s = L(null), d = $((u) => {
|
|
1389
|
+
s.current = u.touches[0].clientY;
|
|
1390
|
+
}, []), l = $((u) => {
|
|
1391
|
+
if (s.current === null) return;
|
|
1392
|
+
u.changedTouches[0].clientY - s.current > 60 && t(), s.current = null;
|
|
1393
|
+
}, [t]);
|
|
1394
|
+
return /* @__PURE__ */ y(G, { children: [
|
|
1395
|
+
/* @__PURE__ */ o(
|
|
1396
|
+
"div",
|
|
1397
|
+
{
|
|
1398
|
+
ref: a,
|
|
1399
|
+
style: { display: "none", zIndex: z.sheetBackdrop },
|
|
1400
|
+
className: "fixed inset-0 bg-black/40 backdrop-blur-sm",
|
|
1401
|
+
onClick: t,
|
|
1402
|
+
"aria-hidden": "true"
|
|
1403
|
+
}
|
|
1404
|
+
),
|
|
1405
|
+
/* @__PURE__ */ y(
|
|
1406
|
+
"div",
|
|
1407
|
+
{
|
|
1408
|
+
ref: i,
|
|
1409
|
+
role: "dialog",
|
|
1410
|
+
"aria-modal": "true",
|
|
1411
|
+
"aria-label": n,
|
|
1412
|
+
style: { display: "none", zIndex: z.sheet },
|
|
1413
|
+
className: [
|
|
1414
|
+
"fixed inset-x-0 bottom-0",
|
|
1415
|
+
"bg-[var(--surface-solid)] rounded-t-[28px]",
|
|
1416
|
+
"shadow-[var(--shadow-float)]",
|
|
1417
|
+
"max-h-[90dvh] flex flex-col"
|
|
1418
|
+
].join(" "),
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ y(
|
|
1421
|
+
"div",
|
|
1422
|
+
{
|
|
1423
|
+
className: "flex flex-col items-center pt-3 pb-2 cursor-grab active:cursor-grabbing select-none shrink-0",
|
|
1424
|
+
onTouchStart: d,
|
|
1425
|
+
onTouchEnd: l,
|
|
1426
|
+
children: [
|
|
1427
|
+
/* @__PURE__ */ o("div", { className: "w-9 h-1 bg-[var(--surface-divider)] rounded-full mb-3" }),
|
|
1428
|
+
n && /* @__PURE__ */ o("p", { className: "text-[17px] font-semibold text-[var(--color-ink)] pb-1", children: n })
|
|
1429
|
+
]
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
/* @__PURE__ */ o(
|
|
1433
|
+
"div",
|
|
1434
|
+
{
|
|
1435
|
+
className: "overflow-y-auto px-4 pb-[calc(env(safe-area-inset-bottom)+16px)] flex-1",
|
|
1436
|
+
children: r
|
|
1437
|
+
}
|
|
1438
|
+
)
|
|
1439
|
+
]
|
|
1440
|
+
}
|
|
1441
|
+
)
|
|
1442
|
+
] });
|
|
1443
|
+
}
|
|
1444
|
+
const J = {
|
|
1445
|
+
enter: { duration: 340, easing: "cubic-bezier(0.34, 1.28, 0.64, 1)" },
|
|
1446
|
+
exit: { duration: 200, easing: "cubic-bezier(0.4, 0, 0.6, 1)" }
|
|
1447
|
+
};
|
|
1448
|
+
function fr({ open: e, onClose: t, title: n, actions: r }) {
|
|
1449
|
+
const a = L(null), i = L(null), c = L(null), s = L(!1);
|
|
1450
|
+
_(() => {
|
|
1451
|
+
const l = a.current, u = i.current, f = c.current;
|
|
1452
|
+
if (!(!l || !u || !f)) {
|
|
1453
|
+
if (e && !s.current)
|
|
1454
|
+
l.style.display = "block", u.style.display = "block", f.style.display = "block", l.animate(
|
|
1455
|
+
[{ opacity: 0 }, { opacity: 1 }],
|
|
1456
|
+
{ ...J.enter, fill: "forwards" }
|
|
1457
|
+
), u.animate(
|
|
1458
|
+
[
|
|
1459
|
+
{ opacity: 0, transform: "translateY(20px) scale(0.97)" },
|
|
1460
|
+
{ opacity: 1, transform: "translateY(0) scale(1)" }
|
|
1461
|
+
],
|
|
1462
|
+
{ ...J.enter, fill: "forwards" }
|
|
1463
|
+
), f.animate(
|
|
1464
|
+
[
|
|
1465
|
+
{ opacity: 0, transform: "translateY(10px)" },
|
|
1466
|
+
{ opacity: 1, transform: "translateY(0)" }
|
|
1467
|
+
],
|
|
1468
|
+
{ ...J.enter, delay: 40, fill: "forwards" }
|
|
1469
|
+
);
|
|
1470
|
+
else if (!e && s.current) {
|
|
1471
|
+
const v = l.animate(
|
|
1472
|
+
[{ opacity: 1 }, { opacity: 0 }],
|
|
1473
|
+
{ ...J.exit, fill: "forwards" }
|
|
1474
|
+
);
|
|
1475
|
+
u.animate(
|
|
1476
|
+
[
|
|
1477
|
+
{ opacity: 1, transform: "translateY(0) scale(1)" },
|
|
1478
|
+
{ opacity: 0, transform: "translateY(12px) scale(0.97)" }
|
|
1479
|
+
],
|
|
1480
|
+
{ ...J.exit, fill: "forwards" }
|
|
1481
|
+
), f.animate(
|
|
1482
|
+
[{ opacity: 1 }, { opacity: 0 }],
|
|
1483
|
+
{ ...J.exit, fill: "forwards" }
|
|
1484
|
+
), v.onfinish = () => {
|
|
1485
|
+
l.style.display = "none", u.style.display = "none", f.style.display = "none";
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
s.current = e;
|
|
1489
|
+
}
|
|
1490
|
+
}, [e]);
|
|
1491
|
+
const d = (l) => {
|
|
1492
|
+
l.disabled || (t(), setTimeout(() => l.onPress(), 160));
|
|
1493
|
+
};
|
|
1494
|
+
return /* @__PURE__ */ y(G, { children: [
|
|
1495
|
+
/* @__PURE__ */ o(
|
|
1496
|
+
"div",
|
|
1497
|
+
{
|
|
1498
|
+
ref: a,
|
|
1499
|
+
style: { display: "none", zIndex: z.actionSheetBackdrop },
|
|
1500
|
+
className: "fixed inset-0 bg-black/30 backdrop-blur-[2px]",
|
|
1501
|
+
onClick: t,
|
|
1502
|
+
"aria-hidden": "true"
|
|
1503
|
+
}
|
|
1504
|
+
),
|
|
1505
|
+
/* @__PURE__ */ y(
|
|
1506
|
+
"div",
|
|
1507
|
+
{
|
|
1508
|
+
ref: i,
|
|
1509
|
+
role: "dialog",
|
|
1510
|
+
"aria-modal": "true",
|
|
1511
|
+
"aria-label": n ?? "Action sheet",
|
|
1512
|
+
style: { display: "none", zIndex: z.actionSheet },
|
|
1513
|
+
className: [
|
|
1514
|
+
"fixed inset-x-4",
|
|
1515
|
+
"bottom-[calc(env(safe-area-inset-bottom)+76px)]",
|
|
1516
|
+
// above tab bar
|
|
1517
|
+
"bg-[var(--surface-solid)] rounded-[20px]",
|
|
1518
|
+
"shadow-[var(--shadow-float)]",
|
|
1519
|
+
"overflow-hidden"
|
|
1520
|
+
].join(" "),
|
|
1521
|
+
children: [
|
|
1522
|
+
n && /* @__PURE__ */ o("div", { className: "px-4 pt-4 pb-3 border-b border-[var(--surface-divider)]", children: /* @__PURE__ */ o("p", { className: "text-xs text-gray-400 text-center font-medium leading-snug", children: n }) }),
|
|
1523
|
+
r.map((l, u) => /* @__PURE__ */ o(
|
|
1524
|
+
"button",
|
|
1525
|
+
{
|
|
1526
|
+
onClick: () => d(l),
|
|
1527
|
+
disabled: l.disabled,
|
|
1528
|
+
className: [
|
|
1529
|
+
"w-full px-4 py-[15px] text-left text-[17px] font-medium",
|
|
1530
|
+
"active:bg-[var(--surface-active)] transition-colors",
|
|
1531
|
+
u > 0 ? "border-t border-[var(--surface-divider)]" : "",
|
|
1532
|
+
l.destructive ? "text-[var(--color-danger)]" : "text-[var(--color-ink)]",
|
|
1533
|
+
l.disabled ? "opacity-40 cursor-not-allowed" : ""
|
|
1534
|
+
].join(" "),
|
|
1535
|
+
children: l.label
|
|
1536
|
+
},
|
|
1537
|
+
u
|
|
1538
|
+
))
|
|
1539
|
+
]
|
|
1540
|
+
}
|
|
1541
|
+
),
|
|
1542
|
+
/* @__PURE__ */ o(
|
|
1543
|
+
"button",
|
|
1544
|
+
{
|
|
1545
|
+
ref: c,
|
|
1546
|
+
onClick: t,
|
|
1547
|
+
style: { display: "none", zIndex: z.actionSheet },
|
|
1548
|
+
className: [
|
|
1549
|
+
"fixed inset-x-4",
|
|
1550
|
+
"bottom-[calc(env(safe-area-inset-bottom)+8px)]",
|
|
1551
|
+
"bg-[var(--surface-solid)] rounded-[20px]",
|
|
1552
|
+
"py-[15px] text-center text-[17px] font-semibold text-[var(--color-accent)]",
|
|
1553
|
+
"shadow-[var(--shadow-float)]",
|
|
1554
|
+
"active:bg-[var(--surface-active)] transition-colors"
|
|
1555
|
+
].join(" "),
|
|
1556
|
+
children: "Cancel"
|
|
1557
|
+
}
|
|
1558
|
+
)
|
|
1559
|
+
] });
|
|
1560
|
+
}
|
|
1561
|
+
function ee() {
|
|
1562
|
+
const e = window.visualViewport?.height ?? window.innerHeight, t = `${Math.round(e)}px`;
|
|
1563
|
+
document.documentElement.style.setProperty("--app-height", t);
|
|
1564
|
+
const n = document.getElementById("root");
|
|
1565
|
+
n && (n.style.height = "var(--app-height)", n.style.overflow = "hidden"), document.documentElement.style.height = "var(--app-height)", document.body.style.height = "var(--app-height)", document.body.style.overflow = "hidden";
|
|
1566
|
+
}
|
|
1567
|
+
function hr({
|
|
1568
|
+
children: e,
|
|
1569
|
+
lockZoom: t = !0
|
|
1570
|
+
}) {
|
|
1571
|
+
return _(() => {
|
|
1572
|
+
const n = document.querySelector('meta[name="viewport"]'), r = n?.getAttribute("content") ?? null, a = document.getElementById("root"), i = a?.style.height ?? "", c = a?.style.overflow ?? "", s = document.documentElement.style.height, d = document.body.style.height, l = document.body.style.overflow;
|
|
1573
|
+
t && n && n.setAttribute("content", "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover");
|
|
1574
|
+
const u = (b) => b.preventDefault(), f = (b) => {
|
|
1575
|
+
b.touches.length > 1 && b.preventDefault();
|
|
1576
|
+
}, v = (b) => {
|
|
1577
|
+
b.ctrlKey && b.preventDefault();
|
|
1578
|
+
};
|
|
1579
|
+
return t && (document.addEventListener("gesturestart", u, { passive: !1 }), document.addEventListener("gesturechange", u, { passive: !1 }), document.addEventListener("gestureend", u, { passive: !1 }), document.addEventListener("touchmove", f, { passive: !1 }), window.addEventListener("wheel", v, { passive: !1 })), ee(), window.addEventListener("resize", ee), window.visualViewport?.addEventListener("resize", ee), () => {
|
|
1580
|
+
window.removeEventListener("resize", ee), window.visualViewport?.removeEventListener("resize", ee), t && (document.removeEventListener("gesturestart", u), document.removeEventListener("gesturechange", u), document.removeEventListener("gestureend", u), document.removeEventListener("touchmove", f), window.removeEventListener("wheel", v)), n && r && n.setAttribute("content", r), a && (a.style.height = i, a.style.overflow = c), document.documentElement.style.height = s, document.body.style.height = d, document.body.style.overflow = l;
|
|
1581
|
+
};
|
|
1582
|
+
}, [t]), /* @__PURE__ */ o(G, { children: e });
|
|
1583
|
+
}
|
|
1584
|
+
const ut = se(null);
|
|
1585
|
+
function pr() {
|
|
1586
|
+
const e = Z(ut);
|
|
1587
|
+
if (!e)
|
|
1588
|
+
throw new Error("useOverlayNavigator must be used within <OverlayNavigatorProvider>");
|
|
1589
|
+
return e;
|
|
1590
|
+
}
|
|
1591
|
+
function pn({
|
|
1592
|
+
page: e,
|
|
1593
|
+
onClosed: t
|
|
1594
|
+
}) {
|
|
1595
|
+
const { push: n, canGoBack: r } = tt(), a = L(!1), i = L(!1);
|
|
1596
|
+
return _(() => {
|
|
1597
|
+
a.current || (a.current = !0, requestAnimationFrame(() => n(e)));
|
|
1598
|
+
}, [e, n]), _(() => {
|
|
1599
|
+
if (a.current) {
|
|
1600
|
+
if (r) {
|
|
1601
|
+
i.current = !0;
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
i.current && t();
|
|
1605
|
+
}
|
|
1606
|
+
}, [r, t]), /* @__PURE__ */ o("div", { className: "h-full w-full pointer-events-none" });
|
|
1607
|
+
}
|
|
1608
|
+
function vr({ children: e }) {
|
|
1609
|
+
const [t, n] = B(null), r = $(() => n(null), []), a = $((i) => n(i), []);
|
|
1610
|
+
return /* @__PURE__ */ y(
|
|
1611
|
+
ut.Provider,
|
|
1612
|
+
{
|
|
1613
|
+
value: {
|
|
1614
|
+
present: a,
|
|
1615
|
+
dismiss: r,
|
|
1616
|
+
isPresented: t !== null
|
|
1617
|
+
},
|
|
1618
|
+
children: [
|
|
1619
|
+
e,
|
|
1620
|
+
t && wt(
|
|
1621
|
+
/* @__PURE__ */ o("div", { className: "fixed inset-0", style: { zIndex: z.sheet }, children: /* @__PURE__ */ o(
|
|
1622
|
+
St,
|
|
1623
|
+
{
|
|
1624
|
+
initialPage: /* @__PURE__ */ o(pn, { page: t, onClosed: r })
|
|
1625
|
+
}
|
|
1626
|
+
) }),
|
|
1627
|
+
document.body
|
|
1628
|
+
)
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
function Ie(e = {}) {
|
|
1634
|
+
const {
|
|
1635
|
+
stiffness: t = 200,
|
|
1636
|
+
damping: n = 26,
|
|
1637
|
+
mass: r = 1,
|
|
1638
|
+
dt: a = 8,
|
|
1639
|
+
maxDuration: i = 1200
|
|
1640
|
+
} = e, c = [];
|
|
1641
|
+
let s = 0, d = 0, l = 0;
|
|
1642
|
+
const u = 2e-3;
|
|
1643
|
+
for (; l < i; ) {
|
|
1644
|
+
const f = (-t * (s - 1) - n * d) / r;
|
|
1645
|
+
if (d = d + f * (a / 1e3), s = s + d * (a / 1e3), c.push(s), l += a, Math.abs(s - 1) < u && Math.abs(d) < u) break;
|
|
1646
|
+
}
|
|
1647
|
+
return c.length === 0 && c.push(1), c[c.length - 1] = 1, { values: c, duration: c.length * a };
|
|
1648
|
+
}
|
|
1649
|
+
const De = {
|
|
1650
|
+
/** Snappy, iOS-feel. Great for UI elements. */
|
|
1651
|
+
default: { stiffness: 200, damping: 26, mass: 1 },
|
|
1652
|
+
/** Bouncy — for fun interactions, not navigation. */
|
|
1653
|
+
bouncy: { stiffness: 300, damping: 18, mass: 1 },
|
|
1654
|
+
/** Stiff, fast. For subtle feedback. */
|
|
1655
|
+
snappy: { stiffness: 400, damping: 35, mass: 1 },
|
|
1656
|
+
/** Slow, gentle. For larger elements. */
|
|
1657
|
+
gentle: { stiffness: 100, damping: 22, mass: 1.2 },
|
|
1658
|
+
/** Smooth eased in-out. For page transitions. */
|
|
1659
|
+
smooth: { stiffness: 220, damping: 32, mass: 1 }
|
|
1660
|
+
};
|
|
1661
|
+
function vn() {
|
|
1662
|
+
return [{ opacity: 0 }, { opacity: 1 }];
|
|
1663
|
+
}
|
|
1664
|
+
function mn() {
|
|
1665
|
+
return [{ opacity: 1 }, { opacity: 0 }];
|
|
1666
|
+
}
|
|
1667
|
+
function mr(e, t, n = De.default) {
|
|
1668
|
+
const { values: r } = Ie(n);
|
|
1669
|
+
return r.map((a) => ({
|
|
1670
|
+
transform: gn(e, t, a),
|
|
1671
|
+
offset: void 0
|
|
1672
|
+
// let the browser distribute evenly
|
|
1673
|
+
}));
|
|
1674
|
+
}
|
|
1675
|
+
function gn(e, t, n) {
|
|
1676
|
+
const r = parseFloat(e) || 0, a = parseFloat(t) || 0, i = r + (a - r) * n;
|
|
1677
|
+
return e.replace(/[-\d.]+/, String(Math.round(i * 100) / 100));
|
|
1678
|
+
}
|
|
1679
|
+
const Pe = (e) => ({
|
|
1680
|
+
duration: e,
|
|
1681
|
+
fill: "forwards"
|
|
1682
|
+
});
|
|
1683
|
+
function ue(e, t, n = De.default) {
|
|
1684
|
+
const { duration: r } = Ie(n);
|
|
1685
|
+
return {
|
|
1686
|
+
enter: {
|
|
1687
|
+
keyframes: [
|
|
1688
|
+
{ opacity: 0, transform: e },
|
|
1689
|
+
{ opacity: 1, transform: "translateX(0) translateY(0) scale(1)" }
|
|
1690
|
+
],
|
|
1691
|
+
timing: { ...Pe(r), easing: "cubic-bezier(0.34, 1.28, 0.64, 1)" }
|
|
1692
|
+
},
|
|
1693
|
+
exit: {
|
|
1694
|
+
keyframes: [
|
|
1695
|
+
{ opacity: 1, transform: "translateX(0) translateY(0) scale(1)" },
|
|
1696
|
+
{ opacity: 0, transform: t }
|
|
1697
|
+
],
|
|
1698
|
+
timing: Pe(200)
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
const gr = {
|
|
1703
|
+
/** Slide up from bottom (modal / toast enter style) */
|
|
1704
|
+
slideUp: ue("translateY(20px) scale(0.97)", "translateY(12px) scale(0.98)"),
|
|
1705
|
+
/** Slide down from top */
|
|
1706
|
+
slideDown: ue("translateY(-20px) scale(0.97)", "translateY(-12px) scale(0.98)"),
|
|
1707
|
+
/** Slide in from right (iOS push) */
|
|
1708
|
+
slideRight: ue("translateX(100%)", "translateX(30%)"),
|
|
1709
|
+
/** Slide in from left (iOS pop) */
|
|
1710
|
+
slideLeft: ue("translateX(-30%)", "translateX(100%)"),
|
|
1711
|
+
/** Scale in (zoom from 0.92 to 1) */
|
|
1712
|
+
scale: {
|
|
1713
|
+
enter: {
|
|
1714
|
+
keyframes: [{ opacity: 0, transform: "scale(0.92)" }, { opacity: 1, transform: "scale(1)" }],
|
|
1715
|
+
timing: { duration: Ie(De.default).duration, fill: "forwards", easing: "cubic-bezier(0.34, 1.28, 0.64, 1)" }
|
|
1716
|
+
},
|
|
1717
|
+
exit: {
|
|
1718
|
+
keyframes: [{ opacity: 1, transform: "scale(1)" }, { opacity: 0, transform: "scale(0.95)" }],
|
|
1719
|
+
timing: Pe(200)
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
/** Pure fade (no movement) */
|
|
1723
|
+
fade: {
|
|
1724
|
+
enter: {
|
|
1725
|
+
keyframes: vn(),
|
|
1726
|
+
timing: { duration: 220, fill: "forwards", easing: "ease-out" }
|
|
1727
|
+
},
|
|
1728
|
+
exit: {
|
|
1729
|
+
keyframes: mn(),
|
|
1730
|
+
timing: { duration: 160, fill: "forwards", easing: "ease-in" }
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
function X(e, { keyframes: t, timing: n }) {
|
|
1735
|
+
return e ? e.animate(t, n) : null;
|
|
1736
|
+
}
|
|
1737
|
+
function br(e, t, n) {
|
|
1738
|
+
const i = "cubic-bezier(0.28, 0.64, 0.34, 1)", c = "cubic-bezier(0.22, 0.61, 0.36, 1)";
|
|
1739
|
+
switch (n) {
|
|
1740
|
+
case "push": {
|
|
1741
|
+
X(e, {
|
|
1742
|
+
keyframes: [
|
|
1743
|
+
{ transform: "translateX(100%)", opacity: 0.8 },
|
|
1744
|
+
{ transform: "translateX(0)", opacity: 1 }
|
|
1745
|
+
],
|
|
1746
|
+
timing: { duration: 360, fill: "forwards", easing: i }
|
|
1747
|
+
}), X(t, {
|
|
1748
|
+
keyframes: [
|
|
1749
|
+
{ transform: "translateX(0)", opacity: 1 },
|
|
1750
|
+
{ transform: "translateX(-28%)", opacity: 0.6 }
|
|
1751
|
+
],
|
|
1752
|
+
timing: { duration: 360, fill: "forwards", easing: i }
|
|
1753
|
+
});
|
|
1754
|
+
break;
|
|
1755
|
+
}
|
|
1756
|
+
case "pop": {
|
|
1757
|
+
X(e, {
|
|
1758
|
+
keyframes: [
|
|
1759
|
+
{ transform: "translateX(-28%)", opacity: 0.6 },
|
|
1760
|
+
{ transform: "translateX(0)", opacity: 1 }
|
|
1761
|
+
],
|
|
1762
|
+
timing: { duration: 300, fill: "forwards", easing: c }
|
|
1763
|
+
}), X(t, {
|
|
1764
|
+
keyframes: [
|
|
1765
|
+
{ transform: "translateX(0)", opacity: 1 },
|
|
1766
|
+
{ transform: "translateX(100%)", opacity: 0.8 }
|
|
1767
|
+
],
|
|
1768
|
+
timing: { duration: 300, fill: "forwards", easing: c }
|
|
1769
|
+
});
|
|
1770
|
+
break;
|
|
1771
|
+
}
|
|
1772
|
+
case "modal": {
|
|
1773
|
+
X(e, {
|
|
1774
|
+
keyframes: [
|
|
1775
|
+
{ transform: "translateY(100%)", opacity: 0.9 },
|
|
1776
|
+
{ transform: "translateY(0)", opacity: 1 }
|
|
1777
|
+
],
|
|
1778
|
+
timing: { duration: 360, fill: "forwards", easing: i }
|
|
1779
|
+
});
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1782
|
+
case "dismiss": {
|
|
1783
|
+
X(t, {
|
|
1784
|
+
keyframes: [
|
|
1785
|
+
{ transform: "translateY(0)", opacity: 1 },
|
|
1786
|
+
{ transform: "translateY(100%)", opacity: 0.9 }
|
|
1787
|
+
],
|
|
1788
|
+
timing: { duration: 300, fill: "forwards", easing: c }
|
|
1789
|
+
});
|
|
1790
|
+
break;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
function xr(e) {
|
|
1795
|
+
const t = L(null), n = $(() => {
|
|
1796
|
+
const a = X(t.current, e.enter);
|
|
1797
|
+
return a ? new Promise((i) => {
|
|
1798
|
+
a.onfinish = () => i();
|
|
1799
|
+
}) : Promise.resolve();
|
|
1800
|
+
}, [e]), r = $(() => {
|
|
1801
|
+
const a = X(t.current, e.exit);
|
|
1802
|
+
return a ? new Promise((i) => {
|
|
1803
|
+
a.onfinish = () => i();
|
|
1804
|
+
}) : Promise.resolve();
|
|
1805
|
+
}, [e]);
|
|
1806
|
+
return [t, n, r];
|
|
1807
|
+
}
|
|
1808
|
+
function yr({
|
|
1809
|
+
label: e,
|
|
1810
|
+
helper: t,
|
|
1811
|
+
error: n,
|
|
1812
|
+
type: r = "text",
|
|
1813
|
+
value: a,
|
|
1814
|
+
onChange: i,
|
|
1815
|
+
placeholder: c,
|
|
1816
|
+
disabled: s = !1,
|
|
1817
|
+
clearable: d = !1,
|
|
1818
|
+
leadingIcon: l,
|
|
1819
|
+
className: u = ""
|
|
1820
|
+
}) {
|
|
1821
|
+
const f = Ze(), v = L(null), [b, E] = B(!1), k = r === "password", h = k && b ? "text" : r, p = a !== void 0 && a !== "", m = !!n, S = m ? "focus-within:shadow-[0_0_0_3px_rgba(230,57,70,0.28)]" : "focus-within:shadow-[0_0_0_3px_rgba(67,97,238,0.24)]";
|
|
1822
|
+
return /* @__PURE__ */ y("div", { className: `flex flex-col gap-1.5 ${u}`, children: [
|
|
1823
|
+
e && /* @__PURE__ */ o(
|
|
1824
|
+
"label",
|
|
1825
|
+
{
|
|
1826
|
+
htmlFor: f,
|
|
1827
|
+
className: "text-[13px] font-medium text-[var(--color-ink)] px-1",
|
|
1828
|
+
children: e
|
|
1829
|
+
}
|
|
1830
|
+
),
|
|
1831
|
+
/* @__PURE__ */ y(
|
|
1832
|
+
"div",
|
|
1833
|
+
{
|
|
1834
|
+
className: [
|
|
1835
|
+
"flex items-center gap-2 px-3 rounded-xl min-h-[44px]",
|
|
1836
|
+
"bg-[var(--input-bg)] transition-shadow duration-150",
|
|
1837
|
+
S,
|
|
1838
|
+
m ? "shadow-[0_0_0_1.5px_rgba(230,57,70,0.5)]" : "",
|
|
1839
|
+
s ? "opacity-40 pointer-events-none" : ""
|
|
1840
|
+
].join(" "),
|
|
1841
|
+
onClick: () => v.current?.focus(),
|
|
1842
|
+
children: [
|
|
1843
|
+
l && /* @__PURE__ */ o("span", { className: "shrink-0 text-[var(--color-muted)] text-[17px] leading-none select-none", children: l }),
|
|
1844
|
+
/* @__PURE__ */ o(
|
|
1845
|
+
"input",
|
|
1846
|
+
{
|
|
1847
|
+
ref: v,
|
|
1848
|
+
id: f,
|
|
1849
|
+
type: h,
|
|
1850
|
+
value: a,
|
|
1851
|
+
onChange: (g) => i?.(g.target.value),
|
|
1852
|
+
placeholder: c,
|
|
1853
|
+
disabled: s,
|
|
1854
|
+
autoCapitalize: r === "email" || k ? "none" : void 0,
|
|
1855
|
+
autoCorrect: k || r === "email" ? "off" : void 0,
|
|
1856
|
+
spellCheck: k ? !1 : void 0,
|
|
1857
|
+
className: [
|
|
1858
|
+
"flex-1 min-w-0 bg-transparent outline-none select-text",
|
|
1859
|
+
"text-[15px] text-[var(--color-ink)] placeholder:text-[var(--color-muted)]",
|
|
1860
|
+
"leading-none py-3"
|
|
1861
|
+
].join(" ")
|
|
1862
|
+
}
|
|
1863
|
+
),
|
|
1864
|
+
d && p && !k && /* @__PURE__ */ o(
|
|
1865
|
+
"button",
|
|
1866
|
+
{
|
|
1867
|
+
type: "button",
|
|
1868
|
+
onPointerDown: (g) => {
|
|
1869
|
+
g.preventDefault(), i?.(""), v.current?.focus();
|
|
1870
|
+
},
|
|
1871
|
+
className: "shrink-0 flex items-center justify-center w-5 h-5 rounded-full bg-[var(--color-muted)] opacity-60 active:opacity-40 transition-opacity",
|
|
1872
|
+
"aria-label": "Clear",
|
|
1873
|
+
children: /* @__PURE__ */ o("span", { className: "text-white text-[11px] font-bold leading-none select-none", children: "✕" })
|
|
1874
|
+
}
|
|
1875
|
+
),
|
|
1876
|
+
k && /* @__PURE__ */ o(
|
|
1877
|
+
"button",
|
|
1878
|
+
{
|
|
1879
|
+
type: "button",
|
|
1880
|
+
onPointerDown: (g) => {
|
|
1881
|
+
g.preventDefault(), E((x) => !x);
|
|
1882
|
+
},
|
|
1883
|
+
className: "shrink-0 text-[var(--color-muted)] text-[15px] leading-none min-w-[28px] min-h-[28px] flex items-center justify-center active:opacity-40 transition-opacity",
|
|
1884
|
+
"aria-label": b ? "Hide password" : "Show password",
|
|
1885
|
+
children: b ? "🙈" : "👁"
|
|
1886
|
+
}
|
|
1887
|
+
)
|
|
1888
|
+
]
|
|
1889
|
+
}
|
|
1890
|
+
),
|
|
1891
|
+
(t || n) && /* @__PURE__ */ o(
|
|
1892
|
+
"p",
|
|
1893
|
+
{
|
|
1894
|
+
className: [
|
|
1895
|
+
"text-[12px] px-1 leading-snug",
|
|
1896
|
+
m ? "text-[var(--color-danger)]" : "text-[var(--color-muted)]"
|
|
1897
|
+
].join(" "),
|
|
1898
|
+
children: n ?? t
|
|
1899
|
+
}
|
|
1900
|
+
)
|
|
1901
|
+
] });
|
|
1902
|
+
}
|
|
1903
|
+
const bn = {
|
|
1904
|
+
default: "bg-[var(--surface-solid-hover)] text-[var(--color-ink)] border border-[var(--surface-divider)]",
|
|
1905
|
+
primary: "bg-[var(--color-accent)] text-white",
|
|
1906
|
+
success: "bg-[var(--surface-success)] text-[var(--color-success)]",
|
|
1907
|
+
warning: "bg-[var(--surface-warning)] text-[#7a5c00]",
|
|
1908
|
+
danger: "bg-[var(--surface-danger)] text-[var(--color-danger)]",
|
|
1909
|
+
muted: "bg-[var(--input-bg)] text-[var(--color-muted)]"
|
|
1910
|
+
}, xn = {
|
|
1911
|
+
sm: "text-[10px] px-1.5 py-px font-bold tracking-wide leading-none",
|
|
1912
|
+
md: "text-[12px] px-2 py-0.5 font-semibold leading-none"
|
|
1913
|
+
};
|
|
1914
|
+
function wr({
|
|
1915
|
+
children: e,
|
|
1916
|
+
variant: t = "default",
|
|
1917
|
+
size: n = "md",
|
|
1918
|
+
className: r = ""
|
|
1919
|
+
}) {
|
|
1920
|
+
return /* @__PURE__ */ o(
|
|
1921
|
+
"span",
|
|
1922
|
+
{
|
|
1923
|
+
className: [
|
|
1924
|
+
"inline-flex items-center justify-center rounded-full select-none whitespace-nowrap",
|
|
1925
|
+
bn[t],
|
|
1926
|
+
xn[n],
|
|
1927
|
+
r
|
|
1928
|
+
].join(" "),
|
|
1929
|
+
children: e
|
|
1930
|
+
}
|
|
1931
|
+
);
|
|
1932
|
+
}
|
|
1933
|
+
function yn({
|
|
1934
|
+
label: e,
|
|
1935
|
+
selected: t = !1,
|
|
1936
|
+
onToggle: n,
|
|
1937
|
+
disabled: r = !1,
|
|
1938
|
+
icon: a,
|
|
1939
|
+
className: i = ""
|
|
1940
|
+
}) {
|
|
1941
|
+
return /* @__PURE__ */ y(
|
|
1942
|
+
"button",
|
|
1943
|
+
{
|
|
1944
|
+
type: "button",
|
|
1945
|
+
onClick: () => !r && n?.(!t),
|
|
1946
|
+
disabled: r,
|
|
1947
|
+
className: [
|
|
1948
|
+
// layout + shape
|
|
1949
|
+
"inline-flex items-center gap-1.5 px-3.5 rounded-full select-none",
|
|
1950
|
+
"min-h-[34px]",
|
|
1951
|
+
// comfortable tap height under 44px rows
|
|
1952
|
+
"transition-all duration-150",
|
|
1953
|
+
// selected state
|
|
1954
|
+
t ? "bg-[var(--color-ink)] text-white shadow-[var(--shadow-xs)]" : "bg-[var(--input-bg)] text-[var(--color-ink)] border border-[var(--surface-divider)]",
|
|
1955
|
+
// interaction
|
|
1956
|
+
r ? "opacity-40 pointer-events-none" : "active:scale-[0.94] active:opacity-80",
|
|
1957
|
+
i
|
|
1958
|
+
].join(" "),
|
|
1959
|
+
children: [
|
|
1960
|
+
a && /* @__PURE__ */ o("span", { className: "text-[13px] leading-none", children: a }),
|
|
1961
|
+
/* @__PURE__ */ o("span", { className: "text-[13px] font-medium leading-none whitespace-nowrap", children: e }),
|
|
1962
|
+
t && /* @__PURE__ */ o("span", { className: "text-[10px] leading-none opacity-70", children: "✓" })
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
function kr({
|
|
1968
|
+
options: e,
|
|
1969
|
+
value: t,
|
|
1970
|
+
onChange: n,
|
|
1971
|
+
multi: r = !1,
|
|
1972
|
+
className: a = ""
|
|
1973
|
+
}) {
|
|
1974
|
+
const i = Array.isArray(t) ? t : [t], c = (s) => {
|
|
1975
|
+
if (r) {
|
|
1976
|
+
const d = i, l = d.includes(s) ? d.filter((u) => u !== s) : [...d, s];
|
|
1977
|
+
n(l);
|
|
1978
|
+
} else
|
|
1979
|
+
n(s);
|
|
1980
|
+
};
|
|
1981
|
+
return /* @__PURE__ */ o(
|
|
1982
|
+
"div",
|
|
1983
|
+
{
|
|
1984
|
+
className: `flex gap-2 overflow-x-auto pb-1 ${a}`,
|
|
1985
|
+
style: {
|
|
1986
|
+
scrollbarWidth: "none",
|
|
1987
|
+
WebkitOverflowScrolling: "touch"
|
|
1988
|
+
},
|
|
1989
|
+
children: e.map((s) => /* @__PURE__ */ o(
|
|
1990
|
+
yn,
|
|
1991
|
+
{
|
|
1992
|
+
label: s.label,
|
|
1993
|
+
icon: s.icon,
|
|
1994
|
+
selected: i.includes(s.value),
|
|
1995
|
+
onToggle: () => c(s.value)
|
|
1996
|
+
},
|
|
1997
|
+
s.value
|
|
1998
|
+
))
|
|
1999
|
+
}
|
|
2000
|
+
);
|
|
2001
|
+
}
|
|
2002
|
+
const Be = "cubic-bezier(0.34, 1.56, 0.64, 1)", We = "0.32s";
|
|
2003
|
+
function Sr({
|
|
2004
|
+
options: e,
|
|
2005
|
+
value: t,
|
|
2006
|
+
onChange: n,
|
|
2007
|
+
size: r = "md",
|
|
2008
|
+
fullWidth: a = !0,
|
|
2009
|
+
className: i = "",
|
|
2010
|
+
"aria-label": c
|
|
2011
|
+
}) {
|
|
2012
|
+
const s = Ze(), d = e.length, l = Math.max(0, e.findIndex((p) => p.value === t)), u = r === "sm" ? "30px" : "36px", f = r === "sm" ? "12px" : "13px", v = "500", b = 2, E = `calc((100% - ${b * 2}px) / ${d})`, k = `calc(${b}px + ${l} * (100% - ${b * 2}px) / ${d})`;
|
|
2013
|
+
return /* @__PURE__ */ y(
|
|
2014
|
+
"div",
|
|
2015
|
+
{
|
|
2016
|
+
role: "tablist",
|
|
2017
|
+
"aria-label": c ?? "Segmented control",
|
|
2018
|
+
onKeyDown: (p) => {
|
|
2019
|
+
const m = e.map((x, w) => ({ o: x, i: w })).filter(({ o: x }) => !x.disabled).map(({ i: x }) => x), S = m.indexOf(l);
|
|
2020
|
+
let g = null;
|
|
2021
|
+
if (p.key === "ArrowRight" || p.key === "ArrowDown" ? (p.preventDefault(), g = (S + 1) % m.length) : p.key === "ArrowLeft" || p.key === "ArrowUp" ? (p.preventDefault(), g = (S - 1 + m.length) % m.length) : p.key === "Home" ? (p.preventDefault(), g = 0) : p.key === "End" && (p.preventDefault(), g = m.length - 1), g !== null) {
|
|
2022
|
+
const x = m[g];
|
|
2023
|
+
n(e[x].value);
|
|
2024
|
+
}
|
|
2025
|
+
},
|
|
2026
|
+
className: i,
|
|
2027
|
+
style: {
|
|
2028
|
+
position: "relative",
|
|
2029
|
+
display: "inline-flex",
|
|
2030
|
+
width: a ? "100%" : "auto",
|
|
2031
|
+
height: u,
|
|
2032
|
+
backgroundColor: "var(--input-bg)",
|
|
2033
|
+
borderRadius: "var(--radius-sm)",
|
|
2034
|
+
// 10px — matches iOS
|
|
2035
|
+
padding: `${b}px`,
|
|
2036
|
+
boxSizing: "border-box",
|
|
2037
|
+
// subtle inner shadow like iOS
|
|
2038
|
+
boxShadow: "inset 0 1px 3px rgba(0,0,0,0.12)"
|
|
2039
|
+
},
|
|
2040
|
+
children: [
|
|
2041
|
+
/* @__PURE__ */ o(
|
|
2042
|
+
"div",
|
|
2043
|
+
{
|
|
2044
|
+
"aria-hidden": "true",
|
|
2045
|
+
style: {
|
|
2046
|
+
position: "absolute",
|
|
2047
|
+
top: `${b}px`,
|
|
2048
|
+
left: k,
|
|
2049
|
+
width: E,
|
|
2050
|
+
bottom: `${b}px`,
|
|
2051
|
+
borderRadius: `calc(var(--radius-sm) - ${b}px)`,
|
|
2052
|
+
// inset radius
|
|
2053
|
+
backgroundColor: "var(--surface-solid)",
|
|
2054
|
+
boxShadow: "var(--shadow-xs)",
|
|
2055
|
+
transition: `left ${We} ${Be}`,
|
|
2056
|
+
pointerEvents: "none",
|
|
2057
|
+
willChange: "left"
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
),
|
|
2061
|
+
e.map((p, m) => {
|
|
2062
|
+
const S = m === l, g = p.disabled === !0, x = `${s}-tab-${p.value}`;
|
|
2063
|
+
return /* @__PURE__ */ y(
|
|
2064
|
+
"button",
|
|
2065
|
+
{
|
|
2066
|
+
id: x,
|
|
2067
|
+
role: "tab",
|
|
2068
|
+
type: "button",
|
|
2069
|
+
"aria-selected": S,
|
|
2070
|
+
"aria-disabled": g,
|
|
2071
|
+
tabIndex: S ? 0 : -1,
|
|
2072
|
+
disabled: g,
|
|
2073
|
+
onClick: () => !g && n(p.value),
|
|
2074
|
+
style: {
|
|
2075
|
+
// layout
|
|
2076
|
+
flex: 1,
|
|
2077
|
+
position: "relative",
|
|
2078
|
+
zIndex: 1,
|
|
2079
|
+
display: "flex",
|
|
2080
|
+
alignItems: "center",
|
|
2081
|
+
justifyContent: "center",
|
|
2082
|
+
gap: "4px",
|
|
2083
|
+
padding: "0 4px",
|
|
2084
|
+
minWidth: 0,
|
|
2085
|
+
// typography
|
|
2086
|
+
fontSize: f,
|
|
2087
|
+
fontWeight: v,
|
|
2088
|
+
fontFamily: "var(--font-sans)",
|
|
2089
|
+
lineHeight: 1,
|
|
2090
|
+
whiteSpace: "nowrap",
|
|
2091
|
+
userSelect: "none",
|
|
2092
|
+
// color — transitions smoothly with the pill
|
|
2093
|
+
color: S ? "var(--color-ink)" : "var(--color-muted)",
|
|
2094
|
+
opacity: g ? 0.38 : 1,
|
|
2095
|
+
// transitions
|
|
2096
|
+
transition: `color ${We} ${Be}, opacity 150ms ease`,
|
|
2097
|
+
// reset button defaults
|
|
2098
|
+
background: "transparent",
|
|
2099
|
+
border: "none",
|
|
2100
|
+
outline: "none",
|
|
2101
|
+
cursor: g ? "not-allowed" : "pointer",
|
|
2102
|
+
WebkitTapHighlightColor: "transparent",
|
|
2103
|
+
borderRadius: `calc(var(--radius-sm) - ${b}px)`
|
|
2104
|
+
},
|
|
2105
|
+
children: [
|
|
2106
|
+
p.icon && /* @__PURE__ */ o(
|
|
2107
|
+
"span",
|
|
2108
|
+
{
|
|
2109
|
+
style: {
|
|
2110
|
+
fontSize: r === "sm" ? "11px" : "13px",
|
|
2111
|
+
lineHeight: 1,
|
|
2112
|
+
flexShrink: 0
|
|
2113
|
+
},
|
|
2114
|
+
children: p.icon
|
|
2115
|
+
}
|
|
2116
|
+
),
|
|
2117
|
+
/* @__PURE__ */ o(
|
|
2118
|
+
"span",
|
|
2119
|
+
{
|
|
2120
|
+
style: {
|
|
2121
|
+
overflow: "hidden",
|
|
2122
|
+
textOverflow: "ellipsis",
|
|
2123
|
+
maxWidth: "100%"
|
|
2124
|
+
},
|
|
2125
|
+
children: p.label
|
|
2126
|
+
}
|
|
2127
|
+
)
|
|
2128
|
+
]
|
|
2129
|
+
},
|
|
2130
|
+
p.value
|
|
2131
|
+
);
|
|
2132
|
+
})
|
|
2133
|
+
]
|
|
2134
|
+
}
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
const wn = {
|
|
2138
|
+
xs: 3,
|
|
2139
|
+
sm: 6,
|
|
2140
|
+
md: 8,
|
|
2141
|
+
lg: 12
|
|
2142
|
+
}, kn = {
|
|
2143
|
+
accent: "var(--color-accent)",
|
|
2144
|
+
success: "var(--color-success)",
|
|
2145
|
+
warning: "var(--color-warning)",
|
|
2146
|
+
danger: "var(--color-danger)",
|
|
2147
|
+
muted: "var(--color-muted)"
|
|
2148
|
+
};
|
|
2149
|
+
function Er({
|
|
2150
|
+
value: e,
|
|
2151
|
+
max: t = 100,
|
|
2152
|
+
size: n = "sm",
|
|
2153
|
+
variant: r = "accent",
|
|
2154
|
+
showLabel: a = !1,
|
|
2155
|
+
label: i,
|
|
2156
|
+
animated: c = !0,
|
|
2157
|
+
"aria-label": s,
|
|
2158
|
+
className: d = ""
|
|
2159
|
+
}) {
|
|
2160
|
+
const l = Math.max(0, Math.min(e, t)), u = t > 0 ? l / t * 100 : 0, f = wn[n], v = kn[r], b = i ?? (t !== 100 ? `${l} / ${t}` : null), E = u > 0 ? `${Math.round(u)}%` : null;
|
|
2161
|
+
return /* @__PURE__ */ y("div", { className: d, style: { width: "100%" }, children: [
|
|
2162
|
+
a && (b || E) && /* @__PURE__ */ y(
|
|
2163
|
+
"div",
|
|
2164
|
+
{
|
|
2165
|
+
style: {
|
|
2166
|
+
display: "flex",
|
|
2167
|
+
alignItems: "center",
|
|
2168
|
+
justifyContent: "space-between",
|
|
2169
|
+
marginBottom: 6
|
|
2170
|
+
},
|
|
2171
|
+
children: [
|
|
2172
|
+
b && /* @__PURE__ */ o(
|
|
2173
|
+
"span",
|
|
2174
|
+
{
|
|
2175
|
+
style: {
|
|
2176
|
+
fontSize: 11,
|
|
2177
|
+
fontFamily: "var(--font-mono)",
|
|
2178
|
+
color: "var(--color-muted)",
|
|
2179
|
+
lineHeight: 1
|
|
2180
|
+
},
|
|
2181
|
+
children: b
|
|
2182
|
+
}
|
|
2183
|
+
),
|
|
2184
|
+
E && /* @__PURE__ */ o(
|
|
2185
|
+
"span",
|
|
2186
|
+
{
|
|
2187
|
+
style: {
|
|
2188
|
+
fontSize: 11,
|
|
2189
|
+
fontFamily: "var(--font-mono)",
|
|
2190
|
+
color: v,
|
|
2191
|
+
lineHeight: 1
|
|
2192
|
+
},
|
|
2193
|
+
children: E
|
|
2194
|
+
}
|
|
2195
|
+
)
|
|
2196
|
+
]
|
|
2197
|
+
}
|
|
2198
|
+
),
|
|
2199
|
+
/* @__PURE__ */ o(
|
|
2200
|
+
"div",
|
|
2201
|
+
{
|
|
2202
|
+
role: "progressbar",
|
|
2203
|
+
"aria-valuenow": Math.round(u),
|
|
2204
|
+
"aria-valuemin": 0,
|
|
2205
|
+
"aria-valuemax": 100,
|
|
2206
|
+
"aria-label": s ?? "Progress",
|
|
2207
|
+
style: {
|
|
2208
|
+
position: "relative",
|
|
2209
|
+
width: "100%",
|
|
2210
|
+
height: f,
|
|
2211
|
+
borderRadius: 9999,
|
|
2212
|
+
backgroundColor: "var(--input-bg)",
|
|
2213
|
+
overflow: "hidden"
|
|
2214
|
+
},
|
|
2215
|
+
children: /* @__PURE__ */ o(
|
|
2216
|
+
"div",
|
|
2217
|
+
{
|
|
2218
|
+
style: {
|
|
2219
|
+
position: "absolute",
|
|
2220
|
+
inset: 0,
|
|
2221
|
+
right: "auto",
|
|
2222
|
+
// let width control the fill
|
|
2223
|
+
width: `${u}%`,
|
|
2224
|
+
borderRadius: 9999,
|
|
2225
|
+
backgroundColor: v,
|
|
2226
|
+
transition: c ? "width 0.5s cubic-bezier(0.4, 0, 0.2, 1)" : void 0,
|
|
2227
|
+
// Subtle shimmer on larger bars to suggest activity
|
|
2228
|
+
...n === "lg" || n === "md" ? {
|
|
2229
|
+
backgroundImage: `linear-gradient(
|
|
2230
|
+
90deg,
|
|
2231
|
+
${v} 0%,
|
|
2232
|
+
color-mix(in srgb, ${v} 80%, white) 50%,
|
|
2233
|
+
${v} 100%
|
|
2234
|
+
)`
|
|
2235
|
+
} : {}
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
)
|
|
2239
|
+
}
|
|
2240
|
+
)
|
|
2241
|
+
] });
|
|
2242
|
+
}
|
|
2243
|
+
function Pr({
|
|
2244
|
+
total: e,
|
|
2245
|
+
current: t,
|
|
2246
|
+
dotSize: n = 8,
|
|
2247
|
+
gap: r = 6,
|
|
2248
|
+
"aria-label": a,
|
|
2249
|
+
className: i = ""
|
|
2250
|
+
}) {
|
|
2251
|
+
const c = Math.max(0, Math.min(t, e - 1)), s = n * 2;
|
|
2252
|
+
return /* @__PURE__ */ o(
|
|
2253
|
+
"div",
|
|
2254
|
+
{
|
|
2255
|
+
role: "tablist",
|
|
2256
|
+
"aria-label": a ?? `Step ${c + 1} of ${e}`,
|
|
2257
|
+
className: i,
|
|
2258
|
+
style: {
|
|
2259
|
+
display: "flex",
|
|
2260
|
+
alignItems: "center",
|
|
2261
|
+
justifyContent: "center",
|
|
2262
|
+
gap: r,
|
|
2263
|
+
padding: "4px 0"
|
|
2264
|
+
},
|
|
2265
|
+
children: Array.from({ length: e }, (d, l) => {
|
|
2266
|
+
const u = l === c, f = l < c;
|
|
2267
|
+
return /* @__PURE__ */ o(
|
|
2268
|
+
"div",
|
|
2269
|
+
{
|
|
2270
|
+
role: "tab",
|
|
2271
|
+
"aria-selected": u,
|
|
2272
|
+
"aria-label": `Step ${l + 1}`,
|
|
2273
|
+
style: {
|
|
2274
|
+
// Shape: active expands to a capsule, others stay circular
|
|
2275
|
+
width: u ? s : n,
|
|
2276
|
+
height: n,
|
|
2277
|
+
borderRadius: 9999,
|
|
2278
|
+
// Colour
|
|
2279
|
+
backgroundColor: u ? "var(--color-accent)" : f ? "color-mix(in srgb, var(--color-accent) 30%, transparent)" : "var(--input-bg)",
|
|
2280
|
+
border: !u && !f ? "1.5px solid var(--surface-divider)" : "none",
|
|
2281
|
+
// Spring-like transition — width + background together
|
|
2282
|
+
transition: [
|
|
2283
|
+
"width 0.32s cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
2284
|
+
"background-color 0.2s ease"
|
|
2285
|
+
].join(", "),
|
|
2286
|
+
// Perf
|
|
2287
|
+
willChange: "width",
|
|
2288
|
+
flexShrink: 0
|
|
2289
|
+
}
|
|
2290
|
+
},
|
|
2291
|
+
l
|
|
2292
|
+
);
|
|
2293
|
+
})
|
|
2294
|
+
}
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
2297
|
+
const Sn = "cubic-bezier(0.34, 1.28, 0.64, 1)", En = "cubic-bezier(0.4, 0, 0.6, 1)";
|
|
2298
|
+
function Pn() {
|
|
2299
|
+
return /* @__PURE__ */ y(
|
|
2300
|
+
"svg",
|
|
2301
|
+
{
|
|
2302
|
+
width: "16",
|
|
2303
|
+
height: "16",
|
|
2304
|
+
viewBox: "0 0 24 24",
|
|
2305
|
+
fill: "none",
|
|
2306
|
+
stroke: "currentColor",
|
|
2307
|
+
strokeWidth: "2.5",
|
|
2308
|
+
strokeLinecap: "round",
|
|
2309
|
+
strokeLinejoin: "round",
|
|
2310
|
+
"aria-hidden": "true",
|
|
2311
|
+
children: [
|
|
2312
|
+
/* @__PURE__ */ o("circle", { cx: "11", cy: "11", r: "7.5" }),
|
|
2313
|
+
/* @__PURE__ */ o("line", { x1: "16.5", y1: "16.5", x2: "22", y2: "22" })
|
|
2314
|
+
]
|
|
2315
|
+
}
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
function Lr({
|
|
2319
|
+
value: e,
|
|
2320
|
+
onChange: t,
|
|
2321
|
+
onCancel: n,
|
|
2322
|
+
onFocus: r,
|
|
2323
|
+
onBlur: a,
|
|
2324
|
+
onSubmit: i,
|
|
2325
|
+
placeholder: c = "Search",
|
|
2326
|
+
showCancel: s = !1,
|
|
2327
|
+
cancelLabel: d = "Cancel",
|
|
2328
|
+
disabled: l = !1,
|
|
2329
|
+
autoFocus: u = !1,
|
|
2330
|
+
className: f = ""
|
|
2331
|
+
}) {
|
|
2332
|
+
const v = L(null), b = e.length > 0, E = () => {
|
|
2333
|
+
Y(), r?.();
|
|
2334
|
+
}, k = () => {
|
|
2335
|
+
a?.();
|
|
2336
|
+
}, h = () => {
|
|
2337
|
+
t(""), v.current?.focus();
|
|
2338
|
+
}, p = () => {
|
|
2339
|
+
t(""), v.current?.blur(), n?.();
|
|
2340
|
+
}, m = (S) => {
|
|
2341
|
+
S.key === "Enter" ? (S.preventDefault(), i?.(e), v.current?.blur()) : S.key === "Escape" && p();
|
|
2342
|
+
};
|
|
2343
|
+
return /* @__PURE__ */ y(
|
|
2344
|
+
"div",
|
|
2345
|
+
{
|
|
2346
|
+
className: `flex items-center gap-2 ${f}`,
|
|
2347
|
+
style: { WebkitTapHighlightColor: "transparent" },
|
|
2348
|
+
children: [
|
|
2349
|
+
/* @__PURE__ */ y(
|
|
2350
|
+
"div",
|
|
2351
|
+
{
|
|
2352
|
+
className: [
|
|
2353
|
+
"flex items-center gap-1.5 px-3 flex-1 min-w-0",
|
|
2354
|
+
"bg-[var(--input-bg)] rounded-[var(--radius-full)]",
|
|
2355
|
+
"transition-shadow duration-150",
|
|
2356
|
+
s ? "focus-within:shadow-[0_0_0_2.5px_rgba(67,97,238,0.22)]" : "",
|
|
2357
|
+
l ? "opacity-40 pointer-events-none" : ""
|
|
2358
|
+
].join(" "),
|
|
2359
|
+
style: {
|
|
2360
|
+
height: 36,
|
|
2361
|
+
// iOS UISearchBar canonical height
|
|
2362
|
+
minHeight: 36
|
|
2363
|
+
},
|
|
2364
|
+
onClick: () => v.current?.focus(),
|
|
2365
|
+
children: [
|
|
2366
|
+
/* @__PURE__ */ o(
|
|
2367
|
+
"span",
|
|
2368
|
+
{
|
|
2369
|
+
className: "shrink-0 text-[var(--color-muted)] leading-none",
|
|
2370
|
+
style: { marginTop: 1 },
|
|
2371
|
+
children: /* @__PURE__ */ o(Pn, {})
|
|
2372
|
+
}
|
|
2373
|
+
),
|
|
2374
|
+
/* @__PURE__ */ o(
|
|
2375
|
+
"input",
|
|
2376
|
+
{
|
|
2377
|
+
ref: v,
|
|
2378
|
+
type: "search",
|
|
2379
|
+
inputMode: "search",
|
|
2380
|
+
enterKeyHint: "search",
|
|
2381
|
+
autoCapitalize: "none",
|
|
2382
|
+
autoCorrect: "off",
|
|
2383
|
+
autoComplete: "off",
|
|
2384
|
+
spellCheck: !1,
|
|
2385
|
+
autoFocus: u,
|
|
2386
|
+
value: e,
|
|
2387
|
+
disabled: l,
|
|
2388
|
+
placeholder: c,
|
|
2389
|
+
onChange: (S) => t(S.target.value),
|
|
2390
|
+
onFocus: E,
|
|
2391
|
+
onBlur: k,
|
|
2392
|
+
onKeyDown: m,
|
|
2393
|
+
className: [
|
|
2394
|
+
"flex-1 min-w-0 bg-transparent outline-none",
|
|
2395
|
+
"text-[15px] text-[var(--color-ink)]",
|
|
2396
|
+
"placeholder:text-[var(--color-muted)]",
|
|
2397
|
+
// Reset native search input chrome (✕ button on WebKit)
|
|
2398
|
+
"[&::-webkit-search-decoration]:hidden",
|
|
2399
|
+
"[&::-webkit-search-cancel-button]:hidden",
|
|
2400
|
+
"[&::-webkit-search-results-button]:hidden"
|
|
2401
|
+
].join(" "),
|
|
2402
|
+
"aria-label": c
|
|
2403
|
+
}
|
|
2404
|
+
),
|
|
2405
|
+
b && /* @__PURE__ */ o(
|
|
2406
|
+
"button",
|
|
2407
|
+
{
|
|
2408
|
+
type: "button",
|
|
2409
|
+
onPointerDown: (S) => {
|
|
2410
|
+
S.preventDefault(), h();
|
|
2411
|
+
},
|
|
2412
|
+
className: [
|
|
2413
|
+
"shrink-0 flex items-center justify-center",
|
|
2414
|
+
"w-[17px] h-[17px] rounded-full",
|
|
2415
|
+
"bg-[var(--color-muted)] opacity-50",
|
|
2416
|
+
"active:opacity-30 transition-opacity duration-100"
|
|
2417
|
+
].join(" "),
|
|
2418
|
+
"aria-label": "Clear search",
|
|
2419
|
+
children: /* @__PURE__ */ o(
|
|
2420
|
+
"span",
|
|
2421
|
+
{
|
|
2422
|
+
className: "text-white font-bold leading-none select-none",
|
|
2423
|
+
style: { fontSize: 10 },
|
|
2424
|
+
children: "✕"
|
|
2425
|
+
}
|
|
2426
|
+
)
|
|
2427
|
+
}
|
|
2428
|
+
)
|
|
2429
|
+
]
|
|
2430
|
+
}
|
|
2431
|
+
),
|
|
2432
|
+
/* @__PURE__ */ o(
|
|
2433
|
+
"div",
|
|
2434
|
+
{
|
|
2435
|
+
"aria-hidden": !s,
|
|
2436
|
+
style: {
|
|
2437
|
+
// Spring-physics width transition: expand from 0 → auto
|
|
2438
|
+
// We drive it with max-width + opacity so the pill reflows naturally
|
|
2439
|
+
maxWidth: s ? 80 : 0,
|
|
2440
|
+
opacity: s ? 1 : 0,
|
|
2441
|
+
overflow: "hidden",
|
|
2442
|
+
transition: [
|
|
2443
|
+
`max-width 0.32s ${s ? Sn : En}`,
|
|
2444
|
+
`opacity ${s ? "0.2s 0.04s ease" : "0.15s ease"}`
|
|
2445
|
+
].join(", "),
|
|
2446
|
+
flexShrink: 0,
|
|
2447
|
+
whiteSpace: "nowrap",
|
|
2448
|
+
// Pad left inside so text doesn't touch the pill edge
|
|
2449
|
+
paddingLeft: 0
|
|
2450
|
+
},
|
|
2451
|
+
children: /* @__PURE__ */ o(
|
|
2452
|
+
"button",
|
|
2453
|
+
{
|
|
2454
|
+
type: "button",
|
|
2455
|
+
tabIndex: s ? 0 : -1,
|
|
2456
|
+
onClick: p,
|
|
2457
|
+
className: [
|
|
2458
|
+
"text-[var(--color-accent)] font-medium text-[17px]",
|
|
2459
|
+
"min-h-[44px] min-w-[44px]",
|
|
2460
|
+
"flex items-center justify-center",
|
|
2461
|
+
"active:opacity-50 transition-opacity duration-100",
|
|
2462
|
+
"select-none whitespace-nowrap"
|
|
2463
|
+
].join(" "),
|
|
2464
|
+
style: { paddingLeft: 4 },
|
|
2465
|
+
children: d
|
|
2466
|
+
}
|
|
2467
|
+
)
|
|
2468
|
+
}
|
|
2469
|
+
)
|
|
2470
|
+
]
|
|
2471
|
+
}
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
const re = 51, fe = 31, pe = 27, Le = 2, Ln = re - pe - Le * 2, Cn = {
|
|
2475
|
+
success: "var(--color-success)",
|
|
2476
|
+
accent: "var(--color-accent)",
|
|
2477
|
+
primary: "var(--color-ink)"
|
|
2478
|
+
}, ke = "cubic-bezier(0.34, 1.28, 0.64, 1)", Se = "320ms";
|
|
2479
|
+
function Cr({
|
|
2480
|
+
checked: e,
|
|
2481
|
+
onChange: t,
|
|
2482
|
+
label: n,
|
|
2483
|
+
sublabel: r,
|
|
2484
|
+
disabled: a = !1,
|
|
2485
|
+
variant: i = "success",
|
|
2486
|
+
"aria-label": c,
|
|
2487
|
+
className: s = ""
|
|
2488
|
+
}) {
|
|
2489
|
+
const d = () => {
|
|
2490
|
+
a || (Y(), t(!e));
|
|
2491
|
+
}, l = (E) => {
|
|
2492
|
+
(E.key === " " || E.key === "Enter") && (E.preventDefault(), d());
|
|
2493
|
+
}, u = {
|
|
2494
|
+
position: "relative",
|
|
2495
|
+
width: re,
|
|
2496
|
+
minWidth: re,
|
|
2497
|
+
// prevent flex shrink
|
|
2498
|
+
height: fe,
|
|
2499
|
+
borderRadius: fe / 2,
|
|
2500
|
+
backgroundColor: e ? Cn[i] : "var(--input-bg)",
|
|
2501
|
+
// Inset shadow gives the recessed track look iOS uses
|
|
2502
|
+
boxShadow: e ? "none" : "inset 0 0 0 1.5px var(--surface-divider)",
|
|
2503
|
+
transition: [
|
|
2504
|
+
`background-color ${Se} ${ke}`,
|
|
2505
|
+
`box-shadow ${Se} ${ke}`
|
|
2506
|
+
].join(", "),
|
|
2507
|
+
cursor: a ? "not-allowed" : "pointer",
|
|
2508
|
+
opacity: a ? 0.4 : 1,
|
|
2509
|
+
flexShrink: 0
|
|
2510
|
+
}, f = {
|
|
2511
|
+
position: "absolute",
|
|
2512
|
+
top: Le,
|
|
2513
|
+
left: Le,
|
|
2514
|
+
width: pe,
|
|
2515
|
+
height: pe,
|
|
2516
|
+
borderRadius: pe / 2,
|
|
2517
|
+
backgroundColor: "#ffffff",
|
|
2518
|
+
boxShadow: "0 2px 6px rgba(0,0,0,0.22), 0 0.5px 2px rgba(0,0,0,0.14)",
|
|
2519
|
+
transform: e ? `translateX(${Ln}px)` : "translateX(0px)",
|
|
2520
|
+
transition: `transform ${Se} ${ke}`,
|
|
2521
|
+
willChange: "transform",
|
|
2522
|
+
pointerEvents: "none"
|
|
2523
|
+
}, v = !!(n || r), b = /* @__PURE__ */ o(
|
|
2524
|
+
"div",
|
|
2525
|
+
{
|
|
2526
|
+
role: "switch",
|
|
2527
|
+
"aria-checked": e,
|
|
2528
|
+
"aria-disabled": a,
|
|
2529
|
+
"aria-label": v ? void 0 : c ?? "Toggle",
|
|
2530
|
+
tabIndex: a ? -1 : 0,
|
|
2531
|
+
onKeyDown: l,
|
|
2532
|
+
style: u,
|
|
2533
|
+
onClick: v ? void 0 : d,
|
|
2534
|
+
children: /* @__PURE__ */ o("div", { style: f })
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
return v ? /* @__PURE__ */ y(
|
|
2538
|
+
"div",
|
|
2539
|
+
{
|
|
2540
|
+
role: "switch",
|
|
2541
|
+
"aria-checked": e,
|
|
2542
|
+
"aria-disabled": a,
|
|
2543
|
+
"aria-label": c,
|
|
2544
|
+
tabIndex: a ? -1 : 0,
|
|
2545
|
+
onKeyDown: l,
|
|
2546
|
+
onClick: d,
|
|
2547
|
+
className: s,
|
|
2548
|
+
style: {
|
|
2549
|
+
display: "flex",
|
|
2550
|
+
alignItems: "center",
|
|
2551
|
+
justifyContent: "space-between",
|
|
2552
|
+
gap: 12,
|
|
2553
|
+
minHeight: 44,
|
|
2554
|
+
// Apple HIG minimum touch target
|
|
2555
|
+
cursor: a ? "not-allowed" : "pointer",
|
|
2556
|
+
opacity: a ? 0.4 : 1,
|
|
2557
|
+
// Override cursor on the inner track when label is present
|
|
2558
|
+
userSelect: "none",
|
|
2559
|
+
WebkitTapHighlightColor: "transparent"
|
|
2560
|
+
},
|
|
2561
|
+
children: [
|
|
2562
|
+
/* @__PURE__ */ y("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2563
|
+
n && /* @__PURE__ */ o("p", { style: {
|
|
2564
|
+
fontSize: 15,
|
|
2565
|
+
fontWeight: 500,
|
|
2566
|
+
color: "var(--color-ink)",
|
|
2567
|
+
lineHeight: 1.3,
|
|
2568
|
+
margin: 0
|
|
2569
|
+
}, children: n }),
|
|
2570
|
+
r && /* @__PURE__ */ o("p", { style: {
|
|
2571
|
+
fontSize: 13,
|
|
2572
|
+
color: "var(--color-muted)",
|
|
2573
|
+
lineHeight: 1.3,
|
|
2574
|
+
margin: "2px 0 0"
|
|
2575
|
+
}, children: r })
|
|
2576
|
+
] }),
|
|
2577
|
+
/* @__PURE__ */ o("div", { style: { ...u, cursor: "inherit" }, children: /* @__PURE__ */ o("div", { style: f }) })
|
|
2578
|
+
]
|
|
2579
|
+
}
|
|
2580
|
+
) : /* @__PURE__ */ o(
|
|
2581
|
+
"div",
|
|
2582
|
+
{
|
|
2583
|
+
className: s,
|
|
2584
|
+
style: {
|
|
2585
|
+
display: "inline-flex",
|
|
2586
|
+
alignItems: "center",
|
|
2587
|
+
// Extend touch target to 44px using padding — visually transparent
|
|
2588
|
+
padding: `${(44 - fe) / 2}px ${(44 - re) / 2}px`,
|
|
2589
|
+
margin: `-${(44 - fe) / 2}px -${(44 - re) / 2}px`,
|
|
2590
|
+
cursor: a ? "not-allowed" : "pointer"
|
|
2591
|
+
},
|
|
2592
|
+
onClick: d,
|
|
2593
|
+
children: b
|
|
2594
|
+
}
|
|
2595
|
+
);
|
|
2596
|
+
}
|
|
2597
|
+
function Nr() {
|
|
2598
|
+
return he(() => ({
|
|
2599
|
+
impact(e) {
|
|
2600
|
+
switch (e) {
|
|
2601
|
+
case "light":
|
|
2602
|
+
Y();
|
|
2603
|
+
break;
|
|
2604
|
+
case "medium":
|
|
2605
|
+
xe();
|
|
2606
|
+
break;
|
|
2607
|
+
case "heavy":
|
|
2608
|
+
rt();
|
|
2609
|
+
break;
|
|
2610
|
+
}
|
|
2611
|
+
},
|
|
2612
|
+
notification(e) {
|
|
2613
|
+
switch (e) {
|
|
2614
|
+
case "success":
|
|
2615
|
+
at();
|
|
2616
|
+
break;
|
|
2617
|
+
case "warning":
|
|
2618
|
+
jt();
|
|
2619
|
+
break;
|
|
2620
|
+
case "error":
|
|
2621
|
+
_t();
|
|
2622
|
+
break;
|
|
2623
|
+
}
|
|
2624
|
+
},
|
|
2625
|
+
selection() {
|
|
2626
|
+
me();
|
|
2627
|
+
}
|
|
2628
|
+
}), []);
|
|
2629
|
+
}
|
|
2630
|
+
function Tr(e = {}) {
|
|
2631
|
+
const t = L(null), n = L(e);
|
|
2632
|
+
return n.current = e, _(() => {
|
|
2633
|
+
const r = t.current;
|
|
2634
|
+
if (!r) return;
|
|
2635
|
+
let a = 0, i = 0, c = 0, s = 0, d = 0, l = 0, u = 0, f = !1;
|
|
2636
|
+
const v = (h, p) => ({
|
|
2637
|
+
dx: h - a,
|
|
2638
|
+
dy: p - i,
|
|
2639
|
+
vx: l,
|
|
2640
|
+
vy: u,
|
|
2641
|
+
x: h,
|
|
2642
|
+
y: p
|
|
2643
|
+
}), b = (h) => {
|
|
2644
|
+
h.isPrimary && (a = h.clientX, i = h.clientY, c = h.clientX, s = h.clientY, d = h.timeStamp, l = 0, u = 0, f = !0, r.setPointerCapture(h.pointerId), n.current.onStart?.(v(h.clientX, h.clientY)));
|
|
2645
|
+
}, E = (h) => {
|
|
2646
|
+
if (!f || !h.isPrimary) return;
|
|
2647
|
+
n.current.preventDefault !== !1 && h.preventDefault();
|
|
2648
|
+
const p = h.timeStamp - d;
|
|
2649
|
+
p > 0 && (l = 0.7 * ((h.clientX - c) / p) + (1 - 0.7) * l, u = 0.7 * ((h.clientY - s) / p) + (1 - 0.7) * u), c = h.clientX, s = h.clientY, d = h.timeStamp, n.current.onMove?.(v(h.clientX, h.clientY));
|
|
2650
|
+
}, k = (h) => {
|
|
2651
|
+
!f || !h.isPrimary || (f = !1, n.current.onEnd?.(v(h.clientX, h.clientY)));
|
|
2652
|
+
};
|
|
2653
|
+
return r.addEventListener("pointerdown", b, { passive: !0 }), r.addEventListener("pointermove", E, { passive: !1 }), r.addEventListener("pointerup", k, { passive: !0 }), r.addEventListener("pointercancel", k, { passive: !0 }), () => {
|
|
2654
|
+
r.removeEventListener("pointerdown", b), r.removeEventListener("pointermove", E), r.removeEventListener("pointerup", k), r.removeEventListener("pointercancel", k);
|
|
2655
|
+
};
|
|
2656
|
+
}, []), t;
|
|
2657
|
+
}
|
|
2658
|
+
function Ye(e) {
|
|
2659
|
+
const [t, n] = [e[0], e[1]], r = n.clientX - t.clientX, a = n.clientY - t.clientY;
|
|
2660
|
+
return Math.hypot(r, a);
|
|
2661
|
+
}
|
|
2662
|
+
function ze(e) {
|
|
2663
|
+
return [
|
|
2664
|
+
(e[0].clientX + e[1].clientX) / 2,
|
|
2665
|
+
(e[0].clientY + e[1].clientY) / 2
|
|
2666
|
+
];
|
|
2667
|
+
}
|
|
2668
|
+
function Ir(e = {}) {
|
|
2669
|
+
const t = L(null), n = L(e);
|
|
2670
|
+
return n.current = e, _(() => {
|
|
2671
|
+
const r = t.current;
|
|
2672
|
+
if (!r) return;
|
|
2673
|
+
let a = 0, i = !1;
|
|
2674
|
+
const c = (l) => {
|
|
2675
|
+
if (l.touches.length !== 2) return;
|
|
2676
|
+
l.preventDefault(), a = Ye(l.touches), i = !0;
|
|
2677
|
+
const u = ze(l.touches);
|
|
2678
|
+
n.current.onStart?.({ scale: 1, origin: u });
|
|
2679
|
+
}, s = (l) => {
|
|
2680
|
+
if (!i || l.touches.length !== 2) return;
|
|
2681
|
+
l.preventDefault();
|
|
2682
|
+
const u = Ye(l.touches), f = a > 0 ? u / a : 1, v = ze(l.touches);
|
|
2683
|
+
n.current.onMove?.({ scale: f, origin: v });
|
|
2684
|
+
}, d = (l) => {
|
|
2685
|
+
i && l.touches.length < 2 && (i = !1, n.current.onEnd?.({ scale: 1, origin: [0, 0] }));
|
|
2686
|
+
};
|
|
2687
|
+
return r.addEventListener("touchstart", c, { passive: !1 }), r.addEventListener("touchmove", s, { passive: !1 }), r.addEventListener("touchend", d, { passive: !0 }), r.addEventListener("touchcancel", d, { passive: !0 }), () => {
|
|
2688
|
+
r.removeEventListener("touchstart", c), r.removeEventListener("touchmove", s), r.removeEventListener("touchend", d), r.removeEventListener("touchcancel", d);
|
|
2689
|
+
};
|
|
2690
|
+
}, []), t;
|
|
2691
|
+
}
|
|
2692
|
+
function Dr(e) {
|
|
2693
|
+
const t = L(null), n = L(e);
|
|
2694
|
+
return n.current = e, _(() => {
|
|
2695
|
+
const r = t.current;
|
|
2696
|
+
if (!r) return;
|
|
2697
|
+
let a = null, i = 0, c = 0;
|
|
2698
|
+
const s = () => {
|
|
2699
|
+
a !== null && (clearTimeout(a), a = null);
|
|
2700
|
+
}, d = (u) => {
|
|
2701
|
+
if (!u.isPrimary) return;
|
|
2702
|
+
i = u.clientX, c = u.clientY, s();
|
|
2703
|
+
const f = n.current.delay ?? 500, v = n.current.haptic !== !1;
|
|
2704
|
+
a = setTimeout(() => {
|
|
2705
|
+
a = null, v && xe(), n.current.onLongPress();
|
|
2706
|
+
}, f);
|
|
2707
|
+
}, l = (u) => {
|
|
2708
|
+
if (!u.isPrimary || a === null) return;
|
|
2709
|
+
const f = n.current.threshold ?? 10;
|
|
2710
|
+
Math.hypot(u.clientX - i, u.clientY - c) > f && s();
|
|
2711
|
+
};
|
|
2712
|
+
return r.addEventListener("pointerdown", d, { passive: !0 }), r.addEventListener("pointermove", l, { passive: !0 }), r.addEventListener("pointerup", s, { passive: !0 }), r.addEventListener("pointercancel", s, { passive: !0 }), () => {
|
|
2713
|
+
s(), r.removeEventListener("pointerdown", d), r.removeEventListener("pointermove", l), r.removeEventListener("pointerup", s), r.removeEventListener("pointercancel", s);
|
|
2714
|
+
};
|
|
2715
|
+
}, []), t;
|
|
2716
|
+
}
|
|
2717
|
+
const Nn = {
|
|
2718
|
+
default: "📭",
|
|
2719
|
+
error: "⚠️",
|
|
2720
|
+
offline: "📡",
|
|
2721
|
+
search: "🔍"
|
|
2722
|
+
};
|
|
2723
|
+
function Tn({ label: e, onPress: t, variant: n = "primary" }) {
|
|
2724
|
+
const r = () => {
|
|
2725
|
+
Y(), t();
|
|
2726
|
+
};
|
|
2727
|
+
return n === "ghost" ? /* @__PURE__ */ o(
|
|
2728
|
+
"button",
|
|
2729
|
+
{
|
|
2730
|
+
type: "button",
|
|
2731
|
+
onClick: r,
|
|
2732
|
+
style: {
|
|
2733
|
+
background: "transparent",
|
|
2734
|
+
border: "none",
|
|
2735
|
+
color: "var(--color-accent)",
|
|
2736
|
+
fontSize: 17,
|
|
2737
|
+
fontWeight: 500,
|
|
2738
|
+
padding: "10px 20px",
|
|
2739
|
+
minHeight: 44,
|
|
2740
|
+
cursor: "pointer",
|
|
2741
|
+
borderRadius: 12,
|
|
2742
|
+
transition: "opacity 0.12s ease"
|
|
2743
|
+
},
|
|
2744
|
+
onPointerDown: (a) => a.currentTarget.style.opacity = "0.5",
|
|
2745
|
+
onPointerUp: (a) => a.currentTarget.style.opacity = "1",
|
|
2746
|
+
onPointerLeave: (a) => a.currentTarget.style.opacity = "1",
|
|
2747
|
+
children: e
|
|
2748
|
+
}
|
|
2749
|
+
) : /* @__PURE__ */ o(
|
|
2750
|
+
"button",
|
|
2751
|
+
{
|
|
2752
|
+
type: "button",
|
|
2753
|
+
onClick: r,
|
|
2754
|
+
style: {
|
|
2755
|
+
background: "var(--color-ink)",
|
|
2756
|
+
border: "none",
|
|
2757
|
+
color: "var(--color-paper)",
|
|
2758
|
+
fontSize: 15,
|
|
2759
|
+
fontWeight: 600,
|
|
2760
|
+
padding: "0 24px",
|
|
2761
|
+
height: 44,
|
|
2762
|
+
minWidth: 120,
|
|
2763
|
+
cursor: "pointer",
|
|
2764
|
+
borderRadius: 12,
|
|
2765
|
+
transition: "opacity 0.12s ease",
|
|
2766
|
+
WebkitTapHighlightColor: "transparent"
|
|
2767
|
+
},
|
|
2768
|
+
onPointerDown: (a) => a.currentTarget.style.opacity = "0.7",
|
|
2769
|
+
onPointerUp: (a) => a.currentTarget.style.opacity = "1",
|
|
2770
|
+
onPointerLeave: (a) => a.currentTarget.style.opacity = "1",
|
|
2771
|
+
children: e
|
|
2772
|
+
}
|
|
2773
|
+
);
|
|
2774
|
+
}
|
|
2775
|
+
function Rr({
|
|
2776
|
+
icon: e,
|
|
2777
|
+
title: t,
|
|
2778
|
+
subtitle: n,
|
|
2779
|
+
action: r,
|
|
2780
|
+
variant: a = "default",
|
|
2781
|
+
contained: i = !1,
|
|
2782
|
+
className: c = ""
|
|
2783
|
+
}) {
|
|
2784
|
+
const s = e !== void 0 ? e : Nn[a], d = typeof s == "string", l = r != null && typeof r == "object" && "label" in r && "onPress" in r;
|
|
2785
|
+
return /* @__PURE__ */ y(
|
|
2786
|
+
"div",
|
|
2787
|
+
{
|
|
2788
|
+
className: c,
|
|
2789
|
+
style: {
|
|
2790
|
+
display: "flex",
|
|
2791
|
+
flexDirection: "column",
|
|
2792
|
+
alignItems: "center",
|
|
2793
|
+
justifyContent: "center",
|
|
2794
|
+
textAlign: "center",
|
|
2795
|
+
padding: i ? "32px 24px" : "48px 32px",
|
|
2796
|
+
// Full-screen: fill parent height; contained: let content determine height
|
|
2797
|
+
...i ? {} : { flex: 1, minHeight: 280 }
|
|
2798
|
+
},
|
|
2799
|
+
children: [
|
|
2800
|
+
s != null && /* @__PURE__ */ o(
|
|
2801
|
+
"div",
|
|
2802
|
+
{
|
|
2803
|
+
"aria-hidden": "true",
|
|
2804
|
+
style: {
|
|
2805
|
+
marginBottom: i ? 16 : 20,
|
|
2806
|
+
fontSize: i ? 40 : 52,
|
|
2807
|
+
lineHeight: 1,
|
|
2808
|
+
// Slight entrance: no JS animation, keep it simple and safe
|
|
2809
|
+
opacity: 1
|
|
2810
|
+
},
|
|
2811
|
+
children: d ? /* @__PURE__ */ o("span", { role: "img", "aria-hidden": "true", style: { fontSize: "inherit" }, children: s }) : s
|
|
2812
|
+
}
|
|
2813
|
+
),
|
|
2814
|
+
/* @__PURE__ */ o(
|
|
2815
|
+
"p",
|
|
2816
|
+
{
|
|
2817
|
+
style: {
|
|
2818
|
+
fontSize: i ? 17 : 20,
|
|
2819
|
+
fontWeight: 700,
|
|
2820
|
+
color: a === "error" ? "var(--color-danger)" : "var(--color-ink)",
|
|
2821
|
+
lineHeight: 1.3,
|
|
2822
|
+
margin: 0,
|
|
2823
|
+
marginBottom: n ? 6 : r ? 20 : 0,
|
|
2824
|
+
maxWidth: 280
|
|
2825
|
+
},
|
|
2826
|
+
children: t
|
|
2827
|
+
}
|
|
2828
|
+
),
|
|
2829
|
+
n && /* @__PURE__ */ o(
|
|
2830
|
+
"p",
|
|
2831
|
+
{
|
|
2832
|
+
style: {
|
|
2833
|
+
fontSize: i ? 14 : 15,
|
|
2834
|
+
fontWeight: 400,
|
|
2835
|
+
color: "var(--color-muted)",
|
|
2836
|
+
lineHeight: 1.5,
|
|
2837
|
+
margin: 0,
|
|
2838
|
+
marginBottom: r ? i ? 20 : 28 : 0,
|
|
2839
|
+
maxWidth: 260
|
|
2840
|
+
},
|
|
2841
|
+
children: n
|
|
2842
|
+
}
|
|
2843
|
+
),
|
|
2844
|
+
r && /* @__PURE__ */ o("div", { style: { marginTop: !n && r ? i ? 20 : 24 : 0 }, children: l ? /* @__PURE__ */ o(Tn, { ...r }) : r })
|
|
2845
|
+
]
|
|
2846
|
+
}
|
|
2847
|
+
);
|
|
2848
|
+
}
|
|
2849
|
+
const ft = {
|
|
2850
|
+
xs: 28,
|
|
2851
|
+
sm: 36,
|
|
2852
|
+
md: 44,
|
|
2853
|
+
lg: 56,
|
|
2854
|
+
xl: 80
|
|
2855
|
+
}, In = {
|
|
2856
|
+
xs: 11,
|
|
2857
|
+
sm: 13,
|
|
2858
|
+
md: 16,
|
|
2859
|
+
lg: 20,
|
|
2860
|
+
xl: 28
|
|
2861
|
+
}, Dn = {
|
|
2862
|
+
xs: 8,
|
|
2863
|
+
sm: 10,
|
|
2864
|
+
md: 12,
|
|
2865
|
+
lg: 14,
|
|
2866
|
+
xl: 18
|
|
2867
|
+
}, Rn = {
|
|
2868
|
+
xs: 1.5,
|
|
2869
|
+
sm: 2,
|
|
2870
|
+
md: 2.5,
|
|
2871
|
+
lg: 2.5,
|
|
2872
|
+
xl: 3
|
|
2873
|
+
}, Ue = [
|
|
2874
|
+
"#4361ee",
|
|
2875
|
+
// subject blue
|
|
2876
|
+
"#2d6a4f",
|
|
2877
|
+
// success green
|
|
2878
|
+
"#e63946",
|
|
2879
|
+
// accent red
|
|
2880
|
+
"#e76f51",
|
|
2881
|
+
// object orange
|
|
2882
|
+
"#6d6875",
|
|
2883
|
+
// particle purple
|
|
2884
|
+
"#9b2226",
|
|
2885
|
+
// verb deep red
|
|
2886
|
+
"#457b9d",
|
|
2887
|
+
// calm blue
|
|
2888
|
+
"#2a9d8f"
|
|
2889
|
+
// teal
|
|
2890
|
+
];
|
|
2891
|
+
function $n(e) {
|
|
2892
|
+
let t = 0;
|
|
2893
|
+
for (let n = 0; n < e.length; n++)
|
|
2894
|
+
t = t * 31 + e.charCodeAt(n) >>> 0;
|
|
2895
|
+
return Ue[t % Ue.length];
|
|
2896
|
+
}
|
|
2897
|
+
function jn(e) {
|
|
2898
|
+
if (!e.trim()) return "?";
|
|
2899
|
+
const t = e.trim().split(/\s+/);
|
|
2900
|
+
return t.length === 1 ? t[0][0].toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
|
|
2901
|
+
}
|
|
2902
|
+
function _n({ size: e }) {
|
|
2903
|
+
const t = ft[e];
|
|
2904
|
+
return /* @__PURE__ */ y(G, { children: [
|
|
2905
|
+
/* @__PURE__ */ o("style", { children: `
|
|
2906
|
+
@keyframes kami-avatar-shimmer {
|
|
2907
|
+
0% { background-position: -200% 0; }
|
|
2908
|
+
100% { background-position: 200% 0; }
|
|
2909
|
+
}
|
|
2910
|
+
` }),
|
|
2911
|
+
/* @__PURE__ */ o(
|
|
2912
|
+
"div",
|
|
2913
|
+
{
|
|
2914
|
+
"aria-hidden": "true",
|
|
2915
|
+
style: {
|
|
2916
|
+
width: t,
|
|
2917
|
+
height: t,
|
|
2918
|
+
borderRadius: "50%",
|
|
2919
|
+
backgroundImage: "linear-gradient(90deg, var(--input-bg) 25%, var(--surface-divider) 50%, var(--input-bg) 75%)",
|
|
2920
|
+
backgroundSize: "200% 100%",
|
|
2921
|
+
animation: "kami-avatar-shimmer 1.4s ease-in-out infinite",
|
|
2922
|
+
flexShrink: 0
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
)
|
|
2926
|
+
] });
|
|
2927
|
+
}
|
|
2928
|
+
function $r({
|
|
2929
|
+
src: e,
|
|
2930
|
+
name: t = "",
|
|
2931
|
+
size: n = "md",
|
|
2932
|
+
online: r = !1,
|
|
2933
|
+
loading: a = !1,
|
|
2934
|
+
onClick: i,
|
|
2935
|
+
alt: c,
|
|
2936
|
+
className: s = ""
|
|
2937
|
+
}) {
|
|
2938
|
+
const [d, l] = B(!1), u = ft[n], f = In[n], v = Dn[n], b = Rn[n], E = !!e && !d, k = !E, h = jn(t), p = $n(t || "?"), m = c ?? t ?? "Avatar", S = !!i, g = () => {
|
|
2939
|
+
i && (Y(), i());
|
|
2940
|
+
};
|
|
2941
|
+
if (a)
|
|
2942
|
+
return /* @__PURE__ */ o("div", { className: s, style: { position: "relative", display: "inline-flex", flexShrink: 0 }, children: /* @__PURE__ */ o(_n, { size: n }) });
|
|
2943
|
+
const x = {
|
|
2944
|
+
width: u,
|
|
2945
|
+
height: u,
|
|
2946
|
+
borderRadius: "50%",
|
|
2947
|
+
overflow: "hidden",
|
|
2948
|
+
flexShrink: 0,
|
|
2949
|
+
display: "flex",
|
|
2950
|
+
alignItems: "center",
|
|
2951
|
+
justifyContent: "center",
|
|
2952
|
+
backgroundColor: k ? p : "var(--input-bg)",
|
|
2953
|
+
position: "relative",
|
|
2954
|
+
userSelect: "none",
|
|
2955
|
+
transition: S ? "transform 0.12s ease, opacity 0.12s ease" : void 0,
|
|
2956
|
+
cursor: S ? "pointer" : "default",
|
|
2957
|
+
WebkitTapHighlightColor: "transparent"
|
|
2958
|
+
}, w = S ? /* @__PURE__ */ y(
|
|
2959
|
+
"button",
|
|
2960
|
+
{
|
|
2961
|
+
type: "button",
|
|
2962
|
+
onClick: g,
|
|
2963
|
+
"aria-label": m,
|
|
2964
|
+
style: {
|
|
2965
|
+
...x,
|
|
2966
|
+
padding: 0,
|
|
2967
|
+
border: "none",
|
|
2968
|
+
outline: "none"
|
|
2969
|
+
},
|
|
2970
|
+
className: [
|
|
2971
|
+
S ? "active:scale-[0.90] active:opacity-80" : "",
|
|
2972
|
+
s
|
|
2973
|
+
].join(" "),
|
|
2974
|
+
children: [
|
|
2975
|
+
E && /* @__PURE__ */ o(
|
|
2976
|
+
"img",
|
|
2977
|
+
{
|
|
2978
|
+
src: e,
|
|
2979
|
+
alt: m,
|
|
2980
|
+
onError: () => l(!0),
|
|
2981
|
+
style: { width: "100%", height: "100%", objectFit: "cover", display: "block" },
|
|
2982
|
+
draggable: !1
|
|
2983
|
+
}
|
|
2984
|
+
),
|
|
2985
|
+
k && /* @__PURE__ */ o(
|
|
2986
|
+
"span",
|
|
2987
|
+
{
|
|
2988
|
+
style: {
|
|
2989
|
+
fontSize: f,
|
|
2990
|
+
fontWeight: 700,
|
|
2991
|
+
color: "#ffffff",
|
|
2992
|
+
lineHeight: 1,
|
|
2993
|
+
letterSpacing: n === "xl" ? "-0.5px" : void 0
|
|
2994
|
+
},
|
|
2995
|
+
"aria-hidden": "true",
|
|
2996
|
+
children: h
|
|
2997
|
+
}
|
|
2998
|
+
)
|
|
2999
|
+
]
|
|
3000
|
+
}
|
|
3001
|
+
) : /* @__PURE__ */ y(
|
|
3002
|
+
"div",
|
|
3003
|
+
{
|
|
3004
|
+
role: "img",
|
|
3005
|
+
"aria-label": m,
|
|
3006
|
+
style: x,
|
|
3007
|
+
className: s,
|
|
3008
|
+
children: [
|
|
3009
|
+
E && /* @__PURE__ */ o(
|
|
3010
|
+
"img",
|
|
3011
|
+
{
|
|
3012
|
+
src: e,
|
|
3013
|
+
alt: m,
|
|
3014
|
+
onError: () => l(!0),
|
|
3015
|
+
style: { width: "100%", height: "100%", objectFit: "cover", display: "block" },
|
|
3016
|
+
draggable: !1
|
|
3017
|
+
}
|
|
3018
|
+
),
|
|
3019
|
+
k && /* @__PURE__ */ o(
|
|
3020
|
+
"span",
|
|
3021
|
+
{
|
|
3022
|
+
style: {
|
|
3023
|
+
fontSize: f,
|
|
3024
|
+
fontWeight: 700,
|
|
3025
|
+
color: "#ffffff",
|
|
3026
|
+
lineHeight: 1,
|
|
3027
|
+
letterSpacing: n === "xl" ? "-0.5px" : void 0
|
|
3028
|
+
},
|
|
3029
|
+
"aria-hidden": "true",
|
|
3030
|
+
children: h
|
|
3031
|
+
}
|
|
3032
|
+
)
|
|
3033
|
+
]
|
|
3034
|
+
}
|
|
3035
|
+
);
|
|
3036
|
+
return r ? /* @__PURE__ */ y(
|
|
3037
|
+
"div",
|
|
3038
|
+
{
|
|
3039
|
+
style: { position: "relative", display: "inline-flex", flexShrink: 0 },
|
|
3040
|
+
children: [
|
|
3041
|
+
w,
|
|
3042
|
+
/* @__PURE__ */ o(
|
|
3043
|
+
"div",
|
|
3044
|
+
{
|
|
3045
|
+
"aria-label": "Online",
|
|
3046
|
+
style: {
|
|
3047
|
+
position: "absolute",
|
|
3048
|
+
bottom: b / 2,
|
|
3049
|
+
right: b / 2,
|
|
3050
|
+
width: v,
|
|
3051
|
+
height: v,
|
|
3052
|
+
borderRadius: "50%",
|
|
3053
|
+
backgroundColor: "var(--color-success)",
|
|
3054
|
+
border: `${b}px solid white`,
|
|
3055
|
+
boxSizing: "border-box",
|
|
3056
|
+
pointerEvents: "none"
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
)
|
|
3060
|
+
]
|
|
3061
|
+
}
|
|
3062
|
+
) : w;
|
|
3063
|
+
}
|
|
3064
|
+
function jr({
|
|
3065
|
+
children: e,
|
|
3066
|
+
overlap: t = -8,
|
|
3067
|
+
className: n = ""
|
|
3068
|
+
}) {
|
|
3069
|
+
const r = mt.Children.toArray(e);
|
|
3070
|
+
return /* @__PURE__ */ o(
|
|
3071
|
+
"div",
|
|
3072
|
+
{
|
|
3073
|
+
className: n,
|
|
3074
|
+
style: { display: "flex", flexDirection: "row" },
|
|
3075
|
+
children: r.map((a, i) => /* @__PURE__ */ o(
|
|
3076
|
+
"div",
|
|
3077
|
+
{
|
|
3078
|
+
style: {
|
|
3079
|
+
// Each item is offset left by `overlap` px relative to the previous
|
|
3080
|
+
marginLeft: i === 0 ? 0 : t,
|
|
3081
|
+
// Right-to-left stacking: first child is on top
|
|
3082
|
+
zIndex: r.length - i,
|
|
3083
|
+
position: "relative",
|
|
3084
|
+
// White ring between avatars
|
|
3085
|
+
borderRadius: "50%",
|
|
3086
|
+
boxShadow: "0 0 0 2px white"
|
|
3087
|
+
},
|
|
3088
|
+
children: a
|
|
3089
|
+
},
|
|
3090
|
+
i
|
|
3091
|
+
))
|
|
3092
|
+
}
|
|
3093
|
+
);
|
|
3094
|
+
}
|
|
3095
|
+
const An = 72, On = 108, ge = 14, ae = ge * 2 + 8, Xe = 2 * Math.PI * ge, Fe = { duration: 260, easing: "cubic-bezier(0.4, 0, 0.6, 1)" };
|
|
3096
|
+
function Hn({ progress: e, spinning: t, translateY: n }) {
|
|
3097
|
+
const r = ae + 8, a = r / 2, i = Xe, c = i - i * Math.min(e, 1);
|
|
3098
|
+
return /* @__PURE__ */ o(
|
|
3099
|
+
"div",
|
|
3100
|
+
{
|
|
3101
|
+
"aria-hidden": "true",
|
|
3102
|
+
style: {
|
|
3103
|
+
position: "absolute",
|
|
3104
|
+
top: 0,
|
|
3105
|
+
left: "50%",
|
|
3106
|
+
transform: `translateX(-50%) translateY(${n}px)`,
|
|
3107
|
+
width: r,
|
|
3108
|
+
height: r,
|
|
3109
|
+
display: "flex",
|
|
3110
|
+
alignItems: "center",
|
|
3111
|
+
justifyContent: "center",
|
|
3112
|
+
// Only visible when pulled
|
|
3113
|
+
opacity: Math.max(0, Math.min(1, n / 24)),
|
|
3114
|
+
transition: t ? void 0 : "opacity 80ms ease",
|
|
3115
|
+
pointerEvents: "none"
|
|
3116
|
+
},
|
|
3117
|
+
children: /* @__PURE__ */ y(
|
|
3118
|
+
"svg",
|
|
3119
|
+
{
|
|
3120
|
+
width: r,
|
|
3121
|
+
height: r,
|
|
3122
|
+
viewBox: `0 0 ${r} ${r}`,
|
|
3123
|
+
fill: "none",
|
|
3124
|
+
children: [
|
|
3125
|
+
/* @__PURE__ */ o(
|
|
3126
|
+
"circle",
|
|
3127
|
+
{
|
|
3128
|
+
cx: a,
|
|
3129
|
+
cy: a,
|
|
3130
|
+
r: ge,
|
|
3131
|
+
stroke: "var(--surface-divider)",
|
|
3132
|
+
strokeWidth: "2.5"
|
|
3133
|
+
}
|
|
3134
|
+
),
|
|
3135
|
+
/* @__PURE__ */ o(
|
|
3136
|
+
"circle",
|
|
3137
|
+
{
|
|
3138
|
+
cx: a,
|
|
3139
|
+
cy: a,
|
|
3140
|
+
r: ge,
|
|
3141
|
+
stroke: "var(--color-accent)",
|
|
3142
|
+
strokeWidth: "2.5",
|
|
3143
|
+
strokeLinecap: "round",
|
|
3144
|
+
strokeDasharray: i,
|
|
3145
|
+
strokeDashoffset: t ? Xe * 0.75 : c,
|
|
3146
|
+
transform: `rotate(-90 ${a} ${a})`,
|
|
3147
|
+
style: t ? {
|
|
3148
|
+
animationName: "kami-ptr-spin",
|
|
3149
|
+
animationDuration: "800ms",
|
|
3150
|
+
animationTimingFunction: "linear",
|
|
3151
|
+
animationIterationCount: "infinite"
|
|
3152
|
+
} : {
|
|
3153
|
+
transition: "stroke-dashoffset 60ms linear"
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
)
|
|
3157
|
+
]
|
|
3158
|
+
}
|
|
3159
|
+
)
|
|
3160
|
+
}
|
|
3161
|
+
);
|
|
3162
|
+
}
|
|
3163
|
+
function _r({
|
|
3164
|
+
onRefresh: e,
|
|
3165
|
+
children: t,
|
|
3166
|
+
disabled: n = !1,
|
|
3167
|
+
threshold: r = An,
|
|
3168
|
+
className: a = "",
|
|
3169
|
+
style: i
|
|
3170
|
+
}) {
|
|
3171
|
+
const c = L(null), s = L(null), d = L(null), l = L("idle"), u = L(0), f = L(0), v = L(!1), [b, E] = B({
|
|
3172
|
+
translateY: -ae,
|
|
3173
|
+
progress: 0,
|
|
3174
|
+
spinning: !1
|
|
3175
|
+
}), k = $((p, m) => {
|
|
3176
|
+
const S = s.current;
|
|
3177
|
+
S && (m ? S.animate(
|
|
3178
|
+
[{ transform: `translateY(${p}px)` }],
|
|
3179
|
+
{ ...Fe, fill: "forwards" }
|
|
3180
|
+
) : S.style.transform = `translateY(${p}px)`);
|
|
3181
|
+
}, []), h = $(() => {
|
|
3182
|
+
l.current = "snapping", k(0, !0), E({ translateY: -ae, progress: 0, spinning: !1 }), setTimeout(() => {
|
|
3183
|
+
l.current = "idle";
|
|
3184
|
+
}, Fe.duration + 50);
|
|
3185
|
+
}, [k]);
|
|
3186
|
+
return _(() => {
|
|
3187
|
+
const p = c.current, m = d.current;
|
|
3188
|
+
if (!p || !m) return;
|
|
3189
|
+
const S = (w) => {
|
|
3190
|
+
n || l.current !== "idle" || m.scrollTop > 2 || (u.current = w.touches[0].clientY, f.current = 0, v.current = !1, l.current = "pulling");
|
|
3191
|
+
}, g = (w) => {
|
|
3192
|
+
if (l.current !== "pulling" && l.current !== "triggered") return;
|
|
3193
|
+
const N = w.touches[0].clientY - u.current;
|
|
3194
|
+
if (N <= 0) {
|
|
3195
|
+
l.current === "pulling" && (l.current = "idle");
|
|
3196
|
+
return;
|
|
3197
|
+
}
|
|
3198
|
+
m.scrollTop <= 0 && w.preventDefault();
|
|
3199
|
+
const T = N, C = T < r ? T : r + (T - r) * 0.25;
|
|
3200
|
+
f.current = Math.min(C, On);
|
|
3201
|
+
const P = Math.min(f.current / r, 1);
|
|
3202
|
+
f.current >= r && !v.current ? (v.current = !0, l.current = "triggered", Y()) : f.current < r && (l.current = "pulling", v.current = !1), k(f.current), E({
|
|
3203
|
+
translateY: f.current - ae - 8,
|
|
3204
|
+
progress: P,
|
|
3205
|
+
spinning: !1
|
|
3206
|
+
});
|
|
3207
|
+
}, x = async () => {
|
|
3208
|
+
if (l.current === "triggered") {
|
|
3209
|
+
l.current = "refreshing";
|
|
3210
|
+
const w = r + 8;
|
|
3211
|
+
k(w, !0), E((N) => ({ ...N, translateY: w - ae - 8, spinning: !0 })), at();
|
|
3212
|
+
try {
|
|
3213
|
+
await e();
|
|
3214
|
+
} finally {
|
|
3215
|
+
h();
|
|
3216
|
+
}
|
|
3217
|
+
} else l.current === "pulling" && h();
|
|
3218
|
+
};
|
|
3219
|
+
return p.addEventListener("touchstart", S, { passive: !0 }), p.addEventListener("touchmove", g, { passive: !1 }), p.addEventListener("touchend", x, { passive: !0 }), p.addEventListener("touchcancel", h, { passive: !0 }), () => {
|
|
3220
|
+
p.removeEventListener("touchstart", S), p.removeEventListener("touchmove", g), p.removeEventListener("touchend", x), p.removeEventListener("touchcancel", h);
|
|
3221
|
+
};
|
|
3222
|
+
}, [n, r, e, k, h]), /* @__PURE__ */ y(G, { children: [
|
|
3223
|
+
/* @__PURE__ */ o("style", { children: `
|
|
3224
|
+
@keyframes kami-ptr-spin {
|
|
3225
|
+
from { transform: rotate(-90deg); }
|
|
3226
|
+
to { transform: rotate(270deg); }
|
|
3227
|
+
}
|
|
3228
|
+
` }),
|
|
3229
|
+
/* @__PURE__ */ y(
|
|
3230
|
+
"div",
|
|
3231
|
+
{
|
|
3232
|
+
ref: c,
|
|
3233
|
+
className: a,
|
|
3234
|
+
style: { position: "relative", overflow: "hidden", height: "100%", ...i },
|
|
3235
|
+
children: [
|
|
3236
|
+
/* @__PURE__ */ o(Hn, { ...b }),
|
|
3237
|
+
/* @__PURE__ */ o(
|
|
3238
|
+
"div",
|
|
3239
|
+
{
|
|
3240
|
+
ref: d,
|
|
3241
|
+
style: {
|
|
3242
|
+
height: "100%",
|
|
3243
|
+
overflowY: "auto",
|
|
3244
|
+
WebkitOverflowScrolling: "touch"
|
|
3245
|
+
},
|
|
3246
|
+
children: /* @__PURE__ */ o("div", { ref: s, style: { willChange: "transform" }, children: t })
|
|
3247
|
+
}
|
|
3248
|
+
)
|
|
3249
|
+
]
|
|
3250
|
+
}
|
|
3251
|
+
)
|
|
3252
|
+
] });
|
|
3253
|
+
}
|
|
3254
|
+
function Mn() {
|
|
3255
|
+
return /* @__PURE__ */ o(
|
|
3256
|
+
"svg",
|
|
3257
|
+
{
|
|
3258
|
+
width: "14",
|
|
3259
|
+
height: "14",
|
|
3260
|
+
viewBox: "0 0 24 24",
|
|
3261
|
+
fill: "none",
|
|
3262
|
+
stroke: "currentColor",
|
|
3263
|
+
strokeWidth: "2.5",
|
|
3264
|
+
strokeLinecap: "round",
|
|
3265
|
+
strokeLinejoin: "round",
|
|
3266
|
+
"aria-hidden": "true",
|
|
3267
|
+
children: /* @__PURE__ */ o("polyline", { points: "6 9 12 15 18 9" })
|
|
3268
|
+
}
|
|
3269
|
+
);
|
|
3270
|
+
}
|
|
3271
|
+
function Bn() {
|
|
3272
|
+
return /* @__PURE__ */ o(
|
|
3273
|
+
"svg",
|
|
3274
|
+
{
|
|
3275
|
+
width: "17",
|
|
3276
|
+
height: "17",
|
|
3277
|
+
viewBox: "0 0 24 24",
|
|
3278
|
+
fill: "none",
|
|
3279
|
+
stroke: "currentColor",
|
|
3280
|
+
strokeWidth: "2.5",
|
|
3281
|
+
strokeLinecap: "round",
|
|
3282
|
+
strokeLinejoin: "round",
|
|
3283
|
+
"aria-hidden": "true",
|
|
3284
|
+
children: /* @__PURE__ */ o("polyline", { points: "20 6 9 17 4 12" })
|
|
3285
|
+
}
|
|
3286
|
+
);
|
|
3287
|
+
}
|
|
3288
|
+
function Wn({ option: e, selected: t, multi: n, onPress: r }) {
|
|
3289
|
+
return /* @__PURE__ */ y(
|
|
3290
|
+
"button",
|
|
3291
|
+
{
|
|
3292
|
+
type: "button",
|
|
3293
|
+
disabled: e.disabled,
|
|
3294
|
+
onClick: r,
|
|
3295
|
+
className: [
|
|
3296
|
+
"w-full flex items-center gap-3 px-4 py-3.5 min-h-[50px]",
|
|
3297
|
+
"text-left select-none transition-colors duration-100",
|
|
3298
|
+
"active:bg-[var(--surface-active)]",
|
|
3299
|
+
e.disabled ? "opacity-40 cursor-not-allowed" : "cursor-pointer"
|
|
3300
|
+
// Show a top divider for all but the first row
|
|
3301
|
+
].join(" "),
|
|
3302
|
+
style: { borderTop: "1px solid var(--surface-divider)" },
|
|
3303
|
+
children: [
|
|
3304
|
+
n ? /* @__PURE__ */ o(
|
|
3305
|
+
"div",
|
|
3306
|
+
{
|
|
3307
|
+
style: {
|
|
3308
|
+
width: 22,
|
|
3309
|
+
height: 22,
|
|
3310
|
+
flexShrink: 0,
|
|
3311
|
+
borderRadius: 6,
|
|
3312
|
+
border: t ? "2px solid var(--color-accent)" : "2px solid var(--surface-divider)",
|
|
3313
|
+
background: t ? "var(--color-accent)" : "transparent",
|
|
3314
|
+
display: "flex",
|
|
3315
|
+
alignItems: "center",
|
|
3316
|
+
justifyContent: "center",
|
|
3317
|
+
transition: "background 0.15s ease, border-color 0.15s ease"
|
|
3318
|
+
},
|
|
3319
|
+
children: t && /* @__PURE__ */ o(
|
|
3320
|
+
"svg",
|
|
3321
|
+
{
|
|
3322
|
+
width: "12",
|
|
3323
|
+
height: "12",
|
|
3324
|
+
viewBox: "0 0 24 24",
|
|
3325
|
+
fill: "none",
|
|
3326
|
+
stroke: "white",
|
|
3327
|
+
strokeWidth: "3",
|
|
3328
|
+
strokeLinecap: "round",
|
|
3329
|
+
strokeLinejoin: "round",
|
|
3330
|
+
children: /* @__PURE__ */ o("polyline", { points: "20 6 9 17 4 12" })
|
|
3331
|
+
}
|
|
3332
|
+
)
|
|
3333
|
+
}
|
|
3334
|
+
) : e.icon ? /* @__PURE__ */ o("span", { className: "text-[20px] leading-none shrink-0", children: e.icon }) : null,
|
|
3335
|
+
/* @__PURE__ */ y("div", { className: "flex-1 min-w-0", children: [
|
|
3336
|
+
/* @__PURE__ */ o("p", { className: [
|
|
3337
|
+
"text-[15px] leading-snug",
|
|
3338
|
+
t && !n ? "font-semibold text-[var(--color-ink)]" : "font-medium text-[var(--color-ink)]"
|
|
3339
|
+
].join(" "), children: e.label }),
|
|
3340
|
+
e.sublabel && /* @__PURE__ */ o("p", { className: "text-[13px] text-[var(--color-muted)] mt-0.5 leading-snug", children: e.sublabel })
|
|
3341
|
+
] }),
|
|
3342
|
+
!n && t && /* @__PURE__ */ o("span", { className: "shrink-0 text-[var(--color-accent)]", children: /* @__PURE__ */ o(Bn, {}) })
|
|
3343
|
+
]
|
|
3344
|
+
}
|
|
3345
|
+
);
|
|
3346
|
+
}
|
|
3347
|
+
function Yn({ label: e, displayValue: t, hasValue: n, disabled: r, clearable: a, onClear: i, onClick: c, ariaLabel: s }) {
|
|
3348
|
+
return /* @__PURE__ */ y("div", { className: "flex flex-col gap-1.5", children: [
|
|
3349
|
+
e && /* @__PURE__ */ o("span", { className: "text-[13px] font-medium text-[var(--color-ink)] px-1", children: e }),
|
|
3350
|
+
/* @__PURE__ */ y(
|
|
3351
|
+
"button",
|
|
3352
|
+
{
|
|
3353
|
+
type: "button",
|
|
3354
|
+
onClick: c,
|
|
3355
|
+
disabled: r,
|
|
3356
|
+
"aria-label": s,
|
|
3357
|
+
"aria-haspopup": "listbox",
|
|
3358
|
+
className: [
|
|
3359
|
+
"flex items-center gap-2 px-3 min-h-[44px] rounded-xl w-full text-left",
|
|
3360
|
+
"bg-[var(--input-bg)] transition-shadow duration-150",
|
|
3361
|
+
"active:shadow-[0_0_0_2.5px_rgba(67,97,238,0.22)]",
|
|
3362
|
+
r ? "opacity-40 pointer-events-none" : ""
|
|
3363
|
+
].join(" "),
|
|
3364
|
+
children: [
|
|
3365
|
+
/* @__PURE__ */ o("span", { className: [
|
|
3366
|
+
"flex-1 text-[15px] truncate",
|
|
3367
|
+
n ? "text-[var(--color-ink)]" : "text-[var(--color-muted)]"
|
|
3368
|
+
].join(" "), children: t }),
|
|
3369
|
+
a && n && i && /* @__PURE__ */ o(
|
|
3370
|
+
"button",
|
|
3371
|
+
{
|
|
3372
|
+
type: "button",
|
|
3373
|
+
onPointerDown: (d) => {
|
|
3374
|
+
d.preventDefault(), d.stopPropagation(), i();
|
|
3375
|
+
},
|
|
3376
|
+
className: "shrink-0 flex items-center justify-center w-5 h-5 rounded-full bg-[var(--color-muted)] opacity-60 active:opacity-40 transition-opacity",
|
|
3377
|
+
"aria-label": "Clear selection",
|
|
3378
|
+
children: /* @__PURE__ */ o("span", { className: "text-white font-bold leading-none", style: { fontSize: 10 }, children: "✕" })
|
|
3379
|
+
}
|
|
3380
|
+
),
|
|
3381
|
+
/* @__PURE__ */ o("span", { className: "shrink-0 text-[var(--color-muted)]", children: /* @__PURE__ */ o(Mn, {}) })
|
|
3382
|
+
]
|
|
3383
|
+
}
|
|
3384
|
+
)
|
|
3385
|
+
] });
|
|
3386
|
+
}
|
|
3387
|
+
function zn({ value: e, onChange: t, placeholder: n = "Search…" }) {
|
|
3388
|
+
const r = L(null);
|
|
3389
|
+
return /* @__PURE__ */ o("div", { className: "px-4 pb-3 pt-1", children: /* @__PURE__ */ y(
|
|
3390
|
+
"div",
|
|
3391
|
+
{
|
|
3392
|
+
className: "flex items-center gap-2 px-3 bg-[var(--input-bg)] rounded-full",
|
|
3393
|
+
style: { height: 36 },
|
|
3394
|
+
onClick: () => r.current?.focus(),
|
|
3395
|
+
children: [
|
|
3396
|
+
/* @__PURE__ */ y(
|
|
3397
|
+
"svg",
|
|
3398
|
+
{
|
|
3399
|
+
width: "14",
|
|
3400
|
+
height: "14",
|
|
3401
|
+
viewBox: "0 0 24 24",
|
|
3402
|
+
fill: "none",
|
|
3403
|
+
stroke: "currentColor",
|
|
3404
|
+
strokeWidth: "2.5",
|
|
3405
|
+
strokeLinecap: "round",
|
|
3406
|
+
strokeLinejoin: "round",
|
|
3407
|
+
className: "text-[var(--color-muted)] shrink-0",
|
|
3408
|
+
"aria-hidden": "true",
|
|
3409
|
+
children: [
|
|
3410
|
+
/* @__PURE__ */ o("circle", { cx: "11", cy: "11", r: "7.5" }),
|
|
3411
|
+
/* @__PURE__ */ o("line", { x1: "16.5", y1: "16.5", x2: "22", y2: "22" })
|
|
3412
|
+
]
|
|
3413
|
+
}
|
|
3414
|
+
),
|
|
3415
|
+
/* @__PURE__ */ o(
|
|
3416
|
+
"input",
|
|
3417
|
+
{
|
|
3418
|
+
ref: r,
|
|
3419
|
+
type: "search",
|
|
3420
|
+
inputMode: "search",
|
|
3421
|
+
autoCapitalize: "none",
|
|
3422
|
+
autoCorrect: "off",
|
|
3423
|
+
value: e,
|
|
3424
|
+
onChange: (a) => t(a.target.value),
|
|
3425
|
+
placeholder: n,
|
|
3426
|
+
className: [
|
|
3427
|
+
"flex-1 min-w-0 bg-transparent outline-none",
|
|
3428
|
+
"text-[15px] text-[var(--color-ink)] placeholder:text-[var(--color-muted)]",
|
|
3429
|
+
"[&::-webkit-search-cancel-button]:hidden",
|
|
3430
|
+
"[&::-webkit-search-decoration]:hidden"
|
|
3431
|
+
].join(" ")
|
|
3432
|
+
}
|
|
3433
|
+
),
|
|
3434
|
+
e && /* @__PURE__ */ o(
|
|
3435
|
+
"button",
|
|
3436
|
+
{
|
|
3437
|
+
type: "button",
|
|
3438
|
+
onPointerDown: (a) => {
|
|
3439
|
+
a.preventDefault(), t("");
|
|
3440
|
+
},
|
|
3441
|
+
className: "shrink-0 flex items-center justify-center w-[16px] h-[16px] rounded-full bg-[var(--color-muted)] opacity-50 active:opacity-30",
|
|
3442
|
+
"aria-label": "Clear search",
|
|
3443
|
+
children: /* @__PURE__ */ o("span", { className: "text-white font-bold leading-none", style: { fontSize: 9 }, children: "✕" })
|
|
3444
|
+
}
|
|
3445
|
+
)
|
|
3446
|
+
]
|
|
3447
|
+
}
|
|
3448
|
+
) });
|
|
3449
|
+
}
|
|
3450
|
+
function Ar(e) {
|
|
3451
|
+
const {
|
|
3452
|
+
options: t,
|
|
3453
|
+
placeholder: n = "Select…",
|
|
3454
|
+
label: r,
|
|
3455
|
+
title: a,
|
|
3456
|
+
searchable: i = !1,
|
|
3457
|
+
disabled: c = !1,
|
|
3458
|
+
doneLabel: s = "Done",
|
|
3459
|
+
clearable: d = !1,
|
|
3460
|
+
className: l = "",
|
|
3461
|
+
"aria-label": u
|
|
3462
|
+
} = e, [f, v] = B(!1), [b, E] = B(""), k = a ?? r ?? n, h = he(() => e.multi ? t.filter((P) => e.value.includes(P.value)) : t.filter((P) => P.value === e.value), [t, (e.multi, e.value)]), p = he(() => {
|
|
3463
|
+
if (h.length === 0) return n;
|
|
3464
|
+
if (e.multi)
|
|
3465
|
+
return h.length === 1 ? h[0].label : `${h[0].label} +${h.length - 1} more`;
|
|
3466
|
+
const P = h[0];
|
|
3467
|
+
return P.icon ? `${P.icon} ${P.label}` : P.label;
|
|
3468
|
+
}, [h, n, e.multi]), m = h.length > 0, S = he(() => {
|
|
3469
|
+
if (!b.trim()) return t;
|
|
3470
|
+
const P = b.toLowerCase();
|
|
3471
|
+
return t.filter(
|
|
3472
|
+
(I) => I.label.toLowerCase().includes(P) || (I.sublabel?.toLowerCase().includes(P) ?? !1)
|
|
3473
|
+
);
|
|
3474
|
+
}, [t, b]), g = () => {
|
|
3475
|
+
c || (Y(), E(""), v(!0));
|
|
3476
|
+
}, x = () => {
|
|
3477
|
+
v(!1), E("");
|
|
3478
|
+
}, w = (P) => {
|
|
3479
|
+
e.multi || (me(), e.onChange(P), setTimeout(x, 100));
|
|
3480
|
+
}, N = (P) => {
|
|
3481
|
+
if (!e.multi) return;
|
|
3482
|
+
me();
|
|
3483
|
+
const I = e.value, R = I.includes(P) ? I.filter((D) => D !== P) : [...I, P];
|
|
3484
|
+
e.onChange(R);
|
|
3485
|
+
}, T = () => {
|
|
3486
|
+
e.multi || e.onClear?.();
|
|
3487
|
+
}, C = b.trim() && S.length === 0;
|
|
3488
|
+
return /* @__PURE__ */ y("div", { className: l, children: [
|
|
3489
|
+
/* @__PURE__ */ o(
|
|
3490
|
+
Yn,
|
|
3491
|
+
{
|
|
3492
|
+
label: r,
|
|
3493
|
+
displayValue: p,
|
|
3494
|
+
hasValue: m,
|
|
3495
|
+
disabled: c,
|
|
3496
|
+
clearable: d && !e.multi,
|
|
3497
|
+
onClear: T,
|
|
3498
|
+
onClick: g,
|
|
3499
|
+
ariaLabel: u ?? r ?? n
|
|
3500
|
+
}
|
|
3501
|
+
),
|
|
3502
|
+
/* @__PURE__ */ y(dt, { open: f, onClose: x, title: k, children: [
|
|
3503
|
+
i && /* @__PURE__ */ o(
|
|
3504
|
+
zn,
|
|
3505
|
+
{
|
|
3506
|
+
value: b,
|
|
3507
|
+
onChange: E,
|
|
3508
|
+
placeholder: `Search ${k.toLowerCase()}…`
|
|
3509
|
+
}
|
|
3510
|
+
),
|
|
3511
|
+
/* @__PURE__ */ o(
|
|
3512
|
+
"div",
|
|
3513
|
+
{
|
|
3514
|
+
role: "listbox",
|
|
3515
|
+
"aria-label": k,
|
|
3516
|
+
"aria-multiselectable": e.multi,
|
|
3517
|
+
children: C ? /* @__PURE__ */ y("div", { className: "py-10 flex flex-col items-center gap-2", children: [
|
|
3518
|
+
/* @__PURE__ */ o("p", { className: "text-[34px] leading-none", children: "🔍" }),
|
|
3519
|
+
/* @__PURE__ */ y("p", { className: "text-[15px] text-[var(--color-muted)]", children: [
|
|
3520
|
+
"No results for “",
|
|
3521
|
+
b,
|
|
3522
|
+
"”"
|
|
3523
|
+
] })
|
|
3524
|
+
] }) : S.map((P) => {
|
|
3525
|
+
const I = e.multi ? e.value.includes(P.value) : e.value === P.value;
|
|
3526
|
+
return /* @__PURE__ */ o(
|
|
3527
|
+
Wn,
|
|
3528
|
+
{
|
|
3529
|
+
option: P,
|
|
3530
|
+
selected: I,
|
|
3531
|
+
multi: !!e.multi,
|
|
3532
|
+
onPress: () => e.multi ? N(P.value) : w(P.value)
|
|
3533
|
+
},
|
|
3534
|
+
P.value
|
|
3535
|
+
);
|
|
3536
|
+
})
|
|
3537
|
+
}
|
|
3538
|
+
),
|
|
3539
|
+
e.multi && /* @__PURE__ */ o("div", { className: "pt-4 pb-2", children: /* @__PURE__ */ y(
|
|
3540
|
+
"button",
|
|
3541
|
+
{
|
|
3542
|
+
type: "button",
|
|
3543
|
+
onClick: x,
|
|
3544
|
+
className: [
|
|
3545
|
+
"w-full bg-[var(--color-ink)] text-[var(--color-paper)]",
|
|
3546
|
+
"rounded-xl py-3.5 text-[15px] font-semibold",
|
|
3547
|
+
"active:opacity-75 transition-opacity"
|
|
3548
|
+
].join(" "),
|
|
3549
|
+
children: [
|
|
3550
|
+
s,
|
|
3551
|
+
e.value.length > 0 && /* @__PURE__ */ y("span", { className: "opacity-60 font-normal", children: [
|
|
3552
|
+
" ",
|
|
3553
|
+
"· ",
|
|
3554
|
+
e.value.length,
|
|
3555
|
+
" selected"
|
|
3556
|
+
] })
|
|
3557
|
+
]
|
|
3558
|
+
}
|
|
3559
|
+
) })
|
|
3560
|
+
] })
|
|
3561
|
+
] });
|
|
3562
|
+
}
|
|
3563
|
+
const W = 44, ht = 5, Ce = W * ht, te = Math.floor(ht / 2);
|
|
3564
|
+
function Un(e) {
|
|
3565
|
+
return typeof e == "string" ? { value: e, label: e } : e;
|
|
3566
|
+
}
|
|
3567
|
+
function Ge(e) {
|
|
3568
|
+
return String(e).padStart(2, "0");
|
|
3569
|
+
}
|
|
3570
|
+
function ve(e, t, n) {
|
|
3571
|
+
return Math.max(t, Math.min(n, e));
|
|
3572
|
+
}
|
|
3573
|
+
function ne({
|
|
3574
|
+
items: e,
|
|
3575
|
+
value: t,
|
|
3576
|
+
onChange: n,
|
|
3577
|
+
width: r,
|
|
3578
|
+
"aria-label": a = "Picker",
|
|
3579
|
+
className: i = ""
|
|
3580
|
+
}) {
|
|
3581
|
+
const c = e.map(Un), s = L(null), d = L(-1), l = L(!1), u = $((h, p = "smooth") => {
|
|
3582
|
+
const m = s.current;
|
|
3583
|
+
m && (l.current = !0, m.scrollTo({ top: h * W, behavior: p }), setTimeout(() => {
|
|
3584
|
+
l.current = !1;
|
|
3585
|
+
}, 400));
|
|
3586
|
+
}, []);
|
|
3587
|
+
_(() => {
|
|
3588
|
+
const h = c.findIndex((p) => p.value === t);
|
|
3589
|
+
h < 0 || (u(h, d.current < 0 ? "instant" : "smooth"), d.current = h);
|
|
3590
|
+
}, [t]);
|
|
3591
|
+
const f = $(() => {
|
|
3592
|
+
const h = s.current;
|
|
3593
|
+
if (!h) return;
|
|
3594
|
+
const p = Math.round(h.scrollTop / W), m = ve(p, 0, c.length - 1);
|
|
3595
|
+
if (m === d.current) return;
|
|
3596
|
+
const S = c[m];
|
|
3597
|
+
S?.disabled || (d.current = m, l.current || me(), n(S.value));
|
|
3598
|
+
}, [c, n]), v = L(null), b = $(() => {
|
|
3599
|
+
f(), v.current && clearTimeout(v.current), v.current = setTimeout(f, 120);
|
|
3600
|
+
}, [f]), E = $((h) => {
|
|
3601
|
+
const p = c.findIndex((m) => m.value === t);
|
|
3602
|
+
if (h.key === "ArrowDown") {
|
|
3603
|
+
h.preventDefault();
|
|
3604
|
+
const m = ve(p + 1, 0, c.length - 1);
|
|
3605
|
+
n(c[m].value);
|
|
3606
|
+
} else if (h.key === "ArrowUp") {
|
|
3607
|
+
h.preventDefault();
|
|
3608
|
+
const m = ve(p - 1, 0, c.length - 1);
|
|
3609
|
+
n(c[m].value);
|
|
3610
|
+
}
|
|
3611
|
+
}, [c, t, n]), k = c.findIndex((h) => h.value === t);
|
|
3612
|
+
return /* @__PURE__ */ y(
|
|
3613
|
+
"div",
|
|
3614
|
+
{
|
|
3615
|
+
className: i,
|
|
3616
|
+
style: {
|
|
3617
|
+
position: "relative",
|
|
3618
|
+
height: Ce,
|
|
3619
|
+
width: r ?? void 0,
|
|
3620
|
+
flex: r ? void 0 : 1,
|
|
3621
|
+
overflow: "hidden",
|
|
3622
|
+
userSelect: "none"
|
|
3623
|
+
},
|
|
3624
|
+
children: [
|
|
3625
|
+
/* @__PURE__ */ o("div", { style: {
|
|
3626
|
+
position: "absolute",
|
|
3627
|
+
top: 0,
|
|
3628
|
+
left: 0,
|
|
3629
|
+
right: 0,
|
|
3630
|
+
height: W * te,
|
|
3631
|
+
background: "linear-gradient(to bottom, var(--surface-solid) 20%, transparent)",
|
|
3632
|
+
zIndex: 2,
|
|
3633
|
+
pointerEvents: "none"
|
|
3634
|
+
}, "aria-hidden": "true" }),
|
|
3635
|
+
/* @__PURE__ */ o("div", { style: {
|
|
3636
|
+
position: "absolute",
|
|
3637
|
+
bottom: 0,
|
|
3638
|
+
left: 0,
|
|
3639
|
+
right: 0,
|
|
3640
|
+
height: W * te,
|
|
3641
|
+
background: "linear-gradient(to top, var(--surface-solid) 20%, transparent)",
|
|
3642
|
+
zIndex: 2,
|
|
3643
|
+
pointerEvents: "none"
|
|
3644
|
+
}, "aria-hidden": "true" }),
|
|
3645
|
+
/* @__PURE__ */ o(
|
|
3646
|
+
"div",
|
|
3647
|
+
{
|
|
3648
|
+
"aria-hidden": "true",
|
|
3649
|
+
style: {
|
|
3650
|
+
position: "absolute",
|
|
3651
|
+
top: W * te,
|
|
3652
|
+
left: 0,
|
|
3653
|
+
right: 0,
|
|
3654
|
+
height: W,
|
|
3655
|
+
borderTop: "1px solid var(--surface-divider)",
|
|
3656
|
+
borderBottom: "1px solid var(--surface-divider)",
|
|
3657
|
+
zIndex: 2,
|
|
3658
|
+
pointerEvents: "none"
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
),
|
|
3662
|
+
/* @__PURE__ */ o(
|
|
3663
|
+
"div",
|
|
3664
|
+
{
|
|
3665
|
+
ref: s,
|
|
3666
|
+
role: "listbox",
|
|
3667
|
+
"aria-label": a,
|
|
3668
|
+
tabIndex: 0,
|
|
3669
|
+
onScroll: b,
|
|
3670
|
+
onKeyDown: E,
|
|
3671
|
+
style: {
|
|
3672
|
+
height: Ce,
|
|
3673
|
+
overflowY: "scroll",
|
|
3674
|
+
scrollSnapType: "y mandatory",
|
|
3675
|
+
WebkitOverflowScrolling: "touch",
|
|
3676
|
+
paddingTop: W * te,
|
|
3677
|
+
paddingBottom: W * te,
|
|
3678
|
+
outline: "none",
|
|
3679
|
+
// Hide scrollbar (cross-browser)
|
|
3680
|
+
scrollbarWidth: "none",
|
|
3681
|
+
msOverflowStyle: "none"
|
|
3682
|
+
},
|
|
3683
|
+
children: c.map((h, p) => {
|
|
3684
|
+
const m = p === k;
|
|
3685
|
+
return /* @__PURE__ */ o(
|
|
3686
|
+
"div",
|
|
3687
|
+
{
|
|
3688
|
+
role: "option",
|
|
3689
|
+
"aria-selected": m,
|
|
3690
|
+
"aria-disabled": h.disabled,
|
|
3691
|
+
onClick: () => {
|
|
3692
|
+
h.disabled || (u(p), n(h.value));
|
|
3693
|
+
},
|
|
3694
|
+
style: {
|
|
3695
|
+
height: W,
|
|
3696
|
+
display: "flex",
|
|
3697
|
+
alignItems: "center",
|
|
3698
|
+
justifyContent: "center",
|
|
3699
|
+
scrollSnapAlign: "center",
|
|
3700
|
+
fontSize: m ? 20 : 17,
|
|
3701
|
+
fontWeight: m ? 600 : 400,
|
|
3702
|
+
color: h.disabled ? "var(--color-muted)" : m ? "var(--color-ink)" : "color-mix(in srgb, var(--color-ink) 55%, transparent)",
|
|
3703
|
+
transition: "font-size 120ms ease, color 120ms ease",
|
|
3704
|
+
cursor: h.disabled ? "not-allowed" : "pointer",
|
|
3705
|
+
paddingInline: 12,
|
|
3706
|
+
textAlign: "center",
|
|
3707
|
+
whiteSpace: "nowrap"
|
|
3708
|
+
},
|
|
3709
|
+
children: h.label
|
|
3710
|
+
},
|
|
3711
|
+
h.value
|
|
3712
|
+
);
|
|
3713
|
+
})
|
|
3714
|
+
}
|
|
3715
|
+
)
|
|
3716
|
+
]
|
|
3717
|
+
}
|
|
3718
|
+
);
|
|
3719
|
+
}
|
|
3720
|
+
function Xn(e) {
|
|
3721
|
+
return Array.from(
|
|
3722
|
+
{ length: 12 },
|
|
3723
|
+
(t, n) => new Intl.DateTimeFormat(e, { month: "short" }).format(new Date(2e3, n, 1))
|
|
3724
|
+
);
|
|
3725
|
+
}
|
|
3726
|
+
function Ke(e, t) {
|
|
3727
|
+
return new Date(e, t + 1, 0).getDate();
|
|
3728
|
+
}
|
|
3729
|
+
function Ve(e, t) {
|
|
3730
|
+
return Array.from({ length: t - e + 1 }, (n, r) => String(e + r));
|
|
3731
|
+
}
|
|
3732
|
+
function Fn({
|
|
3733
|
+
value: e,
|
|
3734
|
+
onChange: t,
|
|
3735
|
+
mode: n = "date",
|
|
3736
|
+
min: r,
|
|
3737
|
+
max: a,
|
|
3738
|
+
locale: i,
|
|
3739
|
+
className: c = ""
|
|
3740
|
+
}) {
|
|
3741
|
+
const s = Xn(i), d = e.getFullYear(), l = e.getMonth(), u = e.getDate(), f = e.getHours(), v = e.getMinutes(), b = r?.getFullYear() ?? d - 50, E = a?.getFullYear() ?? d + 50, k = Ve(b, E), h = s.map((w, N) => ({
|
|
3742
|
+
value: String(N),
|
|
3743
|
+
label: w
|
|
3744
|
+
})), p = Ke(d, l), m = Ve(1, p).map((w) => ({ value: w, label: w })), S = Array.from({ length: 24 }, (w, N) => ({
|
|
3745
|
+
value: String(N),
|
|
3746
|
+
label: Ge(N)
|
|
3747
|
+
})), g = Array.from({ length: 60 }, (w, N) => ({
|
|
3748
|
+
value: String(N),
|
|
3749
|
+
label: Ge(N)
|
|
3750
|
+
})), x = (w) => {
|
|
3751
|
+
const N = w.y ?? d, T = w.m ?? l, C = Ke(N, T), P = ve(w.d ?? u, 1, C), I = w.h ?? f, R = w.min ?? v, D = new Date(e);
|
|
3752
|
+
D.setFullYear(N), D.setMonth(T), D.setDate(P), D.setHours(I), D.setMinutes(R), t(D);
|
|
3753
|
+
};
|
|
3754
|
+
return /* @__PURE__ */ y(
|
|
3755
|
+
"div",
|
|
3756
|
+
{
|
|
3757
|
+
className: c,
|
|
3758
|
+
style: {
|
|
3759
|
+
display: "flex",
|
|
3760
|
+
flexDirection: "row",
|
|
3761
|
+
alignItems: "stretch",
|
|
3762
|
+
background: "var(--surface-solid)",
|
|
3763
|
+
borderRadius: 16,
|
|
3764
|
+
overflow: "hidden",
|
|
3765
|
+
height: Ce
|
|
3766
|
+
},
|
|
3767
|
+
children: [
|
|
3768
|
+
(n === "date" || n === "datetime") && /* @__PURE__ */ y(G, { children: [
|
|
3769
|
+
/* @__PURE__ */ o(
|
|
3770
|
+
ne,
|
|
3771
|
+
{
|
|
3772
|
+
items: h,
|
|
3773
|
+
value: String(l),
|
|
3774
|
+
onChange: (w) => x({ m: Number(w) }),
|
|
3775
|
+
"aria-label": "Month"
|
|
3776
|
+
}
|
|
3777
|
+
),
|
|
3778
|
+
/* @__PURE__ */ o(
|
|
3779
|
+
ne,
|
|
3780
|
+
{
|
|
3781
|
+
items: m,
|
|
3782
|
+
value: String(u),
|
|
3783
|
+
onChange: (w) => x({ d: Number(w) }),
|
|
3784
|
+
"aria-label": "Day",
|
|
3785
|
+
width: 56
|
|
3786
|
+
}
|
|
3787
|
+
),
|
|
3788
|
+
/* @__PURE__ */ o(
|
|
3789
|
+
ne,
|
|
3790
|
+
{
|
|
3791
|
+
items: k,
|
|
3792
|
+
value: String(d),
|
|
3793
|
+
onChange: (w) => x({ y: Number(w) }),
|
|
3794
|
+
"aria-label": "Year",
|
|
3795
|
+
width: 80
|
|
3796
|
+
}
|
|
3797
|
+
)
|
|
3798
|
+
] }),
|
|
3799
|
+
n === "datetime" && /* @__PURE__ */ o("div", { style: {
|
|
3800
|
+
width: 1,
|
|
3801
|
+
background: "var(--surface-divider)",
|
|
3802
|
+
alignSelf: "stretch",
|
|
3803
|
+
flexShrink: 0
|
|
3804
|
+
} }),
|
|
3805
|
+
(n === "time" || n === "datetime") && /* @__PURE__ */ y(G, { children: [
|
|
3806
|
+
/* @__PURE__ */ o(
|
|
3807
|
+
ne,
|
|
3808
|
+
{
|
|
3809
|
+
items: S,
|
|
3810
|
+
value: String(f),
|
|
3811
|
+
onChange: (w) => x({ h: Number(w) }),
|
|
3812
|
+
"aria-label": "Hour",
|
|
3813
|
+
width: 56
|
|
3814
|
+
}
|
|
3815
|
+
),
|
|
3816
|
+
/* @__PURE__ */ o(
|
|
3817
|
+
ne,
|
|
3818
|
+
{
|
|
3819
|
+
items: g,
|
|
3820
|
+
value: String(v),
|
|
3821
|
+
onChange: (w) => x({ min: Number(w) }),
|
|
3822
|
+
"aria-label": "Minute",
|
|
3823
|
+
width: 56
|
|
3824
|
+
}
|
|
3825
|
+
)
|
|
3826
|
+
] })
|
|
3827
|
+
]
|
|
3828
|
+
}
|
|
3829
|
+
);
|
|
3830
|
+
}
|
|
3831
|
+
function Or({
|
|
3832
|
+
mode: e = "date",
|
|
3833
|
+
initialValue: t,
|
|
3834
|
+
title: n
|
|
3835
|
+
} = {}) {
|
|
3836
|
+
const [r, a] = B(!1), [i, c] = B(t ?? /* @__PURE__ */ new Date()), [s, d] = B(t ?? /* @__PURE__ */ new Date());
|
|
3837
|
+
return { value: i, open: () => {
|
|
3838
|
+
d(i), a(!0);
|
|
3839
|
+
}, sheet: /* @__PURE__ */ y(dt, { open: r, onClose: () => {
|
|
3840
|
+
d(i), a(!1);
|
|
3841
|
+
}, title: n ?? (e === "date" ? "Select date" : e === "time" ? "Select time" : "Select date & time"), children: [
|
|
3842
|
+
/* @__PURE__ */ o("div", { style: { padding: "8px 16px 0" }, children: /* @__PURE__ */ o(Fn, { mode: e, value: s, onChange: d }) }),
|
|
3843
|
+
/* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(an, { onClick: () => {
|
|
3844
|
+
c(s), a(!1);
|
|
3845
|
+
}, fullWidth: !0, children: "Done" }) })
|
|
3846
|
+
] }) };
|
|
3847
|
+
}
|
|
3848
|
+
const pt = {
|
|
3849
|
+
destructive: "var(--color-danger)",
|
|
3850
|
+
primary: "var(--color-accent)",
|
|
3851
|
+
secondary: "var(--color-muted)"
|
|
3852
|
+
}, Gn = { duration: 320, easing: "cubic-bezier(0.34, 1.28, 0.64, 1)" }, Kn = { duration: 260, easing: "cubic-bezier(0.4, 0, 0.6, 1)" }, qe = 0.88, Je = 8, Vn = 1.2;
|
|
3853
|
+
function Qe({
|
|
3854
|
+
action: e,
|
|
3855
|
+
targetWidth: t,
|
|
3856
|
+
side: n
|
|
3857
|
+
}) {
|
|
3858
|
+
const r = pt[e.variant ?? "secondary"];
|
|
3859
|
+
return /* @__PURE__ */ y(
|
|
3860
|
+
"button",
|
|
3861
|
+
{
|
|
3862
|
+
type: "button",
|
|
3863
|
+
onClick: () => e.onPress(),
|
|
3864
|
+
style: {
|
|
3865
|
+
width: t,
|
|
3866
|
+
minWidth: t,
|
|
3867
|
+
minHeight: 44,
|
|
3868
|
+
height: "100%",
|
|
3869
|
+
background: r,
|
|
3870
|
+
border: "none",
|
|
3871
|
+
color: "white",
|
|
3872
|
+
display: "flex",
|
|
3873
|
+
flexDirection: "column",
|
|
3874
|
+
alignItems: "center",
|
|
3875
|
+
justifyContent: "center",
|
|
3876
|
+
gap: 2,
|
|
3877
|
+
cursor: "pointer",
|
|
3878
|
+
flexShrink: 0,
|
|
3879
|
+
// Leading actions are flush right; trailing flush left
|
|
3880
|
+
order: n === "leading" ? -1 : 1,
|
|
3881
|
+
transition: "opacity 100ms ease"
|
|
3882
|
+
},
|
|
3883
|
+
onPointerDown: (a) => {
|
|
3884
|
+
a.currentTarget.style.opacity = "0.75";
|
|
3885
|
+
},
|
|
3886
|
+
onPointerUp: (a) => {
|
|
3887
|
+
a.currentTarget.style.opacity = "1";
|
|
3888
|
+
},
|
|
3889
|
+
onPointerLeave: (a) => {
|
|
3890
|
+
a.currentTarget.style.opacity = "1";
|
|
3891
|
+
},
|
|
3892
|
+
children: [
|
|
3893
|
+
e.icon && /* @__PURE__ */ o("span", { style: { fontSize: 18, lineHeight: 1 }, children: e.icon }),
|
|
3894
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 11, fontWeight: 600, lineHeight: 1, letterSpacing: "0.02em" }, children: e.label })
|
|
3895
|
+
]
|
|
3896
|
+
}
|
|
3897
|
+
);
|
|
3898
|
+
}
|
|
3899
|
+
function Hr({
|
|
3900
|
+
children: e,
|
|
3901
|
+
trailingActions: t = [],
|
|
3902
|
+
leadingActions: n = [],
|
|
3903
|
+
fullSwipeEnabled: r = !0,
|
|
3904
|
+
fullSwipeThreshold: a = 0.55,
|
|
3905
|
+
className: i = ""
|
|
3906
|
+
}) {
|
|
3907
|
+
const c = L(null), s = L(null), d = L(null), l = L(0), u = L(null), [f, v] = B(!1), b = t.reduce(
|
|
3908
|
+
(p, m) => p + (m.width ?? 80),
|
|
3909
|
+
0
|
|
3910
|
+
), E = n.reduce(
|
|
3911
|
+
(p, m) => p + (m.width ?? 80),
|
|
3912
|
+
0
|
|
3913
|
+
), k = $((p, m) => {
|
|
3914
|
+
const S = s.current;
|
|
3915
|
+
if (S)
|
|
3916
|
+
if (l.current = p, m) {
|
|
3917
|
+
const g = p === 0 ? Kn : Gn;
|
|
3918
|
+
S.animate(
|
|
3919
|
+
[{ transform: `translateX(${p}px)` }],
|
|
3920
|
+
{ ...g, fill: "forwards" }
|
|
3921
|
+
);
|
|
3922
|
+
} else
|
|
3923
|
+
S.style.transform = `translateX(${p}px)`;
|
|
3924
|
+
}, []), h = $(() => {
|
|
3925
|
+
u.current = null, k(0, !0);
|
|
3926
|
+
}, [k]);
|
|
3927
|
+
return _(() => {
|
|
3928
|
+
const p = c.current;
|
|
3929
|
+
if (!p) return;
|
|
3930
|
+
let m = 0, S = 0, g = 0, x = "idle", w = !1;
|
|
3931
|
+
const N = () => d.current?.offsetWidth ?? 375, T = (I) => {
|
|
3932
|
+
I.isPrimary && (m = I.clientX, S = I.clientY, g = l.current, x = "deciding", w = !1, p.setPointerCapture(I.pointerId));
|
|
3933
|
+
}, C = (I) => {
|
|
3934
|
+
if (!I.isPrimary || x === "idle" || x === "vert") return;
|
|
3935
|
+
const R = I.clientX - m, D = I.clientY - S, O = Math.abs(R), j = Math.abs(D);
|
|
3936
|
+
if (x === "deciding") {
|
|
3937
|
+
if (O < Je && j < Je) return;
|
|
3938
|
+
if (j > O * Vn) {
|
|
3939
|
+
x = "vert";
|
|
3940
|
+
return;
|
|
3941
|
+
}
|
|
3942
|
+
x = "horiz";
|
|
3943
|
+
}
|
|
3944
|
+
I.preventDefault();
|
|
3945
|
+
const le = N(), M = g + R;
|
|
3946
|
+
let U = M;
|
|
3947
|
+
if (M < 0) {
|
|
3948
|
+
const F = -b;
|
|
3949
|
+
if (M < F) {
|
|
3950
|
+
const vt = M - F;
|
|
3951
|
+
U = F + vt * 0.25;
|
|
3952
|
+
}
|
|
3953
|
+
const ye = Math.abs(U) / le, ce = r && ye >= a && t.length > 0;
|
|
3954
|
+
ce !== w && (w = ce, v(ce), ce ? rt() : Y());
|
|
3955
|
+
} else if (M > 0) {
|
|
3956
|
+
const F = E;
|
|
3957
|
+
if (M > F) {
|
|
3958
|
+
const ye = M - F;
|
|
3959
|
+
U = F + ye * 0.25;
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
U < 0 && t.length === 0 && (U = M * 0.08), U > 0 && n.length === 0 && (U = M * 0.08), k(U);
|
|
3963
|
+
}, P = (I) => {
|
|
3964
|
+
if (!I.isPrimary || x !== "horiz") {
|
|
3965
|
+
x = "idle";
|
|
3966
|
+
return;
|
|
3967
|
+
}
|
|
3968
|
+
x = "idle";
|
|
3969
|
+
const R = N(), D = l.current;
|
|
3970
|
+
if (w && t.length > 0 && D < 0) {
|
|
3971
|
+
k(-R, !0), v(!1), setTimeout(() => {
|
|
3972
|
+
t[0].onPress(), setTimeout(() => k(0), 400);
|
|
3973
|
+
}, 220);
|
|
3974
|
+
return;
|
|
3975
|
+
}
|
|
3976
|
+
v(!1);
|
|
3977
|
+
const O = 0.35;
|
|
3978
|
+
if (D < 0 && t.length > 0) {
|
|
3979
|
+
const j = -(b * qe);
|
|
3980
|
+
Math.abs(D) > b * O ? (u.current = "trailing", Y(), k(j, !0)) : h();
|
|
3981
|
+
} else if (D > 0 && n.length > 0) {
|
|
3982
|
+
const j = E * qe;
|
|
3983
|
+
D > E * O ? (u.current = "leading", Y(), k(j, !0)) : h();
|
|
3984
|
+
} else
|
|
3985
|
+
h();
|
|
3986
|
+
};
|
|
3987
|
+
return p.addEventListener("pointerdown", T, { passive: !0 }), p.addEventListener("pointermove", C, { passive: !1 }), p.addEventListener("pointerup", P, { passive: !0 }), p.addEventListener("pointercancel", () => {
|
|
3988
|
+
x = "idle", h();
|
|
3989
|
+
}, { passive: !0 }), () => {
|
|
3990
|
+
p.removeEventListener("pointerdown", T), p.removeEventListener("pointermove", C), p.removeEventListener("pointerup", P);
|
|
3991
|
+
};
|
|
3992
|
+
}, [
|
|
3993
|
+
t,
|
|
3994
|
+
n,
|
|
3995
|
+
b,
|
|
3996
|
+
E,
|
|
3997
|
+
r,
|
|
3998
|
+
a,
|
|
3999
|
+
k,
|
|
4000
|
+
h
|
|
4001
|
+
]), _(() => {
|
|
4002
|
+
const p = (m) => {
|
|
4003
|
+
m.key === "Escape" && u.current && h();
|
|
4004
|
+
};
|
|
4005
|
+
return document.addEventListener("keydown", p), () => document.removeEventListener("keydown", p);
|
|
4006
|
+
}, [h]), /* @__PURE__ */ y(
|
|
4007
|
+
"div",
|
|
4008
|
+
{
|
|
4009
|
+
ref: d,
|
|
4010
|
+
className: i,
|
|
4011
|
+
style: {
|
|
4012
|
+
position: "relative",
|
|
4013
|
+
overflow: "hidden",
|
|
4014
|
+
// Full-swipe: flash the first trailing action's colour beneath the row
|
|
4015
|
+
backgroundColor: f && t.length > 0 ? pt[t[0].variant ?? "secondary"] : void 0,
|
|
4016
|
+
transition: f ? "background-color 100ms ease" : void 0
|
|
4017
|
+
},
|
|
4018
|
+
children: [
|
|
4019
|
+
n.length > 0 && /* @__PURE__ */ o(
|
|
4020
|
+
"div",
|
|
4021
|
+
{
|
|
4022
|
+
"aria-hidden": "true",
|
|
4023
|
+
style: {
|
|
4024
|
+
position: "absolute",
|
|
4025
|
+
left: 0,
|
|
4026
|
+
top: 0,
|
|
4027
|
+
bottom: 0,
|
|
4028
|
+
display: "flex",
|
|
4029
|
+
alignItems: "stretch",
|
|
4030
|
+
pointerEvents: u.current === "leading" ? "auto" : "none"
|
|
4031
|
+
},
|
|
4032
|
+
children: n.map((p, m) => /* @__PURE__ */ o(
|
|
4033
|
+
Qe,
|
|
4034
|
+
{
|
|
4035
|
+
action: p,
|
|
4036
|
+
targetWidth: p.width ?? 80,
|
|
4037
|
+
side: "leading"
|
|
4038
|
+
},
|
|
4039
|
+
m
|
|
4040
|
+
))
|
|
4041
|
+
}
|
|
4042
|
+
),
|
|
4043
|
+
t.length > 0 && /* @__PURE__ */ o(
|
|
4044
|
+
"div",
|
|
4045
|
+
{
|
|
4046
|
+
"aria-hidden": "true",
|
|
4047
|
+
style: {
|
|
4048
|
+
position: "absolute",
|
|
4049
|
+
right: 0,
|
|
4050
|
+
top: 0,
|
|
4051
|
+
bottom: 0,
|
|
4052
|
+
display: "flex",
|
|
4053
|
+
alignItems: "stretch",
|
|
4054
|
+
pointerEvents: u.current === "trailing" ? "auto" : "none"
|
|
4055
|
+
},
|
|
4056
|
+
children: t.map((p, m) => /* @__PURE__ */ o(
|
|
4057
|
+
Qe,
|
|
4058
|
+
{
|
|
4059
|
+
action: p,
|
|
4060
|
+
targetWidth: p.width ?? 80,
|
|
4061
|
+
side: "trailing"
|
|
4062
|
+
},
|
|
4063
|
+
m
|
|
4064
|
+
))
|
|
4065
|
+
}
|
|
4066
|
+
),
|
|
4067
|
+
/* @__PURE__ */ o(
|
|
4068
|
+
"div",
|
|
4069
|
+
{
|
|
4070
|
+
ref: c,
|
|
4071
|
+
style: {
|
|
4072
|
+
position: "relative",
|
|
4073
|
+
zIndex: 1,
|
|
4074
|
+
willChange: "transform",
|
|
4075
|
+
touchAction: "pan-y",
|
|
4076
|
+
// allow vertical scroll, we handle horizontal
|
|
4077
|
+
cursor: "default",
|
|
4078
|
+
backgroundColor: "var(--surface-solid)"
|
|
4079
|
+
},
|
|
4080
|
+
children: /* @__PURE__ */ o("div", { ref: s, style: { willChange: "transform" }, children: e })
|
|
4081
|
+
}
|
|
4082
|
+
)
|
|
4083
|
+
]
|
|
4084
|
+
}
|
|
4085
|
+
);
|
|
4086
|
+
}
|
|
4087
|
+
export {
|
|
4088
|
+
zt as $,
|
|
4089
|
+
fr as A,
|
|
4090
|
+
wr as B,
|
|
4091
|
+
ar as C,
|
|
4092
|
+
Fn as D,
|
|
4093
|
+
Rr as E,
|
|
4094
|
+
tr as F,
|
|
4095
|
+
Cr as G,
|
|
4096
|
+
ur as H,
|
|
4097
|
+
oe as I,
|
|
4098
|
+
ne as J,
|
|
4099
|
+
X as K,
|
|
4100
|
+
or as L,
|
|
4101
|
+
At as M,
|
|
4102
|
+
ie as N,
|
|
4103
|
+
tn as O,
|
|
4104
|
+
qt as P,
|
|
4105
|
+
Xt as Q,
|
|
4106
|
+
Ft as R,
|
|
4107
|
+
Lr as S,
|
|
4108
|
+
er as T,
|
|
4109
|
+
vn as U,
|
|
4110
|
+
mn as V,
|
|
4111
|
+
Ne as W,
|
|
4112
|
+
Mt as X,
|
|
4113
|
+
br as Y,
|
|
4114
|
+
Yt as Z,
|
|
4115
|
+
Ut as _,
|
|
4116
|
+
it as a,
|
|
4117
|
+
mr as a0,
|
|
4118
|
+
Bt as a1,
|
|
4119
|
+
Ie as a2,
|
|
4120
|
+
De as a3,
|
|
4121
|
+
Ot as a4,
|
|
4122
|
+
Ht as a5,
|
|
4123
|
+
Zn as a6,
|
|
4124
|
+
Wt as a7,
|
|
4125
|
+
Gt as a8,
|
|
4126
|
+
xr as a9,
|
|
4127
|
+
Or as aa,
|
|
4128
|
+
Qt as ab,
|
|
4129
|
+
Nr as ac,
|
|
4130
|
+
Dr as ad,
|
|
4131
|
+
tt as ae,
|
|
4132
|
+
pr as af,
|
|
4133
|
+
Tr as ag,
|
|
4134
|
+
Ir as ah,
|
|
4135
|
+
Vt as ai,
|
|
4136
|
+
dr as aj,
|
|
4137
|
+
z as ak,
|
|
4138
|
+
hr as b,
|
|
4139
|
+
$r as c,
|
|
4140
|
+
jr as d,
|
|
4141
|
+
dt as e,
|
|
4142
|
+
an as f,
|
|
4143
|
+
yn as g,
|
|
4144
|
+
kr as h,
|
|
4145
|
+
cr as i,
|
|
4146
|
+
un as j,
|
|
4147
|
+
nr as k,
|
|
4148
|
+
yr as l,
|
|
4149
|
+
ir as m,
|
|
4150
|
+
rr as n,
|
|
4151
|
+
St as o,
|
|
4152
|
+
vr as p,
|
|
4153
|
+
Jt as q,
|
|
4154
|
+
gr as r,
|
|
4155
|
+
Er as s,
|
|
4156
|
+
_r as t,
|
|
4157
|
+
sr as u,
|
|
4158
|
+
Sr as v,
|
|
4159
|
+
Ar as w,
|
|
4160
|
+
lr as x,
|
|
4161
|
+
Pr as y,
|
|
4162
|
+
Hr as z
|
|
4163
|
+
};
|