@withgus/debug 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/dist/components/DebugDrawer/DebugDrawer.d.ts +19 -0
- package/dist/components/DebugDrawer/EndpointBlock.d.ts +9 -0
- package/dist/debug.css +1 -0
- package/dist/hooks/useRegisterMockEndpoints.d.ts +2 -0
- package/dist/index.cjs +68 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3075 -0
- package/dist/mocks/types.d.ts +25 -0
- package/dist/store/debugDrawerStore.d.ts +30 -0
- package/package.json +59 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3075 @@
|
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import E, { useState as qe, useMemo as nr, useLayoutEffect as rr, useEffect as Jt, useCallback as ar } from "react";
|
|
3
|
+
import * as or from "react-dom";
|
|
4
|
+
import sr from "react-dom";
|
|
5
|
+
import { create as ir } from "zustand";
|
|
6
|
+
var Fe = { exports: {} }, De = {};
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.production.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var At;
|
|
17
|
+
function cr() {
|
|
18
|
+
if (At) return De;
|
|
19
|
+
At = 1;
|
|
20
|
+
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
21
|
+
function n(r, a, o) {
|
|
22
|
+
var i = null;
|
|
23
|
+
if (o !== void 0 && (i = "" + o), a.key !== void 0 && (i = "" + a.key), "key" in a) {
|
|
24
|
+
o = {};
|
|
25
|
+
for (var s in a)
|
|
26
|
+
s !== "key" && (o[s] = a[s]);
|
|
27
|
+
} else o = a;
|
|
28
|
+
return a = o.ref, {
|
|
29
|
+
$$typeof: e,
|
|
30
|
+
type: r,
|
|
31
|
+
key: i,
|
|
32
|
+
ref: a !== void 0 ? a : null,
|
|
33
|
+
props: o
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return De.Fragment = t, De.jsx = n, De.jsxs = n, De;
|
|
37
|
+
}
|
|
38
|
+
var Ae = {};
|
|
39
|
+
/**
|
|
40
|
+
* @license React
|
|
41
|
+
* react-jsx-runtime.development.js
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/
|
|
48
|
+
var _t;
|
|
49
|
+
function lr() {
|
|
50
|
+
return _t || (_t = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
51
|
+
function e(u) {
|
|
52
|
+
if (u == null) return null;
|
|
53
|
+
if (typeof u == "function")
|
|
54
|
+
return u.$$typeof === B ? null : u.displayName || u.name || null;
|
|
55
|
+
if (typeof u == "string") return u;
|
|
56
|
+
switch (u) {
|
|
57
|
+
case S:
|
|
58
|
+
return "Fragment";
|
|
59
|
+
case T:
|
|
60
|
+
return "Profiler";
|
|
61
|
+
case g:
|
|
62
|
+
return "StrictMode";
|
|
63
|
+
case F:
|
|
64
|
+
return "Suspense";
|
|
65
|
+
case b:
|
|
66
|
+
return "SuspenseList";
|
|
67
|
+
case $:
|
|
68
|
+
return "Activity";
|
|
69
|
+
}
|
|
70
|
+
if (typeof u == "object")
|
|
71
|
+
switch (typeof u.tag == "number" && console.error(
|
|
72
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
73
|
+
), u.$$typeof) {
|
|
74
|
+
case l:
|
|
75
|
+
return "Portal";
|
|
76
|
+
case y:
|
|
77
|
+
return u.displayName || "Context";
|
|
78
|
+
case P:
|
|
79
|
+
return (u._context.displayName || "Context") + ".Consumer";
|
|
80
|
+
case _:
|
|
81
|
+
var D = u.render;
|
|
82
|
+
return u = u.displayName, u || (u = D.displayName || D.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
|
|
83
|
+
case O:
|
|
84
|
+
return D = u.displayName || null, D !== null ? D : e(u.type) || "Memo";
|
|
85
|
+
case w:
|
|
86
|
+
D = u._payload, u = u._init;
|
|
87
|
+
try {
|
|
88
|
+
return e(u(D));
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function t(u) {
|
|
95
|
+
return "" + u;
|
|
96
|
+
}
|
|
97
|
+
function n(u) {
|
|
98
|
+
try {
|
|
99
|
+
t(u);
|
|
100
|
+
var D = !1;
|
|
101
|
+
} catch {
|
|
102
|
+
D = !0;
|
|
103
|
+
}
|
|
104
|
+
if (D) {
|
|
105
|
+
D = console;
|
|
106
|
+
var M = D.error, W = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
|
|
107
|
+
return M.call(
|
|
108
|
+
D,
|
|
109
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
110
|
+
W
|
|
111
|
+
), t(u);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function r(u) {
|
|
115
|
+
if (u === S) return "<>";
|
|
116
|
+
if (typeof u == "object" && u !== null && u.$$typeof === w)
|
|
117
|
+
return "<...>";
|
|
118
|
+
try {
|
|
119
|
+
var D = e(u);
|
|
120
|
+
return D ? "<" + D + ">" : "<...>";
|
|
121
|
+
} catch {
|
|
122
|
+
return "<...>";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function a() {
|
|
126
|
+
var u = Y.A;
|
|
127
|
+
return u === null ? null : u.getOwner();
|
|
128
|
+
}
|
|
129
|
+
function o() {
|
|
130
|
+
return Error("react-stack-top-frame");
|
|
131
|
+
}
|
|
132
|
+
function i(u) {
|
|
133
|
+
if (C.call(u, "key")) {
|
|
134
|
+
var D = Object.getOwnPropertyDescriptor(u, "key").get;
|
|
135
|
+
if (D && D.isReactWarning) return !1;
|
|
136
|
+
}
|
|
137
|
+
return u.key !== void 0;
|
|
138
|
+
}
|
|
139
|
+
function s(u, D) {
|
|
140
|
+
function M() {
|
|
141
|
+
J || (J = !0, console.error(
|
|
142
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
143
|
+
D
|
|
144
|
+
));
|
|
145
|
+
}
|
|
146
|
+
M.isReactWarning = !0, Object.defineProperty(u, "key", {
|
|
147
|
+
get: M,
|
|
148
|
+
configurable: !0
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function v() {
|
|
152
|
+
var u = e(this.type);
|
|
153
|
+
return q[u] || (q[u] = !0, console.error(
|
|
154
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
155
|
+
)), u = this.props.ref, u !== void 0 ? u : null;
|
|
156
|
+
}
|
|
157
|
+
function m(u, D, M, W, le, pe) {
|
|
158
|
+
var L = M.ref;
|
|
159
|
+
return u = {
|
|
160
|
+
$$typeof: N,
|
|
161
|
+
type: u,
|
|
162
|
+
key: D,
|
|
163
|
+
props: M,
|
|
164
|
+
_owner: W
|
|
165
|
+
}, (L !== void 0 ? L : null) !== null ? Object.defineProperty(u, "ref", {
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
get: v
|
|
168
|
+
}) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: 0
|
|
173
|
+
}), Object.defineProperty(u, "_debugInfo", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: null
|
|
178
|
+
}), Object.defineProperty(u, "_debugStack", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: le
|
|
183
|
+
}), Object.defineProperty(u, "_debugTask", {
|
|
184
|
+
configurable: !1,
|
|
185
|
+
enumerable: !1,
|
|
186
|
+
writable: !0,
|
|
187
|
+
value: pe
|
|
188
|
+
}), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
|
|
189
|
+
}
|
|
190
|
+
function p(u, D, M, W, le, pe) {
|
|
191
|
+
var L = D.children;
|
|
192
|
+
if (L !== void 0)
|
|
193
|
+
if (W)
|
|
194
|
+
if (K(L)) {
|
|
195
|
+
for (W = 0; W < L.length; W++)
|
|
196
|
+
f(L[W]);
|
|
197
|
+
Object.freeze && Object.freeze(L);
|
|
198
|
+
} else
|
|
199
|
+
console.error(
|
|
200
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
201
|
+
);
|
|
202
|
+
else f(L);
|
|
203
|
+
if (C.call(D, "key")) {
|
|
204
|
+
L = e(u);
|
|
205
|
+
var te = Object.keys(D).filter(function(Pe) {
|
|
206
|
+
return Pe !== "key";
|
|
207
|
+
});
|
|
208
|
+
W = 0 < te.length ? "{key: someKey, " + te.join(": ..., ") + ": ...}" : "{key: someKey}", ce[L + W] || (te = 0 < te.length ? "{" + te.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
209
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
210
|
+
let props = %s;
|
|
211
|
+
<%s {...props} />
|
|
212
|
+
React keys must be passed directly to JSX without using spread:
|
|
213
|
+
let props = %s;
|
|
214
|
+
<%s key={someKey} {...props} />`,
|
|
215
|
+
W,
|
|
216
|
+
L,
|
|
217
|
+
te,
|
|
218
|
+
L
|
|
219
|
+
), ce[L + W] = !0);
|
|
220
|
+
}
|
|
221
|
+
if (L = null, M !== void 0 && (n(M), L = "" + M), i(D) && (n(D.key), L = "" + D.key), "key" in D) {
|
|
222
|
+
M = {};
|
|
223
|
+
for (var ve in D)
|
|
224
|
+
ve !== "key" && (M[ve] = D[ve]);
|
|
225
|
+
} else M = D;
|
|
226
|
+
return L && s(
|
|
227
|
+
M,
|
|
228
|
+
typeof u == "function" ? u.displayName || u.name || "Unknown" : u
|
|
229
|
+
), m(
|
|
230
|
+
u,
|
|
231
|
+
L,
|
|
232
|
+
M,
|
|
233
|
+
a(),
|
|
234
|
+
le,
|
|
235
|
+
pe
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
function f(u) {
|
|
239
|
+
h(u) ? u._store && (u._store.validated = 1) : typeof u == "object" && u !== null && u.$$typeof === w && (u._payload.status === "fulfilled" ? h(u._payload.value) && u._payload.value._store && (u._payload.value._store.validated = 1) : u._store && (u._store.validated = 1));
|
|
240
|
+
}
|
|
241
|
+
function h(u) {
|
|
242
|
+
return typeof u == "object" && u !== null && u.$$typeof === N;
|
|
243
|
+
}
|
|
244
|
+
var R = E, N = Symbol.for("react.transitional.element"), l = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), P = Symbol.for("react.consumer"), y = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), $ = Symbol.for("react.activity"), B = Symbol.for("react.client.reference"), Y = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, K = Array.isArray, z = console.createTask ? console.createTask : function() {
|
|
245
|
+
return null;
|
|
246
|
+
};
|
|
247
|
+
R = {
|
|
248
|
+
react_stack_bottom_frame: function(u) {
|
|
249
|
+
return u();
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
var J, q = {}, ee = R.react_stack_bottom_frame.bind(
|
|
253
|
+
R,
|
|
254
|
+
o
|
|
255
|
+
)(), ne = z(r(o)), ce = {};
|
|
256
|
+
Ae.Fragment = S, Ae.jsx = function(u, D, M) {
|
|
257
|
+
var W = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
258
|
+
return p(
|
|
259
|
+
u,
|
|
260
|
+
D,
|
|
261
|
+
M,
|
|
262
|
+
!1,
|
|
263
|
+
W ? Error("react-stack-top-frame") : ee,
|
|
264
|
+
W ? z(r(u)) : ne
|
|
265
|
+
);
|
|
266
|
+
}, Ae.jsxs = function(u, D, M) {
|
|
267
|
+
var W = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
268
|
+
return p(
|
|
269
|
+
u,
|
|
270
|
+
D,
|
|
271
|
+
M,
|
|
272
|
+
!0,
|
|
273
|
+
W ? Error("react-stack-top-frame") : ee,
|
|
274
|
+
W ? z(r(u)) : ne
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
})()), Ae;
|
|
278
|
+
}
|
|
279
|
+
var kt;
|
|
280
|
+
function ur() {
|
|
281
|
+
return kt || (kt = 1, process.env.NODE_ENV === "production" ? Fe.exports = cr() : Fe.exports = lr()), Fe.exports;
|
|
282
|
+
}
|
|
283
|
+
var d = ur();
|
|
284
|
+
function me(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
285
|
+
return function(a) {
|
|
286
|
+
if (e == null || e(a), n === !1 || !a.defaultPrevented)
|
|
287
|
+
return t == null ? void 0 : t(a);
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function Mt(e, t) {
|
|
291
|
+
if (typeof e == "function")
|
|
292
|
+
return e(t);
|
|
293
|
+
e != null && (e.current = t);
|
|
294
|
+
}
|
|
295
|
+
function Zt(...e) {
|
|
296
|
+
return (t) => {
|
|
297
|
+
let n = !1;
|
|
298
|
+
const r = e.map((a) => {
|
|
299
|
+
const o = Mt(a, t);
|
|
300
|
+
return !n && typeof o == "function" && (n = !0), o;
|
|
301
|
+
});
|
|
302
|
+
if (n)
|
|
303
|
+
return () => {
|
|
304
|
+
for (let a = 0; a < r.length; a++) {
|
|
305
|
+
const o = r[a];
|
|
306
|
+
typeof o == "function" ? o() : Mt(e[a], null);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function ye(...e) {
|
|
312
|
+
return c.useCallback(Zt(...e), e);
|
|
313
|
+
}
|
|
314
|
+
function dr(e, t) {
|
|
315
|
+
const n = c.createContext(t), r = (o) => {
|
|
316
|
+
const { children: i, ...s } = o, v = c.useMemo(() => s, Object.values(s));
|
|
317
|
+
return /* @__PURE__ */ d.jsx(n.Provider, { value: v, children: i });
|
|
318
|
+
};
|
|
319
|
+
r.displayName = e + "Provider";
|
|
320
|
+
function a(o) {
|
|
321
|
+
const i = c.useContext(n);
|
|
322
|
+
if (i) return i;
|
|
323
|
+
if (t !== void 0) return t;
|
|
324
|
+
throw new Error(`\`${o}\` must be used within \`${e}\``);
|
|
325
|
+
}
|
|
326
|
+
return [r, a];
|
|
327
|
+
}
|
|
328
|
+
function fr(e, t = []) {
|
|
329
|
+
let n = [];
|
|
330
|
+
function r(o, i) {
|
|
331
|
+
const s = c.createContext(i), v = n.length;
|
|
332
|
+
n = [...n, i];
|
|
333
|
+
const m = (f) => {
|
|
334
|
+
var g;
|
|
335
|
+
const { scope: h, children: R, ...N } = f, l = ((g = h == null ? void 0 : h[e]) == null ? void 0 : g[v]) || s, S = c.useMemo(() => N, Object.values(N));
|
|
336
|
+
return /* @__PURE__ */ d.jsx(l.Provider, { value: S, children: R });
|
|
337
|
+
};
|
|
338
|
+
m.displayName = o + "Provider";
|
|
339
|
+
function p(f, h) {
|
|
340
|
+
var l;
|
|
341
|
+
const R = ((l = h == null ? void 0 : h[e]) == null ? void 0 : l[v]) || s, N = c.useContext(R);
|
|
342
|
+
if (N) return N;
|
|
343
|
+
if (i !== void 0) return i;
|
|
344
|
+
throw new Error(`\`${f}\` must be used within \`${o}\``);
|
|
345
|
+
}
|
|
346
|
+
return [m, p];
|
|
347
|
+
}
|
|
348
|
+
const a = () => {
|
|
349
|
+
const o = n.map((i) => c.createContext(i));
|
|
350
|
+
return function(s) {
|
|
351
|
+
const v = (s == null ? void 0 : s[e]) || o;
|
|
352
|
+
return c.useMemo(
|
|
353
|
+
() => ({ [`__scope${e}`]: { ...s, [e]: v } }),
|
|
354
|
+
[s, v]
|
|
355
|
+
);
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
return a.scopeName = e, [r, mr(a, ...t)];
|
|
359
|
+
}
|
|
360
|
+
function mr(...e) {
|
|
361
|
+
const t = e[0];
|
|
362
|
+
if (e.length === 1) return t;
|
|
363
|
+
const n = () => {
|
|
364
|
+
const r = e.map((a) => ({
|
|
365
|
+
useScope: a(),
|
|
366
|
+
scopeName: a.scopeName
|
|
367
|
+
}));
|
|
368
|
+
return function(o) {
|
|
369
|
+
const i = r.reduce((s, { useScope: v, scopeName: m }) => {
|
|
370
|
+
const f = v(o)[`__scope${m}`];
|
|
371
|
+
return { ...s, ...f };
|
|
372
|
+
}, {});
|
|
373
|
+
return c.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
return n.scopeName = t.scopeName, n;
|
|
377
|
+
}
|
|
378
|
+
var Me = globalThis != null && globalThis.document ? c.useLayoutEffect : () => {
|
|
379
|
+
}, pr = c[" useId ".trim().toString()] || (() => {
|
|
380
|
+
}), vr = 0;
|
|
381
|
+
function tt(e) {
|
|
382
|
+
const [t, n] = c.useState(pr());
|
|
383
|
+
return Me(() => {
|
|
384
|
+
n((r) => r ?? String(vr++));
|
|
385
|
+
}, [e]), e || (t ? `radix-${t}` : "");
|
|
386
|
+
}
|
|
387
|
+
var hr = c[" useInsertionEffect ".trim().toString()] || Me;
|
|
388
|
+
function gr({
|
|
389
|
+
prop: e,
|
|
390
|
+
defaultProp: t,
|
|
391
|
+
onChange: n = () => {
|
|
392
|
+
},
|
|
393
|
+
caller: r
|
|
394
|
+
}) {
|
|
395
|
+
const [a, o, i] = wr({
|
|
396
|
+
defaultProp: t,
|
|
397
|
+
onChange: n
|
|
398
|
+
}), s = e !== void 0, v = s ? e : a;
|
|
399
|
+
{
|
|
400
|
+
const p = c.useRef(e !== void 0);
|
|
401
|
+
c.useEffect(() => {
|
|
402
|
+
const f = p.current;
|
|
403
|
+
f !== s && console.warn(
|
|
404
|
+
`${r} is changing from ${f ? "controlled" : "uncontrolled"} to ${s ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
405
|
+
), p.current = s;
|
|
406
|
+
}, [s, r]);
|
|
407
|
+
}
|
|
408
|
+
const m = c.useCallback(
|
|
409
|
+
(p) => {
|
|
410
|
+
var f;
|
|
411
|
+
if (s) {
|
|
412
|
+
const h = br(p) ? p(e) : p;
|
|
413
|
+
h !== e && ((f = i.current) == null || f.call(i, h));
|
|
414
|
+
} else
|
|
415
|
+
o(p);
|
|
416
|
+
},
|
|
417
|
+
[s, e, o, i]
|
|
418
|
+
);
|
|
419
|
+
return [v, m];
|
|
420
|
+
}
|
|
421
|
+
function wr({
|
|
422
|
+
defaultProp: e,
|
|
423
|
+
onChange: t
|
|
424
|
+
}) {
|
|
425
|
+
const [n, r] = c.useState(e), a = c.useRef(n), o = c.useRef(t);
|
|
426
|
+
return hr(() => {
|
|
427
|
+
o.current = t;
|
|
428
|
+
}, [t]), c.useEffect(() => {
|
|
429
|
+
var i;
|
|
430
|
+
a.current !== n && ((i = o.current) == null || i.call(o, n), a.current = n);
|
|
431
|
+
}, [n, a]), [n, r, o];
|
|
432
|
+
}
|
|
433
|
+
function br(e) {
|
|
434
|
+
return typeof e == "function";
|
|
435
|
+
}
|
|
436
|
+
// @__NO_SIDE_EFFECTS__
|
|
437
|
+
function Qt(e) {
|
|
438
|
+
const t = /* @__PURE__ */ yr(e), n = c.forwardRef((r, a) => {
|
|
439
|
+
const { children: o, ...i } = r, s = c.Children.toArray(o), v = s.find(Sr);
|
|
440
|
+
if (v) {
|
|
441
|
+
const m = v.props.children, p = s.map((f) => f === v ? c.Children.count(m) > 1 ? c.Children.only(null) : c.isValidElement(m) ? m.props.children : null : f);
|
|
442
|
+
return /* @__PURE__ */ d.jsx(t, { ...i, ref: a, children: c.isValidElement(m) ? c.cloneElement(m, void 0, p) : null });
|
|
443
|
+
}
|
|
444
|
+
return /* @__PURE__ */ d.jsx(t, { ...i, ref: a, children: o });
|
|
445
|
+
});
|
|
446
|
+
return n.displayName = `${e}.Slot`, n;
|
|
447
|
+
}
|
|
448
|
+
// @__NO_SIDE_EFFECTS__
|
|
449
|
+
function yr(e) {
|
|
450
|
+
const t = c.forwardRef((n, r) => {
|
|
451
|
+
const { children: a, ...o } = n;
|
|
452
|
+
if (c.isValidElement(a)) {
|
|
453
|
+
const i = Cr(a), s = Rr(o, a.props);
|
|
454
|
+
return a.type !== c.Fragment && (s.ref = r ? Zt(r, i) : i), c.cloneElement(a, s);
|
|
455
|
+
}
|
|
456
|
+
return c.Children.count(a) > 1 ? c.Children.only(null) : null;
|
|
457
|
+
});
|
|
458
|
+
return t.displayName = `${e}.SlotClone`, t;
|
|
459
|
+
}
|
|
460
|
+
var Er = Symbol("radix.slottable");
|
|
461
|
+
function Sr(e) {
|
|
462
|
+
return c.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Er;
|
|
463
|
+
}
|
|
464
|
+
function Rr(e, t) {
|
|
465
|
+
const n = { ...t };
|
|
466
|
+
for (const r in t) {
|
|
467
|
+
const a = e[r], o = t[r];
|
|
468
|
+
/^on[A-Z]/.test(r) ? a && o ? n[r] = (...s) => {
|
|
469
|
+
const v = o(...s);
|
|
470
|
+
return a(...s), v;
|
|
471
|
+
} : a && (n[r] = a) : r === "style" ? n[r] = { ...a, ...o } : r === "className" && (n[r] = [a, o].filter(Boolean).join(" "));
|
|
472
|
+
}
|
|
473
|
+
return { ...e, ...n };
|
|
474
|
+
}
|
|
475
|
+
function Cr(e) {
|
|
476
|
+
var r, a;
|
|
477
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
478
|
+
return n ? e.ref : (t = (a = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : a.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
479
|
+
}
|
|
480
|
+
var xr = [
|
|
481
|
+
"a",
|
|
482
|
+
"button",
|
|
483
|
+
"div",
|
|
484
|
+
"form",
|
|
485
|
+
"h2",
|
|
486
|
+
"h3",
|
|
487
|
+
"img",
|
|
488
|
+
"input",
|
|
489
|
+
"label",
|
|
490
|
+
"li",
|
|
491
|
+
"nav",
|
|
492
|
+
"ol",
|
|
493
|
+
"p",
|
|
494
|
+
"select",
|
|
495
|
+
"span",
|
|
496
|
+
"svg",
|
|
497
|
+
"ul"
|
|
498
|
+
], ie = xr.reduce((e, t) => {
|
|
499
|
+
const n = /* @__PURE__ */ Qt(`Primitive.${t}`), r = c.forwardRef((a, o) => {
|
|
500
|
+
const { asChild: i, ...s } = a, v = i ? n : t;
|
|
501
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ d.jsx(v, { ...s, ref: o });
|
|
502
|
+
});
|
|
503
|
+
return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
|
|
504
|
+
}, {});
|
|
505
|
+
function Tr(e, t) {
|
|
506
|
+
e && or.flushSync(() => e.dispatchEvent(t));
|
|
507
|
+
}
|
|
508
|
+
function Ie(e) {
|
|
509
|
+
const t = c.useRef(e);
|
|
510
|
+
return c.useEffect(() => {
|
|
511
|
+
t.current = e;
|
|
512
|
+
}), c.useMemo(() => (...n) => {
|
|
513
|
+
var r;
|
|
514
|
+
return (r = t.current) == null ? void 0 : r.call(t, ...n);
|
|
515
|
+
}, []);
|
|
516
|
+
}
|
|
517
|
+
function Pr(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
518
|
+
const n = Ie(e);
|
|
519
|
+
c.useEffect(() => {
|
|
520
|
+
const r = (a) => {
|
|
521
|
+
a.key === "Escape" && n(a);
|
|
522
|
+
};
|
|
523
|
+
return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
|
|
524
|
+
}, [n, t]);
|
|
525
|
+
}
|
|
526
|
+
var Nr = "DismissableLayer", pt = "dismissableLayer.update", Or = "dismissableLayer.pointerDownOutside", Dr = "dismissableLayer.focusOutside", It, en = c.createContext({
|
|
527
|
+
layers: /* @__PURE__ */ new Set(),
|
|
528
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
529
|
+
branches: /* @__PURE__ */ new Set()
|
|
530
|
+
}), tn = c.forwardRef(
|
|
531
|
+
(e, t) => {
|
|
532
|
+
const {
|
|
533
|
+
disableOutsidePointerEvents: n = !1,
|
|
534
|
+
onEscapeKeyDown: r,
|
|
535
|
+
onPointerDownOutside: a,
|
|
536
|
+
onFocusOutside: o,
|
|
537
|
+
onInteractOutside: i,
|
|
538
|
+
onDismiss: s,
|
|
539
|
+
...v
|
|
540
|
+
} = e, m = c.useContext(en), [p, f] = c.useState(null), h = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, R] = c.useState({}), N = ye(t, (b) => f(b)), l = Array.from(m.layers), [S] = [...m.layersWithOutsidePointerEventsDisabled].slice(-1), g = l.indexOf(S), T = p ? l.indexOf(p) : -1, P = m.layersWithOutsidePointerEventsDisabled.size > 0, y = T >= g, _ = kr((b) => {
|
|
541
|
+
const O = b.target, w = [...m.branches].some(($) => $.contains(O));
|
|
542
|
+
!y || w || (a == null || a(b), i == null || i(b), b.defaultPrevented || s == null || s());
|
|
543
|
+
}, h), F = Mr((b) => {
|
|
544
|
+
const O = b.target;
|
|
545
|
+
[...m.branches].some(($) => $.contains(O)) || (o == null || o(b), i == null || i(b), b.defaultPrevented || s == null || s());
|
|
546
|
+
}, h);
|
|
547
|
+
return Pr((b) => {
|
|
548
|
+
T === m.layers.size - 1 && (r == null || r(b), !b.defaultPrevented && s && (b.preventDefault(), s()));
|
|
549
|
+
}, h), c.useEffect(() => {
|
|
550
|
+
if (p)
|
|
551
|
+
return n && (m.layersWithOutsidePointerEventsDisabled.size === 0 && (It = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), m.layersWithOutsidePointerEventsDisabled.add(p)), m.layers.add(p), jt(), () => {
|
|
552
|
+
n && m.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = It);
|
|
553
|
+
};
|
|
554
|
+
}, [p, h, n, m]), c.useEffect(() => () => {
|
|
555
|
+
p && (m.layers.delete(p), m.layersWithOutsidePointerEventsDisabled.delete(p), jt());
|
|
556
|
+
}, [p, m]), c.useEffect(() => {
|
|
557
|
+
const b = () => R({});
|
|
558
|
+
return document.addEventListener(pt, b), () => document.removeEventListener(pt, b);
|
|
559
|
+
}, []), /* @__PURE__ */ d.jsx(
|
|
560
|
+
ie.div,
|
|
561
|
+
{
|
|
562
|
+
...v,
|
|
563
|
+
ref: N,
|
|
564
|
+
style: {
|
|
565
|
+
pointerEvents: P ? y ? "auto" : "none" : void 0,
|
|
566
|
+
...e.style
|
|
567
|
+
},
|
|
568
|
+
onFocusCapture: me(e.onFocusCapture, F.onFocusCapture),
|
|
569
|
+
onBlurCapture: me(e.onBlurCapture, F.onBlurCapture),
|
|
570
|
+
onPointerDownCapture: me(
|
|
571
|
+
e.onPointerDownCapture,
|
|
572
|
+
_.onPointerDownCapture
|
|
573
|
+
)
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
tn.displayName = Nr;
|
|
579
|
+
var Ar = "DismissableLayerBranch", _r = c.forwardRef((e, t) => {
|
|
580
|
+
const n = c.useContext(en), r = c.useRef(null), a = ye(t, r);
|
|
581
|
+
return c.useEffect(() => {
|
|
582
|
+
const o = r.current;
|
|
583
|
+
if (o)
|
|
584
|
+
return n.branches.add(o), () => {
|
|
585
|
+
n.branches.delete(o);
|
|
586
|
+
};
|
|
587
|
+
}, [n.branches]), /* @__PURE__ */ d.jsx(ie.div, { ...e, ref: a });
|
|
588
|
+
});
|
|
589
|
+
_r.displayName = Ar;
|
|
590
|
+
function kr(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
591
|
+
const n = Ie(e), r = c.useRef(!1), a = c.useRef(() => {
|
|
592
|
+
});
|
|
593
|
+
return c.useEffect(() => {
|
|
594
|
+
const o = (s) => {
|
|
595
|
+
if (s.target && !r.current) {
|
|
596
|
+
let v = function() {
|
|
597
|
+
nn(
|
|
598
|
+
Or,
|
|
599
|
+
n,
|
|
600
|
+
m,
|
|
601
|
+
{ discrete: !0 }
|
|
602
|
+
);
|
|
603
|
+
};
|
|
604
|
+
const m = { originalEvent: s };
|
|
605
|
+
s.pointerType === "touch" ? (t.removeEventListener("click", a.current), a.current = v, t.addEventListener("click", a.current, { once: !0 })) : v();
|
|
606
|
+
} else
|
|
607
|
+
t.removeEventListener("click", a.current);
|
|
608
|
+
r.current = !1;
|
|
609
|
+
}, i = window.setTimeout(() => {
|
|
610
|
+
t.addEventListener("pointerdown", o);
|
|
611
|
+
}, 0);
|
|
612
|
+
return () => {
|
|
613
|
+
window.clearTimeout(i), t.removeEventListener("pointerdown", o), t.removeEventListener("click", a.current);
|
|
614
|
+
};
|
|
615
|
+
}, [t, n]), {
|
|
616
|
+
// ensures we check React component tree (not just DOM tree)
|
|
617
|
+
onPointerDownCapture: () => r.current = !0
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
function Mr(e, t = globalThis == null ? void 0 : globalThis.document) {
|
|
621
|
+
const n = Ie(e), r = c.useRef(!1);
|
|
622
|
+
return c.useEffect(() => {
|
|
623
|
+
const a = (o) => {
|
|
624
|
+
o.target && !r.current && nn(Dr, n, { originalEvent: o }, {
|
|
625
|
+
discrete: !1
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
return t.addEventListener("focusin", a), () => t.removeEventListener("focusin", a);
|
|
629
|
+
}, [t, n]), {
|
|
630
|
+
onFocusCapture: () => r.current = !0,
|
|
631
|
+
onBlurCapture: () => r.current = !1
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
function jt() {
|
|
635
|
+
const e = new CustomEvent(pt);
|
|
636
|
+
document.dispatchEvent(e);
|
|
637
|
+
}
|
|
638
|
+
function nn(e, t, n, { discrete: r }) {
|
|
639
|
+
const a = n.originalEvent.target, o = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
|
|
640
|
+
t && a.addEventListener(e, t, { once: !0 }), r ? Tr(a, o) : a.dispatchEvent(o);
|
|
641
|
+
}
|
|
642
|
+
var nt = "focusScope.autoFocusOnMount", rt = "focusScope.autoFocusOnUnmount", $t = { bubbles: !1, cancelable: !0 }, Ir = "FocusScope", rn = c.forwardRef((e, t) => {
|
|
643
|
+
const {
|
|
644
|
+
loop: n = !1,
|
|
645
|
+
trapped: r = !1,
|
|
646
|
+
onMountAutoFocus: a,
|
|
647
|
+
onUnmountAutoFocus: o,
|
|
648
|
+
...i
|
|
649
|
+
} = e, [s, v] = c.useState(null), m = Ie(a), p = Ie(o), f = c.useRef(null), h = ye(t, (l) => v(l)), R = c.useRef({
|
|
650
|
+
paused: !1,
|
|
651
|
+
pause() {
|
|
652
|
+
this.paused = !0;
|
|
653
|
+
},
|
|
654
|
+
resume() {
|
|
655
|
+
this.paused = !1;
|
|
656
|
+
}
|
|
657
|
+
}).current;
|
|
658
|
+
c.useEffect(() => {
|
|
659
|
+
if (r) {
|
|
660
|
+
let l = function(P) {
|
|
661
|
+
if (R.paused || !s) return;
|
|
662
|
+
const y = P.target;
|
|
663
|
+
s.contains(y) ? f.current = y : fe(f.current, { select: !0 });
|
|
664
|
+
}, S = function(P) {
|
|
665
|
+
if (R.paused || !s) return;
|
|
666
|
+
const y = P.relatedTarget;
|
|
667
|
+
y !== null && (s.contains(y) || fe(f.current, { select: !0 }));
|
|
668
|
+
}, g = function(P) {
|
|
669
|
+
if (document.activeElement === document.body)
|
|
670
|
+
for (const _ of P)
|
|
671
|
+
_.removedNodes.length > 0 && fe(s);
|
|
672
|
+
};
|
|
673
|
+
document.addEventListener("focusin", l), document.addEventListener("focusout", S);
|
|
674
|
+
const T = new MutationObserver(g);
|
|
675
|
+
return s && T.observe(s, { childList: !0, subtree: !0 }), () => {
|
|
676
|
+
document.removeEventListener("focusin", l), document.removeEventListener("focusout", S), T.disconnect();
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}, [r, s, R.paused]), c.useEffect(() => {
|
|
680
|
+
if (s) {
|
|
681
|
+
Ft.add(R);
|
|
682
|
+
const l = document.activeElement;
|
|
683
|
+
if (!s.contains(l)) {
|
|
684
|
+
const g = new CustomEvent(nt, $t);
|
|
685
|
+
s.addEventListener(nt, m), s.dispatchEvent(g), g.defaultPrevented || (jr(Br(an(s)), { select: !0 }), document.activeElement === l && fe(s));
|
|
686
|
+
}
|
|
687
|
+
return () => {
|
|
688
|
+
s.removeEventListener(nt, m), setTimeout(() => {
|
|
689
|
+
const g = new CustomEvent(rt, $t);
|
|
690
|
+
s.addEventListener(rt, p), s.dispatchEvent(g), g.defaultPrevented || fe(l ?? document.body, { select: !0 }), s.removeEventListener(rt, p), Ft.remove(R);
|
|
691
|
+
}, 0);
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
}, [s, m, p, R]);
|
|
695
|
+
const N = c.useCallback(
|
|
696
|
+
(l) => {
|
|
697
|
+
if (!n && !r || R.paused) return;
|
|
698
|
+
const S = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, g = document.activeElement;
|
|
699
|
+
if (S && g) {
|
|
700
|
+
const T = l.currentTarget, [P, y] = $r(T);
|
|
701
|
+
P && y ? !l.shiftKey && g === y ? (l.preventDefault(), n && fe(P, { select: !0 })) : l.shiftKey && g === P && (l.preventDefault(), n && fe(y, { select: !0 })) : g === T && l.preventDefault();
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
[n, r, R.paused]
|
|
705
|
+
);
|
|
706
|
+
return /* @__PURE__ */ d.jsx(ie.div, { tabIndex: -1, ...i, ref: h, onKeyDown: N });
|
|
707
|
+
});
|
|
708
|
+
rn.displayName = Ir;
|
|
709
|
+
function jr(e, { select: t = !1 } = {}) {
|
|
710
|
+
const n = document.activeElement;
|
|
711
|
+
for (const r of e)
|
|
712
|
+
if (fe(r, { select: t }), document.activeElement !== n) return;
|
|
713
|
+
}
|
|
714
|
+
function $r(e) {
|
|
715
|
+
const t = an(e), n = Lt(t, e), r = Lt(t.reverse(), e);
|
|
716
|
+
return [n, r];
|
|
717
|
+
}
|
|
718
|
+
function an(e) {
|
|
719
|
+
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
720
|
+
acceptNode: (r) => {
|
|
721
|
+
const a = r.tagName === "INPUT" && r.type === "hidden";
|
|
722
|
+
return r.disabled || r.hidden || a ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
for (; n.nextNode(); ) t.push(n.currentNode);
|
|
726
|
+
return t;
|
|
727
|
+
}
|
|
728
|
+
function Lt(e, t) {
|
|
729
|
+
for (const n of e)
|
|
730
|
+
if (!Lr(n, { upTo: t })) return n;
|
|
731
|
+
}
|
|
732
|
+
function Lr(e, { upTo: t }) {
|
|
733
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
734
|
+
for (; e; ) {
|
|
735
|
+
if (t !== void 0 && e === t) return !1;
|
|
736
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
737
|
+
e = e.parentElement;
|
|
738
|
+
}
|
|
739
|
+
return !1;
|
|
740
|
+
}
|
|
741
|
+
function Fr(e) {
|
|
742
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
743
|
+
}
|
|
744
|
+
function fe(e, { select: t = !1 } = {}) {
|
|
745
|
+
if (e && e.focus) {
|
|
746
|
+
const n = document.activeElement;
|
|
747
|
+
e.focus({ preventScroll: !0 }), e !== n && Fr(e) && t && e.select();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
var Ft = Wr();
|
|
751
|
+
function Wr() {
|
|
752
|
+
let e = [];
|
|
753
|
+
return {
|
|
754
|
+
add(t) {
|
|
755
|
+
const n = e[0];
|
|
756
|
+
t !== n && (n == null || n.pause()), e = Wt(e, t), e.unshift(t);
|
|
757
|
+
},
|
|
758
|
+
remove(t) {
|
|
759
|
+
var n;
|
|
760
|
+
e = Wt(e, t), (n = e[0]) == null || n.resume();
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
function Wt(e, t) {
|
|
765
|
+
const n = [...e], r = n.indexOf(t);
|
|
766
|
+
return r !== -1 && n.splice(r, 1), n;
|
|
767
|
+
}
|
|
768
|
+
function Br(e) {
|
|
769
|
+
return e.filter((t) => t.tagName !== "A");
|
|
770
|
+
}
|
|
771
|
+
var Ur = "Portal", on = c.forwardRef((e, t) => {
|
|
772
|
+
var s;
|
|
773
|
+
const { container: n, ...r } = e, [a, o] = c.useState(!1);
|
|
774
|
+
Me(() => o(!0), []);
|
|
775
|
+
const i = n || a && ((s = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : s.body);
|
|
776
|
+
return i ? sr.createPortal(/* @__PURE__ */ d.jsx(ie.div, { ...r, ref: t }), i) : null;
|
|
777
|
+
});
|
|
778
|
+
on.displayName = Ur;
|
|
779
|
+
function Hr(e, t) {
|
|
780
|
+
return c.useReducer((n, r) => t[n][r] ?? n, e);
|
|
781
|
+
}
|
|
782
|
+
var Je = (e) => {
|
|
783
|
+
const { present: t, children: n } = e, r = Vr(t), a = typeof n == "function" ? n({ present: r.isPresent }) : c.Children.only(n), o = ye(r.ref, Yr(a));
|
|
784
|
+
return typeof n == "function" || r.isPresent ? c.cloneElement(a, { ref: o }) : null;
|
|
785
|
+
};
|
|
786
|
+
Je.displayName = "Presence";
|
|
787
|
+
function Vr(e) {
|
|
788
|
+
const [t, n] = c.useState(), r = c.useRef(null), a = c.useRef(e), o = c.useRef("none"), i = e ? "mounted" : "unmounted", [s, v] = Hr(i, {
|
|
789
|
+
mounted: {
|
|
790
|
+
UNMOUNT: "unmounted",
|
|
791
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
792
|
+
},
|
|
793
|
+
unmountSuspended: {
|
|
794
|
+
MOUNT: "mounted",
|
|
795
|
+
ANIMATION_END: "unmounted"
|
|
796
|
+
},
|
|
797
|
+
unmounted: {
|
|
798
|
+
MOUNT: "mounted"
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
return c.useEffect(() => {
|
|
802
|
+
const m = We(r.current);
|
|
803
|
+
o.current = s === "mounted" ? m : "none";
|
|
804
|
+
}, [s]), Me(() => {
|
|
805
|
+
const m = r.current, p = a.current;
|
|
806
|
+
if (p !== e) {
|
|
807
|
+
const h = o.current, R = We(m);
|
|
808
|
+
e ? v("MOUNT") : R === "none" || (m == null ? void 0 : m.display) === "none" ? v("UNMOUNT") : v(p && h !== R ? "ANIMATION_OUT" : "UNMOUNT"), a.current = e;
|
|
809
|
+
}
|
|
810
|
+
}, [e, v]), Me(() => {
|
|
811
|
+
if (t) {
|
|
812
|
+
let m;
|
|
813
|
+
const p = t.ownerDocument.defaultView ?? window, f = (R) => {
|
|
814
|
+
const l = We(r.current).includes(CSS.escape(R.animationName));
|
|
815
|
+
if (R.target === t && l && (v("ANIMATION_END"), !a.current)) {
|
|
816
|
+
const S = t.style.animationFillMode;
|
|
817
|
+
t.style.animationFillMode = "forwards", m = p.setTimeout(() => {
|
|
818
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = S);
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
}, h = (R) => {
|
|
822
|
+
R.target === t && (o.current = We(r.current));
|
|
823
|
+
};
|
|
824
|
+
return t.addEventListener("animationstart", h), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
|
|
825
|
+
p.clearTimeout(m), t.removeEventListener("animationstart", h), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
|
|
826
|
+
};
|
|
827
|
+
} else
|
|
828
|
+
v("ANIMATION_END");
|
|
829
|
+
}, [t, v]), {
|
|
830
|
+
isPresent: ["mounted", "unmountSuspended"].includes(s),
|
|
831
|
+
ref: c.useCallback((m) => {
|
|
832
|
+
r.current = m ? getComputedStyle(m) : null, n(m);
|
|
833
|
+
}, [])
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
function We(e) {
|
|
837
|
+
return (e == null ? void 0 : e.animationName) || "none";
|
|
838
|
+
}
|
|
839
|
+
function Yr(e) {
|
|
840
|
+
var r, a;
|
|
841
|
+
let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
842
|
+
return n ? e.ref : (t = (a = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : a.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
843
|
+
}
|
|
844
|
+
var at = 0;
|
|
845
|
+
function zr() {
|
|
846
|
+
c.useEffect(() => {
|
|
847
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
848
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? Bt()), document.body.insertAdjacentElement("beforeend", e[1] ?? Bt()), at++, () => {
|
|
849
|
+
at === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), at--;
|
|
850
|
+
};
|
|
851
|
+
}, []);
|
|
852
|
+
}
|
|
853
|
+
function Bt() {
|
|
854
|
+
const e = document.createElement("span");
|
|
855
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
856
|
+
}
|
|
857
|
+
var se = function() {
|
|
858
|
+
return se = Object.assign || function(t) {
|
|
859
|
+
for (var n, r = 1, a = arguments.length; r < a; r++) {
|
|
860
|
+
n = arguments[r];
|
|
861
|
+
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
862
|
+
}
|
|
863
|
+
return t;
|
|
864
|
+
}, se.apply(this, arguments);
|
|
865
|
+
};
|
|
866
|
+
function sn(e, t) {
|
|
867
|
+
var n = {};
|
|
868
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
|
|
869
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
870
|
+
for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
|
|
871
|
+
t.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (n[r[a]] = e[r[a]]);
|
|
872
|
+
return n;
|
|
873
|
+
}
|
|
874
|
+
function qr(e, t, n) {
|
|
875
|
+
if (n || arguments.length === 2) for (var r = 0, a = t.length, o; r < a; r++)
|
|
876
|
+
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
877
|
+
return e.concat(o || Array.prototype.slice.call(t));
|
|
878
|
+
}
|
|
879
|
+
var Xe = "right-scroll-bar-position", Ge = "width-before-scroll-bar", Xr = "with-scroll-bars-hidden", Gr = "--removed-body-scroll-bar-size";
|
|
880
|
+
function ot(e, t) {
|
|
881
|
+
return typeof e == "function" ? e(t) : e && (e.current = t), e;
|
|
882
|
+
}
|
|
883
|
+
function Kr(e, t) {
|
|
884
|
+
var n = qe(function() {
|
|
885
|
+
return {
|
|
886
|
+
// value
|
|
887
|
+
value: e,
|
|
888
|
+
// last callback
|
|
889
|
+
callback: t,
|
|
890
|
+
// "memoized" public interface
|
|
891
|
+
facade: {
|
|
892
|
+
get current() {
|
|
893
|
+
return n.value;
|
|
894
|
+
},
|
|
895
|
+
set current(r) {
|
|
896
|
+
var a = n.value;
|
|
897
|
+
a !== r && (n.value = r, n.callback(r, a));
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
})[0];
|
|
902
|
+
return n.callback = t, n.facade;
|
|
903
|
+
}
|
|
904
|
+
var Jr = typeof window < "u" ? c.useLayoutEffect : c.useEffect, Ut = /* @__PURE__ */ new WeakMap();
|
|
905
|
+
function Zr(e, t) {
|
|
906
|
+
var n = Kr(null, function(r) {
|
|
907
|
+
return e.forEach(function(a) {
|
|
908
|
+
return ot(a, r);
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
return Jr(function() {
|
|
912
|
+
var r = Ut.get(n);
|
|
913
|
+
if (r) {
|
|
914
|
+
var a = new Set(r), o = new Set(e), i = n.current;
|
|
915
|
+
a.forEach(function(s) {
|
|
916
|
+
o.has(s) || ot(s, null);
|
|
917
|
+
}), o.forEach(function(s) {
|
|
918
|
+
a.has(s) || ot(s, i);
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
Ut.set(n, e);
|
|
922
|
+
}, [e]), n;
|
|
923
|
+
}
|
|
924
|
+
function Qr(e) {
|
|
925
|
+
return e;
|
|
926
|
+
}
|
|
927
|
+
function ea(e, t) {
|
|
928
|
+
t === void 0 && (t = Qr);
|
|
929
|
+
var n = [], r = !1, a = {
|
|
930
|
+
read: function() {
|
|
931
|
+
if (r)
|
|
932
|
+
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
933
|
+
return n.length ? n[n.length - 1] : e;
|
|
934
|
+
},
|
|
935
|
+
useMedium: function(o) {
|
|
936
|
+
var i = t(o, r);
|
|
937
|
+
return n.push(i), function() {
|
|
938
|
+
n = n.filter(function(s) {
|
|
939
|
+
return s !== i;
|
|
940
|
+
});
|
|
941
|
+
};
|
|
942
|
+
},
|
|
943
|
+
assignSyncMedium: function(o) {
|
|
944
|
+
for (r = !0; n.length; ) {
|
|
945
|
+
var i = n;
|
|
946
|
+
n = [], i.forEach(o);
|
|
947
|
+
}
|
|
948
|
+
n = {
|
|
949
|
+
push: function(s) {
|
|
950
|
+
return o(s);
|
|
951
|
+
},
|
|
952
|
+
filter: function() {
|
|
953
|
+
return n;
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
},
|
|
957
|
+
assignMedium: function(o) {
|
|
958
|
+
r = !0;
|
|
959
|
+
var i = [];
|
|
960
|
+
if (n.length) {
|
|
961
|
+
var s = n;
|
|
962
|
+
n = [], s.forEach(o), i = n;
|
|
963
|
+
}
|
|
964
|
+
var v = function() {
|
|
965
|
+
var p = i;
|
|
966
|
+
i = [], p.forEach(o);
|
|
967
|
+
}, m = function() {
|
|
968
|
+
return Promise.resolve().then(v);
|
|
969
|
+
};
|
|
970
|
+
m(), n = {
|
|
971
|
+
push: function(p) {
|
|
972
|
+
i.push(p), m();
|
|
973
|
+
},
|
|
974
|
+
filter: function(p) {
|
|
975
|
+
return i = i.filter(p), n;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
};
|
|
980
|
+
return a;
|
|
981
|
+
}
|
|
982
|
+
function ta(e) {
|
|
983
|
+
e === void 0 && (e = {});
|
|
984
|
+
var t = ea(null);
|
|
985
|
+
return t.options = se({ async: !0, ssr: !1 }, e), t;
|
|
986
|
+
}
|
|
987
|
+
var cn = function(e) {
|
|
988
|
+
var t = e.sideCar, n = sn(e, ["sideCar"]);
|
|
989
|
+
if (!t)
|
|
990
|
+
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
991
|
+
var r = t.read();
|
|
992
|
+
if (!r)
|
|
993
|
+
throw new Error("Sidecar medium not found");
|
|
994
|
+
return c.createElement(r, se({}, n));
|
|
995
|
+
};
|
|
996
|
+
cn.isSideCarExport = !0;
|
|
997
|
+
function na(e, t) {
|
|
998
|
+
return e.useMedium(t), cn;
|
|
999
|
+
}
|
|
1000
|
+
var ln = ta(), st = function() {
|
|
1001
|
+
}, Ze = c.forwardRef(function(e, t) {
|
|
1002
|
+
var n = c.useRef(null), r = c.useState({
|
|
1003
|
+
onScrollCapture: st,
|
|
1004
|
+
onWheelCapture: st,
|
|
1005
|
+
onTouchMoveCapture: st
|
|
1006
|
+
}), a = r[0], o = r[1], i = e.forwardProps, s = e.children, v = e.className, m = e.removeScrollBar, p = e.enabled, f = e.shards, h = e.sideCar, R = e.noRelative, N = e.noIsolation, l = e.inert, S = e.allowPinchZoom, g = e.as, T = g === void 0 ? "div" : g, P = e.gapMode, y = sn(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), _ = h, F = Zr([n, t]), b = se(se({}, y), a);
|
|
1007
|
+
return c.createElement(
|
|
1008
|
+
c.Fragment,
|
|
1009
|
+
null,
|
|
1010
|
+
p && c.createElement(_, { sideCar: ln, removeScrollBar: m, shards: f, noRelative: R, noIsolation: N, inert: l, setCallbacks: o, allowPinchZoom: !!S, lockRef: n, gapMode: P }),
|
|
1011
|
+
i ? c.cloneElement(c.Children.only(s), se(se({}, b), { ref: F })) : c.createElement(T, se({}, b, { className: v, ref: F }), s)
|
|
1012
|
+
);
|
|
1013
|
+
});
|
|
1014
|
+
Ze.defaultProps = {
|
|
1015
|
+
enabled: !0,
|
|
1016
|
+
removeScrollBar: !0,
|
|
1017
|
+
inert: !1
|
|
1018
|
+
};
|
|
1019
|
+
Ze.classNames = {
|
|
1020
|
+
fullWidth: Ge,
|
|
1021
|
+
zeroRight: Xe
|
|
1022
|
+
};
|
|
1023
|
+
var ra = function() {
|
|
1024
|
+
if (typeof __webpack_nonce__ < "u")
|
|
1025
|
+
return __webpack_nonce__;
|
|
1026
|
+
};
|
|
1027
|
+
function aa() {
|
|
1028
|
+
if (!document)
|
|
1029
|
+
return null;
|
|
1030
|
+
var e = document.createElement("style");
|
|
1031
|
+
e.type = "text/css";
|
|
1032
|
+
var t = ra();
|
|
1033
|
+
return t && e.setAttribute("nonce", t), e;
|
|
1034
|
+
}
|
|
1035
|
+
function oa(e, t) {
|
|
1036
|
+
e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
|
|
1037
|
+
}
|
|
1038
|
+
function sa(e) {
|
|
1039
|
+
var t = document.head || document.getElementsByTagName("head")[0];
|
|
1040
|
+
t.appendChild(e);
|
|
1041
|
+
}
|
|
1042
|
+
var ia = function() {
|
|
1043
|
+
var e = 0, t = null;
|
|
1044
|
+
return {
|
|
1045
|
+
add: function(n) {
|
|
1046
|
+
e == 0 && (t = aa()) && (oa(t, n), sa(t)), e++;
|
|
1047
|
+
},
|
|
1048
|
+
remove: function() {
|
|
1049
|
+
e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
}, ca = function() {
|
|
1053
|
+
var e = ia();
|
|
1054
|
+
return function(t, n) {
|
|
1055
|
+
c.useEffect(function() {
|
|
1056
|
+
return e.add(t), function() {
|
|
1057
|
+
e.remove();
|
|
1058
|
+
};
|
|
1059
|
+
}, [t && n]);
|
|
1060
|
+
};
|
|
1061
|
+
}, un = function() {
|
|
1062
|
+
var e = ca(), t = function(n) {
|
|
1063
|
+
var r = n.styles, a = n.dynamic;
|
|
1064
|
+
return e(r, a), null;
|
|
1065
|
+
};
|
|
1066
|
+
return t;
|
|
1067
|
+
}, la = {
|
|
1068
|
+
left: 0,
|
|
1069
|
+
top: 0,
|
|
1070
|
+
right: 0,
|
|
1071
|
+
gap: 0
|
|
1072
|
+
}, it = function(e) {
|
|
1073
|
+
return parseInt(e || "", 10) || 0;
|
|
1074
|
+
}, ua = function(e) {
|
|
1075
|
+
var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], a = t[e === "padding" ? "paddingRight" : "marginRight"];
|
|
1076
|
+
return [it(n), it(r), it(a)];
|
|
1077
|
+
}, da = function(e) {
|
|
1078
|
+
if (e === void 0 && (e = "margin"), typeof window > "u")
|
|
1079
|
+
return la;
|
|
1080
|
+
var t = ua(e), n = document.documentElement.clientWidth, r = window.innerWidth;
|
|
1081
|
+
return {
|
|
1082
|
+
left: t[0],
|
|
1083
|
+
top: t[1],
|
|
1084
|
+
right: t[2],
|
|
1085
|
+
gap: Math.max(0, r - n + t[2] - t[0])
|
|
1086
|
+
};
|
|
1087
|
+
}, fa = un(), Te = "data-scroll-locked", ma = function(e, t, n, r) {
|
|
1088
|
+
var a = e.left, o = e.top, i = e.right, s = e.gap;
|
|
1089
|
+
return n === void 0 && (n = "margin"), `
|
|
1090
|
+
.`.concat(Xr, ` {
|
|
1091
|
+
overflow: hidden `).concat(r, `;
|
|
1092
|
+
padding-right: `).concat(s, "px ").concat(r, `;
|
|
1093
|
+
}
|
|
1094
|
+
body[`).concat(Te, `] {
|
|
1095
|
+
overflow: hidden `).concat(r, `;
|
|
1096
|
+
overscroll-behavior: contain;
|
|
1097
|
+
`).concat([
|
|
1098
|
+
t && "position: relative ".concat(r, ";"),
|
|
1099
|
+
n === "margin" && `
|
|
1100
|
+
padding-left: `.concat(a, `px;
|
|
1101
|
+
padding-top: `).concat(o, `px;
|
|
1102
|
+
padding-right: `).concat(i, `px;
|
|
1103
|
+
margin-left:0;
|
|
1104
|
+
margin-top:0;
|
|
1105
|
+
margin-right: `).concat(s, "px ").concat(r, `;
|
|
1106
|
+
`),
|
|
1107
|
+
n === "padding" && "padding-right: ".concat(s, "px ").concat(r, ";")
|
|
1108
|
+
].filter(Boolean).join(""), `
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
.`).concat(Xe, ` {
|
|
1112
|
+
right: `).concat(s, "px ").concat(r, `;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
.`).concat(Ge, ` {
|
|
1116
|
+
margin-right: `).concat(s, "px ").concat(r, `;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
.`).concat(Xe, " .").concat(Xe, ` {
|
|
1120
|
+
right: 0 `).concat(r, `;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
.`).concat(Ge, " .").concat(Ge, ` {
|
|
1124
|
+
margin-right: 0 `).concat(r, `;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
body[`).concat(Te, `] {
|
|
1128
|
+
`).concat(Gr, ": ").concat(s, `px;
|
|
1129
|
+
}
|
|
1130
|
+
`);
|
|
1131
|
+
}, Ht = function() {
|
|
1132
|
+
var e = parseInt(document.body.getAttribute(Te) || "0", 10);
|
|
1133
|
+
return isFinite(e) ? e : 0;
|
|
1134
|
+
}, pa = function() {
|
|
1135
|
+
c.useEffect(function() {
|
|
1136
|
+
return document.body.setAttribute(Te, (Ht() + 1).toString()), function() {
|
|
1137
|
+
var e = Ht() - 1;
|
|
1138
|
+
e <= 0 ? document.body.removeAttribute(Te) : document.body.setAttribute(Te, e.toString());
|
|
1139
|
+
};
|
|
1140
|
+
}, []);
|
|
1141
|
+
}, va = function(e) {
|
|
1142
|
+
var t = e.noRelative, n = e.noImportant, r = e.gapMode, a = r === void 0 ? "margin" : r;
|
|
1143
|
+
pa();
|
|
1144
|
+
var o = c.useMemo(function() {
|
|
1145
|
+
return da(a);
|
|
1146
|
+
}, [a]);
|
|
1147
|
+
return c.createElement(fa, { styles: ma(o, !t, a, n ? "" : "!important") });
|
|
1148
|
+
}, vt = !1;
|
|
1149
|
+
if (typeof window < "u")
|
|
1150
|
+
try {
|
|
1151
|
+
var Be = Object.defineProperty({}, "passive", {
|
|
1152
|
+
get: function() {
|
|
1153
|
+
return vt = !0, !0;
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
window.addEventListener("test", Be, Be), window.removeEventListener("test", Be, Be);
|
|
1157
|
+
} catch {
|
|
1158
|
+
vt = !1;
|
|
1159
|
+
}
|
|
1160
|
+
var Re = vt ? { passive: !1 } : !1, ha = function(e) {
|
|
1161
|
+
return e.tagName === "TEXTAREA";
|
|
1162
|
+
}, dn = function(e, t) {
|
|
1163
|
+
if (!(e instanceof Element))
|
|
1164
|
+
return !1;
|
|
1165
|
+
var n = window.getComputedStyle(e);
|
|
1166
|
+
return (
|
|
1167
|
+
// not-not-scrollable
|
|
1168
|
+
n[t] !== "hidden" && // contains scroll inside self
|
|
1169
|
+
!(n.overflowY === n.overflowX && !ha(e) && n[t] === "visible")
|
|
1170
|
+
);
|
|
1171
|
+
}, ga = function(e) {
|
|
1172
|
+
return dn(e, "overflowY");
|
|
1173
|
+
}, wa = function(e) {
|
|
1174
|
+
return dn(e, "overflowX");
|
|
1175
|
+
}, Vt = function(e, t) {
|
|
1176
|
+
var n = t.ownerDocument, r = t;
|
|
1177
|
+
do {
|
|
1178
|
+
typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
|
|
1179
|
+
var a = fn(e, r);
|
|
1180
|
+
if (a) {
|
|
1181
|
+
var o = mn(e, r), i = o[1], s = o[2];
|
|
1182
|
+
if (i > s)
|
|
1183
|
+
return !0;
|
|
1184
|
+
}
|
|
1185
|
+
r = r.parentNode;
|
|
1186
|
+
} while (r && r !== n.body);
|
|
1187
|
+
return !1;
|
|
1188
|
+
}, ba = function(e) {
|
|
1189
|
+
var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
|
|
1190
|
+
return [
|
|
1191
|
+
t,
|
|
1192
|
+
n,
|
|
1193
|
+
r
|
|
1194
|
+
];
|
|
1195
|
+
}, ya = function(e) {
|
|
1196
|
+
var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
|
|
1197
|
+
return [
|
|
1198
|
+
t,
|
|
1199
|
+
n,
|
|
1200
|
+
r
|
|
1201
|
+
];
|
|
1202
|
+
}, fn = function(e, t) {
|
|
1203
|
+
return e === "v" ? ga(t) : wa(t);
|
|
1204
|
+
}, mn = function(e, t) {
|
|
1205
|
+
return e === "v" ? ba(t) : ya(t);
|
|
1206
|
+
}, Ea = function(e, t) {
|
|
1207
|
+
return e === "h" && t === "rtl" ? -1 : 1;
|
|
1208
|
+
}, Sa = function(e, t, n, r, a) {
|
|
1209
|
+
var o = Ea(e, window.getComputedStyle(t).direction), i = o * r, s = n.target, v = t.contains(s), m = !1, p = i > 0, f = 0, h = 0;
|
|
1210
|
+
do {
|
|
1211
|
+
if (!s)
|
|
1212
|
+
break;
|
|
1213
|
+
var R = mn(e, s), N = R[0], l = R[1], S = R[2], g = l - S - o * N;
|
|
1214
|
+
(N || g) && fn(e, s) && (f += g, h += N);
|
|
1215
|
+
var T = s.parentNode;
|
|
1216
|
+
s = T && T.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? T.host : T;
|
|
1217
|
+
} while (
|
|
1218
|
+
// portaled content
|
|
1219
|
+
!v && s !== document.body || // self content
|
|
1220
|
+
v && (t.contains(s) || t === s)
|
|
1221
|
+
);
|
|
1222
|
+
return (p && Math.abs(f) < 1 || !p && Math.abs(h) < 1) && (m = !0), m;
|
|
1223
|
+
}, Ue = function(e) {
|
|
1224
|
+
return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
|
|
1225
|
+
}, Yt = function(e) {
|
|
1226
|
+
return [e.deltaX, e.deltaY];
|
|
1227
|
+
}, zt = function(e) {
|
|
1228
|
+
return e && "current" in e ? e.current : e;
|
|
1229
|
+
}, Ra = function(e, t) {
|
|
1230
|
+
return e[0] === t[0] && e[1] === t[1];
|
|
1231
|
+
}, Ca = function(e) {
|
|
1232
|
+
return `
|
|
1233
|
+
.block-interactivity-`.concat(e, ` {pointer-events: none;}
|
|
1234
|
+
.allow-interactivity-`).concat(e, ` {pointer-events: all;}
|
|
1235
|
+
`);
|
|
1236
|
+
}, xa = 0, Ce = [];
|
|
1237
|
+
function Ta(e) {
|
|
1238
|
+
var t = c.useRef([]), n = c.useRef([0, 0]), r = c.useRef(), a = c.useState(xa++)[0], o = c.useState(un)[0], i = c.useRef(e);
|
|
1239
|
+
c.useEffect(function() {
|
|
1240
|
+
i.current = e;
|
|
1241
|
+
}, [e]), c.useEffect(function() {
|
|
1242
|
+
if (e.inert) {
|
|
1243
|
+
document.body.classList.add("block-interactivity-".concat(a));
|
|
1244
|
+
var l = qr([e.lockRef.current], (e.shards || []).map(zt), !0).filter(Boolean);
|
|
1245
|
+
return l.forEach(function(S) {
|
|
1246
|
+
return S.classList.add("allow-interactivity-".concat(a));
|
|
1247
|
+
}), function() {
|
|
1248
|
+
document.body.classList.remove("block-interactivity-".concat(a)), l.forEach(function(S) {
|
|
1249
|
+
return S.classList.remove("allow-interactivity-".concat(a));
|
|
1250
|
+
});
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
}, [e.inert, e.lockRef.current, e.shards]);
|
|
1254
|
+
var s = c.useCallback(function(l, S) {
|
|
1255
|
+
if ("touches" in l && l.touches.length === 2 || l.type === "wheel" && l.ctrlKey)
|
|
1256
|
+
return !i.current.allowPinchZoom;
|
|
1257
|
+
var g = Ue(l), T = n.current, P = "deltaX" in l ? l.deltaX : T[0] - g[0], y = "deltaY" in l ? l.deltaY : T[1] - g[1], _, F = l.target, b = Math.abs(P) > Math.abs(y) ? "h" : "v";
|
|
1258
|
+
if ("touches" in l && b === "h" && F.type === "range")
|
|
1259
|
+
return !1;
|
|
1260
|
+
var O = window.getSelection(), w = O && O.anchorNode, $ = w ? w === F || w.contains(F) : !1;
|
|
1261
|
+
if ($)
|
|
1262
|
+
return !1;
|
|
1263
|
+
var B = Vt(b, F);
|
|
1264
|
+
if (!B)
|
|
1265
|
+
return !0;
|
|
1266
|
+
if (B ? _ = b : (_ = b === "v" ? "h" : "v", B = Vt(b, F)), !B)
|
|
1267
|
+
return !1;
|
|
1268
|
+
if (!r.current && "changedTouches" in l && (P || y) && (r.current = _), !_)
|
|
1269
|
+
return !0;
|
|
1270
|
+
var Y = r.current || _;
|
|
1271
|
+
return Sa(Y, S, l, Y === "h" ? P : y);
|
|
1272
|
+
}, []), v = c.useCallback(function(l) {
|
|
1273
|
+
var S = l;
|
|
1274
|
+
if (!(!Ce.length || Ce[Ce.length - 1] !== o)) {
|
|
1275
|
+
var g = "deltaY" in S ? Yt(S) : Ue(S), T = t.current.filter(function(_) {
|
|
1276
|
+
return _.name === S.type && (_.target === S.target || S.target === _.shadowParent) && Ra(_.delta, g);
|
|
1277
|
+
})[0];
|
|
1278
|
+
if (T && T.should) {
|
|
1279
|
+
S.cancelable && S.preventDefault();
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
if (!T) {
|
|
1283
|
+
var P = (i.current.shards || []).map(zt).filter(Boolean).filter(function(_) {
|
|
1284
|
+
return _.contains(S.target);
|
|
1285
|
+
}), y = P.length > 0 ? s(S, P[0]) : !i.current.noIsolation;
|
|
1286
|
+
y && S.cancelable && S.preventDefault();
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}, []), m = c.useCallback(function(l, S, g, T) {
|
|
1290
|
+
var P = { name: l, delta: S, target: g, should: T, shadowParent: Pa(g) };
|
|
1291
|
+
t.current.push(P), setTimeout(function() {
|
|
1292
|
+
t.current = t.current.filter(function(y) {
|
|
1293
|
+
return y !== P;
|
|
1294
|
+
});
|
|
1295
|
+
}, 1);
|
|
1296
|
+
}, []), p = c.useCallback(function(l) {
|
|
1297
|
+
n.current = Ue(l), r.current = void 0;
|
|
1298
|
+
}, []), f = c.useCallback(function(l) {
|
|
1299
|
+
m(l.type, Yt(l), l.target, s(l, e.lockRef.current));
|
|
1300
|
+
}, []), h = c.useCallback(function(l) {
|
|
1301
|
+
m(l.type, Ue(l), l.target, s(l, e.lockRef.current));
|
|
1302
|
+
}, []);
|
|
1303
|
+
c.useEffect(function() {
|
|
1304
|
+
return Ce.push(o), e.setCallbacks({
|
|
1305
|
+
onScrollCapture: f,
|
|
1306
|
+
onWheelCapture: f,
|
|
1307
|
+
onTouchMoveCapture: h
|
|
1308
|
+
}), document.addEventListener("wheel", v, Re), document.addEventListener("touchmove", v, Re), document.addEventListener("touchstart", p, Re), function() {
|
|
1309
|
+
Ce = Ce.filter(function(l) {
|
|
1310
|
+
return l !== o;
|
|
1311
|
+
}), document.removeEventListener("wheel", v, Re), document.removeEventListener("touchmove", v, Re), document.removeEventListener("touchstart", p, Re);
|
|
1312
|
+
};
|
|
1313
|
+
}, []);
|
|
1314
|
+
var R = e.removeScrollBar, N = e.inert;
|
|
1315
|
+
return c.createElement(
|
|
1316
|
+
c.Fragment,
|
|
1317
|
+
null,
|
|
1318
|
+
N ? c.createElement(o, { styles: Ca(a) }) : null,
|
|
1319
|
+
R ? c.createElement(va, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
function Pa(e) {
|
|
1323
|
+
for (var t = null; e !== null; )
|
|
1324
|
+
e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
|
|
1325
|
+
return t;
|
|
1326
|
+
}
|
|
1327
|
+
const Na = na(ln, Ta);
|
|
1328
|
+
var pn = c.forwardRef(function(e, t) {
|
|
1329
|
+
return c.createElement(Ze, se({}, e, { ref: t, sideCar: Na }));
|
|
1330
|
+
});
|
|
1331
|
+
pn.classNames = Ze.classNames;
|
|
1332
|
+
var Oa = function(e) {
|
|
1333
|
+
if (typeof document > "u")
|
|
1334
|
+
return null;
|
|
1335
|
+
var t = Array.isArray(e) ? e[0] : e;
|
|
1336
|
+
return t.ownerDocument.body;
|
|
1337
|
+
}, xe = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), Ve = {}, ct = 0, vn = function(e) {
|
|
1338
|
+
return e && (e.host || vn(e.parentNode));
|
|
1339
|
+
}, Da = function(e, t) {
|
|
1340
|
+
return t.map(function(n) {
|
|
1341
|
+
if (e.contains(n))
|
|
1342
|
+
return n;
|
|
1343
|
+
var r = vn(n);
|
|
1344
|
+
return r && e.contains(r) ? r : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null);
|
|
1345
|
+
}).filter(function(n) {
|
|
1346
|
+
return !!n;
|
|
1347
|
+
});
|
|
1348
|
+
}, Aa = function(e, t, n, r) {
|
|
1349
|
+
var a = Da(t, Array.isArray(e) ? e : [e]);
|
|
1350
|
+
Ve[n] || (Ve[n] = /* @__PURE__ */ new WeakMap());
|
|
1351
|
+
var o = Ve[n], i = [], s = /* @__PURE__ */ new Set(), v = new Set(a), m = function(f) {
|
|
1352
|
+
!f || s.has(f) || (s.add(f), m(f.parentNode));
|
|
1353
|
+
};
|
|
1354
|
+
a.forEach(m);
|
|
1355
|
+
var p = function(f) {
|
|
1356
|
+
!f || v.has(f) || Array.prototype.forEach.call(f.children, function(h) {
|
|
1357
|
+
if (s.has(h))
|
|
1358
|
+
p(h);
|
|
1359
|
+
else
|
|
1360
|
+
try {
|
|
1361
|
+
var R = h.getAttribute(r), N = R !== null && R !== "false", l = (xe.get(h) || 0) + 1, S = (o.get(h) || 0) + 1;
|
|
1362
|
+
xe.set(h, l), o.set(h, S), i.push(h), l === 1 && N && He.set(h, !0), S === 1 && h.setAttribute(n, "true"), N || h.setAttribute(r, "true");
|
|
1363
|
+
} catch (g) {
|
|
1364
|
+
console.error("aria-hidden: cannot operate on ", h, g);
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
};
|
|
1368
|
+
return p(t), s.clear(), ct++, function() {
|
|
1369
|
+
i.forEach(function(f) {
|
|
1370
|
+
var h = xe.get(f) - 1, R = o.get(f) - 1;
|
|
1371
|
+
xe.set(f, h), o.set(f, R), h || (He.has(f) || f.removeAttribute(r), He.delete(f)), R || f.removeAttribute(n);
|
|
1372
|
+
}), ct--, ct || (xe = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap(), Ve = {});
|
|
1373
|
+
};
|
|
1374
|
+
}, _a = function(e, t, n) {
|
|
1375
|
+
n === void 0 && (n = "data-aria-hidden");
|
|
1376
|
+
var r = Array.from(Array.isArray(e) ? e : [e]), a = Oa(e);
|
|
1377
|
+
return a ? (r.push.apply(r, Array.from(a.querySelectorAll("[aria-live], script"))), Aa(r, a, n, "aria-hidden")) : function() {
|
|
1378
|
+
return null;
|
|
1379
|
+
};
|
|
1380
|
+
}, Qe = "Dialog", [hn] = fr(Qe), [ka, ae] = hn(Qe), gn = (e) => {
|
|
1381
|
+
const {
|
|
1382
|
+
__scopeDialog: t,
|
|
1383
|
+
children: n,
|
|
1384
|
+
open: r,
|
|
1385
|
+
defaultOpen: a,
|
|
1386
|
+
onOpenChange: o,
|
|
1387
|
+
modal: i = !0
|
|
1388
|
+
} = e, s = c.useRef(null), v = c.useRef(null), [m, p] = gr({
|
|
1389
|
+
prop: r,
|
|
1390
|
+
defaultProp: a ?? !1,
|
|
1391
|
+
onChange: o,
|
|
1392
|
+
caller: Qe
|
|
1393
|
+
});
|
|
1394
|
+
return /* @__PURE__ */ d.jsx(
|
|
1395
|
+
ka,
|
|
1396
|
+
{
|
|
1397
|
+
scope: t,
|
|
1398
|
+
triggerRef: s,
|
|
1399
|
+
contentRef: v,
|
|
1400
|
+
contentId: tt(),
|
|
1401
|
+
titleId: tt(),
|
|
1402
|
+
descriptionId: tt(),
|
|
1403
|
+
open: m,
|
|
1404
|
+
onOpenChange: p,
|
|
1405
|
+
onOpenToggle: c.useCallback(() => p((f) => !f), [p]),
|
|
1406
|
+
modal: i,
|
|
1407
|
+
children: n
|
|
1408
|
+
}
|
|
1409
|
+
);
|
|
1410
|
+
};
|
|
1411
|
+
gn.displayName = Qe;
|
|
1412
|
+
var wn = "DialogTrigger", Ma = c.forwardRef(
|
|
1413
|
+
(e, t) => {
|
|
1414
|
+
const { __scopeDialog: n, ...r } = e, a = ae(wn, n), o = ye(t, a.triggerRef);
|
|
1415
|
+
return /* @__PURE__ */ d.jsx(
|
|
1416
|
+
ie.button,
|
|
1417
|
+
{
|
|
1418
|
+
type: "button",
|
|
1419
|
+
"aria-haspopup": "dialog",
|
|
1420
|
+
"aria-expanded": a.open,
|
|
1421
|
+
"aria-controls": a.contentId,
|
|
1422
|
+
"data-state": yt(a.open),
|
|
1423
|
+
...r,
|
|
1424
|
+
ref: o,
|
|
1425
|
+
onClick: me(e.onClick, a.onOpenToggle)
|
|
1426
|
+
}
|
|
1427
|
+
);
|
|
1428
|
+
}
|
|
1429
|
+
);
|
|
1430
|
+
Ma.displayName = wn;
|
|
1431
|
+
var wt = "DialogPortal", [Ia, bn] = hn(wt, {
|
|
1432
|
+
forceMount: void 0
|
|
1433
|
+
}), yn = (e) => {
|
|
1434
|
+
const { __scopeDialog: t, forceMount: n, children: r, container: a } = e, o = ae(wt, t);
|
|
1435
|
+
return /* @__PURE__ */ d.jsx(Ia, { scope: t, forceMount: n, children: c.Children.map(r, (i) => /* @__PURE__ */ d.jsx(Je, { present: n || o.open, children: /* @__PURE__ */ d.jsx(on, { asChild: !0, container: a, children: i }) })) });
|
|
1436
|
+
};
|
|
1437
|
+
yn.displayName = wt;
|
|
1438
|
+
var Ke = "DialogOverlay", En = c.forwardRef(
|
|
1439
|
+
(e, t) => {
|
|
1440
|
+
const n = bn(Ke, e.__scopeDialog), { forceMount: r = n.forceMount, ...a } = e, o = ae(Ke, e.__scopeDialog);
|
|
1441
|
+
return o.modal ? /* @__PURE__ */ d.jsx(Je, { present: r || o.open, children: /* @__PURE__ */ d.jsx($a, { ...a, ref: t }) }) : null;
|
|
1442
|
+
}
|
|
1443
|
+
);
|
|
1444
|
+
En.displayName = Ke;
|
|
1445
|
+
var ja = /* @__PURE__ */ Qt("DialogOverlay.RemoveScroll"), $a = c.forwardRef(
|
|
1446
|
+
(e, t) => {
|
|
1447
|
+
const { __scopeDialog: n, ...r } = e, a = ae(Ke, n);
|
|
1448
|
+
return (
|
|
1449
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
1450
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
1451
|
+
/* @__PURE__ */ d.jsx(pn, { as: ja, allowPinchZoom: !0, shards: [a.contentRef], children: /* @__PURE__ */ d.jsx(
|
|
1452
|
+
ie.div,
|
|
1453
|
+
{
|
|
1454
|
+
"data-state": yt(a.open),
|
|
1455
|
+
...r,
|
|
1456
|
+
ref: t,
|
|
1457
|
+
style: { pointerEvents: "auto", ...r.style }
|
|
1458
|
+
}
|
|
1459
|
+
) })
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
), be = "DialogContent", Sn = c.forwardRef(
|
|
1463
|
+
(e, t) => {
|
|
1464
|
+
const n = bn(be, e.__scopeDialog), { forceMount: r = n.forceMount, ...a } = e, o = ae(be, e.__scopeDialog);
|
|
1465
|
+
return /* @__PURE__ */ d.jsx(Je, { present: r || o.open, children: o.modal ? /* @__PURE__ */ d.jsx(La, { ...a, ref: t }) : /* @__PURE__ */ d.jsx(Fa, { ...a, ref: t }) });
|
|
1466
|
+
}
|
|
1467
|
+
);
|
|
1468
|
+
Sn.displayName = be;
|
|
1469
|
+
var La = c.forwardRef(
|
|
1470
|
+
(e, t) => {
|
|
1471
|
+
const n = ae(be, e.__scopeDialog), r = c.useRef(null), a = ye(t, n.contentRef, r);
|
|
1472
|
+
return c.useEffect(() => {
|
|
1473
|
+
const o = r.current;
|
|
1474
|
+
if (o) return _a(o);
|
|
1475
|
+
}, []), /* @__PURE__ */ d.jsx(
|
|
1476
|
+
Rn,
|
|
1477
|
+
{
|
|
1478
|
+
...e,
|
|
1479
|
+
ref: a,
|
|
1480
|
+
trapFocus: n.open,
|
|
1481
|
+
disableOutsidePointerEvents: !0,
|
|
1482
|
+
onCloseAutoFocus: me(e.onCloseAutoFocus, (o) => {
|
|
1483
|
+
var i;
|
|
1484
|
+
o.preventDefault(), (i = n.triggerRef.current) == null || i.focus();
|
|
1485
|
+
}),
|
|
1486
|
+
onPointerDownOutside: me(e.onPointerDownOutside, (o) => {
|
|
1487
|
+
const i = o.detail.originalEvent, s = i.button === 0 && i.ctrlKey === !0;
|
|
1488
|
+
(i.button === 2 || s) && o.preventDefault();
|
|
1489
|
+
}),
|
|
1490
|
+
onFocusOutside: me(
|
|
1491
|
+
e.onFocusOutside,
|
|
1492
|
+
(o) => o.preventDefault()
|
|
1493
|
+
)
|
|
1494
|
+
}
|
|
1495
|
+
);
|
|
1496
|
+
}
|
|
1497
|
+
), Fa = c.forwardRef(
|
|
1498
|
+
(e, t) => {
|
|
1499
|
+
const n = ae(be, e.__scopeDialog), r = c.useRef(!1), a = c.useRef(!1);
|
|
1500
|
+
return /* @__PURE__ */ d.jsx(
|
|
1501
|
+
Rn,
|
|
1502
|
+
{
|
|
1503
|
+
...e,
|
|
1504
|
+
ref: t,
|
|
1505
|
+
trapFocus: !1,
|
|
1506
|
+
disableOutsidePointerEvents: !1,
|
|
1507
|
+
onCloseAutoFocus: (o) => {
|
|
1508
|
+
var i, s;
|
|
1509
|
+
(i = e.onCloseAutoFocus) == null || i.call(e, o), o.defaultPrevented || (r.current || (s = n.triggerRef.current) == null || s.focus(), o.preventDefault()), r.current = !1, a.current = !1;
|
|
1510
|
+
},
|
|
1511
|
+
onInteractOutside: (o) => {
|
|
1512
|
+
var v, m;
|
|
1513
|
+
(v = e.onInteractOutside) == null || v.call(e, o), o.defaultPrevented || (r.current = !0, o.detail.originalEvent.type === "pointerdown" && (a.current = !0));
|
|
1514
|
+
const i = o.target;
|
|
1515
|
+
((m = n.triggerRef.current) == null ? void 0 : m.contains(i)) && o.preventDefault(), o.detail.originalEvent.type === "focusin" && a.current && o.preventDefault();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
), Rn = c.forwardRef(
|
|
1521
|
+
(e, t) => {
|
|
1522
|
+
const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: a, onCloseAutoFocus: o, ...i } = e, s = ae(be, n), v = c.useRef(null), m = ye(t, v);
|
|
1523
|
+
return zr(), /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
1524
|
+
/* @__PURE__ */ d.jsx(
|
|
1525
|
+
rn,
|
|
1526
|
+
{
|
|
1527
|
+
asChild: !0,
|
|
1528
|
+
loop: !0,
|
|
1529
|
+
trapped: r,
|
|
1530
|
+
onMountAutoFocus: a,
|
|
1531
|
+
onUnmountAutoFocus: o,
|
|
1532
|
+
children: /* @__PURE__ */ d.jsx(
|
|
1533
|
+
tn,
|
|
1534
|
+
{
|
|
1535
|
+
role: "dialog",
|
|
1536
|
+
id: s.contentId,
|
|
1537
|
+
"aria-describedby": s.descriptionId,
|
|
1538
|
+
"aria-labelledby": s.titleId,
|
|
1539
|
+
"data-state": yt(s.open),
|
|
1540
|
+
...i,
|
|
1541
|
+
ref: m,
|
|
1542
|
+
onDismiss: () => s.onOpenChange(!1)
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
}
|
|
1546
|
+
),
|
|
1547
|
+
/* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
1548
|
+
/* @__PURE__ */ d.jsx(Ba, { titleId: s.titleId }),
|
|
1549
|
+
/* @__PURE__ */ d.jsx(Ha, { contentRef: v, descriptionId: s.descriptionId })
|
|
1550
|
+
] })
|
|
1551
|
+
] });
|
|
1552
|
+
}
|
|
1553
|
+
), bt = "DialogTitle", Cn = c.forwardRef(
|
|
1554
|
+
(e, t) => {
|
|
1555
|
+
const { __scopeDialog: n, ...r } = e, a = ae(bt, n);
|
|
1556
|
+
return /* @__PURE__ */ d.jsx(ie.h2, { id: a.titleId, ...r, ref: t });
|
|
1557
|
+
}
|
|
1558
|
+
);
|
|
1559
|
+
Cn.displayName = bt;
|
|
1560
|
+
var xn = "DialogDescription", Wa = c.forwardRef(
|
|
1561
|
+
(e, t) => {
|
|
1562
|
+
const { __scopeDialog: n, ...r } = e, a = ae(xn, n);
|
|
1563
|
+
return /* @__PURE__ */ d.jsx(ie.p, { id: a.descriptionId, ...r, ref: t });
|
|
1564
|
+
}
|
|
1565
|
+
);
|
|
1566
|
+
Wa.displayName = xn;
|
|
1567
|
+
var Tn = "DialogClose", Pn = c.forwardRef(
|
|
1568
|
+
(e, t) => {
|
|
1569
|
+
const { __scopeDialog: n, ...r } = e, a = ae(Tn, n);
|
|
1570
|
+
return /* @__PURE__ */ d.jsx(
|
|
1571
|
+
ie.button,
|
|
1572
|
+
{
|
|
1573
|
+
type: "button",
|
|
1574
|
+
...r,
|
|
1575
|
+
ref: t,
|
|
1576
|
+
onClick: me(e.onClick, () => a.onOpenChange(!1))
|
|
1577
|
+
}
|
|
1578
|
+
);
|
|
1579
|
+
}
|
|
1580
|
+
);
|
|
1581
|
+
Pn.displayName = Tn;
|
|
1582
|
+
function yt(e) {
|
|
1583
|
+
return e ? "open" : "closed";
|
|
1584
|
+
}
|
|
1585
|
+
var Nn = "DialogTitleWarning", [$o, On] = dr(Nn, {
|
|
1586
|
+
contentName: be,
|
|
1587
|
+
titleName: bt,
|
|
1588
|
+
docsSlug: "dialog"
|
|
1589
|
+
}), Ba = ({ titleId: e }) => {
|
|
1590
|
+
const t = On(Nn), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
1591
|
+
|
|
1592
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
1593
|
+
|
|
1594
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
|
|
1595
|
+
return c.useEffect(() => {
|
|
1596
|
+
e && (document.getElementById(e) || console.error(n));
|
|
1597
|
+
}, [n, e]), null;
|
|
1598
|
+
}, Ua = "DialogDescriptionWarning", Ha = ({ contentRef: e, descriptionId: t }) => {
|
|
1599
|
+
const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${On(Ua).contentName}}.`;
|
|
1600
|
+
return c.useEffect(() => {
|
|
1601
|
+
var o;
|
|
1602
|
+
const a = (o = e.current) == null ? void 0 : o.getAttribute("aria-describedby");
|
|
1603
|
+
t && a && (document.getElementById(t) || console.warn(r));
|
|
1604
|
+
}, [r, e, t]), null;
|
|
1605
|
+
}, Va = gn, Ya = yn, za = En, qa = Sn, Xa = Cn, Ga = Pn;
|
|
1606
|
+
function Ka(e) {
|
|
1607
|
+
if (typeof document > "u") return;
|
|
1608
|
+
let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
|
|
1609
|
+
n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
|
|
1610
|
+
}
|
|
1611
|
+
const Dn = E.createContext({
|
|
1612
|
+
drawerRef: {
|
|
1613
|
+
current: null
|
|
1614
|
+
},
|
|
1615
|
+
overlayRef: {
|
|
1616
|
+
current: null
|
|
1617
|
+
},
|
|
1618
|
+
onPress: () => {
|
|
1619
|
+
},
|
|
1620
|
+
onRelease: () => {
|
|
1621
|
+
},
|
|
1622
|
+
onDrag: () => {
|
|
1623
|
+
},
|
|
1624
|
+
onNestedDrag: () => {
|
|
1625
|
+
},
|
|
1626
|
+
onNestedOpenChange: () => {
|
|
1627
|
+
},
|
|
1628
|
+
onNestedRelease: () => {
|
|
1629
|
+
},
|
|
1630
|
+
openProp: void 0,
|
|
1631
|
+
dismissible: !1,
|
|
1632
|
+
isOpen: !1,
|
|
1633
|
+
isDragging: !1,
|
|
1634
|
+
keyboardIsOpen: {
|
|
1635
|
+
current: !1
|
|
1636
|
+
},
|
|
1637
|
+
snapPointsOffset: null,
|
|
1638
|
+
snapPoints: null,
|
|
1639
|
+
handleOnly: !1,
|
|
1640
|
+
modal: !1,
|
|
1641
|
+
shouldFade: !1,
|
|
1642
|
+
activeSnapPoint: null,
|
|
1643
|
+
onOpenChange: () => {
|
|
1644
|
+
},
|
|
1645
|
+
setActiveSnapPoint: () => {
|
|
1646
|
+
},
|
|
1647
|
+
closeDrawer: () => {
|
|
1648
|
+
},
|
|
1649
|
+
direction: "bottom",
|
|
1650
|
+
shouldAnimate: {
|
|
1651
|
+
current: !0
|
|
1652
|
+
},
|
|
1653
|
+
shouldScaleBackground: !1,
|
|
1654
|
+
setBackgroundColorOnScale: !0,
|
|
1655
|
+
noBodyStyles: !1,
|
|
1656
|
+
container: null,
|
|
1657
|
+
autoFocus: !1
|
|
1658
|
+
}), je = () => {
|
|
1659
|
+
const e = E.useContext(Dn);
|
|
1660
|
+
if (!e)
|
|
1661
|
+
throw new Error("useDrawerContext must be used within a Drawer.Root");
|
|
1662
|
+
return e;
|
|
1663
|
+
};
|
|
1664
|
+
Ka(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
1665
|
+
[data-state=closed]
|
|
1666
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);
|
|
1667
|
+
function Ja() {
|
|
1668
|
+
const e = navigator.userAgent;
|
|
1669
|
+
return typeof window < "u" && (/Firefox/.test(e) && /Mobile/.test(e) || // Android Firefox
|
|
1670
|
+
/FxiOS/.test(e));
|
|
1671
|
+
}
|
|
1672
|
+
function Za() {
|
|
1673
|
+
return Et(/^Mac/);
|
|
1674
|
+
}
|
|
1675
|
+
function Qa() {
|
|
1676
|
+
return Et(/^iPhone/);
|
|
1677
|
+
}
|
|
1678
|
+
function qt() {
|
|
1679
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1680
|
+
}
|
|
1681
|
+
function eo() {
|
|
1682
|
+
return Et(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
1683
|
+
Za() && navigator.maxTouchPoints > 1;
|
|
1684
|
+
}
|
|
1685
|
+
function An() {
|
|
1686
|
+
return Qa() || eo();
|
|
1687
|
+
}
|
|
1688
|
+
function Et(e) {
|
|
1689
|
+
return typeof window < "u" && window.navigator != null ? e.test(window.navigator.platform) : void 0;
|
|
1690
|
+
}
|
|
1691
|
+
const to = 24, no = typeof window < "u" ? rr : Jt;
|
|
1692
|
+
function Xt(...e) {
|
|
1693
|
+
return (...t) => {
|
|
1694
|
+
for (let n of e)
|
|
1695
|
+
typeof n == "function" && n(...t);
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
const lt = typeof document < "u" && window.visualViewport;
|
|
1699
|
+
function Gt(e) {
|
|
1700
|
+
let t = window.getComputedStyle(e);
|
|
1701
|
+
return /(auto|scroll)/.test(t.overflow + t.overflowX + t.overflowY);
|
|
1702
|
+
}
|
|
1703
|
+
function _n(e) {
|
|
1704
|
+
for (Gt(e) && (e = e.parentElement); e && !Gt(e); )
|
|
1705
|
+
e = e.parentElement;
|
|
1706
|
+
return e || document.scrollingElement || document.documentElement;
|
|
1707
|
+
}
|
|
1708
|
+
const ro = /* @__PURE__ */ new Set([
|
|
1709
|
+
"checkbox",
|
|
1710
|
+
"radio",
|
|
1711
|
+
"range",
|
|
1712
|
+
"color",
|
|
1713
|
+
"file",
|
|
1714
|
+
"image",
|
|
1715
|
+
"button",
|
|
1716
|
+
"submit",
|
|
1717
|
+
"reset"
|
|
1718
|
+
]);
|
|
1719
|
+
let Ye = 0, ut;
|
|
1720
|
+
function ao(e = {}) {
|
|
1721
|
+
let { isDisabled: t } = e;
|
|
1722
|
+
no(() => {
|
|
1723
|
+
if (!t)
|
|
1724
|
+
return Ye++, Ye === 1 && An() && (ut = oo()), () => {
|
|
1725
|
+
Ye--, Ye === 0 && (ut == null || ut());
|
|
1726
|
+
};
|
|
1727
|
+
}, [
|
|
1728
|
+
t
|
|
1729
|
+
]);
|
|
1730
|
+
}
|
|
1731
|
+
function oo() {
|
|
1732
|
+
let e, t = 0, n = (f) => {
|
|
1733
|
+
e = _n(f.target), !(e === document.documentElement && e === document.body) && (t = f.changedTouches[0].pageY);
|
|
1734
|
+
}, r = (f) => {
|
|
1735
|
+
if (!e || e === document.documentElement || e === document.body) {
|
|
1736
|
+
f.preventDefault();
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
let h = f.changedTouches[0].pageY, R = e.scrollTop, N = e.scrollHeight - e.clientHeight;
|
|
1740
|
+
N !== 0 && ((R <= 0 && h > t || R >= N && h < t) && f.preventDefault(), t = h);
|
|
1741
|
+
}, a = (f) => {
|
|
1742
|
+
let h = f.target;
|
|
1743
|
+
ht(h) && h !== document.activeElement && (f.preventDefault(), h.style.transform = "translateY(-2000px)", h.focus(), requestAnimationFrame(() => {
|
|
1744
|
+
h.style.transform = "";
|
|
1745
|
+
}));
|
|
1746
|
+
}, o = (f) => {
|
|
1747
|
+
let h = f.target;
|
|
1748
|
+
ht(h) && (h.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
1749
|
+
h.style.transform = "", lt && (lt.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
1750
|
+
Kt(h);
|
|
1751
|
+
}) : lt.addEventListener("resize", () => Kt(h), {
|
|
1752
|
+
once: !0
|
|
1753
|
+
}));
|
|
1754
|
+
}));
|
|
1755
|
+
}, i = () => {
|
|
1756
|
+
window.scrollTo(0, 0);
|
|
1757
|
+
}, s = window.pageXOffset, v = window.pageYOffset, m = Xt(so(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
|
|
1758
|
+
window.scrollTo(0, 0);
|
|
1759
|
+
let p = Xt(_e(document, "touchstart", n, {
|
|
1760
|
+
passive: !1,
|
|
1761
|
+
capture: !0
|
|
1762
|
+
}), _e(document, "touchmove", r, {
|
|
1763
|
+
passive: !1,
|
|
1764
|
+
capture: !0
|
|
1765
|
+
}), _e(document, "touchend", a, {
|
|
1766
|
+
passive: !1,
|
|
1767
|
+
capture: !0
|
|
1768
|
+
}), _e(document, "focus", o, !0), _e(window, "scroll", i));
|
|
1769
|
+
return () => {
|
|
1770
|
+
m(), p(), window.scrollTo(s, v);
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
function so(e, t, n) {
|
|
1774
|
+
let r = e.style[t];
|
|
1775
|
+
return e.style[t] = n, () => {
|
|
1776
|
+
e.style[t] = r;
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
function _e(e, t, n, r) {
|
|
1780
|
+
return e.addEventListener(t, n, r), () => {
|
|
1781
|
+
e.removeEventListener(t, n, r);
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
function Kt(e) {
|
|
1785
|
+
let t = document.scrollingElement || document.documentElement;
|
|
1786
|
+
for (; e && e !== t; ) {
|
|
1787
|
+
let n = _n(e);
|
|
1788
|
+
if (n !== document.documentElement && n !== document.body && n !== e) {
|
|
1789
|
+
let r = n.getBoundingClientRect().top, a = e.getBoundingClientRect().top, o = e.getBoundingClientRect().bottom;
|
|
1790
|
+
const i = n.getBoundingClientRect().bottom + to;
|
|
1791
|
+
o > i && (n.scrollTop += a - r);
|
|
1792
|
+
}
|
|
1793
|
+
e = n.parentElement;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
function ht(e) {
|
|
1797
|
+
return e instanceof HTMLInputElement && !ro.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
|
|
1798
|
+
}
|
|
1799
|
+
function io(e, t) {
|
|
1800
|
+
typeof e == "function" ? e(t) : e != null && (e.current = t);
|
|
1801
|
+
}
|
|
1802
|
+
function co(...e) {
|
|
1803
|
+
return (t) => e.forEach((n) => io(n, t));
|
|
1804
|
+
}
|
|
1805
|
+
function kn(...e) {
|
|
1806
|
+
return c.useCallback(co(...e), e);
|
|
1807
|
+
}
|
|
1808
|
+
const Mn = /* @__PURE__ */ new WeakMap();
|
|
1809
|
+
function X(e, t, n = !1) {
|
|
1810
|
+
if (!e || !(e instanceof HTMLElement)) return;
|
|
1811
|
+
let r = {};
|
|
1812
|
+
Object.entries(t).forEach(([a, o]) => {
|
|
1813
|
+
if (a.startsWith("--")) {
|
|
1814
|
+
e.style.setProperty(a, o);
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1817
|
+
r[a] = e.style[a], e.style[a] = o;
|
|
1818
|
+
}), !n && Mn.set(e, r);
|
|
1819
|
+
}
|
|
1820
|
+
function lo(e, t) {
|
|
1821
|
+
if (!e || !(e instanceof HTMLElement)) return;
|
|
1822
|
+
let n = Mn.get(e);
|
|
1823
|
+
n && (e.style[t] = n[t]);
|
|
1824
|
+
}
|
|
1825
|
+
const V = (e) => {
|
|
1826
|
+
switch (e) {
|
|
1827
|
+
case "top":
|
|
1828
|
+
case "bottom":
|
|
1829
|
+
return !0;
|
|
1830
|
+
case "left":
|
|
1831
|
+
case "right":
|
|
1832
|
+
return !1;
|
|
1833
|
+
default:
|
|
1834
|
+
return e;
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
function ze(e, t) {
|
|
1838
|
+
if (!e)
|
|
1839
|
+
return null;
|
|
1840
|
+
const n = window.getComputedStyle(e), r = (
|
|
1841
|
+
// @ts-ignore
|
|
1842
|
+
n.transform || n.webkitTransform || n.mozTransform
|
|
1843
|
+
);
|
|
1844
|
+
let a = r.match(/^matrix3d\((.+)\)$/);
|
|
1845
|
+
return a ? parseFloat(a[1].split(", ")[V(t) ? 13 : 12]) : (a = r.match(/^matrix\((.+)\)$/), a ? parseFloat(a[1].split(", ")[V(t) ? 5 : 4]) : null);
|
|
1846
|
+
}
|
|
1847
|
+
function uo(e) {
|
|
1848
|
+
return 8 * (Math.log(e + 1) - 2);
|
|
1849
|
+
}
|
|
1850
|
+
function dt(e, t) {
|
|
1851
|
+
if (!e) return () => {
|
|
1852
|
+
};
|
|
1853
|
+
const n = e.style.cssText;
|
|
1854
|
+
return Object.assign(e.style, t), () => {
|
|
1855
|
+
e.style.cssText = n;
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
function fo(...e) {
|
|
1859
|
+
return (...t) => {
|
|
1860
|
+
for (const n of e)
|
|
1861
|
+
typeof n == "function" && n(...t);
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
const U = {
|
|
1865
|
+
DURATION: 0.5,
|
|
1866
|
+
EASE: [
|
|
1867
|
+
0.32,
|
|
1868
|
+
0.72,
|
|
1869
|
+
0,
|
|
1870
|
+
1
|
|
1871
|
+
]
|
|
1872
|
+
}, In = 0.4, mo = 0.25, po = 100, jn = 8, ge = 16, gt = 26, ft = "vaul-dragging";
|
|
1873
|
+
function $n(e) {
|
|
1874
|
+
const t = E.useRef(e);
|
|
1875
|
+
return E.useEffect(() => {
|
|
1876
|
+
t.current = e;
|
|
1877
|
+
}), E.useMemo(() => (...n) => t.current == null ? void 0 : t.current.call(t, ...n), []);
|
|
1878
|
+
}
|
|
1879
|
+
function vo({ defaultProp: e, onChange: t }) {
|
|
1880
|
+
const n = E.useState(e), [r] = n, a = E.useRef(r), o = $n(t);
|
|
1881
|
+
return E.useEffect(() => {
|
|
1882
|
+
a.current !== r && (o(r), a.current = r);
|
|
1883
|
+
}, [
|
|
1884
|
+
r,
|
|
1885
|
+
a,
|
|
1886
|
+
o
|
|
1887
|
+
]), n;
|
|
1888
|
+
}
|
|
1889
|
+
function Ln({ prop: e, defaultProp: t, onChange: n = () => {
|
|
1890
|
+
} }) {
|
|
1891
|
+
const [r, a] = vo({
|
|
1892
|
+
defaultProp: t,
|
|
1893
|
+
onChange: n
|
|
1894
|
+
}), o = e !== void 0, i = o ? e : r, s = $n(n), v = E.useCallback((m) => {
|
|
1895
|
+
if (o) {
|
|
1896
|
+
const f = typeof m == "function" ? m(e) : m;
|
|
1897
|
+
f !== e && s(f);
|
|
1898
|
+
} else
|
|
1899
|
+
a(m);
|
|
1900
|
+
}, [
|
|
1901
|
+
o,
|
|
1902
|
+
e,
|
|
1903
|
+
a,
|
|
1904
|
+
s
|
|
1905
|
+
]);
|
|
1906
|
+
return [
|
|
1907
|
+
i,
|
|
1908
|
+
v
|
|
1909
|
+
];
|
|
1910
|
+
}
|
|
1911
|
+
function ho({ activeSnapPointProp: e, setActiveSnapPointProp: t, snapPoints: n, drawerRef: r, overlayRef: a, fadeFromIndex: o, onSnapPointChange: i, direction: s = "bottom", container: v, snapToSequentialPoint: m }) {
|
|
1912
|
+
const [p, f] = Ln({
|
|
1913
|
+
prop: e,
|
|
1914
|
+
defaultProp: n == null ? void 0 : n[0],
|
|
1915
|
+
onChange: t
|
|
1916
|
+
}), [h, R] = E.useState(typeof window < "u" ? {
|
|
1917
|
+
innerWidth: window.innerWidth,
|
|
1918
|
+
innerHeight: window.innerHeight
|
|
1919
|
+
} : void 0);
|
|
1920
|
+
E.useEffect(() => {
|
|
1921
|
+
function b() {
|
|
1922
|
+
R({
|
|
1923
|
+
innerWidth: window.innerWidth,
|
|
1924
|
+
innerHeight: window.innerHeight
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
return window.addEventListener("resize", b), () => window.removeEventListener("resize", b);
|
|
1928
|
+
}, []);
|
|
1929
|
+
const N = E.useMemo(() => p === (n == null ? void 0 : n[n.length - 1]) || null, [
|
|
1930
|
+
n,
|
|
1931
|
+
p
|
|
1932
|
+
]), l = E.useMemo(() => {
|
|
1933
|
+
var b;
|
|
1934
|
+
return (b = n == null ? void 0 : n.findIndex((O) => O === p)) != null ? b : null;
|
|
1935
|
+
}, [
|
|
1936
|
+
n,
|
|
1937
|
+
p
|
|
1938
|
+
]), S = n && n.length > 0 && (o || o === 0) && !Number.isNaN(o) && n[o] === p || !n, g = E.useMemo(() => {
|
|
1939
|
+
const b = v ? {
|
|
1940
|
+
width: v.getBoundingClientRect().width,
|
|
1941
|
+
height: v.getBoundingClientRect().height
|
|
1942
|
+
} : typeof window < "u" ? {
|
|
1943
|
+
width: window.innerWidth,
|
|
1944
|
+
height: window.innerHeight
|
|
1945
|
+
} : {
|
|
1946
|
+
width: 0,
|
|
1947
|
+
height: 0
|
|
1948
|
+
};
|
|
1949
|
+
var O;
|
|
1950
|
+
return (O = n == null ? void 0 : n.map((w) => {
|
|
1951
|
+
const $ = typeof w == "string";
|
|
1952
|
+
let B = 0;
|
|
1953
|
+
if ($ && (B = parseInt(w, 10)), V(s)) {
|
|
1954
|
+
const C = $ ? B : h ? w * b.height : 0;
|
|
1955
|
+
return h ? s === "bottom" ? b.height - C : -b.height + C : C;
|
|
1956
|
+
}
|
|
1957
|
+
const Y = $ ? B : h ? w * b.width : 0;
|
|
1958
|
+
return h ? s === "right" ? b.width - Y : -b.width + Y : Y;
|
|
1959
|
+
})) != null ? O : [];
|
|
1960
|
+
}, [
|
|
1961
|
+
n,
|
|
1962
|
+
h,
|
|
1963
|
+
v
|
|
1964
|
+
]), T = E.useMemo(() => l !== null ? g == null ? void 0 : g[l] : null, [
|
|
1965
|
+
g,
|
|
1966
|
+
l
|
|
1967
|
+
]), P = E.useCallback((b) => {
|
|
1968
|
+
var O;
|
|
1969
|
+
const w = (O = g == null ? void 0 : g.findIndex(($) => $ === b)) != null ? O : null;
|
|
1970
|
+
i(w), X(r.current, {
|
|
1971
|
+
transition: `transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,
|
|
1972
|
+
transform: V(s) ? `translate3d(0, ${b}px, 0)` : `translate3d(${b}px, 0, 0)`
|
|
1973
|
+
}), g && w !== g.length - 1 && o !== void 0 && w !== o && w < o ? X(a.current, {
|
|
1974
|
+
transition: `opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,
|
|
1975
|
+
opacity: "0"
|
|
1976
|
+
}) : X(a.current, {
|
|
1977
|
+
transition: `opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,
|
|
1978
|
+
opacity: "1"
|
|
1979
|
+
}), f(n == null ? void 0 : n[Math.max(w, 0)]);
|
|
1980
|
+
}, [
|
|
1981
|
+
r.current,
|
|
1982
|
+
n,
|
|
1983
|
+
g,
|
|
1984
|
+
o,
|
|
1985
|
+
a,
|
|
1986
|
+
f
|
|
1987
|
+
]);
|
|
1988
|
+
E.useEffect(() => {
|
|
1989
|
+
if (p || e) {
|
|
1990
|
+
var b;
|
|
1991
|
+
const O = (b = n == null ? void 0 : n.findIndex((w) => w === e || w === p)) != null ? b : -1;
|
|
1992
|
+
g && O !== -1 && typeof g[O] == "number" && P(g[O]);
|
|
1993
|
+
}
|
|
1994
|
+
}, [
|
|
1995
|
+
p,
|
|
1996
|
+
e,
|
|
1997
|
+
n,
|
|
1998
|
+
g,
|
|
1999
|
+
P
|
|
2000
|
+
]);
|
|
2001
|
+
function y({ draggedDistance: b, closeDrawer: O, velocity: w, dismissible: $ }) {
|
|
2002
|
+
if (o === void 0) return;
|
|
2003
|
+
const B = s === "bottom" || s === "right" ? (T ?? 0) - b : (T ?? 0) + b, Y = l === o - 1, C = l === 0, K = b > 0;
|
|
2004
|
+
if (Y && X(a.current, {
|
|
2005
|
+
transition: `opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`
|
|
2006
|
+
}), !m && w > 2 && !K) {
|
|
2007
|
+
$ ? O() : P(g[0]);
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
if (!m && w > 2 && K && g && n) {
|
|
2011
|
+
P(g[n.length - 1]);
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
const z = g == null ? void 0 : g.reduce((q, ee) => typeof q != "number" || typeof ee != "number" ? q : Math.abs(ee - B) < Math.abs(q - B) ? ee : q), J = V(s) ? window.innerHeight : window.innerWidth;
|
|
2015
|
+
if (w > In && Math.abs(b) < J * 0.4) {
|
|
2016
|
+
const q = K ? 1 : -1;
|
|
2017
|
+
if (q > 0 && N && n) {
|
|
2018
|
+
P(g[n.length - 1]);
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
if (C && q < 0 && $ && O(), l === null) return;
|
|
2022
|
+
P(g[l + q]);
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
P(z);
|
|
2026
|
+
}
|
|
2027
|
+
function _({ draggedDistance: b }) {
|
|
2028
|
+
if (T === null) return;
|
|
2029
|
+
const O = s === "bottom" || s === "right" ? T - b : T + b;
|
|
2030
|
+
(s === "bottom" || s === "right") && O < g[g.length - 1] || (s === "top" || s === "left") && O > g[g.length - 1] || X(r.current, {
|
|
2031
|
+
transform: V(s) ? `translate3d(0, ${O}px, 0)` : `translate3d(${O}px, 0, 0)`
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
function F(b, O) {
|
|
2035
|
+
if (!n || typeof l != "number" || !g || o === void 0) return null;
|
|
2036
|
+
const w = l === o - 1;
|
|
2037
|
+
if (l >= o && O)
|
|
2038
|
+
return 0;
|
|
2039
|
+
if (w && !O) return 1;
|
|
2040
|
+
if (!S && !w) return null;
|
|
2041
|
+
const B = w ? l + 1 : l - 1, Y = w ? g[B] - g[B - 1] : g[B + 1] - g[B], C = b / Math.abs(Y);
|
|
2042
|
+
return w ? 1 - C : C;
|
|
2043
|
+
}
|
|
2044
|
+
return {
|
|
2045
|
+
isLastSnapPoint: N,
|
|
2046
|
+
activeSnapPoint: p,
|
|
2047
|
+
shouldFade: S,
|
|
2048
|
+
getPercentageDragged: F,
|
|
2049
|
+
setActiveSnapPoint: f,
|
|
2050
|
+
activeSnapPointIndex: l,
|
|
2051
|
+
onRelease: y,
|
|
2052
|
+
onDrag: _,
|
|
2053
|
+
snapPointsOffset: g
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
const go = () => () => {
|
|
2057
|
+
};
|
|
2058
|
+
function wo() {
|
|
2059
|
+
const { direction: e, isOpen: t, shouldScaleBackground: n, setBackgroundColorOnScale: r, noBodyStyles: a } = je(), o = E.useRef(null), i = nr(() => document.body.style.backgroundColor, []);
|
|
2060
|
+
function s() {
|
|
2061
|
+
return (window.innerWidth - gt) / window.innerWidth;
|
|
2062
|
+
}
|
|
2063
|
+
E.useEffect(() => {
|
|
2064
|
+
if (t && n) {
|
|
2065
|
+
o.current && clearTimeout(o.current);
|
|
2066
|
+
const v = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
|
|
2067
|
+
if (!v) return;
|
|
2068
|
+
fo(r && !a ? dt(document.body, {
|
|
2069
|
+
background: "black"
|
|
2070
|
+
}) : go, dt(v, {
|
|
2071
|
+
transformOrigin: V(e) ? "top" : "left",
|
|
2072
|
+
transitionProperty: "transform, border-radius",
|
|
2073
|
+
transitionDuration: `${U.DURATION}s`,
|
|
2074
|
+
transitionTimingFunction: `cubic-bezier(${U.EASE.join(",")})`
|
|
2075
|
+
}));
|
|
2076
|
+
const m = dt(v, {
|
|
2077
|
+
borderRadius: `${jn}px`,
|
|
2078
|
+
overflow: "hidden",
|
|
2079
|
+
...V(e) ? {
|
|
2080
|
+
transform: `scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
|
|
2081
|
+
} : {
|
|
2082
|
+
transform: `scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
return () => {
|
|
2086
|
+
m(), o.current = window.setTimeout(() => {
|
|
2087
|
+
i ? document.body.style.background = i : document.body.style.removeProperty("background");
|
|
2088
|
+
}, U.DURATION * 1e3);
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
}, [
|
|
2092
|
+
t,
|
|
2093
|
+
n,
|
|
2094
|
+
i
|
|
2095
|
+
]);
|
|
2096
|
+
}
|
|
2097
|
+
let ke = null;
|
|
2098
|
+
function bo({ isOpen: e, modal: t, nested: n, hasBeenOpened: r, preventScrollRestoration: a, noBodyStyles: o }) {
|
|
2099
|
+
const [i, s] = E.useState(() => typeof window < "u" ? window.location.href : ""), v = E.useRef(0), m = E.useCallback(() => {
|
|
2100
|
+
if (qt() && ke === null && e && !o) {
|
|
2101
|
+
ke = {
|
|
2102
|
+
position: document.body.style.position,
|
|
2103
|
+
top: document.body.style.top,
|
|
2104
|
+
left: document.body.style.left,
|
|
2105
|
+
height: document.body.style.height,
|
|
2106
|
+
right: "unset"
|
|
2107
|
+
};
|
|
2108
|
+
const { scrollX: f, innerHeight: h } = window;
|
|
2109
|
+
document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
|
|
2110
|
+
top: `${-v.current}px`,
|
|
2111
|
+
left: `${-f}px`,
|
|
2112
|
+
right: "0px",
|
|
2113
|
+
height: "auto"
|
|
2114
|
+
}), window.setTimeout(() => window.requestAnimationFrame(() => {
|
|
2115
|
+
const R = h - window.innerHeight;
|
|
2116
|
+
R && v.current >= h && (document.body.style.top = `${-(v.current + R)}px`);
|
|
2117
|
+
}), 300);
|
|
2118
|
+
}
|
|
2119
|
+
}, [
|
|
2120
|
+
e
|
|
2121
|
+
]), p = E.useCallback(() => {
|
|
2122
|
+
if (qt() && ke !== null && !o) {
|
|
2123
|
+
const f = -parseInt(document.body.style.top, 10), h = -parseInt(document.body.style.left, 10);
|
|
2124
|
+
Object.assign(document.body.style, ke), window.requestAnimationFrame(() => {
|
|
2125
|
+
if (a && i !== window.location.href) {
|
|
2126
|
+
s(window.location.href);
|
|
2127
|
+
return;
|
|
2128
|
+
}
|
|
2129
|
+
window.scrollTo(h, f);
|
|
2130
|
+
}), ke = null;
|
|
2131
|
+
}
|
|
2132
|
+
}, [
|
|
2133
|
+
i
|
|
2134
|
+
]);
|
|
2135
|
+
return E.useEffect(() => {
|
|
2136
|
+
function f() {
|
|
2137
|
+
v.current = window.scrollY;
|
|
2138
|
+
}
|
|
2139
|
+
return f(), window.addEventListener("scroll", f), () => {
|
|
2140
|
+
window.removeEventListener("scroll", f);
|
|
2141
|
+
};
|
|
2142
|
+
}, []), E.useEffect(() => {
|
|
2143
|
+
if (t)
|
|
2144
|
+
return () => {
|
|
2145
|
+
typeof document > "u" || document.querySelector("[data-vaul-drawer]") || p();
|
|
2146
|
+
};
|
|
2147
|
+
}, [
|
|
2148
|
+
t,
|
|
2149
|
+
p
|
|
2150
|
+
]), E.useEffect(() => {
|
|
2151
|
+
n || !r || (e ? (!window.matchMedia("(display-mode: standalone)").matches && m(), t || window.setTimeout(() => {
|
|
2152
|
+
p();
|
|
2153
|
+
}, 500)) : p());
|
|
2154
|
+
}, [
|
|
2155
|
+
e,
|
|
2156
|
+
r,
|
|
2157
|
+
i,
|
|
2158
|
+
t,
|
|
2159
|
+
n,
|
|
2160
|
+
m,
|
|
2161
|
+
p
|
|
2162
|
+
]), {
|
|
2163
|
+
restorePositionSetting: p
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
function yo({ open: e, onOpenChange: t, children: n, onDrag: r, onRelease: a, snapPoints: o, shouldScaleBackground: i = !1, setBackgroundColorOnScale: s = !0, closeThreshold: v = mo, scrollLockTimeout: m = po, dismissible: p = !0, handleOnly: f = !1, fadeFromIndex: h = o && o.length - 1, activeSnapPoint: R, setActiveSnapPoint: N, fixed: l, modal: S = !0, onClose: g, nested: T, noBodyStyles: P = !1, direction: y = "bottom", defaultOpen: _ = !1, disablePreventScroll: F = !0, snapToSequentialPoint: b = !1, preventScrollRestoration: O = !1, repositionInputs: w = !0, onAnimationEnd: $, container: B, autoFocus: Y = !1 }) {
|
|
2167
|
+
var C, K;
|
|
2168
|
+
const [z = !1, J] = Ln({
|
|
2169
|
+
defaultProp: _,
|
|
2170
|
+
prop: e,
|
|
2171
|
+
onChange: (x) => {
|
|
2172
|
+
t == null || t(x), !x && !T && Xn(), setTimeout(() => {
|
|
2173
|
+
$ == null || $(x);
|
|
2174
|
+
}, U.DURATION * 1e3), x && !S && typeof window < "u" && window.requestAnimationFrame(() => {
|
|
2175
|
+
document.body.style.pointerEvents = "auto";
|
|
2176
|
+
}), x || (document.body.style.pointerEvents = "auto");
|
|
2177
|
+
}
|
|
2178
|
+
}), [q, ee] = E.useState(!1), [ne, ce] = E.useState(!1), [u, D] = E.useState(!1), M = E.useRef(null), W = E.useRef(null), le = E.useRef(null), pe = E.useRef(null), L = E.useRef(null), te = E.useRef(!1), ve = E.useRef(null), Pe = E.useRef(0), Ee = E.useRef(!1), St = E.useRef(!_), Rt = E.useRef(0), A = E.useRef(null), Ct = E.useRef(((C = A.current) == null ? void 0 : C.getBoundingClientRect().height) || 0), xt = E.useRef(((K = A.current) == null ? void 0 : K.getBoundingClientRect().width) || 0), et = E.useRef(0), Hn = E.useCallback((x) => {
|
|
2179
|
+
o && x === Ne.length - 1 && (W.current = /* @__PURE__ */ new Date());
|
|
2180
|
+
}, []), { activeSnapPoint: Vn, activeSnapPointIndex: Se, setActiveSnapPoint: Tt, onRelease: Yn, snapPointsOffset: Ne, onDrag: zn, shouldFade: Pt, getPercentageDragged: qn } = ho({
|
|
2181
|
+
snapPoints: o,
|
|
2182
|
+
activeSnapPointProp: R,
|
|
2183
|
+
setActiveSnapPointProp: N,
|
|
2184
|
+
drawerRef: A,
|
|
2185
|
+
fadeFromIndex: h,
|
|
2186
|
+
overlayRef: M,
|
|
2187
|
+
onSnapPointChange: Hn,
|
|
2188
|
+
direction: y,
|
|
2189
|
+
container: B,
|
|
2190
|
+
snapToSequentialPoint: b
|
|
2191
|
+
});
|
|
2192
|
+
ao({
|
|
2193
|
+
isDisabled: !z || ne || !S || u || !q || !w || !F
|
|
2194
|
+
});
|
|
2195
|
+
const { restorePositionSetting: Xn } = bo({
|
|
2196
|
+
isOpen: z,
|
|
2197
|
+
modal: S,
|
|
2198
|
+
nested: T ?? !1,
|
|
2199
|
+
hasBeenOpened: q,
|
|
2200
|
+
preventScrollRestoration: O,
|
|
2201
|
+
noBodyStyles: P
|
|
2202
|
+
});
|
|
2203
|
+
function $e() {
|
|
2204
|
+
return (window.innerWidth - gt) / window.innerWidth;
|
|
2205
|
+
}
|
|
2206
|
+
function Gn(x) {
|
|
2207
|
+
var I, j;
|
|
2208
|
+
!p && !o || A.current && !A.current.contains(x.target) || (Ct.current = ((I = A.current) == null ? void 0 : I.getBoundingClientRect().height) || 0, xt.current = ((j = A.current) == null ? void 0 : j.getBoundingClientRect().width) || 0, ce(!0), le.current = /* @__PURE__ */ new Date(), An() && window.addEventListener("touchend", () => te.current = !1, {
|
|
2209
|
+
once: !0
|
|
2210
|
+
}), x.target.setPointerCapture(x.pointerId), Pe.current = V(y) ? x.pageY : x.pageX);
|
|
2211
|
+
}
|
|
2212
|
+
function Nt(x, I) {
|
|
2213
|
+
var j;
|
|
2214
|
+
let k = x;
|
|
2215
|
+
const H = (j = window.getSelection()) == null ? void 0 : j.toString(), Q = A.current ? ze(A.current, y) : null, Z = /* @__PURE__ */ new Date();
|
|
2216
|
+
if (k.tagName === "SELECT" || k.hasAttribute("data-vaul-no-drag") || k.closest("[data-vaul-no-drag]"))
|
|
2217
|
+
return !1;
|
|
2218
|
+
if (y === "right" || y === "left")
|
|
2219
|
+
return !0;
|
|
2220
|
+
if (W.current && Z.getTime() - W.current.getTime() < 500)
|
|
2221
|
+
return !1;
|
|
2222
|
+
if (Q !== null && (y === "bottom" ? Q > 0 : Q < 0))
|
|
2223
|
+
return !0;
|
|
2224
|
+
if (H && H.length > 0)
|
|
2225
|
+
return !1;
|
|
2226
|
+
if (L.current && Z.getTime() - L.current.getTime() < m && Q === 0 || I)
|
|
2227
|
+
return L.current = Z, !1;
|
|
2228
|
+
for (; k; ) {
|
|
2229
|
+
if (k.scrollHeight > k.clientHeight) {
|
|
2230
|
+
if (k.scrollTop !== 0)
|
|
2231
|
+
return L.current = /* @__PURE__ */ new Date(), !1;
|
|
2232
|
+
if (k.getAttribute("role") === "dialog")
|
|
2233
|
+
return !0;
|
|
2234
|
+
}
|
|
2235
|
+
k = k.parentNode;
|
|
2236
|
+
}
|
|
2237
|
+
return !0;
|
|
2238
|
+
}
|
|
2239
|
+
function Kn(x) {
|
|
2240
|
+
if (A.current && ne) {
|
|
2241
|
+
const I = y === "bottom" || y === "right" ? 1 : -1, j = (Pe.current - (V(y) ? x.pageY : x.pageX)) * I, k = j > 0, H = o && !p && !k;
|
|
2242
|
+
if (H && Se === 0) return;
|
|
2243
|
+
const Q = Math.abs(j), Z = document.querySelector("[data-vaul-drawer-wrapper]"), ue = y === "bottom" || y === "top" ? Ct.current : xt.current;
|
|
2244
|
+
let re = Q / ue;
|
|
2245
|
+
const he = qn(Q, k);
|
|
2246
|
+
if (he !== null && (re = he), H && re >= 1 || !te.current && !Nt(x.target, k)) return;
|
|
2247
|
+
if (A.current.classList.add(ft), te.current = !0, X(A.current, {
|
|
2248
|
+
transition: "none"
|
|
2249
|
+
}), X(M.current, {
|
|
2250
|
+
transition: "none"
|
|
2251
|
+
}), o && zn({
|
|
2252
|
+
draggedDistance: j
|
|
2253
|
+
}), k && !o) {
|
|
2254
|
+
const oe = uo(j), Le = Math.min(oe * -1, 0) * I;
|
|
2255
|
+
X(A.current, {
|
|
2256
|
+
transform: V(y) ? `translate3d(0, ${Le}px, 0)` : `translate3d(${Le}px, 0, 0)`
|
|
2257
|
+
});
|
|
2258
|
+
return;
|
|
2259
|
+
}
|
|
2260
|
+
const de = 1 - re;
|
|
2261
|
+
if ((Pt || h && Se === h - 1) && (r == null || r(x, re), X(M.current, {
|
|
2262
|
+
opacity: `${de}`,
|
|
2263
|
+
transition: "none"
|
|
2264
|
+
}, !0)), Z && M.current && i) {
|
|
2265
|
+
const oe = Math.min($e() + re * (1 - $e()), 1), Le = 8 - re * 8, Dt = Math.max(0, 14 - re * 14);
|
|
2266
|
+
X(Z, {
|
|
2267
|
+
borderRadius: `${Le}px`,
|
|
2268
|
+
transform: V(y) ? `scale(${oe}) translate3d(0, ${Dt}px, 0)` : `scale(${oe}) translate3d(${Dt}px, 0, 0)`,
|
|
2269
|
+
transition: "none"
|
|
2270
|
+
}, !0);
|
|
2271
|
+
}
|
|
2272
|
+
if (!o) {
|
|
2273
|
+
const oe = Q * I;
|
|
2274
|
+
X(A.current, {
|
|
2275
|
+
transform: V(y) ? `translate3d(0, ${oe}px, 0)` : `translate3d(${oe}px, 0, 0)`
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
E.useEffect(() => {
|
|
2281
|
+
window.requestAnimationFrame(() => {
|
|
2282
|
+
St.current = !0;
|
|
2283
|
+
});
|
|
2284
|
+
}, []), E.useEffect(() => {
|
|
2285
|
+
var x;
|
|
2286
|
+
function I() {
|
|
2287
|
+
if (!A.current || !w) return;
|
|
2288
|
+
const j = document.activeElement;
|
|
2289
|
+
if (ht(j) || Ee.current) {
|
|
2290
|
+
var k;
|
|
2291
|
+
const H = ((k = window.visualViewport) == null ? void 0 : k.height) || 0, Q = window.innerHeight;
|
|
2292
|
+
let Z = Q - H;
|
|
2293
|
+
const ue = A.current.getBoundingClientRect().height || 0, re = ue > Q * 0.8;
|
|
2294
|
+
et.current || (et.current = ue);
|
|
2295
|
+
const he = A.current.getBoundingClientRect().top;
|
|
2296
|
+
if (Math.abs(Rt.current - Z) > 60 && (Ee.current = !Ee.current), o && o.length > 0 && Ne && Se) {
|
|
2297
|
+
const de = Ne[Se] || 0;
|
|
2298
|
+
Z += de;
|
|
2299
|
+
}
|
|
2300
|
+
if (Rt.current = Z, ue > H || Ee.current) {
|
|
2301
|
+
const de = A.current.getBoundingClientRect().height;
|
|
2302
|
+
let oe = de;
|
|
2303
|
+
de > H && (oe = H - (re ? he : gt)), l ? A.current.style.height = `${de - Math.max(Z, 0)}px` : A.current.style.height = `${Math.max(oe, H - he)}px`;
|
|
2304
|
+
} else Ja() || (A.current.style.height = `${et.current}px`);
|
|
2305
|
+
o && o.length > 0 && !Ee.current ? A.current.style.bottom = "0px" : A.current.style.bottom = `${Math.max(Z, 0)}px`;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
return (x = window.visualViewport) == null || x.addEventListener("resize", I), () => {
|
|
2309
|
+
var j;
|
|
2310
|
+
return (j = window.visualViewport) == null ? void 0 : j.removeEventListener("resize", I);
|
|
2311
|
+
};
|
|
2312
|
+
}, [
|
|
2313
|
+
Se,
|
|
2314
|
+
o,
|
|
2315
|
+
Ne
|
|
2316
|
+
]);
|
|
2317
|
+
function Oe(x) {
|
|
2318
|
+
Jn(), g == null || g(), x || J(!1), setTimeout(() => {
|
|
2319
|
+
o && Tt(o[0]);
|
|
2320
|
+
}, U.DURATION * 1e3);
|
|
2321
|
+
}
|
|
2322
|
+
function Ot() {
|
|
2323
|
+
if (!A.current) return;
|
|
2324
|
+
const x = document.querySelector("[data-vaul-drawer-wrapper]"), I = ze(A.current, y);
|
|
2325
|
+
X(A.current, {
|
|
2326
|
+
transform: "translate3d(0, 0, 0)",
|
|
2327
|
+
transition: `transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`
|
|
2328
|
+
}), X(M.current, {
|
|
2329
|
+
transition: `opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,
|
|
2330
|
+
opacity: "1"
|
|
2331
|
+
}), i && I && I > 0 && z && X(x, {
|
|
2332
|
+
borderRadius: `${jn}px`,
|
|
2333
|
+
overflow: "hidden",
|
|
2334
|
+
...V(y) ? {
|
|
2335
|
+
transform: `scale(${$e()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
|
|
2336
|
+
transformOrigin: "top"
|
|
2337
|
+
} : {
|
|
2338
|
+
transform: `scale(${$e()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
|
|
2339
|
+
transformOrigin: "left"
|
|
2340
|
+
},
|
|
2341
|
+
transitionProperty: "transform, border-radius",
|
|
2342
|
+
transitionDuration: `${U.DURATION}s`,
|
|
2343
|
+
transitionTimingFunction: `cubic-bezier(${U.EASE.join(",")})`
|
|
2344
|
+
}, !0);
|
|
2345
|
+
}
|
|
2346
|
+
function Jn() {
|
|
2347
|
+
!ne || !A.current || (A.current.classList.remove(ft), te.current = !1, ce(!1), pe.current = /* @__PURE__ */ new Date());
|
|
2348
|
+
}
|
|
2349
|
+
function Zn(x) {
|
|
2350
|
+
if (!ne || !A.current) return;
|
|
2351
|
+
A.current.classList.remove(ft), te.current = !1, ce(!1), pe.current = /* @__PURE__ */ new Date();
|
|
2352
|
+
const I = ze(A.current, y);
|
|
2353
|
+
if (!x || !Nt(x.target, !1) || !I || Number.isNaN(I) || le.current === null) return;
|
|
2354
|
+
const j = pe.current.getTime() - le.current.getTime(), k = Pe.current - (V(y) ? x.pageY : x.pageX), H = Math.abs(k) / j;
|
|
2355
|
+
if (H > 0.05 && (D(!0), setTimeout(() => {
|
|
2356
|
+
D(!1);
|
|
2357
|
+
}, 200)), o) {
|
|
2358
|
+
Yn({
|
|
2359
|
+
draggedDistance: k * (y === "bottom" || y === "right" ? 1 : -1),
|
|
2360
|
+
closeDrawer: Oe,
|
|
2361
|
+
velocity: H,
|
|
2362
|
+
dismissible: p
|
|
2363
|
+
}), a == null || a(x, !0);
|
|
2364
|
+
return;
|
|
2365
|
+
}
|
|
2366
|
+
if (y === "bottom" || y === "right" ? k > 0 : k < 0) {
|
|
2367
|
+
Ot(), a == null || a(x, !0);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
if (H > In) {
|
|
2371
|
+
Oe(), a == null || a(x, !1);
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
var Q;
|
|
2375
|
+
const Z = Math.min((Q = A.current.getBoundingClientRect().height) != null ? Q : 0, window.innerHeight);
|
|
2376
|
+
var ue;
|
|
2377
|
+
const re = Math.min((ue = A.current.getBoundingClientRect().width) != null ? ue : 0, window.innerWidth), he = y === "left" || y === "right";
|
|
2378
|
+
if (Math.abs(I) >= (he ? re : Z) * v) {
|
|
2379
|
+
Oe(), a == null || a(x, !1);
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
a == null || a(x, !0), Ot();
|
|
2383
|
+
}
|
|
2384
|
+
E.useEffect(() => (z && (X(document.documentElement, {
|
|
2385
|
+
scrollBehavior: "auto"
|
|
2386
|
+
}), W.current = /* @__PURE__ */ new Date()), () => {
|
|
2387
|
+
lo(document.documentElement, "scrollBehavior");
|
|
2388
|
+
}), [
|
|
2389
|
+
z
|
|
2390
|
+
]);
|
|
2391
|
+
function Qn(x) {
|
|
2392
|
+
const I = x ? (window.innerWidth - ge) / window.innerWidth : 1, j = x ? -ge : 0;
|
|
2393
|
+
ve.current && window.clearTimeout(ve.current), X(A.current, {
|
|
2394
|
+
transition: `transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,
|
|
2395
|
+
transform: V(y) ? `scale(${I}) translate3d(0, ${j}px, 0)` : `scale(${I}) translate3d(${j}px, 0, 0)`
|
|
2396
|
+
}), !x && A.current && (ve.current = setTimeout(() => {
|
|
2397
|
+
const k = ze(A.current, y);
|
|
2398
|
+
X(A.current, {
|
|
2399
|
+
transition: "none",
|
|
2400
|
+
transform: V(y) ? `translate3d(0, ${k}px, 0)` : `translate3d(${k}px, 0, 0)`
|
|
2401
|
+
});
|
|
2402
|
+
}, 500));
|
|
2403
|
+
}
|
|
2404
|
+
function er(x, I) {
|
|
2405
|
+
if (I < 0) return;
|
|
2406
|
+
const j = (window.innerWidth - ge) / window.innerWidth, k = j + I * (1 - j), H = -ge + I * ge;
|
|
2407
|
+
X(A.current, {
|
|
2408
|
+
transform: V(y) ? `scale(${k}) translate3d(0, ${H}px, 0)` : `scale(${k}) translate3d(${H}px, 0, 0)`,
|
|
2409
|
+
transition: "none"
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
function tr(x, I) {
|
|
2413
|
+
const j = V(y) ? window.innerHeight : window.innerWidth, k = I ? (j - ge) / j : 1, H = I ? -ge : 0;
|
|
2414
|
+
I && X(A.current, {
|
|
2415
|
+
transition: `transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,
|
|
2416
|
+
transform: V(y) ? `scale(${k}) translate3d(0, ${H}px, 0)` : `scale(${k}) translate3d(${H}px, 0, 0)`
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
return E.useEffect(() => {
|
|
2420
|
+
S || window.requestAnimationFrame(() => {
|
|
2421
|
+
document.body.style.pointerEvents = "auto";
|
|
2422
|
+
});
|
|
2423
|
+
}, [
|
|
2424
|
+
S
|
|
2425
|
+
]), /* @__PURE__ */ E.createElement(Va, {
|
|
2426
|
+
defaultOpen: _,
|
|
2427
|
+
onOpenChange: (x) => {
|
|
2428
|
+
!p && !x || (x ? ee(!0) : Oe(!0), J(x));
|
|
2429
|
+
},
|
|
2430
|
+
open: z
|
|
2431
|
+
}, /* @__PURE__ */ E.createElement(Dn.Provider, {
|
|
2432
|
+
value: {
|
|
2433
|
+
activeSnapPoint: Vn,
|
|
2434
|
+
snapPoints: o,
|
|
2435
|
+
setActiveSnapPoint: Tt,
|
|
2436
|
+
drawerRef: A,
|
|
2437
|
+
overlayRef: M,
|
|
2438
|
+
onOpenChange: t,
|
|
2439
|
+
onPress: Gn,
|
|
2440
|
+
onRelease: Zn,
|
|
2441
|
+
onDrag: Kn,
|
|
2442
|
+
dismissible: p,
|
|
2443
|
+
shouldAnimate: St,
|
|
2444
|
+
handleOnly: f,
|
|
2445
|
+
isOpen: z,
|
|
2446
|
+
isDragging: ne,
|
|
2447
|
+
shouldFade: Pt,
|
|
2448
|
+
closeDrawer: Oe,
|
|
2449
|
+
onNestedDrag: er,
|
|
2450
|
+
onNestedOpenChange: Qn,
|
|
2451
|
+
onNestedRelease: tr,
|
|
2452
|
+
keyboardIsOpen: Ee,
|
|
2453
|
+
modal: S,
|
|
2454
|
+
snapPointsOffset: Ne,
|
|
2455
|
+
activeSnapPointIndex: Se,
|
|
2456
|
+
direction: y,
|
|
2457
|
+
shouldScaleBackground: i,
|
|
2458
|
+
setBackgroundColorOnScale: s,
|
|
2459
|
+
noBodyStyles: P,
|
|
2460
|
+
container: B,
|
|
2461
|
+
autoFocus: Y
|
|
2462
|
+
}
|
|
2463
|
+
}, n));
|
|
2464
|
+
}
|
|
2465
|
+
const Fn = /* @__PURE__ */ E.forwardRef(function({ ...e }, t) {
|
|
2466
|
+
const { overlayRef: n, snapPoints: r, onRelease: a, shouldFade: o, isOpen: i, modal: s, shouldAnimate: v } = je(), m = kn(t, n), p = r && r.length > 0;
|
|
2467
|
+
if (!s)
|
|
2468
|
+
return null;
|
|
2469
|
+
const f = E.useCallback((h) => a(h), [
|
|
2470
|
+
a
|
|
2471
|
+
]);
|
|
2472
|
+
return /* @__PURE__ */ E.createElement(za, {
|
|
2473
|
+
onMouseUp: f,
|
|
2474
|
+
ref: m,
|
|
2475
|
+
"data-vaul-overlay": "",
|
|
2476
|
+
"data-vaul-snap-points": i && p ? "true" : "false",
|
|
2477
|
+
"data-vaul-snap-points-overlay": i && o ? "true" : "false",
|
|
2478
|
+
"data-vaul-animate": v != null && v.current ? "true" : "false",
|
|
2479
|
+
...e
|
|
2480
|
+
});
|
|
2481
|
+
});
|
|
2482
|
+
Fn.displayName = "Drawer.Overlay";
|
|
2483
|
+
const Wn = /* @__PURE__ */ E.forwardRef(function({ onPointerDownOutside: e, style: t, onOpenAutoFocus: n, ...r }, a) {
|
|
2484
|
+
const { drawerRef: o, onPress: i, onRelease: s, onDrag: v, keyboardIsOpen: m, snapPointsOffset: p, activeSnapPointIndex: f, modal: h, isOpen: R, direction: N, snapPoints: l, container: S, handleOnly: g, shouldAnimate: T, autoFocus: P } = je(), [y, _] = E.useState(!1), F = kn(a, o), b = E.useRef(null), O = E.useRef(null), w = E.useRef(!1), $ = l && l.length > 0;
|
|
2485
|
+
wo();
|
|
2486
|
+
const B = (C, K, z = 0) => {
|
|
2487
|
+
if (w.current) return !0;
|
|
2488
|
+
const J = Math.abs(C.y), q = Math.abs(C.x), ee = q > J, ne = [
|
|
2489
|
+
"bottom",
|
|
2490
|
+
"right"
|
|
2491
|
+
].includes(K) ? 1 : -1;
|
|
2492
|
+
if (K === "left" || K === "right") {
|
|
2493
|
+
if (!(C.x * ne < 0) && q >= 0 && q <= z)
|
|
2494
|
+
return ee;
|
|
2495
|
+
} else if (!(C.y * ne < 0) && J >= 0 && J <= z)
|
|
2496
|
+
return !ee;
|
|
2497
|
+
return w.current = !0, !0;
|
|
2498
|
+
};
|
|
2499
|
+
E.useEffect(() => {
|
|
2500
|
+
$ && window.requestAnimationFrame(() => {
|
|
2501
|
+
_(!0);
|
|
2502
|
+
});
|
|
2503
|
+
}, []);
|
|
2504
|
+
function Y(C) {
|
|
2505
|
+
b.current = null, w.current = !1, s(C);
|
|
2506
|
+
}
|
|
2507
|
+
return /* @__PURE__ */ E.createElement(qa, {
|
|
2508
|
+
"data-vaul-drawer-direction": N,
|
|
2509
|
+
"data-vaul-drawer": "",
|
|
2510
|
+
"data-vaul-delayed-snap-points": y ? "true" : "false",
|
|
2511
|
+
"data-vaul-snap-points": R && $ ? "true" : "false",
|
|
2512
|
+
"data-vaul-custom-container": S ? "true" : "false",
|
|
2513
|
+
"data-vaul-animate": T != null && T.current ? "true" : "false",
|
|
2514
|
+
...r,
|
|
2515
|
+
ref: F,
|
|
2516
|
+
style: p && p.length > 0 ? {
|
|
2517
|
+
"--snap-point-height": `${p[f ?? 0]}px`,
|
|
2518
|
+
...t
|
|
2519
|
+
} : t,
|
|
2520
|
+
onPointerDown: (C) => {
|
|
2521
|
+
g || (r.onPointerDown == null || r.onPointerDown.call(r, C), b.current = {
|
|
2522
|
+
x: C.pageX,
|
|
2523
|
+
y: C.pageY
|
|
2524
|
+
}, i(C));
|
|
2525
|
+
},
|
|
2526
|
+
onOpenAutoFocus: (C) => {
|
|
2527
|
+
n == null || n(C), P || C.preventDefault();
|
|
2528
|
+
},
|
|
2529
|
+
onPointerDownOutside: (C) => {
|
|
2530
|
+
if (e == null || e(C), !h || C.defaultPrevented) {
|
|
2531
|
+
C.preventDefault();
|
|
2532
|
+
return;
|
|
2533
|
+
}
|
|
2534
|
+
m.current && (m.current = !1);
|
|
2535
|
+
},
|
|
2536
|
+
onFocusOutside: (C) => {
|
|
2537
|
+
if (!h) {
|
|
2538
|
+
C.preventDefault();
|
|
2539
|
+
return;
|
|
2540
|
+
}
|
|
2541
|
+
},
|
|
2542
|
+
onPointerMove: (C) => {
|
|
2543
|
+
if (O.current = C, g || (r.onPointerMove == null || r.onPointerMove.call(r, C), !b.current)) return;
|
|
2544
|
+
const K = C.pageY - b.current.y, z = C.pageX - b.current.x, J = C.pointerType === "touch" ? 10 : 2;
|
|
2545
|
+
B({
|
|
2546
|
+
x: z,
|
|
2547
|
+
y: K
|
|
2548
|
+
}, N, J) ? v(C) : (Math.abs(z) > J || Math.abs(K) > J) && (b.current = null);
|
|
2549
|
+
},
|
|
2550
|
+
onPointerUp: (C) => {
|
|
2551
|
+
r.onPointerUp == null || r.onPointerUp.call(r, C), b.current = null, w.current = !1, s(C);
|
|
2552
|
+
},
|
|
2553
|
+
onPointerOut: (C) => {
|
|
2554
|
+
r.onPointerOut == null || r.onPointerOut.call(r, C), Y(O.current);
|
|
2555
|
+
},
|
|
2556
|
+
onContextMenu: (C) => {
|
|
2557
|
+
r.onContextMenu == null || r.onContextMenu.call(r, C), O.current && Y(O.current);
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
});
|
|
2561
|
+
Wn.displayName = "Drawer.Content";
|
|
2562
|
+
const Eo = 250, So = 120, Bn = /* @__PURE__ */ E.forwardRef(function({ preventCycle: e = !1, children: t, ...n }, r) {
|
|
2563
|
+
const { closeDrawer: a, isDragging: o, snapPoints: i, activeSnapPoint: s, setActiveSnapPoint: v, dismissible: m, handleOnly: p, isOpen: f, onPress: h, onDrag: R } = je(), N = E.useRef(null), l = E.useRef(!1);
|
|
2564
|
+
function S() {
|
|
2565
|
+
if (l.current) {
|
|
2566
|
+
P();
|
|
2567
|
+
return;
|
|
2568
|
+
}
|
|
2569
|
+
window.setTimeout(() => {
|
|
2570
|
+
g();
|
|
2571
|
+
}, So);
|
|
2572
|
+
}
|
|
2573
|
+
function g() {
|
|
2574
|
+
if (o || e || l.current) {
|
|
2575
|
+
P();
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2578
|
+
if (P(), !i || i.length === 0) {
|
|
2579
|
+
m || a();
|
|
2580
|
+
return;
|
|
2581
|
+
}
|
|
2582
|
+
if (s === i[i.length - 1] && m) {
|
|
2583
|
+
a();
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
const _ = i.findIndex((b) => b === s);
|
|
2587
|
+
if (_ === -1) return;
|
|
2588
|
+
const F = i[_ + 1];
|
|
2589
|
+
v(F);
|
|
2590
|
+
}
|
|
2591
|
+
function T() {
|
|
2592
|
+
N.current = window.setTimeout(() => {
|
|
2593
|
+
l.current = !0;
|
|
2594
|
+
}, Eo);
|
|
2595
|
+
}
|
|
2596
|
+
function P() {
|
|
2597
|
+
N.current && window.clearTimeout(N.current), l.current = !1;
|
|
2598
|
+
}
|
|
2599
|
+
return /* @__PURE__ */ E.createElement("div", {
|
|
2600
|
+
onClick: S,
|
|
2601
|
+
onPointerCancel: P,
|
|
2602
|
+
onPointerDown: (y) => {
|
|
2603
|
+
p && h(y), T();
|
|
2604
|
+
},
|
|
2605
|
+
onPointerMove: (y) => {
|
|
2606
|
+
p && R(y);
|
|
2607
|
+
},
|
|
2608
|
+
// onPointerUp is already handled by the content component
|
|
2609
|
+
ref: r,
|
|
2610
|
+
"data-vaul-drawer-visible": f ? "true" : "false",
|
|
2611
|
+
"data-vaul-handle": "",
|
|
2612
|
+
"aria-hidden": "true",
|
|
2613
|
+
...n
|
|
2614
|
+
}, /* @__PURE__ */ E.createElement("span", {
|
|
2615
|
+
"data-vaul-handle-hitarea": "",
|
|
2616
|
+
"aria-hidden": "true"
|
|
2617
|
+
}, t));
|
|
2618
|
+
});
|
|
2619
|
+
Bn.displayName = "Drawer.Handle";
|
|
2620
|
+
function Ro(e) {
|
|
2621
|
+
const t = je(), { container: n = t.container, ...r } = e;
|
|
2622
|
+
return /* @__PURE__ */ E.createElement(Ya, {
|
|
2623
|
+
container: n,
|
|
2624
|
+
...r
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
const we = {
|
|
2628
|
+
Root: yo,
|
|
2629
|
+
Content: Wn,
|
|
2630
|
+
Overlay: Fn,
|
|
2631
|
+
Portal: Ro,
|
|
2632
|
+
Handle: Bn,
|
|
2633
|
+
Close: Ga,
|
|
2634
|
+
Title: Xa
|
|
2635
|
+
};
|
|
2636
|
+
function mt(e, t) {
|
|
2637
|
+
e.resetHandlers(), t.endpoints.forEach((n) => {
|
|
2638
|
+
var a;
|
|
2639
|
+
const r = (a = t.handlers[n.id]) == null ? void 0 : a[n.selectedScenario];
|
|
2640
|
+
r && e.use(r());
|
|
2641
|
+
});
|
|
2642
|
+
}
|
|
2643
|
+
const G = ir((e, t) => ({
|
|
2644
|
+
pages: {},
|
|
2645
|
+
currentPageId: null,
|
|
2646
|
+
expandedIds: /* @__PURE__ */ new Set(),
|
|
2647
|
+
globalPreset: null,
|
|
2648
|
+
pendingChanges: !1,
|
|
2649
|
+
mockEnabled: !0,
|
|
2650
|
+
_worker: null,
|
|
2651
|
+
_setWorker: (n) => e({ _worker: n }),
|
|
2652
|
+
registerPage: (n) => {
|
|
2653
|
+
e((r) => {
|
|
2654
|
+
const a = r.pages[n.pageId], o = a ? n.endpoints.map((i) => {
|
|
2655
|
+
const s = a.endpoints.find((v) => v.id === i.id);
|
|
2656
|
+
return s ? { ...i, selectedScenario: s.selectedScenario } : i;
|
|
2657
|
+
}) : n.endpoints;
|
|
2658
|
+
return {
|
|
2659
|
+
pages: {
|
|
2660
|
+
...r.pages,
|
|
2661
|
+
[n.pageId]: { endpoints: o, handlers: n.handlers }
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
});
|
|
2665
|
+
},
|
|
2666
|
+
unregisterPage: (n) => {
|
|
2667
|
+
e((r) => {
|
|
2668
|
+
const { [n]: a, ...o } = r.pages;
|
|
2669
|
+
return { pages: o };
|
|
2670
|
+
});
|
|
2671
|
+
},
|
|
2672
|
+
setCurrentPage: (n) => {
|
|
2673
|
+
const { pages: r, mockEnabled: a, _worker: o } = t(), i = r[n];
|
|
2674
|
+
e({
|
|
2675
|
+
currentPageId: n,
|
|
2676
|
+
expandedIds: new Set(i != null && i.endpoints[0] ? [i.endpoints[0].id] : []),
|
|
2677
|
+
globalPreset: null,
|
|
2678
|
+
pendingChanges: !1
|
|
2679
|
+
}), a && i && o && mt(o, i);
|
|
2680
|
+
},
|
|
2681
|
+
toggleEndpoint: (n) => {
|
|
2682
|
+
e((r) => {
|
|
2683
|
+
const a = new Set(r.expandedIds);
|
|
2684
|
+
return a.has(n) ? a.delete(n) : a.add(n), { expandedIds: a };
|
|
2685
|
+
});
|
|
2686
|
+
},
|
|
2687
|
+
selectScenario: (n, r) => {
|
|
2688
|
+
const { currentPageId: a } = t();
|
|
2689
|
+
a && e((o) => {
|
|
2690
|
+
const i = o.pages[a];
|
|
2691
|
+
return i ? {
|
|
2692
|
+
pages: {
|
|
2693
|
+
...o.pages,
|
|
2694
|
+
[a]: {
|
|
2695
|
+
...i,
|
|
2696
|
+
endpoints: i.endpoints.map(
|
|
2697
|
+
(s) => s.id === n ? { ...s, selectedScenario: r } : s
|
|
2698
|
+
)
|
|
2699
|
+
}
|
|
2700
|
+
},
|
|
2701
|
+
globalPreset: null,
|
|
2702
|
+
pendingChanges: !0
|
|
2703
|
+
} : {};
|
|
2704
|
+
});
|
|
2705
|
+
},
|
|
2706
|
+
applyGlobalPreset: (n) => {
|
|
2707
|
+
const { currentPageId: r } = t();
|
|
2708
|
+
!n || !r || e((a) => {
|
|
2709
|
+
const o = a.pages[r];
|
|
2710
|
+
return o ? {
|
|
2711
|
+
pages: {
|
|
2712
|
+
...a.pages,
|
|
2713
|
+
[r]: {
|
|
2714
|
+
...o,
|
|
2715
|
+
endpoints: o.endpoints.map((i) => {
|
|
2716
|
+
const s = i.options.some((v) => v.scenario === n);
|
|
2717
|
+
return {
|
|
2718
|
+
...i,
|
|
2719
|
+
selectedScenario: s ? n : i.options[0].scenario
|
|
2720
|
+
};
|
|
2721
|
+
})
|
|
2722
|
+
}
|
|
2723
|
+
},
|
|
2724
|
+
globalPreset: n,
|
|
2725
|
+
pendingChanges: !0
|
|
2726
|
+
} : {};
|
|
2727
|
+
});
|
|
2728
|
+
},
|
|
2729
|
+
applyChanges: () => {
|
|
2730
|
+
const { currentPageId: n, pages: r, mockEnabled: a, _worker: o } = t();
|
|
2731
|
+
if (!n || !a || !o) return;
|
|
2732
|
+
const i = r[n];
|
|
2733
|
+
i && mt(o, i), e({ pendingChanges: !1 });
|
|
2734
|
+
},
|
|
2735
|
+
resetCurrentPage: () => {
|
|
2736
|
+
const { currentPageId: n, pages: r, _worker: a } = t();
|
|
2737
|
+
if (!n) return;
|
|
2738
|
+
const o = r[n];
|
|
2739
|
+
if (!o) return;
|
|
2740
|
+
const i = o.endpoints.map((s) => ({
|
|
2741
|
+
...s,
|
|
2742
|
+
selectedScenario: s.options[0].scenario
|
|
2743
|
+
}));
|
|
2744
|
+
e((s) => ({
|
|
2745
|
+
pages: {
|
|
2746
|
+
...s.pages,
|
|
2747
|
+
[n]: { ...o, endpoints: i }
|
|
2748
|
+
},
|
|
2749
|
+
globalPreset: null,
|
|
2750
|
+
pendingChanges: !1
|
|
2751
|
+
})), a == null || a.resetHandlers();
|
|
2752
|
+
},
|
|
2753
|
+
toggleMockEnabled: async () => {
|
|
2754
|
+
const { mockEnabled: n, currentPageId: r, pages: a, _worker: o } = t();
|
|
2755
|
+
if (o)
|
|
2756
|
+
if (n)
|
|
2757
|
+
o.stop(), e({ mockEnabled: !1, pendingChanges: !1 });
|
|
2758
|
+
else {
|
|
2759
|
+
await o.start({
|
|
2760
|
+
onUnhandledRequest: "warn",
|
|
2761
|
+
serviceWorker: { url: "/mockServiceWorker.js" }
|
|
2762
|
+
});
|
|
2763
|
+
const i = r ? a[r] : null;
|
|
2764
|
+
i && mt(o, i), e({ mockEnabled: !0 });
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
})), Un = (e) => {
|
|
2768
|
+
var t;
|
|
2769
|
+
return e.currentPageId ? ((t = e.pages[e.currentPageId]) == null ? void 0 : t.endpoints) ?? [] : [];
|
|
2770
|
+
}, Co = (e) => {
|
|
2771
|
+
if (!e.mockEnabled) return "off";
|
|
2772
|
+
const t = Un(e);
|
|
2773
|
+
return t.some(
|
|
2774
|
+
(n) => ["error", "not_found", "forbidden", "network_error"].includes(
|
|
2775
|
+
n.selectedScenario
|
|
2776
|
+
)
|
|
2777
|
+
) ? "error" : t.some((n) => n.selectedScenario === "loading") ? "warn" : "ok";
|
|
2778
|
+
};
|
|
2779
|
+
function xo(e) {
|
|
2780
|
+
return e.scenario === "loading" ? "// pending..." : e.scenario === "network_error" ? "// network error" : e.payload ? JSON.stringify(e.payload, null, 2) : "{}";
|
|
2781
|
+
}
|
|
2782
|
+
function To(e) {
|
|
2783
|
+
return e ? e < 300 ? "mswd-sc-badge mswd-sc-badge--2xx" : e < 500 ? "mswd-sc-badge mswd-sc-badge--4xx" : "mswd-sc-badge mswd-sc-badge--5xx" : "mswd-sc-badge mswd-sc-badge--err";
|
|
2784
|
+
}
|
|
2785
|
+
function Po(e, t) {
|
|
2786
|
+
return t ? e === "loading" ? "mswd-radio mswd-radio--loading" : `mswd-radio ${["error", "not_found", "forbidden", "network_error"].includes(
|
|
2787
|
+
e
|
|
2788
|
+
) ? "mswd-radio--error" : "mswd-radio--success"}` : "mswd-radio";
|
|
2789
|
+
}
|
|
2790
|
+
function No(e) {
|
|
2791
|
+
return e === "loading" ? "mswd-radio-dot mswd-radio-dot--loading" : `mswd-radio-dot ${["error", "not_found", "forbidden", "network_error"].includes(
|
|
2792
|
+
e
|
|
2793
|
+
) ? "mswd-radio-dot--error" : "mswd-radio-dot--success"}`;
|
|
2794
|
+
}
|
|
2795
|
+
function Oo(e) {
|
|
2796
|
+
return e === "success" ? "mswd-ep-status mswd-ep-status--success" : e === "loading" ? "mswd-ep-status mswd-ep-status--loading" : "mswd-ep-status mswd-ep-status--error";
|
|
2797
|
+
}
|
|
2798
|
+
function Do({
|
|
2799
|
+
endpoint: e,
|
|
2800
|
+
expanded: t,
|
|
2801
|
+
onToggle: n,
|
|
2802
|
+
onSelectScenario: r
|
|
2803
|
+
}) {
|
|
2804
|
+
const a = e.options.find((o) => o.scenario === e.selectedScenario) ?? e.options[0];
|
|
2805
|
+
return /* @__PURE__ */ d.jsxs("div", { className: "mswd-ep-block", children: [
|
|
2806
|
+
/* @__PURE__ */ d.jsxs("button", { className: "mswd-ep-header", onClick: n, children: [
|
|
2807
|
+
/* @__PURE__ */ d.jsx("span", { className: `mswd-method mswd-method--${e.method}`, children: e.method }),
|
|
2808
|
+
/* @__PURE__ */ d.jsx("span", { className: "mswd-ep-path", children: e.path }),
|
|
2809
|
+
/* @__PURE__ */ d.jsx("span", { className: Oo(e.selectedScenario), children: (a == null ? void 0 : a.statusCode) ?? (e.selectedScenario === "loading" ? "…" : "ERR") }),
|
|
2810
|
+
/* @__PURE__ */ d.jsx(
|
|
2811
|
+
"span",
|
|
2812
|
+
{
|
|
2813
|
+
className: `mswd-chevron ${t ? "mswd-chevron--open" : "mswd-chevron--closed"}`,
|
|
2814
|
+
children: "›"
|
|
2815
|
+
}
|
|
2816
|
+
)
|
|
2817
|
+
] }),
|
|
2818
|
+
t && /* @__PURE__ */ d.jsxs("div", { className: "mswd-options", children: [
|
|
2819
|
+
e.options.map((o, i) => {
|
|
2820
|
+
const s = e.selectedScenario === o.scenario;
|
|
2821
|
+
return /* @__PURE__ */ d.jsxs("div", { children: [
|
|
2822
|
+
i > 0 && /* @__PURE__ */ d.jsx("div", { className: "mswd-option-divider" }),
|
|
2823
|
+
/* @__PURE__ */ d.jsxs(
|
|
2824
|
+
"button",
|
|
2825
|
+
{
|
|
2826
|
+
className: `mswd-option ${s ? "mswd-option--selected" : ""}`,
|
|
2827
|
+
onClick: () => r(o.scenario),
|
|
2828
|
+
children: [
|
|
2829
|
+
/* @__PURE__ */ d.jsx("div", { className: Po(o.scenario, s), children: s && /* @__PURE__ */ d.jsx("div", { className: No(o.scenario) }) }),
|
|
2830
|
+
/* @__PURE__ */ d.jsxs("div", { className: "mswd-opt-info", children: [
|
|
2831
|
+
/* @__PURE__ */ d.jsx("p", { className: "mswd-opt-label", children: o.label }),
|
|
2832
|
+
/* @__PURE__ */ d.jsx("p", { className: "mswd-opt-desc", children: o.description })
|
|
2833
|
+
] }),
|
|
2834
|
+
o.scenario === "loading" ? /* @__PURE__ */ d.jsx("span", { className: "mswd-sc-spinner" }) : /* @__PURE__ */ d.jsx("span", { className: To(o.statusCode), children: o.statusCode ?? "ERR" })
|
|
2835
|
+
]
|
|
2836
|
+
}
|
|
2837
|
+
)
|
|
2838
|
+
] }, o.id);
|
|
2839
|
+
}),
|
|
2840
|
+
/* @__PURE__ */ d.jsxs("div", { className: "mswd-payload", children: [
|
|
2841
|
+
/* @__PURE__ */ d.jsx("p", { className: "mswd-payload-label", children: "Response preview" }),
|
|
2842
|
+
/* @__PURE__ */ d.jsx("pre", { className: "mswd-payload-code", children: xo(a) })
|
|
2843
|
+
] })
|
|
2844
|
+
] })
|
|
2845
|
+
] });
|
|
2846
|
+
}
|
|
2847
|
+
function Ao({
|
|
2848
|
+
status: e,
|
|
2849
|
+
onClick: t
|
|
2850
|
+
}) {
|
|
2851
|
+
const n = e === "error" ? "mswd-badge mswd-badge--error" : e === "warn" ? "mswd-badge mswd-badge--warn" : e === "ok" ? "mswd-badge mswd-badge--ok" : "mswd-badge mswd-badge--off", r = e === "error" ? "!" : e === "warn" ? "…" : e === "ok" ? "✓" : "—";
|
|
2852
|
+
return /* @__PURE__ */ d.jsxs(
|
|
2853
|
+
"button",
|
|
2854
|
+
{
|
|
2855
|
+
onClick: t,
|
|
2856
|
+
className: "mswd-fab",
|
|
2857
|
+
title: "Open MSW Debug Drawer",
|
|
2858
|
+
"aria-label": "Open MSW Debug Drawer",
|
|
2859
|
+
children: [
|
|
2860
|
+
/* @__PURE__ */ d.jsx(
|
|
2861
|
+
"svg",
|
|
2862
|
+
{
|
|
2863
|
+
width: "18",
|
|
2864
|
+
height: "18",
|
|
2865
|
+
fill: "none",
|
|
2866
|
+
stroke: "currentColor",
|
|
2867
|
+
strokeWidth: "1.8",
|
|
2868
|
+
viewBox: "0 0 24 24",
|
|
2869
|
+
"aria-hidden": "true",
|
|
2870
|
+
children: /* @__PURE__ */ d.jsx("path", { d: "M9 3H5a2 2 0 00-2 2v4m6-6h10a2 2 0 012 2v4M9 3v18m0 0h10a2 2 0 002-2V9M9 21H5a2 2 0 01-2-2V9m0 0h18" })
|
|
2871
|
+
}
|
|
2872
|
+
),
|
|
2873
|
+
/* @__PURE__ */ d.jsx("span", { className: n, "aria-hidden": "true", children: r })
|
|
2874
|
+
]
|
|
2875
|
+
}
|
|
2876
|
+
);
|
|
2877
|
+
}
|
|
2878
|
+
function _o({
|
|
2879
|
+
enabled: e,
|
|
2880
|
+
onToggle: t
|
|
2881
|
+
}) {
|
|
2882
|
+
return /* @__PURE__ */ d.jsxs("button", { onClick: t, className: "mswd-toggle-row", type: "button", children: [
|
|
2883
|
+
/* @__PURE__ */ d.jsx("div", { className: `mswd-track ${e ? "mswd-track--on" : ""}`, children: /* @__PURE__ */ d.jsx("div", { className: `mswd-thumb ${e ? "mswd-thumb--on" : ""}` }) }),
|
|
2884
|
+
/* @__PURE__ */ d.jsxs("div", { className: "mswd-toggle-labels", children: [
|
|
2885
|
+
/* @__PURE__ */ d.jsx(
|
|
2886
|
+
"p",
|
|
2887
|
+
{
|
|
2888
|
+
className: `mswd-toggle-title ${e ? "mswd-toggle-title--on" : ""}`,
|
|
2889
|
+
children: e ? "Mock ativo" : "Mock inativo"
|
|
2890
|
+
}
|
|
2891
|
+
),
|
|
2892
|
+
/* @__PURE__ */ d.jsx("p", { className: "mswd-toggle-sub", children: e ? "interceptando requisições" : "requisições indo para a API real" })
|
|
2893
|
+
] }),
|
|
2894
|
+
/* @__PURE__ */ d.jsx("span", { className: `mswd-dot ${e ? "mswd-dot--on" : ""}` })
|
|
2895
|
+
] });
|
|
2896
|
+
}
|
|
2897
|
+
function ko({
|
|
2898
|
+
active: e,
|
|
2899
|
+
disabled: t,
|
|
2900
|
+
onSelect: n
|
|
2901
|
+
}) {
|
|
2902
|
+
const r = [
|
|
2903
|
+
{
|
|
2904
|
+
id: "success",
|
|
2905
|
+
label: "all success",
|
|
2906
|
+
cls: "mswd-preset-btn--success"
|
|
2907
|
+
},
|
|
2908
|
+
{
|
|
2909
|
+
id: "loading",
|
|
2910
|
+
label: "all loading",
|
|
2911
|
+
cls: "mswd-preset-btn--loading"
|
|
2912
|
+
},
|
|
2913
|
+
{ id: "error", label: "all error", cls: "mswd-preset-btn--error" }
|
|
2914
|
+
];
|
|
2915
|
+
return /* @__PURE__ */ d.jsx(
|
|
2916
|
+
"div",
|
|
2917
|
+
{
|
|
2918
|
+
className: `mswd-global-strip ${t ? "mswd-global-strip--disabled" : ""}`,
|
|
2919
|
+
children: r.map((a) => /* @__PURE__ */ d.jsxs(
|
|
2920
|
+
"button",
|
|
2921
|
+
{
|
|
2922
|
+
type: "button",
|
|
2923
|
+
onClick: () => n(a.id),
|
|
2924
|
+
className: `mswd-preset-btn ${e === a.id ? a.cls : ""}`,
|
|
2925
|
+
children: [
|
|
2926
|
+
/* @__PURE__ */ d.jsx("span", { className: `mswd-preset-dot mswd-preset-dot--${a.id}` }),
|
|
2927
|
+
a.label
|
|
2928
|
+
]
|
|
2929
|
+
},
|
|
2930
|
+
a.id
|
|
2931
|
+
))
|
|
2932
|
+
}
|
|
2933
|
+
);
|
|
2934
|
+
}
|
|
2935
|
+
function Lo({
|
|
2936
|
+
worker: e,
|
|
2937
|
+
enabled: t = !0,
|
|
2938
|
+
snapPoints: n = ["500px", 1]
|
|
2939
|
+
}) {
|
|
2940
|
+
const [r, a] = qe(!1), [o, i] = qe(!1), [s, v] = qe(
|
|
2941
|
+
n[0]
|
|
2942
|
+
), m = G((w) => w._setWorker);
|
|
2943
|
+
G((w) => w._worker) || m(e);
|
|
2944
|
+
const f = G(Un), h = G((w) => w.expandedIds), R = G((w) => w.globalPreset), N = G((w) => w.pendingChanges), l = G((w) => w.mockEnabled), S = G((w) => w.currentPageId), g = G(Co), T = G((w) => w.toggleMockEnabled), P = G((w) => w.toggleEndpoint), y = G((w) => w.selectScenario), _ = G((w) => w.applyGlobalPreset), F = G((w) => w.applyChanges), b = G((w) => w.resetCurrentPage), O = ar(() => {
|
|
2945
|
+
F(), i(!0), setTimeout(() => i(!1), 1200);
|
|
2946
|
+
}, [F]);
|
|
2947
|
+
return t ? /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
2948
|
+
/* @__PURE__ */ d.jsx(Ao, { status: g, onClick: () => a(!0) }),
|
|
2949
|
+
/* @__PURE__ */ d.jsx(
|
|
2950
|
+
we.Root,
|
|
2951
|
+
{
|
|
2952
|
+
open: r,
|
|
2953
|
+
onOpenChange: a,
|
|
2954
|
+
snapPoints: n,
|
|
2955
|
+
activeSnapPoint: s,
|
|
2956
|
+
setActiveSnapPoint: v,
|
|
2957
|
+
shouldScaleBackground: !1,
|
|
2958
|
+
modal: !0,
|
|
2959
|
+
children: /* @__PURE__ */ d.jsxs(we.Portal, { children: [
|
|
2960
|
+
/* @__PURE__ */ d.jsx(we.Overlay, { className: "mswd-vaul-overlay" }),
|
|
2961
|
+
/* @__PURE__ */ d.jsxs(
|
|
2962
|
+
we.Content,
|
|
2963
|
+
{
|
|
2964
|
+
className: "mswd-vaul-content",
|
|
2965
|
+
"aria-describedby": void 0,
|
|
2966
|
+
children: [
|
|
2967
|
+
/* @__PURE__ */ d.jsx(we.Handle, { className: "mswd-vaul-handle" }),
|
|
2968
|
+
/* @__PURE__ */ d.jsx(we.Title, { className: "mswd-sr-only", children: "MSW Debug Drawer" }),
|
|
2969
|
+
/* @__PURE__ */ d.jsxs("div", { className: "mswd-header", children: [
|
|
2970
|
+
/* @__PURE__ */ d.jsxs("div", { className: "mswd-header-left", children: [
|
|
2971
|
+
/* @__PURE__ */ d.jsx("div", { className: "mswd-header-icon", "aria-hidden": "true", children: "⚡" }),
|
|
2972
|
+
/* @__PURE__ */ d.jsxs("div", { children: [
|
|
2973
|
+
/* @__PURE__ */ d.jsx("p", { className: "mswd-header-title", children: "MSW Debug" }),
|
|
2974
|
+
S ? /* @__PURE__ */ d.jsx("p", { className: "mswd-header-sub mswd-header-sub--page", children: S }) : /* @__PURE__ */ d.jsx("p", { className: "mswd-header-sub", children: "mock service worker" })
|
|
2975
|
+
] })
|
|
2976
|
+
] }),
|
|
2977
|
+
/* @__PURE__ */ d.jsx(
|
|
2978
|
+
we.Close,
|
|
2979
|
+
{
|
|
2980
|
+
className: "mswd-close-btn",
|
|
2981
|
+
"aria-label": "Close drawer",
|
|
2982
|
+
children: "✕"
|
|
2983
|
+
}
|
|
2984
|
+
)
|
|
2985
|
+
] }),
|
|
2986
|
+
/* @__PURE__ */ d.jsx(_o, { enabled: l, onToggle: T }),
|
|
2987
|
+
f.length === 0 ? /* @__PURE__ */ d.jsxs("div", { className: "mswd-empty", children: [
|
|
2988
|
+
/* @__PURE__ */ d.jsx("div", { className: "mswd-empty-icon", "aria-hidden": "true", children: "📭" }),
|
|
2989
|
+
/* @__PURE__ */ d.jsx("p", { className: "mswd-empty-title", children: "Nenhum endpoint registrado" }),
|
|
2990
|
+
/* @__PURE__ */ d.jsxs("p", { className: "mswd-empty-desc", children: [
|
|
2991
|
+
"Use",
|
|
2992
|
+
" ",
|
|
2993
|
+
/* @__PURE__ */ d.jsx("code", { className: "mswd-code", children: "useRegisterMockEndpoints" }),
|
|
2994
|
+
" em uma página para ver os endpoints aqui."
|
|
2995
|
+
] })
|
|
2996
|
+
] }) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
2997
|
+
/* @__PURE__ */ d.jsx(
|
|
2998
|
+
ko,
|
|
2999
|
+
{
|
|
3000
|
+
active: R,
|
|
3001
|
+
disabled: !l,
|
|
3002
|
+
onSelect: _
|
|
3003
|
+
}
|
|
3004
|
+
),
|
|
3005
|
+
/* @__PURE__ */ d.jsxs(
|
|
3006
|
+
"div",
|
|
3007
|
+
{
|
|
3008
|
+
className: `mswd-section-label ${l ? "" : "mswd-section-label--disabled"}`,
|
|
3009
|
+
children: [
|
|
3010
|
+
/* @__PURE__ */ d.jsxs("span", { className: "mswd-section-text", children: [
|
|
3011
|
+
"endpoints · ",
|
|
3012
|
+
f.length
|
|
3013
|
+
] }),
|
|
3014
|
+
N && l && /* @__PURE__ */ d.jsx("span", { className: "mswd-unsaved", children: "unsaved" })
|
|
3015
|
+
]
|
|
3016
|
+
}
|
|
3017
|
+
),
|
|
3018
|
+
/* @__PURE__ */ d.jsx(
|
|
3019
|
+
"div",
|
|
3020
|
+
{
|
|
3021
|
+
className: `mswd-list ${l ? "" : "mswd-list--disabled"}`,
|
|
3022
|
+
"data-vaul-no-drag": !0,
|
|
3023
|
+
children: f.map((w) => /* @__PURE__ */ d.jsx(
|
|
3024
|
+
Do,
|
|
3025
|
+
{
|
|
3026
|
+
endpoint: w,
|
|
3027
|
+
expanded: h.has(w.id),
|
|
3028
|
+
onToggle: () => P(w.id),
|
|
3029
|
+
onSelectScenario: ($) => y(w.id, $)
|
|
3030
|
+
},
|
|
3031
|
+
w.id
|
|
3032
|
+
))
|
|
3033
|
+
}
|
|
3034
|
+
),
|
|
3035
|
+
/* @__PURE__ */ d.jsxs("div", { className: "mswd-footer", children: [
|
|
3036
|
+
/* @__PURE__ */ d.jsx(
|
|
3037
|
+
"button",
|
|
3038
|
+
{
|
|
3039
|
+
type: "button",
|
|
3040
|
+
onClick: b,
|
|
3041
|
+
className: "mswd-btn-reset",
|
|
3042
|
+
children: "Reset"
|
|
3043
|
+
}
|
|
3044
|
+
),
|
|
3045
|
+
/* @__PURE__ */ d.jsx(
|
|
3046
|
+
"button",
|
|
3047
|
+
{
|
|
3048
|
+
type: "button",
|
|
3049
|
+
onClick: O,
|
|
3050
|
+
disabled: !N || !l,
|
|
3051
|
+
className: `mswd-btn-apply ${o ? "mswd-btn-apply--applied" : N && l ? "mswd-btn-apply--active" : "mswd-btn-apply--disabled"}`,
|
|
3052
|
+
children: o ? "Applied ✓" : "Apply & reload"
|
|
3053
|
+
}
|
|
3054
|
+
)
|
|
3055
|
+
] })
|
|
3056
|
+
] })
|
|
3057
|
+
]
|
|
3058
|
+
}
|
|
3059
|
+
)
|
|
3060
|
+
] })
|
|
3061
|
+
}
|
|
3062
|
+
)
|
|
3063
|
+
] }) : null;
|
|
3064
|
+
}
|
|
3065
|
+
function Fo(e) {
|
|
3066
|
+
const t = G((r) => r.registerPage), n = G((r) => r.setCurrentPage);
|
|
3067
|
+
Jt(() => {
|
|
3068
|
+
t(e), n(e.pageId);
|
|
3069
|
+
}, [e.pageId]);
|
|
3070
|
+
}
|
|
3071
|
+
export {
|
|
3072
|
+
Lo as DebugDrawer,
|
|
3073
|
+
G as useDebugDrawerStore,
|
|
3074
|
+
Fo as useRegisterMockEndpoints
|
|
3075
|
+
};
|