boottent-design 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2106 +1,97 @@
1
- import { jsx as c, jsxs as N, Fragment as pe } from "react/jsx-runtime";
2
- import { p as nt } from "./portal-manager-CttMAZAu.js";
3
- import * as s from "react";
4
- import { useState as me, Fragment as rn, useEffect as ce } from "react";
5
- import { g as ht, P, i as X, f as W, c as Le, d as D, e as ge, j as nn, D as on, k as an, u as yt, a as Te, S as sn, b as J, I as wt, B as ot, h as cn, l as ln, V as Et, m as un, n as dn, o as fn } from "./index-NAHSuYsJ.js";
6
- import * as pn from "react-dom";
7
- import bt from "react-dom";
8
- import { cn as x } from "./boottent-design.utils.es.js";
9
- var mn = "Portal", $e = s.forwardRef((e, t) => {
10
- var i;
11
- const { container: r, ...n } = e, [o, a] = s.useState(!1);
12
- ht(() => a(!0), []);
13
- const l = r || o && ((i = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : i.body);
14
- return l ? bt.createPortal(/* @__PURE__ */ c(P.div, { ...n, ref: t }), l) : null;
15
- });
16
- $e.displayName = mn;
17
- const vn = 5, gn = 2e3;
18
- let Ce = 0;
19
- function hn() {
20
- return Ce = (Ce + 1) % Number.MAX_SAFE_INTEGER, Ce.toString();
21
- }
22
- const xe = /* @__PURE__ */ new Map(), at = (e) => {
23
- if (xe.has(e))
24
- return;
25
- const t = setTimeout(() => {
26
- xe.delete(e), Z({
27
- type: "REMOVE_TOAST",
28
- toastId: e
29
- });
30
- }, gn);
31
- xe.set(e, t);
32
- }, yn = (e, t) => {
33
- switch (t.type) {
34
- case "ADD_TOAST":
35
- return {
36
- ...e,
37
- toasts: [t.toast, ...e.toasts].slice(0, vn)
38
- };
39
- case "UPDATE_TOAST":
40
- return {
41
- ...e,
42
- toasts: e.toasts.map(
43
- (r) => r.id === t.toast.id ? { ...r, ...t.toast } : r
44
- )
45
- };
46
- case "DISMISS_TOAST": {
47
- const { toastId: r } = t;
48
- return r ? at(r) : e.toasts.forEach((n) => {
49
- at(n.id);
50
- }), {
51
- ...e,
52
- toasts: e.toasts.map(
53
- (n) => n.id === r || r === void 0 ? {
54
- ...n,
55
- open: !1
56
- } : n
57
- )
58
- };
59
- }
60
- case "REMOVE_TOAST":
61
- return t.toastId === void 0 ? {
62
- ...e,
63
- toasts: []
64
- } : {
65
- ...e,
66
- toasts: e.toasts.filter((r) => r.id !== t.toastId)
67
- };
68
- }
69
- }, le = [];
70
- let ue = { toasts: [] };
71
- function Z(e) {
72
- ue = yn(ue, e), le.forEach((t) => {
73
- t(ue);
74
- });
75
- }
76
- function Tt({ ...e }) {
77
- const t = hn(), r = (o) => Z({
78
- type: "UPDATE_TOAST",
79
- toast: { ...o, id: t }
80
- }), n = () => Z({ type: "DISMISS_TOAST", toastId: t });
81
- return Z({
82
- type: "ADD_TOAST",
83
- toast: {
84
- ...e,
85
- id: t,
86
- open: !0,
87
- onOpenChange: (o) => {
88
- o || (n(), e.onClose && e.onClose());
89
- }
90
- }
91
- }), {
92
- id: t,
93
- dismiss: n,
94
- update: r
95
- };
96
- }
97
- function wn() {
98
- const [e, t] = s.useState(ue);
99
- return s.useEffect(() => (le.push(t), () => {
100
- const r = le.indexOf(t);
101
- r > -1 && le.splice(r, 1);
102
- }), [e]), {
103
- ...e,
104
- toast: Tt,
105
- dismiss: (r) => Z({ type: "DISMISS_TOAST", toastId: r })
106
- };
107
- }
108
- var Ne = "focusScope.autoFocusOnMount", Se = "focusScope.autoFocusOnUnmount", st = { bubbles: !1, cancelable: !0 }, En = "FocusScope", Ct = s.forwardRef((e, t) => {
109
- const {
110
- loop: r = !1,
111
- trapped: n = !1,
112
- onMountAutoFocus: o,
113
- onUnmountAutoFocus: a,
114
- ...l
115
- } = e, [i, m] = s.useState(null), d = X(o), v = X(a), p = s.useRef(null), b = W(t, (u) => m(u)), T = s.useRef({
116
- paused: !1,
117
- pause() {
118
- this.paused = !0;
119
- },
120
- resume() {
121
- this.paused = !1;
122
- }
123
- }).current;
124
- s.useEffect(() => {
125
- if (n) {
126
- let u = function(h) {
127
- if (T.paused || !i) return;
128
- const w = h.target;
129
- i.contains(w) ? p.current = w : $(p.current, { select: !0 });
130
- }, f = function(h) {
131
- if (T.paused || !i) return;
132
- const w = h.relatedTarget;
133
- w !== null && (i.contains(w) || $(p.current, { select: !0 }));
134
- }, g = function(h) {
135
- if (document.activeElement === document.body)
136
- for (const C of h)
137
- C.removedNodes.length > 0 && $(i);
138
- };
139
- document.addEventListener("focusin", u), document.addEventListener("focusout", f);
140
- const y = new MutationObserver(g);
141
- return i && y.observe(i, { childList: !0, subtree: !0 }), () => {
142
- document.removeEventListener("focusin", u), document.removeEventListener("focusout", f), y.disconnect();
143
- };
144
- }
145
- }, [n, i, T.paused]), s.useEffect(() => {
146
- if (i) {
147
- ct.add(T);
148
- const u = document.activeElement;
149
- if (!i.contains(u)) {
150
- const g = new CustomEvent(Ne, st);
151
- i.addEventListener(Ne, d), i.dispatchEvent(g), g.defaultPrevented || (bn(Sn(xt(i)), { select: !0 }), document.activeElement === u && $(i));
152
- }
153
- return () => {
154
- i.removeEventListener(Ne, d), setTimeout(() => {
155
- const g = new CustomEvent(Se, st);
156
- i.addEventListener(Se, v), i.dispatchEvent(g), g.defaultPrevented || $(u ?? document.body, { select: !0 }), i.removeEventListener(Se, v), ct.remove(T);
157
- }, 0);
158
- };
159
- }
160
- }, [i, d, v, T]);
161
- const S = s.useCallback(
162
- (u) => {
163
- if (!r && !n || T.paused) return;
164
- const f = u.key === "Tab" && !u.altKey && !u.ctrlKey && !u.metaKey, g = document.activeElement;
165
- if (f && g) {
166
- const y = u.currentTarget, [h, w] = Tn(y);
167
- h && w ? !u.shiftKey && g === w ? (u.preventDefault(), r && $(h, { select: !0 })) : u.shiftKey && g === h && (u.preventDefault(), r && $(w, { select: !0 })) : g === y && u.preventDefault();
168
- }
169
- },
170
- [r, n, T.paused]
171
- );
172
- return /* @__PURE__ */ c(P.div, { tabIndex: -1, ...l, ref: b, onKeyDown: S });
173
- });
174
- Ct.displayName = En;
175
- function bn(e, { select: t = !1 } = {}) {
176
- const r = document.activeElement;
177
- for (const n of e)
178
- if ($(n, { select: t }), document.activeElement !== r) return;
179
- }
180
- function Tn(e) {
181
- const t = xt(e), r = it(t, e), n = it(t.reverse(), e);
182
- return [r, n];
183
- }
184
- function xt(e) {
185
- const t = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
186
- acceptNode: (n) => {
187
- const o = n.tagName === "INPUT" && n.type === "hidden";
188
- return n.disabled || n.hidden || o ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
189
- }
190
- });
191
- for (; r.nextNode(); ) t.push(r.currentNode);
192
- return t;
193
- }
194
- function it(e, t) {
195
- for (const r of e)
196
- if (!Cn(r, { upTo: t })) return r;
197
- }
198
- function Cn(e, { upTo: t }) {
199
- if (getComputedStyle(e).visibility === "hidden") return !0;
200
- for (; e; ) {
201
- if (t !== void 0 && e === t) return !1;
202
- if (getComputedStyle(e).display === "none") return !0;
203
- e = e.parentElement;
204
- }
205
- return !1;
206
- }
207
- function xn(e) {
208
- return e instanceof HTMLInputElement && "select" in e;
209
- }
210
- function $(e, { select: t = !1 } = {}) {
211
- if (e && e.focus) {
212
- const r = document.activeElement;
213
- e.focus({ preventScroll: !0 }), e !== r && xn(e) && t && e.select();
214
- }
215
- }
216
- var ct = Nn();
217
- function Nn() {
218
- let e = [];
219
- return {
220
- add(t) {
221
- const r = e[0];
222
- t !== r && (r == null || r.pause()), e = lt(e, t), e.unshift(t);
223
- },
224
- remove(t) {
225
- var r;
226
- e = lt(e, t), (r = e[0]) == null || r.resume();
227
- }
228
- };
229
- }
230
- function lt(e, t) {
231
- const r = [...e], n = r.indexOf(t);
232
- return n !== -1 && r.splice(n, 1), r;
233
- }
234
- function Sn(e) {
235
- return e.filter((t) => t.tagName !== "A");
236
- }
237
- var Ae = 0;
238
- function An() {
239
- s.useEffect(() => {
240
- const e = document.querySelectorAll("[data-radix-focus-guard]");
241
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? ut()), document.body.insertAdjacentElement("beforeend", e[1] ?? ut()), Ae++, () => {
242
- Ae === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), Ae--;
243
- };
244
- }, []);
245
- }
246
- function ut() {
247
- const e = document.createElement("span");
248
- 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;
249
- }
250
- var M = function() {
251
- return M = Object.assign || function(t) {
252
- for (var r, n = 1, o = arguments.length; n < o; n++) {
253
- r = arguments[n];
254
- for (var a in r) Object.prototype.hasOwnProperty.call(r, a) && (t[a] = r[a]);
255
- }
256
- return t;
257
- }, M.apply(this, arguments);
258
- };
259
- function Nt(e, t) {
260
- var r = {};
261
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
262
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
263
- for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
264
- t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
265
- return r;
266
- }
267
- function Dn(e, t, r) {
268
- if (r || arguments.length === 2) for (var n = 0, o = t.length, a; n < o; n++)
269
- (a || !(n in t)) && (a || (a = Array.prototype.slice.call(t, 0, n)), a[n] = t[n]);
270
- return e.concat(a || Array.prototype.slice.call(t));
271
- }
272
- var de = "right-scroll-bar-position", fe = "width-before-scroll-bar", Rn = "with-scroll-bars-hidden", Pn = "--removed-body-scroll-bar-size";
273
- function De(e, t) {
274
- return typeof e == "function" ? e(t) : e && (e.current = t), e;
275
- }
276
- function _n(e, t) {
277
- var r = me(function() {
278
- return {
279
- // value
280
- value: e,
281
- // last callback
282
- callback: t,
283
- // "memoized" public interface
284
- facade: {
285
- get current() {
286
- return r.value;
287
- },
288
- set current(n) {
289
- var o = r.value;
290
- o !== n && (r.value = n, r.callback(n, o));
291
- }
292
- }
293
- };
294
- })[0];
295
- return r.callback = t, r.facade;
296
- }
297
- var On = typeof window < "u" ? s.useLayoutEffect : s.useEffect, dt = /* @__PURE__ */ new WeakMap();
298
- function In(e, t) {
299
- var r = _n(null, function(n) {
300
- return e.forEach(function(o) {
301
- return De(o, n);
302
- });
303
- });
304
- return On(function() {
305
- var n = dt.get(r);
306
- if (n) {
307
- var o = new Set(n), a = new Set(e), l = r.current;
308
- o.forEach(function(i) {
309
- a.has(i) || De(i, null);
310
- }), a.forEach(function(i) {
311
- o.has(i) || De(i, l);
312
- });
313
- }
314
- dt.set(r, e);
315
- }, [e]), r;
316
- }
317
- function Mn(e) {
318
- return e;
319
- }
320
- function Fn(e, t) {
321
- t === void 0 && (t = Mn);
322
- var r = [], n = !1, o = {
323
- read: function() {
324
- if (n)
325
- throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
326
- return r.length ? r[r.length - 1] : e;
327
- },
328
- useMedium: function(a) {
329
- var l = t(a, n);
330
- return r.push(l), function() {
331
- r = r.filter(function(i) {
332
- return i !== l;
333
- });
334
- };
335
- },
336
- assignSyncMedium: function(a) {
337
- for (n = !0; r.length; ) {
338
- var l = r;
339
- r = [], l.forEach(a);
340
- }
341
- r = {
342
- push: function(i) {
343
- return a(i);
344
- },
345
- filter: function() {
346
- return r;
347
- }
348
- };
349
- },
350
- assignMedium: function(a) {
351
- n = !0;
352
- var l = [];
353
- if (r.length) {
354
- var i = r;
355
- r = [], i.forEach(a), l = r;
356
- }
357
- var m = function() {
358
- var v = l;
359
- l = [], v.forEach(a);
360
- }, d = function() {
361
- return Promise.resolve().then(m);
362
- };
363
- d(), r = {
364
- push: function(v) {
365
- l.push(v), d();
366
- },
367
- filter: function(v) {
368
- return l = l.filter(v), r;
369
- }
370
- };
371
- }
372
- };
373
- return o;
374
- }
375
- function kn(e) {
376
- e === void 0 && (e = {});
377
- var t = Fn(null);
378
- return t.options = M({ async: !0, ssr: !1 }, e), t;
379
- }
380
- var St = function(e) {
381
- var t = e.sideCar, r = Nt(e, ["sideCar"]);
382
- if (!t)
383
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
384
- var n = t.read();
385
- if (!n)
386
- throw new Error("Sidecar medium not found");
387
- return s.createElement(n, M({}, r));
388
- };
389
- St.isSideCarExport = !0;
390
- function Ln(e, t) {
391
- return e.useMedium(t), St;
392
- }
393
- var At = kn(), Re = function() {
394
- }, he = s.forwardRef(function(e, t) {
395
- var r = s.useRef(null), n = s.useState({
396
- onScrollCapture: Re,
397
- onWheelCapture: Re,
398
- onTouchMoveCapture: Re
399
- }), o = n[0], a = n[1], l = e.forwardProps, i = e.children, m = e.className, d = e.removeScrollBar, v = e.enabled, p = e.shards, b = e.sideCar, T = e.noIsolation, S = e.inert, u = e.allowPinchZoom, f = e.as, g = f === void 0 ? "div" : f, y = e.gapMode, h = Nt(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), w = b, C = In([r, t]), A = M(M({}, h), o);
400
- return s.createElement(
401
- s.Fragment,
402
- null,
403
- v && s.createElement(w, { sideCar: At, removeScrollBar: d, shards: p, noIsolation: T, inert: S, setCallbacks: a, allowPinchZoom: !!u, lockRef: r, gapMode: y }),
404
- l ? s.cloneElement(s.Children.only(i), M(M({}, A), { ref: C })) : s.createElement(g, M({}, A, { className: m, ref: C }), i)
405
- );
406
- });
407
- he.defaultProps = {
408
- enabled: !0,
409
- removeScrollBar: !0,
410
- inert: !1
411
- };
412
- he.classNames = {
413
- fullWidth: fe,
414
- zeroRight: de
415
- };
416
- var $n = function() {
417
- if (typeof __webpack_nonce__ < "u")
418
- return __webpack_nonce__;
419
- };
420
- function Wn() {
421
- if (!document)
422
- return null;
423
- var e = document.createElement("style");
424
- e.type = "text/css";
425
- var t = $n();
426
- return t && e.setAttribute("nonce", t), e;
427
- }
428
- function Vn(e, t) {
429
- e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
430
- }
431
- function Bn(e) {
432
- var t = document.head || document.getElementsByTagName("head")[0];
433
- t.appendChild(e);
434
- }
435
- var Kn = function() {
436
- var e = 0, t = null;
437
- return {
438
- add: function(r) {
439
- e == 0 && (t = Wn()) && (Vn(t, r), Bn(t)), e++;
440
- },
441
- remove: function() {
442
- e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
443
- }
444
- };
445
- }, zn = function() {
446
- var e = Kn();
447
- return function(t, r) {
448
- s.useEffect(function() {
449
- return e.add(t), function() {
450
- e.remove();
451
- };
452
- }, [t && r]);
453
- };
454
- }, Dt = function() {
455
- var e = zn(), t = function(r) {
456
- var n = r.styles, o = r.dynamic;
457
- return e(n, o), null;
458
- };
459
- return t;
460
- }, Hn = {
461
- left: 0,
462
- top: 0,
463
- right: 0,
464
- gap: 0
465
- }, Pe = function(e) {
466
- return parseInt(e || "", 10) || 0;
467
- }, Un = function(e) {
468
- var t = window.getComputedStyle(document.body), r = t[e === "padding" ? "paddingLeft" : "marginLeft"], n = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"];
469
- return [Pe(r), Pe(n), Pe(o)];
470
- }, jn = function(e) {
471
- if (e === void 0 && (e = "margin"), typeof window > "u")
472
- return Hn;
473
- var t = Un(e), r = document.documentElement.clientWidth, n = window.innerWidth;
474
- return {
475
- left: t[0],
476
- top: t[1],
477
- right: t[2],
478
- gap: Math.max(0, n - r + t[2] - t[0])
479
- };
480
- }, Yn = Dt(), j = "data-scroll-locked", Xn = function(e, t, r, n) {
481
- var o = e.left, a = e.top, l = e.right, i = e.gap;
482
- return r === void 0 && (r = "margin"), `
483
- .`.concat(Rn, ` {
484
- overflow: hidden `).concat(n, `;
485
- padding-right: `).concat(i, "px ").concat(n, `;
486
- }
487
- body[`).concat(j, `] {
488
- overflow: hidden `).concat(n, `;
489
- overscroll-behavior: contain;
490
- `).concat([
491
- t && "position: relative ".concat(n, ";"),
492
- r === "margin" && `
493
- padding-left: `.concat(o, `px;
494
- padding-top: `).concat(a, `px;
495
- padding-right: `).concat(l, `px;
496
- margin-left:0;
497
- margin-top:0;
498
- margin-right: `).concat(i, "px ").concat(n, `;
499
- `),
500
- r === "padding" && "padding-right: ".concat(i, "px ").concat(n, ";")
501
- ].filter(Boolean).join(""), `
502
- }
503
-
504
- .`).concat(de, ` {
505
- right: `).concat(i, "px ").concat(n, `;
506
- }
507
-
508
- .`).concat(fe, ` {
509
- margin-right: `).concat(i, "px ").concat(n, `;
510
- }
511
-
512
- .`).concat(de, " .").concat(de, ` {
513
- right: 0 `).concat(n, `;
514
- }
515
-
516
- .`).concat(fe, " .").concat(fe, ` {
517
- margin-right: 0 `).concat(n, `;
518
- }
519
-
520
- body[`).concat(j, `] {
521
- `).concat(Pn, ": ").concat(i, `px;
522
- }
523
- `);
524
- }, ft = function() {
525
- var e = parseInt(document.body.getAttribute(j) || "0", 10);
526
- return isFinite(e) ? e : 0;
527
- }, Gn = function() {
528
- s.useEffect(function() {
529
- return document.body.setAttribute(j, (ft() + 1).toString()), function() {
530
- var e = ft() - 1;
531
- e <= 0 ? document.body.removeAttribute(j) : document.body.setAttribute(j, e.toString());
532
- };
533
- }, []);
534
- }, qn = function(e) {
535
- var t = e.noRelative, r = e.noImportant, n = e.gapMode, o = n === void 0 ? "margin" : n;
536
- Gn();
537
- var a = s.useMemo(function() {
538
- return jn(o);
539
- }, [o]);
540
- return s.createElement(Yn, { styles: Xn(a, !t, o, r ? "" : "!important") });
541
- }, Ie = !1;
542
- if (typeof window < "u")
543
- try {
544
- var ne = Object.defineProperty({}, "passive", {
545
- get: function() {
546
- return Ie = !0, !0;
547
- }
548
- });
549
- window.addEventListener("test", ne, ne), window.removeEventListener("test", ne, ne);
550
- } catch {
551
- Ie = !1;
552
- }
553
- var z = Ie ? { passive: !1 } : !1, Zn = function(e) {
554
- return e.tagName === "TEXTAREA";
555
- }, Rt = function(e, t) {
556
- if (!(e instanceof Element))
557
- return !1;
558
- var r = window.getComputedStyle(e);
559
- return (
560
- // not-not-scrollable
561
- r[t] !== "hidden" && // contains scroll inside self
562
- !(r.overflowY === r.overflowX && !Zn(e) && r[t] === "visible")
563
- );
564
- }, Qn = function(e) {
565
- return Rt(e, "overflowY");
566
- }, Jn = function(e) {
567
- return Rt(e, "overflowX");
568
- }, pt = function(e, t) {
569
- var r = t.ownerDocument, n = t;
570
- do {
571
- typeof ShadowRoot < "u" && n instanceof ShadowRoot && (n = n.host);
572
- var o = Pt(e, n);
573
- if (o) {
574
- var a = _t(e, n), l = a[1], i = a[2];
575
- if (l > i)
576
- return !0;
577
- }
578
- n = n.parentNode;
579
- } while (n && n !== r.body);
580
- return !1;
581
- }, eo = function(e) {
582
- var t = e.scrollTop, r = e.scrollHeight, n = e.clientHeight;
583
- return [
584
- t,
585
- r,
586
- n
587
- ];
588
- }, to = function(e) {
589
- var t = e.scrollLeft, r = e.scrollWidth, n = e.clientWidth;
590
- return [
591
- t,
592
- r,
593
- n
594
- ];
595
- }, Pt = function(e, t) {
596
- return e === "v" ? Qn(t) : Jn(t);
597
- }, _t = function(e, t) {
598
- return e === "v" ? eo(t) : to(t);
599
- }, ro = function(e, t) {
600
- return e === "h" && t === "rtl" ? -1 : 1;
601
- }, no = function(e, t, r, n, o) {
602
- var a = ro(e, window.getComputedStyle(t).direction), l = a * n, i = r.target, m = t.contains(i), d = !1, v = l > 0, p = 0, b = 0;
603
- do {
604
- var T = _t(e, i), S = T[0], u = T[1], f = T[2], g = u - f - a * S;
605
- (S || g) && Pt(e, i) && (p += g, b += S), i instanceof ShadowRoot ? i = i.host : i = i.parentNode;
606
- } while (
607
- // portaled content
608
- !m && i !== document.body || // self content
609
- m && (t.contains(i) || t === i)
610
- );
611
- return (v && (Math.abs(p) < 1 || !o) || !v && (Math.abs(b) < 1 || !o)) && (d = !0), d;
612
- }, oe = function(e) {
613
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
614
- }, mt = function(e) {
615
- return [e.deltaX, e.deltaY];
616
- }, vt = function(e) {
617
- return e && "current" in e ? e.current : e;
618
- }, oo = function(e, t) {
619
- return e[0] === t[0] && e[1] === t[1];
620
- }, ao = function(e) {
621
- return `
622
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
623
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
624
- `);
625
- }, so = 0, H = [];
626
- function io(e) {
627
- var t = s.useRef([]), r = s.useRef([0, 0]), n = s.useRef(), o = s.useState(so++)[0], a = s.useState(Dt)[0], l = s.useRef(e);
628
- s.useEffect(function() {
629
- l.current = e;
630
- }, [e]), s.useEffect(function() {
631
- if (e.inert) {
632
- document.body.classList.add("block-interactivity-".concat(o));
633
- var u = Dn([e.lockRef.current], (e.shards || []).map(vt), !0).filter(Boolean);
634
- return u.forEach(function(f) {
635
- return f.classList.add("allow-interactivity-".concat(o));
636
- }), function() {
637
- document.body.classList.remove("block-interactivity-".concat(o)), u.forEach(function(f) {
638
- return f.classList.remove("allow-interactivity-".concat(o));
639
- });
640
- };
641
- }
642
- }, [e.inert, e.lockRef.current, e.shards]);
643
- var i = s.useCallback(function(u, f) {
644
- if ("touches" in u && u.touches.length === 2 || u.type === "wheel" && u.ctrlKey)
645
- return !l.current.allowPinchZoom;
646
- var g = oe(u), y = r.current, h = "deltaX" in u ? u.deltaX : y[0] - g[0], w = "deltaY" in u ? u.deltaY : y[1] - g[1], C, A = u.target, R = Math.abs(h) > Math.abs(w) ? "h" : "v";
647
- if ("touches" in u && R === "h" && A.type === "range")
648
- return !1;
649
- var I = pt(R, A);
650
- if (!I)
651
- return !0;
652
- if (I ? C = R : (C = R === "v" ? "h" : "v", I = pt(R, A)), !I)
653
- return !1;
654
- if (!n.current && "changedTouches" in u && (h || w) && (n.current = C), !C)
655
- return !0;
656
- var F = n.current || C;
657
- return no(F, f, u, F === "h" ? h : w, !0);
658
- }, []), m = s.useCallback(function(u) {
659
- var f = u;
660
- if (!(!H.length || H[H.length - 1] !== a)) {
661
- var g = "deltaY" in f ? mt(f) : oe(f), y = t.current.filter(function(C) {
662
- return C.name === f.type && (C.target === f.target || f.target === C.shadowParent) && oo(C.delta, g);
663
- })[0];
664
- if (y && y.should) {
665
- f.cancelable && f.preventDefault();
666
- return;
667
- }
668
- if (!y) {
669
- var h = (l.current.shards || []).map(vt).filter(Boolean).filter(function(C) {
670
- return C.contains(f.target);
671
- }), w = h.length > 0 ? i(f, h[0]) : !l.current.noIsolation;
672
- w && f.cancelable && f.preventDefault();
673
- }
674
- }
675
- }, []), d = s.useCallback(function(u, f, g, y) {
676
- var h = { name: u, delta: f, target: g, should: y, shadowParent: co(g) };
677
- t.current.push(h), setTimeout(function() {
678
- t.current = t.current.filter(function(w) {
679
- return w !== h;
680
- });
681
- }, 1);
682
- }, []), v = s.useCallback(function(u) {
683
- r.current = oe(u), n.current = void 0;
684
- }, []), p = s.useCallback(function(u) {
685
- d(u.type, mt(u), u.target, i(u, e.lockRef.current));
686
- }, []), b = s.useCallback(function(u) {
687
- d(u.type, oe(u), u.target, i(u, e.lockRef.current));
688
- }, []);
689
- s.useEffect(function() {
690
- return H.push(a), e.setCallbacks({
691
- onScrollCapture: p,
692
- onWheelCapture: p,
693
- onTouchMoveCapture: b
694
- }), document.addEventListener("wheel", m, z), document.addEventListener("touchmove", m, z), document.addEventListener("touchstart", v, z), function() {
695
- H = H.filter(function(u) {
696
- return u !== a;
697
- }), document.removeEventListener("wheel", m, z), document.removeEventListener("touchmove", m, z), document.removeEventListener("touchstart", v, z);
698
- };
699
- }, []);
700
- var T = e.removeScrollBar, S = e.inert;
701
- return s.createElement(
702
- s.Fragment,
703
- null,
704
- S ? s.createElement(a, { styles: ao(o) }) : null,
705
- T ? s.createElement(qn, { gapMode: e.gapMode }) : null
706
- );
707
- }
708
- function co(e) {
709
- for (var t = null; e !== null; )
710
- e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
711
- return t;
712
- }
713
- const lo = Ln(At, io);
714
- var Ot = s.forwardRef(function(e, t) {
715
- return s.createElement(he, M({}, e, { ref: t, sideCar: lo }));
716
- });
717
- Ot.classNames = he.classNames;
718
- var uo = function(e) {
719
- if (typeof document > "u")
720
- return null;
721
- var t = Array.isArray(e) ? e[0] : e;
722
- return t.ownerDocument.body;
723
- }, U = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), se = {}, _e = 0, It = function(e) {
724
- return e && (e.host || It(e.parentNode));
725
- }, fo = function(e, t) {
726
- return t.map(function(r) {
727
- if (e.contains(r))
728
- return r;
729
- var n = It(r);
730
- return n && e.contains(n) ? n : (console.error("aria-hidden", r, "in not contained inside", e, ". Doing nothing"), null);
731
- }).filter(function(r) {
732
- return !!r;
733
- });
734
- }, po = function(e, t, r, n) {
735
- var o = fo(t, Array.isArray(e) ? e : [e]);
736
- se[r] || (se[r] = /* @__PURE__ */ new WeakMap());
737
- var a = se[r], l = [], i = /* @__PURE__ */ new Set(), m = new Set(o), d = function(p) {
738
- !p || i.has(p) || (i.add(p), d(p.parentNode));
739
- };
740
- o.forEach(d);
741
- var v = function(p) {
742
- !p || m.has(p) || Array.prototype.forEach.call(p.children, function(b) {
743
- if (i.has(b))
744
- v(b);
745
- else
746
- try {
747
- var T = b.getAttribute(n), S = T !== null && T !== "false", u = (U.get(b) || 0) + 1, f = (a.get(b) || 0) + 1;
748
- U.set(b, u), a.set(b, f), l.push(b), u === 1 && S && ae.set(b, !0), f === 1 && b.setAttribute(r, "true"), S || b.setAttribute(n, "true");
749
- } catch (g) {
750
- console.error("aria-hidden: cannot operate on ", b, g);
751
- }
752
- });
753
- };
754
- return v(t), i.clear(), _e++, function() {
755
- l.forEach(function(p) {
756
- var b = U.get(p) - 1, T = a.get(p) - 1;
757
- U.set(p, b), a.set(p, T), b || (ae.has(p) || p.removeAttribute(n), ae.delete(p)), T || p.removeAttribute(r);
758
- }), _e--, _e || (U = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), se = {});
759
- };
760
- }, mo = function(e, t, r) {
761
- r === void 0 && (r = "data-aria-hidden");
762
- var n = Array.from(Array.isArray(e) ? e : [e]), o = uo(e);
763
- return o ? (n.push.apply(n, Array.from(o.querySelectorAll("[aria-live]"))), po(n, o, r, "aria-hidden")) : function() {
764
- return null;
765
- };
766
- }, We = "Dialog", [Mt, Ft] = Le(We), [vo, O] = Mt(We), kt = (e) => {
767
- const {
768
- __scopeDialog: t,
769
- children: r,
770
- open: n,
771
- defaultOpen: o,
772
- onOpenChange: a,
773
- modal: l = !0
774
- } = e, i = s.useRef(null), m = s.useRef(null), [d = !1, v] = yt({
775
- prop: n,
776
- defaultProp: o,
777
- onChange: a
778
- });
779
- return /* @__PURE__ */ c(
780
- vo,
781
- {
782
- scope: t,
783
- triggerRef: i,
784
- contentRef: m,
785
- contentId: Te(),
786
- titleId: Te(),
787
- descriptionId: Te(),
788
- open: d,
789
- onOpenChange: v,
790
- onOpenToggle: s.useCallback(() => v((p) => !p), [v]),
791
- modal: l,
792
- children: r
793
- }
794
- );
795
- };
796
- kt.displayName = We;
797
- var Lt = "DialogTrigger", $t = s.forwardRef(
798
- (e, t) => {
799
- const { __scopeDialog: r, ...n } = e, o = O(Lt, r), a = W(t, o.triggerRef);
800
- return /* @__PURE__ */ c(
801
- P.button,
802
- {
803
- type: "button",
804
- "aria-haspopup": "dialog",
805
- "aria-expanded": o.open,
806
- "aria-controls": o.contentId,
807
- "data-state": Ke(o.open),
808
- ...n,
809
- ref: a,
810
- onClick: D(e.onClick, o.onOpenToggle)
811
- }
812
- );
813
- }
814
- );
815
- $t.displayName = Lt;
816
- var Ve = "DialogPortal", [go, Wt] = Mt(Ve, {
817
- forceMount: void 0
818
- }), Vt = (e) => {
819
- const { __scopeDialog: t, forceMount: r, children: n, container: o } = e, a = O(Ve, t);
820
- return /* @__PURE__ */ c(go, { scope: t, forceMount: r, children: s.Children.map(n, (l) => /* @__PURE__ */ c(ge, { present: r || a.open, children: /* @__PURE__ */ c($e, { asChild: !0, container: o, children: l }) })) });
821
- };
822
- Vt.displayName = Ve;
823
- var ve = "DialogOverlay", Bt = s.forwardRef(
824
- (e, t) => {
825
- const r = Wt(ve, e.__scopeDialog), { forceMount: n = r.forceMount, ...o } = e, a = O(ve, e.__scopeDialog);
826
- return a.modal ? /* @__PURE__ */ c(ge, { present: n || a.open, children: /* @__PURE__ */ c(ho, { ...o, ref: t }) }) : null;
827
- }
828
- );
829
- Bt.displayName = ve;
830
- var ho = s.forwardRef(
831
- (e, t) => {
832
- const { __scopeDialog: r, ...n } = e, o = O(ve, r);
833
- return (
834
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
835
- // ie. when `Overlay` and `Content` are siblings
836
- /* @__PURE__ */ c(Ot, { as: nn, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ c(
837
- P.div,
838
- {
839
- "data-state": Ke(o.open),
840
- ...n,
841
- ref: t,
842
- style: { pointerEvents: "auto", ...n.style }
843
- }
844
- ) })
845
- );
846
- }
847
- ), B = "DialogContent", Kt = s.forwardRef(
848
- (e, t) => {
849
- const r = Wt(B, e.__scopeDialog), { forceMount: n = r.forceMount, ...o } = e, a = O(B, e.__scopeDialog);
850
- return /* @__PURE__ */ c(ge, { present: n || a.open, children: a.modal ? /* @__PURE__ */ c(yo, { ...o, ref: t }) : /* @__PURE__ */ c(wo, { ...o, ref: t }) });
851
- }
852
- );
853
- Kt.displayName = B;
854
- var yo = s.forwardRef(
855
- (e, t) => {
856
- const r = O(B, e.__scopeDialog), n = s.useRef(null), o = W(t, r.contentRef, n);
857
- return s.useEffect(() => {
858
- const a = n.current;
859
- if (a) return mo(a);
860
- }, []), /* @__PURE__ */ c(
861
- zt,
862
- {
863
- ...e,
864
- ref: o,
865
- trapFocus: r.open,
866
- disableOutsidePointerEvents: !0,
867
- onCloseAutoFocus: D(e.onCloseAutoFocus, (a) => {
868
- var l;
869
- a.preventDefault(), (l = r.triggerRef.current) == null || l.focus();
870
- }),
871
- onPointerDownOutside: D(e.onPointerDownOutside, (a) => {
872
- const l = a.detail.originalEvent, i = l.button === 0 && l.ctrlKey === !0;
873
- (l.button === 2 || i) && a.preventDefault();
874
- }),
875
- onFocusOutside: D(
876
- e.onFocusOutside,
877
- (a) => a.preventDefault()
878
- )
879
- }
880
- );
881
- }
882
- ), wo = s.forwardRef(
883
- (e, t) => {
884
- const r = O(B, e.__scopeDialog), n = s.useRef(!1), o = s.useRef(!1);
885
- return /* @__PURE__ */ c(
886
- zt,
887
- {
888
- ...e,
889
- ref: t,
890
- trapFocus: !1,
891
- disableOutsidePointerEvents: !1,
892
- onCloseAutoFocus: (a) => {
893
- var l, i;
894
- (l = e.onCloseAutoFocus) == null || l.call(e, a), a.defaultPrevented || (n.current || (i = r.triggerRef.current) == null || i.focus(), a.preventDefault()), n.current = !1, o.current = !1;
895
- },
896
- onInteractOutside: (a) => {
897
- var m, d;
898
- (m = e.onInteractOutside) == null || m.call(e, a), a.defaultPrevented || (n.current = !0, a.detail.originalEvent.type === "pointerdown" && (o.current = !0));
899
- const l = a.target;
900
- ((d = r.triggerRef.current) == null ? void 0 : d.contains(l)) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && o.current && a.preventDefault();
901
- }
902
- }
903
- );
904
- }
905
- ), zt = s.forwardRef(
906
- (e, t) => {
907
- const { __scopeDialog: r, trapFocus: n, onOpenAutoFocus: o, onCloseAutoFocus: a, ...l } = e, i = O(B, r), m = s.useRef(null), d = W(t, m);
908
- return An(), /* @__PURE__ */ N(pe, { children: [
909
- /* @__PURE__ */ c(
910
- Ct,
911
- {
912
- asChild: !0,
913
- loop: !0,
914
- trapped: n,
915
- onMountAutoFocus: o,
916
- onUnmountAutoFocus: a,
917
- children: /* @__PURE__ */ c(
918
- on,
919
- {
920
- role: "dialog",
921
- id: i.contentId,
922
- "aria-describedby": i.descriptionId,
923
- "aria-labelledby": i.titleId,
924
- "data-state": Ke(i.open),
925
- ...l,
926
- ref: d,
927
- onDismiss: () => i.onOpenChange(!1)
928
- }
929
- )
930
- }
931
- ),
932
- /* @__PURE__ */ N(pe, { children: [
933
- /* @__PURE__ */ c(bo, { titleId: i.titleId }),
934
- /* @__PURE__ */ c(Co, { contentRef: m, descriptionId: i.descriptionId })
935
- ] })
936
- ] });
937
- }
938
- ), Be = "DialogTitle", Ht = s.forwardRef(
939
- (e, t) => {
940
- const { __scopeDialog: r, ...n } = e, o = O(Be, r);
941
- return /* @__PURE__ */ c(P.h2, { id: o.titleId, ...n, ref: t });
942
- }
943
- );
944
- Ht.displayName = Be;
945
- var Ut = "DialogDescription", jt = s.forwardRef(
946
- (e, t) => {
947
- const { __scopeDialog: r, ...n } = e, o = O(Ut, r);
948
- return /* @__PURE__ */ c(P.p, { id: o.descriptionId, ...n, ref: t });
949
- }
950
- );
951
- jt.displayName = Ut;
952
- var Yt = "DialogClose", Xt = s.forwardRef(
953
- (e, t) => {
954
- const { __scopeDialog: r, ...n } = e, o = O(Yt, r);
955
- return /* @__PURE__ */ c(
956
- P.button,
957
- {
958
- type: "button",
959
- ...n,
960
- ref: t,
961
- onClick: D(e.onClick, () => o.onOpenChange(!1))
962
- }
963
- );
964
- }
965
- );
966
- Xt.displayName = Yt;
967
- function Ke(e) {
968
- return e ? "open" : "closed";
969
- }
970
- var Gt = "DialogTitleWarning", [Eo, qt] = an(Gt, {
971
- contentName: B,
972
- titleName: Be,
973
- docsSlug: "dialog"
974
- }), bo = ({ titleId: e }) => {
975
- const t = qt(Gt), r = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
976
-
977
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
978
-
979
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
980
- return s.useEffect(() => {
981
- e && (document.getElementById(e) || console.error(r));
982
- }, [r, e]), null;
983
- }, To = "DialogDescriptionWarning", Co = ({ contentRef: e, descriptionId: t }) => {
984
- const n = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qt(To).contentName}}.`;
985
- return s.useEffect(() => {
986
- var a;
987
- const o = (a = e.current) == null ? void 0 : a.getAttribute("aria-describedby");
988
- t && o && (document.getElementById(t) || console.warn(n));
989
- }, [n, e, t]), null;
990
- }, Zt = kt, xo = $t, Qt = Vt, ze = Bt, He = Kt, Ue = Ht, je = jt, Ye = Xt, Jt = "AlertDialog", [No, ma] = Le(Jt, [
991
- Ft
992
- ]), k = Ft(), er = (e) => {
993
- const { __scopeAlertDialog: t, ...r } = e, n = k(t);
994
- return /* @__PURE__ */ c(Zt, { ...n, ...r, modal: !0 });
995
- };
996
- er.displayName = Jt;
997
- var So = "AlertDialogTrigger", Ao = s.forwardRef(
998
- (e, t) => {
999
- const { __scopeAlertDialog: r, ...n } = e, o = k(r);
1000
- return /* @__PURE__ */ c(xo, { ...o, ...n, ref: t });
1001
- }
1002
- );
1003
- Ao.displayName = So;
1004
- var Do = "AlertDialogPortal", tr = (e) => {
1005
- const { __scopeAlertDialog: t, ...r } = e, n = k(t);
1006
- return /* @__PURE__ */ c(Qt, { ...n, ...r });
1007
- };
1008
- tr.displayName = Do;
1009
- var Ro = "AlertDialogOverlay", rr = s.forwardRef(
1010
- (e, t) => {
1011
- const { __scopeAlertDialog: r, ...n } = e, o = k(r);
1012
- return /* @__PURE__ */ c(ze, { ...o, ...n, ref: t });
1013
- }
1014
- );
1015
- rr.displayName = Ro;
1016
- var Y = "AlertDialogContent", [Po, _o] = No(Y), nr = s.forwardRef(
1017
- (e, t) => {
1018
- const { __scopeAlertDialog: r, children: n, ...o } = e, a = k(r), l = s.useRef(null), i = W(t, l), m = s.useRef(null);
1019
- return /* @__PURE__ */ c(
1020
- Eo,
1021
- {
1022
- contentName: Y,
1023
- titleName: or,
1024
- docsSlug: "alert-dialog",
1025
- children: /* @__PURE__ */ c(Po, { scope: r, cancelRef: m, children: /* @__PURE__ */ N(
1026
- He,
1027
- {
1028
- role: "alertdialog",
1029
- ...a,
1030
- ...o,
1031
- ref: i,
1032
- onOpenAutoFocus: D(o.onOpenAutoFocus, (d) => {
1033
- var v;
1034
- d.preventDefault(), (v = m.current) == null || v.focus({ preventScroll: !0 });
1035
- }),
1036
- onPointerDownOutside: (d) => d.preventDefault(),
1037
- onInteractOutside: (d) => d.preventDefault(),
1038
- children: [
1039
- /* @__PURE__ */ c(sn, { children: n }),
1040
- /* @__PURE__ */ c(Io, { contentRef: l })
1041
- ]
1042
- }
1043
- ) })
1044
- }
1045
- );
1046
- }
1047
- );
1048
- nr.displayName = Y;
1049
- var or = "AlertDialogTitle", ar = s.forwardRef(
1050
- (e, t) => {
1051
- const { __scopeAlertDialog: r, ...n } = e, o = k(r);
1052
- return /* @__PURE__ */ c(Ue, { ...o, ...n, ref: t });
1053
- }
1054
- );
1055
- ar.displayName = or;
1056
- var sr = "AlertDialogDescription", ir = s.forwardRef((e, t) => {
1057
- const { __scopeAlertDialog: r, ...n } = e, o = k(r);
1058
- return /* @__PURE__ */ c(je, { ...o, ...n, ref: t });
1059
- });
1060
- ir.displayName = sr;
1061
- var Oo = "AlertDialogAction", cr = s.forwardRef(
1062
- (e, t) => {
1063
- const { __scopeAlertDialog: r, ...n } = e, o = k(r);
1064
- return /* @__PURE__ */ c(Ye, { ...o, ...n, ref: t });
1065
- }
1066
- );
1067
- cr.displayName = Oo;
1068
- var lr = "AlertDialogCancel", ur = s.forwardRef(
1069
- (e, t) => {
1070
- const { __scopeAlertDialog: r, ...n } = e, { cancelRef: o } = _o(lr, r), a = k(r), l = W(t, o);
1071
- return /* @__PURE__ */ c(Ye, { ...a, ...n, ref: l });
1072
- }
1073
- );
1074
- ur.displayName = lr;
1075
- var Io = ({ contentRef: e }) => {
1076
- const t = `\`${Y}\` requires a description for the component to be accessible for screen reader users.
1077
-
1078
- You can add a description to the \`${Y}\` by passing a \`${sr}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
1079
-
1080
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Y}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
1081
-
1082
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
1083
- return s.useEffect(() => {
1084
- var n;
1085
- document.getElementById(
1086
- (n = e.current) == null ? void 0 : n.getAttribute("aria-describedby")
1087
- ) || console.warn(t);
1088
- }, [t, e]), null;
1089
- }, Mo = er, Fo = tr, dr = rr, fr = nr, pr = cr, mr = ur, vr = ar, gr = ir;
1090
- const hr = Mo, ko = Fo, yr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1091
- dr,
1092
- {
1093
- className: x(
1094
- "fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1095
- e
1096
- ),
1097
- ...t,
1098
- ref: r
1099
- }
1100
- ));
1101
- yr.displayName = dr.displayName;
1102
- const Lo = {
1103
- sm: "max-w-[344px]",
1104
- // 24rem
1105
- md: "max-w-[500px]",
1106
- // 28rem
1107
- lg: "max-w-[640px]",
1108
- // 32rem
1109
- fit: "max-w-fit"
1110
- }, Xe = s.forwardRef(({ className: e, size: t = "sm", ...r }, n) => /* @__PURE__ */ N(ko, { children: [
1111
- /* @__PURE__ */ c(yr, {}),
1112
- /* @__PURE__ */ c(
1113
- fr,
1114
- {
1115
- ref: n,
1116
- className: x(
1117
- "fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-4 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
1118
- Lo[t],
1119
- e
1120
- ),
1121
- ...r
1122
- }
1123
- )
1124
- ] }));
1125
- Xe.displayName = fr.displayName;
1126
- const Ge = ({
1127
- className: e,
1128
- ...t
1129
- }) => /* @__PURE__ */ c(
1130
- "div",
1131
- {
1132
- className: x(
1133
- "flex flex-col space-y-2 text-center sm:text-left",
1134
- e
1135
- ),
1136
- ...t
1137
- }
1138
- );
1139
- Ge.displayName = "AlertDialogHeader";
1140
- const qe = ({
1141
- className: e,
1142
- ...t
1143
- }) => /* @__PURE__ */ c(
1144
- "div",
1145
- {
1146
- className: x(
1147
- "flex flex-col-reverse sm:flex-row sm:justify-between sm:space-x-2",
1148
- e
1149
- ),
1150
- ...t
1151
- }
1152
- );
1153
- qe.displayName = "AlertDialogFooter";
1154
- const Ze = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1155
- vr,
1156
- {
1157
- ref: r,
1158
- className: x("whitespace-pre-wrap text-semibold16", e),
1159
- ...t
1160
- }
1161
- ));
1162
- Ze.displayName = vr.displayName;
1163
- const Q = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1164
- gr,
1165
- {
1166
- ref: r,
1167
- className: x(
1168
- "whitespace-pre-wrap text-xs font-normal text-grey-600",
1169
- e
1170
- ),
1171
- ...t
1172
- }
1173
- ));
1174
- Q.displayName = gr.displayName;
1175
- const Qe = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1176
- pr,
1177
- {
1178
- ref: r,
1179
- className: x(J({ size: "sm" }), e),
1180
- ...t
1181
- }
1182
- ));
1183
- Qe.displayName = pr.displayName;
1184
- const wr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1185
- mr,
1186
- {
1187
- ref: r,
1188
- className: x(
1189
- J({ variant: "outline", size: "sm" }),
1190
- "mt-2 w-1/2 sm:mt-0",
1191
- e
1192
- ),
1193
- ...t
1194
- }
1195
- ));
1196
- wr.displayName = mr.displayName;
1197
- const Er = ({
1198
- title: e = "알림",
1199
- description: t,
1200
- confirmText: r = "확인",
1201
- onConfirm: n,
1202
- size: o = "sm",
1203
- onClose: a
1204
- }) => /* @__PURE__ */ c(
1205
- hr,
1206
- {
1207
- open: !0,
1208
- onOpenChange: (l) => {
1209
- !l && a && a();
1210
- },
1211
- children: /* @__PURE__ */ N(Xe, { size: o, children: [
1212
- /* @__PURE__ */ N(Ge, { children: [
1213
- /* @__PURE__ */ c(Ze, { children: e }),
1214
- /* @__PURE__ */ c(Q, { children: t })
1215
- ] }),
1216
- /* @__PURE__ */ c(qe, { children: /* @__PURE__ */ c(
1217
- Qe,
1218
- {
1219
- className: x("w-full font-normal"),
1220
- onClick: () => {
1221
- a && a(), n && n();
1222
- },
1223
- children: r
1224
- }
1225
- ) })
1226
- ] })
1227
- }
1228
- );
1229
- Er.displayName = "Alert";
1230
- const $o = Zt, Wo = Qt, br = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1231
- ze,
1232
- {
1233
- ref: r,
1234
- className: x(
1235
- "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1236
- e
1237
- ),
1238
- ...t
1239
- }
1240
- ));
1241
- br.displayName = ze.displayName;
1242
- const Tr = s.forwardRef(({ className: e, children: t, ...r }, n) => /* @__PURE__ */ N(Wo, { children: [
1243
- /* @__PURE__ */ c(br, {}),
1244
- /* @__PURE__ */ N(
1245
- He,
1246
- {
1247
- ref: n,
1248
- className: x(
1249
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-xl translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
1250
- e
1251
- ),
1252
- ...r,
1253
- children: [
1254
- t,
1255
- /* @__PURE__ */ N(Ye, { className: "absolute right-4 top-5 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground md:right-[30px] md:top-[25px]", children: [
1256
- /* @__PURE__ */ c(wt.Cancel, { size: "16" }),
1257
- /* @__PURE__ */ c("span", { className: "sr-only", children: "Close" })
1258
- ] })
1259
- ]
1260
- }
1261
- )
1262
- ] }));
1263
- Tr.displayName = He.displayName;
1264
- const Cr = ({
1265
- className: e,
1266
- ...t
1267
- }) => /* @__PURE__ */ c(
1268
- "div",
1269
- {
1270
- className: x("flex flex-col text-left md:text-center", e),
1271
- ...t
1272
- }
1273
- );
1274
- Cr.displayName = "DialogHeader";
1275
- const xr = ({
1276
- className: e,
1277
- ...t
1278
- }) => /* @__PURE__ */ c(
1279
- "div",
1280
- {
1281
- className: x(
1282
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
1283
- e
1284
- ),
1285
- ...t
1286
- }
1287
- );
1288
- xr.displayName = "DialogFooter";
1289
- const Nr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1290
- Ue,
1291
- {
1292
- ref: r,
1293
- className: x(
1294
- "text-lg font-semibold leading-none tracking-tight",
1295
- e
1296
- ),
1297
- ...t
1298
- }
1299
- ));
1300
- Nr.displayName = Ue.displayName;
1301
- const Sr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1302
- je,
1303
- {
1304
- ref: r,
1305
- className: x("text-sm text-muted", e),
1306
- ...t
1307
- }
1308
- ));
1309
- Sr.displayName = je.displayName;
1310
- const Ar = s.forwardRef(
1311
- ({
1312
- id: e,
1313
- title: t,
1314
- description: r,
1315
- onConfirm: n,
1316
- onCancel: o,
1317
- onClose: a,
1318
- confirmText: l = "확인",
1319
- cancelText: i = "취소",
1320
- size: m = "sm",
1321
- content: d,
1322
- className: v,
1323
- ...p
1324
- }, b) => /* @__PURE__ */ c(
1325
- $o,
1326
- {
1327
- open: !0,
1328
- onOpenChange: (T) => {
1329
- !T && a && a();
1330
- },
1331
- children: /* @__PURE__ */ N(
1332
- Tr,
1333
- {
1334
- className: x(
1335
- "max-w-[328px] gap-0 px-0 py-0 md:max-w-[600px]",
1336
- v
1337
- ),
1338
- ...p,
1339
- ref: b,
1340
- children: [
1341
- /* @__PURE__ */ N(Cr, { className: "border-b border-b-border", children: [
1342
- /* @__PURE__ */ c(Nr, { className: "flex h-[57px] w-full items-center justify-start px-5 md:h-[65px] md:justify-center md:px-[30px]", children: t }),
1343
- r && /* @__PURE__ */ c(Sr, { children: r })
1344
- ] }),
1345
- d && /* @__PURE__ */ c("div", { children: d }),
1346
- /* @__PURE__ */ N(xr, { children: [
1347
- o && /* @__PURE__ */ c(
1348
- ot,
1349
- {
1350
- onClick: () => {
1351
- o && o(), a && a();
1352
- },
1353
- className: x(
1354
- J({ variant: "outline", size: "sm" }),
1355
- "w-full sm:w-auto"
1356
- ),
1357
- children: i
1358
- }
1359
- ),
1360
- n && /* @__PURE__ */ c(
1361
- ot,
1362
- {
1363
- onClick: () => {
1364
- n && n(), a && a();
1365
- },
1366
- className: x(
1367
- J({ size: "sm" }),
1368
- "w-full sm:w-auto"
1369
- ),
1370
- children: l
1371
- }
1372
- )
1373
- ] })
1374
- ]
1375
- }
1376
- )
1377
- }
1378
- )
1379
- );
1380
- Ar.displayName = "Dialog";
1381
- const Dr = s.forwardRef(
1382
- ({
1383
- title: e,
1384
- description: t,
1385
- subDescription: r,
1386
- contents: n,
1387
- onConfirm: o,
1388
- confirmText: a = "확인",
1389
- cancelText: l = "취소",
1390
- size: i = "sm",
1391
- className: m,
1392
- onClose: d,
1393
- ...v
1394
- }, p) => /* @__PURE__ */ c(
1395
- hr,
1396
- {
1397
- open: !0,
1398
- onOpenChange: (b) => {
1399
- !b && d && d();
1400
- },
1401
- children: /* @__PURE__ */ N(
1402
- Xe,
1403
- {
1404
- size: i,
1405
- className: m,
1406
- ...v,
1407
- ref: p,
1408
- children: [
1409
- /* @__PURE__ */ N(Ge, { children: [
1410
- /* @__PURE__ */ c(Ze, { children: e }),
1411
- t && /* @__PURE__ */ c(Q, { children: t }),
1412
- r && /* @__PURE__ */ c(Q, { className: "text-xs text-grey-600", children: r })
1413
- ] }),
1414
- n && /* @__PURE__ */ c(Q, { className: "text-sm font-normal text-grey-600", children: n }),
1415
- /* @__PURE__ */ N(qe, { children: [
1416
- /* @__PURE__ */ c(
1417
- wr,
1418
- {
1419
- className: x("w-full font-normal"),
1420
- children: l
1421
- }
1422
- ),
1423
- /* @__PURE__ */ c(
1424
- Qe,
1425
- {
1426
- className: x("w-full font-normal"),
1427
- onClick: () => {
1428
- o && o();
1429
- },
1430
- children: a
1431
- }
1432
- )
1433
- ] })
1434
- ]
1435
- }
1436
- )
1437
- }
1438
- )
1439
- );
1440
- Dr.displayName = "Modal";
1441
- var Je = "ToastProvider", [et, Vo, Bo] = cn("Toast"), [Rr, va] = Le("Toast", [Bo]), [Ko, ye] = Rr(Je), Pr = (e) => {
1442
- const {
1443
- __scopeToast: t,
1444
- label: r = "Notification",
1445
- duration: n = 5e3,
1446
- swipeDirection: o = "right",
1447
- swipeThreshold: a = 50,
1448
- children: l
1449
- } = e, [i, m] = s.useState(null), [d, v] = s.useState(0), p = s.useRef(!1), b = s.useRef(!1);
1450
- return r.trim() || console.error(
1451
- `Invalid prop \`label\` supplied to \`${Je}\`. Expected non-empty \`string\`.`
1452
- ), /* @__PURE__ */ c(et.Provider, { scope: t, children: /* @__PURE__ */ c(
1453
- Ko,
1454
- {
1455
- scope: t,
1456
- label: r,
1457
- duration: n,
1458
- swipeDirection: o,
1459
- swipeThreshold: a,
1460
- toastCount: d,
1461
- viewport: i,
1462
- onViewportChange: m,
1463
- onToastAdd: s.useCallback(() => v((T) => T + 1), []),
1464
- onToastRemove: s.useCallback(() => v((T) => T - 1), []),
1465
- isFocusedToastEscapeKeyDownRef: p,
1466
- isClosePausedRef: b,
1467
- children: l
1468
- }
1469
- ) });
1470
- };
1471
- Pr.displayName = Je;
1472
- var _r = "ToastViewport", zo = ["F8"], Me = "toast.viewportPause", Fe = "toast.viewportResume", Or = s.forwardRef(
1473
- (e, t) => {
1474
- const {
1475
- __scopeToast: r,
1476
- hotkey: n = zo,
1477
- label: o = "Notifications ({hotkey})",
1478
- ...a
1479
- } = e, l = ye(_r, r), i = Vo(r), m = s.useRef(null), d = s.useRef(null), v = s.useRef(null), p = s.useRef(null), b = W(t, p, l.onViewportChange), T = n.join("+").replace(/Key/g, "").replace(/Digit/g, ""), S = l.toastCount > 0;
1480
- s.useEffect(() => {
1481
- const f = (g) => {
1482
- var h;
1483
- n.length !== 0 && n.every((w) => g[w] || g.code === w) && ((h = p.current) == null || h.focus());
1484
- };
1485
- return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
1486
- }, [n]), s.useEffect(() => {
1487
- const f = m.current, g = p.current;
1488
- if (S && f && g) {
1489
- const y = () => {
1490
- if (!l.isClosePausedRef.current) {
1491
- const A = new CustomEvent(Me);
1492
- g.dispatchEvent(A), l.isClosePausedRef.current = !0;
1493
- }
1494
- }, h = () => {
1495
- if (l.isClosePausedRef.current) {
1496
- const A = new CustomEvent(Fe);
1497
- g.dispatchEvent(A), l.isClosePausedRef.current = !1;
1498
- }
1499
- }, w = (A) => {
1500
- !f.contains(A.relatedTarget) && h();
1501
- }, C = () => {
1502
- f.contains(document.activeElement) || h();
1503
- };
1504
- return f.addEventListener("focusin", y), f.addEventListener("focusout", w), f.addEventListener("pointermove", y), f.addEventListener("pointerleave", C), window.addEventListener("blur", y), window.addEventListener("focus", h), () => {
1505
- f.removeEventListener("focusin", y), f.removeEventListener("focusout", w), f.removeEventListener("pointermove", y), f.removeEventListener("pointerleave", C), window.removeEventListener("blur", y), window.removeEventListener("focus", h);
1506
- };
1507
- }
1508
- }, [S, l.isClosePausedRef]);
1509
- const u = s.useCallback(
1510
- ({ tabbingDirection: f }) => {
1511
- const y = i().map((h) => {
1512
- const w = h.ref.current, C = [w, ...ra(w)];
1513
- return f === "forwards" ? C : C.reverse();
1514
- });
1515
- return (f === "forwards" ? y.reverse() : y).flat();
1516
- },
1517
- [i]
1518
- );
1519
- return s.useEffect(() => {
1520
- const f = p.current;
1521
- if (f) {
1522
- const g = (y) => {
1523
- var C, A, R;
1524
- const h = y.altKey || y.ctrlKey || y.metaKey;
1525
- if (y.key === "Tab" && !h) {
1526
- const I = document.activeElement, F = y.shiftKey;
1527
- if (y.target === f && F) {
1528
- (C = d.current) == null || C.focus();
1529
- return;
1530
- }
1531
- const V = u({ tabbingDirection: F ? "backwards" : "forwards" }), ee = V.findIndex((E) => E === I);
1532
- Oe(V.slice(ee + 1)) ? y.preventDefault() : F ? (A = d.current) == null || A.focus() : (R = v.current) == null || R.focus();
1533
- }
1534
- };
1535
- return f.addEventListener("keydown", g), () => f.removeEventListener("keydown", g);
1536
- }
1537
- }, [i, u]), /* @__PURE__ */ N(
1538
- ln,
1539
- {
1540
- ref: m,
1541
- role: "region",
1542
- "aria-label": o.replace("{hotkey}", T),
1543
- tabIndex: -1,
1544
- style: { pointerEvents: S ? void 0 : "none" },
1545
- children: [
1546
- S && /* @__PURE__ */ c(
1547
- ke,
1548
- {
1549
- ref: d,
1550
- onFocusFromOutsideViewport: () => {
1551
- const f = u({
1552
- tabbingDirection: "forwards"
1553
- });
1554
- Oe(f);
1555
- }
1556
- }
1557
- ),
1558
- /* @__PURE__ */ c(et.Slot, { scope: r, children: /* @__PURE__ */ c(P.ol, { tabIndex: -1, ...a, ref: b }) }),
1559
- S && /* @__PURE__ */ c(
1560
- ke,
1561
- {
1562
- ref: v,
1563
- onFocusFromOutsideViewport: () => {
1564
- const f = u({
1565
- tabbingDirection: "backwards"
1566
- });
1567
- Oe(f);
1568
- }
1569
- }
1570
- )
1571
- ]
1572
- }
1573
- );
1574
- }
1575
- );
1576
- Or.displayName = _r;
1577
- var Ir = "ToastFocusProxy", ke = s.forwardRef(
1578
- (e, t) => {
1579
- const { __scopeToast: r, onFocusFromOutsideViewport: n, ...o } = e, a = ye(Ir, r);
1580
- return /* @__PURE__ */ c(
1581
- Et,
1582
- {
1583
- "aria-hidden": !0,
1584
- tabIndex: 0,
1585
- ...o,
1586
- ref: t,
1587
- style: { position: "fixed" },
1588
- onFocus: (l) => {
1589
- var d;
1590
- const i = l.relatedTarget;
1591
- !((d = a.viewport) != null && d.contains(i)) && n();
1592
- }
1593
- }
1594
- );
1595
- }
1596
- );
1597
- ke.displayName = Ir;
1598
- var we = "Toast", Ho = "toast.swipeStart", Uo = "toast.swipeMove", jo = "toast.swipeCancel", Yo = "toast.swipeEnd", Mr = s.forwardRef(
1599
- (e, t) => {
1600
- const { forceMount: r, open: n, defaultOpen: o, onOpenChange: a, ...l } = e, [i = !0, m] = yt({
1601
- prop: n,
1602
- defaultProp: o,
1603
- onChange: a
1604
- });
1605
- return /* @__PURE__ */ c(ge, { present: r || i, children: /* @__PURE__ */ c(
1606
- qo,
1607
- {
1608
- open: i,
1609
- ...l,
1610
- ref: t,
1611
- onClose: () => m(!1),
1612
- onPause: X(e.onPause),
1613
- onResume: X(e.onResume),
1614
- onSwipeStart: D(e.onSwipeStart, (d) => {
1615
- d.currentTarget.setAttribute("data-swipe", "start");
1616
- }),
1617
- onSwipeMove: D(e.onSwipeMove, (d) => {
1618
- const { x: v, y: p } = d.detail.delta;
1619
- d.currentTarget.setAttribute("data-swipe", "move"), d.currentTarget.style.setProperty("--radix-toast-swipe-move-x", `${v}px`), d.currentTarget.style.setProperty("--radix-toast-swipe-move-y", `${p}px`);
1620
- }),
1621
- onSwipeCancel: D(e.onSwipeCancel, (d) => {
1622
- d.currentTarget.setAttribute("data-swipe", "cancel"), d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"), d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y");
1623
- }),
1624
- onSwipeEnd: D(e.onSwipeEnd, (d) => {
1625
- const { x: v, y: p } = d.detail.delta;
1626
- d.currentTarget.setAttribute("data-swipe", "end"), d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"), d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"), d.currentTarget.style.setProperty("--radix-toast-swipe-end-x", `${v}px`), d.currentTarget.style.setProperty("--radix-toast-swipe-end-y", `${p}px`), m(!1);
1627
- })
1628
- }
1629
- ) });
1630
- }
1631
- );
1632
- Mr.displayName = we;
1633
- var [Xo, Go] = Rr(we, {
1634
- onClose() {
1635
- }
1636
- }), qo = s.forwardRef(
1637
- (e, t) => {
1638
- const {
1639
- __scopeToast: r,
1640
- type: n = "foreground",
1641
- duration: o,
1642
- open: a,
1643
- onClose: l,
1644
- onEscapeKeyDown: i,
1645
- onPause: m,
1646
- onResume: d,
1647
- onSwipeStart: v,
1648
- onSwipeMove: p,
1649
- onSwipeCancel: b,
1650
- onSwipeEnd: T,
1651
- ...S
1652
- } = e, u = ye(we, r), [f, g] = s.useState(null), y = W(t, (E) => g(E)), h = s.useRef(null), w = s.useRef(null), C = o || u.duration, A = s.useRef(0), R = s.useRef(C), I = s.useRef(0), { onToastAdd: F, onToastRemove: Ee } = u, K = X(() => {
1653
- var _;
1654
- (f == null ? void 0 : f.contains(document.activeElement)) && ((_ = u.viewport) == null || _.focus()), l();
1655
- }), V = s.useCallback(
1656
- (E) => {
1657
- !E || E === 1 / 0 || (window.clearTimeout(I.current), A.current = (/* @__PURE__ */ new Date()).getTime(), I.current = window.setTimeout(K, E));
1658
- },
1659
- [K]
1660
- );
1661
- s.useEffect(() => {
1662
- const E = u.viewport;
1663
- if (E) {
1664
- const _ = () => {
1665
- V(R.current), d == null || d();
1666
- }, L = () => {
1667
- const G = (/* @__PURE__ */ new Date()).getTime() - A.current;
1668
- R.current = R.current - G, window.clearTimeout(I.current), m == null || m();
1669
- };
1670
- return E.addEventListener(Me, L), E.addEventListener(Fe, _), () => {
1671
- E.removeEventListener(Me, L), E.removeEventListener(Fe, _);
1672
- };
1673
- }
1674
- }, [u.viewport, C, m, d, V]), s.useEffect(() => {
1675
- a && !u.isClosePausedRef.current && V(C);
1676
- }, [a, C, u.isClosePausedRef, V]), s.useEffect(() => (F(), () => Ee()), [F, Ee]);
1677
- const ee = s.useMemo(() => f ? Br(f) : null, [f]);
1678
- return u.viewport ? /* @__PURE__ */ N(pe, { children: [
1679
- ee && /* @__PURE__ */ c(
1680
- Zo,
1681
- {
1682
- __scopeToast: r,
1683
- role: "status",
1684
- "aria-live": n === "foreground" ? "assertive" : "polite",
1685
- "aria-atomic": !0,
1686
- children: ee
1687
- }
1688
- ),
1689
- /* @__PURE__ */ c(Xo, { scope: r, onClose: K, children: pn.createPortal(
1690
- /* @__PURE__ */ c(et.ItemSlot, { scope: r, children: /* @__PURE__ */ c(
1691
- un,
1692
- {
1693
- asChild: !0,
1694
- onEscapeKeyDown: D(i, () => {
1695
- u.isFocusedToastEscapeKeyDownRef.current || K(), u.isFocusedToastEscapeKeyDownRef.current = !1;
1696
- }),
1697
- children: /* @__PURE__ */ c(
1698
- P.li,
1699
- {
1700
- role: "status",
1701
- "aria-live": "off",
1702
- "aria-atomic": !0,
1703
- tabIndex: 0,
1704
- "data-state": a ? "open" : "closed",
1705
- "data-swipe-direction": u.swipeDirection,
1706
- ...S,
1707
- ref: y,
1708
- style: { userSelect: "none", touchAction: "none", ...e.style },
1709
- onKeyDown: D(e.onKeyDown, (E) => {
1710
- E.key === "Escape" && (i == null || i(E.nativeEvent), E.nativeEvent.defaultPrevented || (u.isFocusedToastEscapeKeyDownRef.current = !0, K()));
1711
- }),
1712
- onPointerDown: D(e.onPointerDown, (E) => {
1713
- E.button === 0 && (h.current = { x: E.clientX, y: E.clientY });
1714
- }),
1715
- onPointerMove: D(e.onPointerMove, (E) => {
1716
- if (!h.current) return;
1717
- const _ = E.clientX - h.current.x, L = E.clientY - h.current.y, G = !!w.current, q = ["left", "right"].includes(u.swipeDirection), te = ["left", "up"].includes(u.swipeDirection) ? Math.min : Math.max, en = q ? te(0, _) : 0, tn = q ? 0 : te(0, L), be = E.pointerType === "touch" ? 10 : 2, re = { x: en, y: tn }, rt = { originalEvent: E, delta: re };
1718
- G ? (w.current = re, ie(Uo, p, rt, {
1719
- discrete: !1
1720
- })) : gt(re, u.swipeDirection, be) ? (w.current = re, ie(Ho, v, rt, {
1721
- discrete: !1
1722
- }), E.target.setPointerCapture(E.pointerId)) : (Math.abs(_) > be || Math.abs(L) > be) && (h.current = null);
1723
- }),
1724
- onPointerUp: D(e.onPointerUp, (E) => {
1725
- const _ = w.current, L = E.target;
1726
- if (L.hasPointerCapture(E.pointerId) && L.releasePointerCapture(E.pointerId), w.current = null, h.current = null, _) {
1727
- const G = E.currentTarget, q = { originalEvent: E, delta: _ };
1728
- gt(_, u.swipeDirection, u.swipeThreshold) ? ie(Yo, T, q, {
1729
- discrete: !0
1730
- }) : ie(
1731
- jo,
1732
- b,
1733
- q,
1734
- {
1735
- discrete: !0
1736
- }
1737
- ), G.addEventListener("click", (te) => te.preventDefault(), {
1738
- once: !0
1739
- });
1740
- }
1741
- })
1742
- }
1743
- )
1744
- }
1745
- ) }),
1746
- u.viewport
1747
- ) })
1748
- ] }) : null;
1749
- }
1750
- ), Zo = (e) => {
1751
- const { __scopeToast: t, children: r, ...n } = e, o = ye(we, t), [a, l] = s.useState(!1), [i, m] = s.useState(!1);
1752
- return ea(() => l(!0)), s.useEffect(() => {
1753
- const d = window.setTimeout(() => m(!0), 1e3);
1754
- return () => window.clearTimeout(d);
1755
- }, []), i ? null : /* @__PURE__ */ c($e, { asChild: !0, children: /* @__PURE__ */ c(Et, { ...n, children: a && /* @__PURE__ */ N(pe, { children: [
1756
- o.label,
1757
- " ",
1758
- r
1759
- ] }) }) });
1760
- }, Qo = "ToastTitle", Fr = s.forwardRef(
1761
- (e, t) => {
1762
- const { __scopeToast: r, ...n } = e;
1763
- return /* @__PURE__ */ c(P.div, { ...n, ref: t });
1764
- }
1765
- );
1766
- Fr.displayName = Qo;
1767
- var Jo = "ToastDescription", kr = s.forwardRef(
1768
- (e, t) => {
1769
- const { __scopeToast: r, ...n } = e;
1770
- return /* @__PURE__ */ c(P.div, { ...n, ref: t });
1771
- }
1772
- );
1773
- kr.displayName = Jo;
1774
- var Lr = "ToastAction", $r = s.forwardRef(
1775
- (e, t) => {
1776
- const { altText: r, ...n } = e;
1777
- return r.trim() ? /* @__PURE__ */ c(Vr, { altText: r, asChild: !0, children: /* @__PURE__ */ c(tt, { ...n, ref: t }) }) : (console.error(
1778
- `Invalid prop \`altText\` supplied to \`${Lr}\`. Expected non-empty \`string\`.`
1779
- ), null);
1780
- }
1781
- );
1782
- $r.displayName = Lr;
1783
- var Wr = "ToastClose", tt = s.forwardRef(
1784
- (e, t) => {
1785
- const { __scopeToast: r, ...n } = e, o = Go(Wr, r);
1786
- return /* @__PURE__ */ c(Vr, { asChild: !0, children: /* @__PURE__ */ c(
1787
- P.button,
1788
- {
1789
- type: "button",
1790
- ...n,
1791
- ref: t,
1792
- onClick: D(e.onClick, o.onClose)
1793
- }
1794
- ) });
1795
- }
1796
- );
1797
- tt.displayName = Wr;
1798
- var Vr = s.forwardRef((e, t) => {
1799
- const { __scopeToast: r, altText: n, ...o } = e;
1800
- return /* @__PURE__ */ c(
1801
- P.div,
1802
- {
1803
- "data-radix-toast-announce-exclude": "",
1804
- "data-radix-toast-announce-alt": n || void 0,
1805
- ...o,
1806
- ref: t
1807
- }
1808
- );
1809
- });
1810
- function Br(e) {
1811
- const t = [];
1812
- return Array.from(e.childNodes).forEach((n) => {
1813
- if (n.nodeType === n.TEXT_NODE && n.textContent && t.push(n.textContent), ta(n)) {
1814
- const o = n.ariaHidden || n.hidden || n.style.display === "none", a = n.dataset.radixToastAnnounceExclude === "";
1815
- if (!o)
1816
- if (a) {
1817
- const l = n.dataset.radixToastAnnounceAlt;
1818
- l && t.push(l);
1819
- } else
1820
- t.push(...Br(n));
1821
- }
1822
- }), t;
1823
- }
1824
- function ie(e, t, r, { discrete: n }) {
1825
- const o = r.originalEvent.currentTarget, a = new CustomEvent(e, { bubbles: !0, cancelable: !0, detail: r });
1826
- t && o.addEventListener(e, t, { once: !0 }), n ? dn(o, a) : o.dispatchEvent(a);
1827
- }
1828
- var gt = (e, t, r = 0) => {
1829
- const n = Math.abs(e.x), o = Math.abs(e.y), a = n > o;
1830
- return t === "left" || t === "right" ? a && n > r : !a && o > r;
1831
- };
1832
- function ea(e = () => {
1833
- }) {
1834
- const t = X(e);
1835
- ht(() => {
1836
- let r = 0, n = 0;
1837
- return r = window.requestAnimationFrame(() => n = window.requestAnimationFrame(t)), () => {
1838
- window.cancelAnimationFrame(r), window.cancelAnimationFrame(n);
1839
- };
1840
- }, [t]);
1841
- }
1842
- function ta(e) {
1843
- return e.nodeType === e.ELEMENT_NODE;
1844
- }
1845
- function ra(e) {
1846
- const t = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
1847
- acceptNode: (n) => {
1848
- const o = n.tagName === "INPUT" && n.type === "hidden";
1849
- return n.disabled || n.hidden || o ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
1850
- }
1851
- });
1852
- for (; r.nextNode(); ) t.push(r.currentNode);
1853
- return t;
1854
- }
1855
- function Oe(e) {
1856
- const t = document.activeElement;
1857
- return e.some((r) => r === t ? !0 : (r.focus(), document.activeElement !== t));
1858
- }
1859
- var na = Pr, Kr = Or, zr = Mr, Hr = Fr, Ur = kr, jr = $r, Yr = tt;
1860
- const oa = na, Xr = s.forwardRef(({ className: e, id: t, ...r }, n) => /* @__PURE__ */ c(
1861
- Kr,
1862
- {
1863
- ref: n,
1864
- id: t,
1865
- className: x(
1866
- "fixed z-[100] flex max-h-screen flex-col-reverse gap-2 p-4 outline-none ring-transparent",
1867
- e
1868
- ),
1869
- ...r
1870
- }
1871
- ));
1872
- Xr.displayName = Kr.displayName;
1873
- const aa = fn(
1874
- "group pointer-events-auto relative flex w-full whitespace-pre-wrap bg-opacity-90 items-center justify-between space-x-4 overflow-hidden rounded-lg border p-4 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-top-full",
1875
- {
1876
- variants: {
1877
- variant: {
1878
- black: "group border bg-grey-800 border-grey-800 text-grey-50",
1879
- white: "group border bg-grey-50 border-grey-50 text-grey-800"
1880
- },
1881
- position: {
1882
- "top-left": "top-0 left-0",
1883
- "top-center": "top-0 left-1/2 transform -translate-x-1/2",
1884
- "top-right": "top-0 right-0",
1885
- "bottom-left": "bottom-0 left-0",
1886
- "bottom-center": "bottom-0 left-1/2 transform -translate-x-1/2",
1887
- "bottom-right": "bottom-0 right-0"
1888
- },
1889
- size: {
1890
- sm: "max-w-xs",
1891
- md: "max-w-md",
1892
- lg: "max-w-lg",
1893
- xl: "max-w-2xl",
1894
- full: "max-w-full",
1895
- fit: "max-w-fit"
1896
- }
1897
- },
1898
- defaultVariants: {
1899
- variant: "black",
1900
- position: "top-center",
1901
- // 기본값 변경
1902
- size: "fit"
1903
- }
1904
- }
1905
- ), Gr = s.forwardRef(({ className: e, variant: t, position: r, size: n, ...o }, a) => /* @__PURE__ */ c(
1906
- zr,
1907
- {
1908
- ref: a,
1909
- className: x(aa({ variant: t, position: r, size: n }), e),
1910
- ...o,
1911
- duration: 2500
1912
- }
1913
- ));
1914
- Gr.displayName = zr.displayName;
1915
- const qr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1916
- jr,
1917
- {
1918
- ref: r,
1919
- className: x(
1920
- J({ variant: "outline", size: "sm", theme: "secondary" }),
1921
- e
1922
- ),
1923
- ...t
1924
- }
1925
- ));
1926
- qr.displayName = jr.displayName;
1927
- const Zr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1928
- Yr,
1929
- {
1930
- ref: r,
1931
- className: x(
1932
- "absolute right-2 top-2 rounded-md p-1 text-grey-50/50 opacity-0 transition-opacity hover:text-grey-50 focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.white]:text-grey-300 group-[.white]:hover:text-grey-50 group-[.white]:focus:ring-grey-400",
1933
- e
1934
- ),
1935
- "toast-close": "",
1936
- ...t,
1937
- children: /* @__PURE__ */ c(wt.Cancel, { size: "12" })
1938
- }
1939
- ));
1940
- Zr.displayName = Yr.displayName;
1941
- const Qr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1942
- Hr,
1943
- {
1944
- ref: r,
1945
- className: x("text-sm font-semibold", e),
1946
- ...t
1947
- }
1948
- ));
1949
- Qr.displayName = Hr.displayName;
1950
- const Jr = s.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ c(
1951
- Ur,
1952
- {
1953
- ref: r,
1954
- className: x("text-sm font-normal", e),
1955
- ...t
1956
- }
1957
- ));
1958
- Jr.displayName = Ur.displayName;
1959
- function sa() {
1960
- const { toasts: e } = wn(), t = e.reduce((r, n) => {
1961
- const o = n.position || "center";
1962
- return r[o] || (r[o] = []), r[o].push(n), r;
1963
- }, {});
1964
- return /* @__PURE__ */ c(rn, { children: Object.entries(t).map(([r, n]) => /* @__PURE__ */ N(oa, { children: [
1965
- /* @__PURE__ */ c(
1966
- Xr,
1967
- {
1968
- className: x(
1969
- r === "top-left" && "top-0 left-0",
1970
- r === "top-center" && "top-0 left-1/2 transform -translate-x-1/2",
1971
- r === "top-right" && "top-0 right-0 items-end",
1972
- r === "bottom-left" && "bottom-0 left-0",
1973
- r === "bottom-center" && "bottom-0 left-1/2 transform -translate-x-1/2",
1974
- r === "bottom-right" && "bottom-0 right-0 items-end"
1975
- )
1976
- }
1977
- ),
1978
- n.map(function({
1979
- id: o,
1980
- title: a,
1981
- description: l,
1982
- action: i,
1983
- actionText: m = "확인",
1984
- closeButton: d = !1,
1985
- variant: v = "black",
1986
- ...p
1987
- }) {
1988
- return /* @__PURE__ */ N(
1989
- Gr,
1990
- {
1991
- variant: v,
1992
- position: r,
1993
- ...p,
1994
- children: [
1995
- /* @__PURE__ */ N("div", { className: "grid gap-1", children: [
1996
- a && /* @__PURE__ */ c(Qr, { children: a }),
1997
- l && /* @__PURE__ */ c(Jr, { children: l })
1998
- ] }),
1999
- i && /* @__PURE__ */ c(qr, { altText: o, onClick: i, className: "overflow-hidden", children: m }),
2000
- d && /* @__PURE__ */ c(Zr, {})
2001
- ]
2002
- },
2003
- o
2004
- );
2005
- })
2006
- ] }, r)) });
2007
- }
2008
- const ia = ({ children: e }) => {
2009
- const [t, r] = me(!1), [n, o] = me(null);
2010
- return ce(() => {
2011
- r(!0);
2012
- let a = document.getElementById("portal");
2013
- a || (a = document.createElement("div"), a.id = "portal", document.body.appendChild(a)), o(a);
2014
- }, []), !t || !n ? null : bt.createPortal(e, n);
2015
- }, ga = () => {
2016
- const [e, t] = me([]);
2017
- ce(() => {
2018
- const n = nt.subscribe(
2019
- (o, a) => {
2020
- t((l) => {
2021
- if (a) {
2022
- if (!l.find((i) => i.id === o.id))
2023
- return [...l, { ...o, isOpen: a }];
1
+ import { jsxs as l, jsx as c } from "react/jsx-runtime";
2
+ import { P as f, T as m, D as p, f as C, M as h } from "./tooltip-x7XcU5XA.js";
3
+ import { useState as P, useEffect as a } from "react";
4
+ import { p as u } from "./portal-manager-CttMAZAu.js";
5
+ import { toast as T } from "./boottent-design.utils.es.js";
6
+ const j = () => {
7
+ const [t, d] = P([]);
8
+ a(() => {
9
+ const s = u.subscribe(
10
+ (e, o) => {
11
+ d((i) => {
12
+ if (o) {
13
+ if (!i.find((r) => r.id === e.id))
14
+ return [...i, { ...e, isOpen: o }];
2024
15
  } else
2025
- return l.map(
2026
- (i) => i.id === o.id ? { ...i, isOpen: a } : i
16
+ return i.map(
17
+ (r) => r.id === e.id ? { ...r, isOpen: o } : r
2027
18
  );
2028
- return l;
19
+ return i;
2029
20
  });
2030
21
  }
2031
22
  );
2032
23
  return () => {
2033
- n();
24
+ s();
2034
25
  };
2035
26
  }, []);
2036
- const r = (n) => {
2037
- nt.setPortalOpen(n, !1);
27
+ const n = (s) => {
28
+ u.setPortalOpen(s, !1);
2038
29
  };
2039
- return ce(() => {
2040
- e.forEach((n) => {
2041
- if (!n.isOpen) {
2042
- const o = setTimeout(() => {
2043
- t((a) => a.filter((l) => l.id !== n.id));
30
+ return a(() => {
31
+ t.forEach((s) => {
32
+ if (!s.isOpen) {
33
+ const e = setTimeout(() => {
34
+ d((o) => o.filter((i) => i.id !== s.id));
2044
35
  }, 300);
2045
- return () => clearTimeout(o);
36
+ return () => clearTimeout(e);
2046
37
  }
2047
38
  });
2048
- }, [e]), ce(() => {
2049
- const n = (o) => {
2050
- const a = o.props;
2051
- Tt({
2052
- title: a.title,
2053
- description: a.description,
2054
- action: a.action,
2055
- closeButton: a.closeButton,
2056
- variant: a.variant,
2057
- position: a.position,
2058
- size: a.size,
2059
- className: a.className
2060
- }), r(o.id);
39
+ }, [t]), a(() => {
40
+ const s = (e) => {
41
+ const o = e.props;
42
+ T({
43
+ title: o.title,
44
+ description: o.description,
45
+ action: o.action,
46
+ closeButton: o.closeButton,
47
+ variant: o.variant,
48
+ position: o.position,
49
+ size: o.size,
50
+ className: o.className
51
+ }), n(e.id);
2061
52
  };
2062
- e.forEach((o) => {
2063
- o.type === "toast" && o.isOpen && n(o);
53
+ t.forEach((e) => {
54
+ e.type === "toast" && e.isOpen && s(e);
2064
55
  });
2065
- }, [e, r]), /* @__PURE__ */ N(ia, { children: [
2066
- /* @__PURE__ */ c(sa, {}),
2067
- e.map((n) => {
2068
- var o;
2069
- if (!n.isOpen) return null;
2070
- switch (n.type) {
56
+ }, [t, n]), /* @__PURE__ */ l(f, { children: [
57
+ /* @__PURE__ */ c(m, {}),
58
+ t.map((s) => {
59
+ var e;
60
+ if (!s.isOpen) return null;
61
+ switch (s.type) {
2071
62
  case "modal":
2072
63
  return /* @__PURE__ */ c(
2073
- Dr,
64
+ h,
2074
65
  {
2075
- ...n.props,
66
+ ...s.props,
2076
67
  onClose: () => {
2077
- n.props.onClose && n.props.onClose(), r(n.id);
68
+ s.props.onClose && s.props.onClose(), n(s.id);
2078
69
  },
2079
- description: (o = n.props.description) == null ? void 0 : o.toString()
70
+ description: (e = s.props.description) == null ? void 0 : e.toString()
2080
71
  },
2081
- n.id
72
+ s.id
2082
73
  );
2083
74
  case "alert":
2084
75
  return /* @__PURE__ */ c(
2085
- Er,
76
+ C,
2086
77
  {
2087
- ...n.props,
78
+ ...s.props,
2088
79
  onClose: () => {
2089
- n.props.onClose && n.props.onClose(), r(n.id);
80
+ s.props.onClose && s.props.onClose(), n(s.id);
2090
81
  }
2091
82
  },
2092
- n.id
83
+ s.id
2093
84
  );
2094
85
  case "dialog":
2095
86
  return /* @__PURE__ */ c(
2096
- Ar,
87
+ p,
2097
88
  {
2098
- ...n.props,
89
+ ...s.props,
2099
90
  onClose: () => {
2100
- n.props.onClose && n.props.onClose(), r(n.id);
91
+ s.props.onClose && s.props.onClose(), n(s.id);
2101
92
  }
2102
93
  },
2103
- n.id
94
+ s.id
2104
95
  );
2105
96
  case "toast":
2106
97
  return null;
@@ -2111,5 +102,5 @@ const ia = ({ children: e }) => {
2111
102
  ] });
2112
103
  };
2113
104
  export {
2114
- ga as PortalProvider
105
+ j as PortalProvider
2115
106
  };