@pfct/purple 1.15.1 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/assets/index.css +2 -2
  2. package/dist/chunks/{Accordion.6fAW322P.js → Accordion.Cs1f4aQZ.js} +37 -36
  3. package/dist/chunks/Accordion.ZIp0NsA0.js +1 -0
  4. package/dist/chunks/{DotLottie.-8NWMOKQ.js → DotLottie.CaDygpsw.js} +5682 -3166
  5. package/dist/chunks/DotLottie.Cf-SL2bJ.js +5 -0
  6. package/dist/chunks/Switch.C6xwIjJR.js +1 -0
  7. package/dist/chunks/{Switch.DZP1mWLt.js → Switch.D_myxCrS.js} +31 -20
  8. package/dist/chunks/{bottomSheet.BH73fUXU.js → bottomSheet.BGKwHjuP.js} +1 -1
  9. package/dist/chunks/{bottomSheet.M3yxr5-0.js → bottomSheet.C99fAuQK.js} +1 -1
  10. package/dist/chunks/{calendar.DyOEuwp0.js → calendar.BMivAvH4.js} +449 -446
  11. package/dist/chunks/calendar.DRakro7x.js +1 -0
  12. package/dist/chunks/checkbox.CfWB_nqn.js +1 -0
  13. package/dist/chunks/{checkbox.DihHSceK.js → checkbox.DNdnhspb.js} +14 -13
  14. package/dist/chunks/{dateMatchModifiers.BP6awhUm.js → dateMatchModifiers.DteXiCog.js} +1 -1
  15. package/dist/chunks/{dateMatchModifiers.DWzTSPL9.js → dateMatchModifiers.T1FaMebC.js} +1 -1
  16. package/dist/chunks/{dist.CYRtTgUR.js → dist.B2wZmrK1.js} +26 -24
  17. package/dist/chunks/dist.B8tpQk-4.js +1 -0
  18. package/dist/chunks/{dist.DJPq2jOJ.js → dist.BC0-iqKU.js} +1 -1
  19. package/dist/chunks/{dist.D3epBPq9.js → dist.BGATFz6w.js} +1 -1
  20. package/dist/chunks/{dist.D3MzxMSH.js → dist.BQIeYu70.js} +1 -1
  21. package/dist/chunks/{dist.DAQtqq8Q.js → dist.BskID78S.js} +10 -9
  22. package/dist/chunks/{dist.Bt6mCKem.js → dist.Bxqi8VAi.js} +1 -1
  23. package/dist/chunks/{dist.DSx7Feoc.js → dist.C8k7jQIp.js} +15 -12
  24. package/dist/chunks/dist.CEJ-WCY_.js +44 -0
  25. package/dist/chunks/dist.CIQdvun-.js +1 -0
  26. package/dist/chunks/dist.Cff8LOoN.js +67 -0
  27. package/dist/chunks/{dist.DuawELEr.js → dist.CwMFqhEQ.js} +2 -1
  28. package/dist/chunks/dist.CyhalHxz.js +1 -0
  29. package/dist/chunks/dist.Czpint58.js +1 -0
  30. package/dist/chunks/{dist.DrZbhygc.js → dist.D3cPoDZ_.js} +26 -25
  31. package/dist/chunks/dist.D4mQo5QB.js +1 -0
  32. package/dist/chunks/dist.D5ataprQ.js +1 -0
  33. package/dist/chunks/{dist.DHqfAMUX.js → dist.DIjdcvlQ.js} +25 -24
  34. package/dist/chunks/dist.DhCw5vjE.js +1 -0
  35. package/dist/chunks/dist.DrfVZqiO.js +186 -0
  36. package/dist/chunks/{dist.CB-rIMVI.js → dist.QtpYoD01.js} +1 -1
  37. package/dist/chunks/{dist.0EAhIi1e.js → dist.kg7EEYPp.js} +1 -1
  38. package/dist/chunks/drawer.Cji5AtcU.js +1720 -0
  39. package/dist/chunks/drawer.Gt1AjdVH.js +7 -0
  40. package/dist/chunks/{src.ClN0uvp3.js → src.CmgILXZE.js} +4 -4
  41. package/dist/chunks/{src.DfmpOXyx.js → src.D-VoFbup.js} +1 -1
  42. package/dist/chunks/{test.DNmyFkvJ.D_-8uo_7.js → test.DNmyFkvJ.B-Ui2GEb.js} +1 -1
  43. package/dist/chunks/{tooltip.D_ECTwc-.js → tooltip.DGgNTZ5B.js} +22 -21
  44. package/dist/chunks/tooltip.vEwTtt8v.js +1 -0
  45. package/dist/components/Accordion/index.cjs.js +1 -1
  46. package/dist/components/Accordion/index.esm.js +1 -1
  47. package/dist/components/Control/Switch/index.cjs.js +1 -1
  48. package/dist/components/Control/Switch/index.esm.js +1 -1
  49. package/dist/components/Control/index.cjs.js +1 -1
  50. package/dist/components/Control/index.esm.js +2 -2
  51. package/dist/components/DatePicker/RangeDatePicker.cjs.js +1 -1
  52. package/dist/components/DatePicker/RangeDatePicker.esm.js +1 -1
  53. package/dist/components/DatePicker/RangeDatePicker.test.esm.js +1 -1
  54. package/dist/components/DatePicker/SingleDatePicker.cjs.js +1 -1
  55. package/dist/components/DatePicker/SingleDatePicker.esm.js +1 -1
  56. package/dist/components/DatePicker/SingleDatePicker.test.esm.js +1 -1
  57. package/dist/components/DatePicker/hooks.cjs.js +1 -1
  58. package/dist/components/DatePicker/hooks.esm.js +1 -1
  59. package/dist/components/DatePicker/styles.cjs.js +1 -1
  60. package/dist/components/DatePicker/styles.esm.js +1 -1
  61. package/dist/components/Input/BaseInput/index.cjs.js +1 -1
  62. package/dist/components/Input/BaseInput/index.d.ts.map +1 -1
  63. package/dist/components/Input/BaseInput/index.esm.js +7 -5
  64. package/dist/components/LegacyModal/index.cjs.js +1 -1
  65. package/dist/components/LegacyModal/index.esm.js +1 -1
  66. package/dist/components/Modal/index.cjs.js +1 -1
  67. package/dist/components/Modal/index.esm.js +1 -1
  68. package/dist/components/SelectBox/index.cjs.js +1 -1
  69. package/dist/components/SelectBox/index.d.ts.map +1 -1
  70. package/dist/components/SelectBox/index.esm.js +16 -53
  71. package/dist/components/Tabs/FillTabs/index.cjs.js +1 -1
  72. package/dist/components/Tabs/FillTabs/index.esm.js +1 -1
  73. package/dist/components/Tabs/index.cjs.js +1 -1
  74. package/dist/components/Tabs/index.esm.js +1 -1
  75. package/dist/components/Terms/index.cjs.js +1 -1
  76. package/dist/components/Terms/index.esm.js +2 -2
  77. package/dist/components/index.cjs.js +1 -1
  78. package/dist/components/index.esm.js +7 -7
  79. package/dist/components/ui/bottomSheet.cjs.js +1 -1
  80. package/dist/components/ui/bottomSheet.esm.js +1 -1
  81. package/dist/components/ui/calendar.cjs.js +1 -1
  82. package/dist/components/ui/calendar.esm.js +1 -1
  83. package/dist/components/ui/checkbox.cjs.js +1 -1
  84. package/dist/components/ui/checkbox.esm.js +1 -1
  85. package/dist/components/ui/dialog.cjs.js +1 -1
  86. package/dist/components/ui/dialog.esm.js +1 -1
  87. package/dist/components/ui/drawer.cjs.js +1 -1
  88. package/dist/components/ui/drawer.esm.js +1 -1
  89. package/dist/components/ui/impact-tooltip.cjs.js +1 -1
  90. package/dist/components/ui/impact-tooltip.esm.js +1 -1
  91. package/dist/components/ui/select.cjs.js +1 -1
  92. package/dist/components/ui/select.d.ts.map +1 -1
  93. package/dist/components/ui/select.esm.js +8 -6
  94. package/dist/components/ui/tooltip.cjs.js +1 -1
  95. package/dist/components/ui/tooltip.esm.js +1 -1
  96. package/dist/icons/src/aliases/aliases.cjs.js +1 -1
  97. package/dist/icons/src/aliases/aliases.d.ts +1 -1
  98. package/dist/icons/src/aliases/aliases.d.ts.map +1 -1
  99. package/dist/icons/src/aliases/aliases.esm.js +3 -3
  100. package/dist/icons/src/aliases/index.cjs.js +1 -1
  101. package/dist/icons/src/aliases/index.esm.js +3 -3
  102. package/dist/icons/src/aliases/prefixed.cjs.js +1 -1
  103. package/dist/icons/src/aliases/prefixed.d.ts +2 -2
  104. package/dist/icons/src/aliases/prefixed.d.ts.map +1 -1
  105. package/dist/icons/src/aliases/prefixed.esm.js +3 -3
  106. package/dist/icons/src/aliases/suffixed.cjs.js +1 -1
  107. package/dist/icons/src/aliases/suffixed.d.ts +8 -8
  108. package/dist/icons/src/aliases/suffixed.d.ts.map +1 -1
  109. package/dist/icons/src/aliases/suffixed.esm.js +3 -3
  110. package/dist/icons/src/icons/index.cjs.js +1 -1
  111. package/dist/icons/src/icons/index.esm.js +3 -3
  112. package/dist/index.cjs.js +1 -1
  113. package/dist/index.esm.js +11 -11
  114. package/dist/library/DotLottie/index.cjs.js +1 -1
  115. package/dist/library/DotLottie/index.esm.js +1 -1
  116. package/dist/library/Lottie/index.cjs.js +1 -1
  117. package/dist/library/Lottie/index.esm.js +1 -1
  118. package/dist/library/index.cjs.js +1 -1
  119. package/dist/library/index.esm.js +1 -1
  120. package/package.json +2 -2
  121. package/dist/chunks/Accordion.DnnZvp-k.js +0 -1
  122. package/dist/chunks/DotLottie.BCyB3kR7.js +0 -5
  123. package/dist/chunks/Switch.Cf6DiCUV.js +0 -1
  124. package/dist/chunks/calendar.B-KPMIgz.js +0 -1
  125. package/dist/chunks/checkbox.kS_54E9q.js +0 -1
  126. package/dist/chunks/dist.BovUpaIu.js +0 -142
  127. package/dist/chunks/dist.C6Y9cYZm.js +0 -1
  128. package/dist/chunks/dist.Cf37BjoU.js +0 -1
  129. package/dist/chunks/dist.DV3oUYlD.js +0 -1
  130. package/dist/chunks/dist.DciOZstR.js +0 -1
  131. package/dist/chunks/dist.cKdeuHWp.js +0 -1
  132. package/dist/chunks/dist.s6QukJK1.js +0 -172
  133. package/dist/chunks/dist.xhWLHjmj.js +0 -1
  134. package/dist/chunks/drawer.CtoEYCdv.js +0 -7
  135. package/dist/chunks/drawer.EQu-ewat.js +0 -1556
  136. package/dist/chunks/tooltip.BIAjX12E.js +0 -1
@@ -1,1556 +0,0 @@
1
- import { a as e, i as t, o as n, r, t as i } from "./dist.BovUpaIu.js";
2
- import { t as a } from "./dist.CwWM0zXK.js";
3
- import { t as o } from "./dist.DSx7Feoc.js";
4
- import { t as s } from "./dist.0EAhIi1e.js";
5
- import { t as c } from "./utils.UNiIm9Bz.js";
6
- import { t as l } from "./dist.C8FJXTu6.js";
7
- import { n as u, r as d, t as f } from "./es2015.ByVyszJo.js";
8
- import * as p from "react";
9
- import m, { useEffect as h, useLayoutEffect as g, useMemo as _ } from "react";
10
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
11
- import * as x from "react-dom";
12
- //#region node_modules/vaul/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.mjs
13
- // @__NO_SIDE_EFFECTS__
14
- function S(e) {
15
- let t = p.forwardRef((t, n) => {
16
- let { children: r, ...i } = t, o = null, s = !1, c = [];
17
- D(r) && typeof k == "function" && (r = k(r._payload)), p.Children.forEach(r, (e) => {
18
- if (ee(e)) {
19
- s = !0;
20
- let t = e, n = "child" in t.props ? t.props.child : t.props.children;
21
- D(n) && typeof k == "function" && (n = k(n._payload)), o = w(t, n), c.push(o?.props?.children);
22
- } else c.push(e);
23
- }), o ? o = p.cloneElement(o, void 0, c) : !s && p.Children.count(r) === 1 && p.isValidElement(r) && (o = r);
24
- let l = o ? E(o) : void 0, u = a(n, l);
25
- if (!o) {
26
- if (r || r === 0) throw Error(s ? re(e) : ne(e));
27
- return r;
28
- }
29
- let d = T(i, o.props ?? {});
30
- return o.type !== p.Fragment && (d.ref = n ? u : l), p.cloneElement(o, d);
31
- });
32
- return t.displayName = `${e}.Slot`, t;
33
- }
34
- var C = Symbol.for("radix.slottable"), w = (e, t) => {
35
- if ("child" in e.props) {
36
- let t = e.props.child;
37
- return p.isValidElement(t) ? p.cloneElement(t, void 0, e.props.children(t.props.children)) : null;
38
- }
39
- return p.isValidElement(t) ? t : null;
40
- };
41
- function T(e, t) {
42
- let n = { ...t };
43
- for (let r in t) {
44
- let i = e[r], a = t[r];
45
- /^on[A-Z]/.test(r) ? i && a ? n[r] = (...e) => {
46
- let t = a(...e);
47
- return i(...e), t;
48
- } : i && (n[r] = i) : r === "style" ? n[r] = {
49
- ...i,
50
- ...a
51
- } : r === "className" && (n[r] = [i, a].filter(Boolean).join(" "));
52
- }
53
- return {
54
- ...e,
55
- ...n
56
- };
57
- }
58
- function E(e) {
59
- let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
60
- return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
61
- }
62
- function ee(e) {
63
- return p.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === C;
64
- }
65
- var te = Symbol.for("react.lazy");
66
- function D(e) {
67
- return typeof e == "object" && !!e && "$$typeof" in e && e.$$typeof === te && "_payload" in e && O(e._payload);
68
- }
69
- function O(e) {
70
- return typeof e == "object" && !!e && "then" in e;
71
- }
72
- var ne = (e) => `${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`, re = (e) => `${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`, k = p.use, A = [
73
- "a",
74
- "button",
75
- "div",
76
- "form",
77
- "h2",
78
- "h3",
79
- "img",
80
- "input",
81
- "label",
82
- "li",
83
- "nav",
84
- "ol",
85
- "p",
86
- "select",
87
- "span",
88
- "svg",
89
- "ul"
90
- ].reduce((e, t) => {
91
- let n = /* @__PURE__ */ S(`Primitive.${t}`), r = p.forwardRef((e, r) => {
92
- let { asChild: i, ...a } = e, o = i ? n : t;
93
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ y(o, {
94
- ...a,
95
- ref: r
96
- });
97
- });
98
- return r.displayName = `Primitive.${t}`, {
99
- ...e,
100
- [t]: r
101
- };
102
- }, {});
103
- function ie(e, t) {
104
- e && x.flushSync(() => e.dispatchEvent(t));
105
- }
106
- //#endregion
107
- //#region node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
108
- function ae(e, t = globalThis?.document) {
109
- let n = l(e);
110
- p.useEffect(() => {
111
- let e = (e) => {
112
- e.key === "Escape" && n(e);
113
- };
114
- return t.addEventListener("keydown", e, { capture: !0 }), () => t.removeEventListener("keydown", e, { capture: !0 });
115
- }, [n, t]);
116
- }
117
- //#endregion
118
- //#region node_modules/vaul/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
119
- var oe = "DismissableLayer", j = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", se = "dismissableLayer.focusOutside", N, P = p.createContext({
120
- layers: /* @__PURE__ */ new Set(),
121
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
122
- branches: /* @__PURE__ */ new Set()
123
- }), F = p.forwardRef((e, n) => {
124
- let { disableOutsidePointerEvents: r = !1, onEscapeKeyDown: i, onPointerDownOutside: o, onFocusOutside: s, onInteractOutside: c, onDismiss: l, ...u } = e, d = p.useContext(P), [f, m] = p.useState(null), h = f?.ownerDocument ?? globalThis?.document, [, g] = p.useState({}), _ = a(n, (e) => m(e)), v = Array.from(d.layers), [b] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), x = v.indexOf(b), S = f ? v.indexOf(f) : -1, C = d.layersWithOutsidePointerEventsDisabled.size > 0, w = S >= x, T = I((e) => {
125
- let t = e.target, n = [...d.branches].some((e) => e.contains(t));
126
- !w || n || (o?.(e), c?.(e), e.defaultPrevented || l?.());
127
- }, h), E = ue((e) => {
128
- let t = e.target;
129
- [...d.branches].some((e) => e.contains(t)) || (s?.(e), c?.(e), e.defaultPrevented || l?.());
130
- }, h);
131
- return ae((e) => {
132
- S === d.layers.size - 1 && (i?.(e), !e.defaultPrevented && l && (e.preventDefault(), l()));
133
- }, h), p.useEffect(() => {
134
- if (f) return r && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (N = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(f)), d.layers.add(f), de(), () => {
135
- r && (d.layersWithOutsidePointerEventsDisabled.delete(f), d.layersWithOutsidePointerEventsDisabled.size === 0 && (h.body.style.pointerEvents = N));
136
- };
137
- }, [
138
- f,
139
- h,
140
- r,
141
- d
142
- ]), p.useEffect(() => () => {
143
- f && (d.layers.delete(f), d.layersWithOutsidePointerEventsDisabled.delete(f), de());
144
- }, [f, d]), p.useEffect(() => {
145
- let e = () => g({});
146
- return document.addEventListener(j, e), () => document.removeEventListener(j, e);
147
- }, []), /* @__PURE__ */ y(A.div, {
148
- ...u,
149
- ref: _,
150
- style: {
151
- pointerEvents: C ? w ? "auto" : "none" : void 0,
152
- ...e.style
153
- },
154
- onFocusCapture: t(e.onFocusCapture, E.onFocusCapture),
155
- onBlurCapture: t(e.onBlurCapture, E.onBlurCapture),
156
- onPointerDownCapture: t(e.onPointerDownCapture, T.onPointerDownCapture)
157
- });
158
- });
159
- F.displayName = oe;
160
- var ce = "DismissableLayerBranch", le = p.forwardRef((e, t) => {
161
- let n = p.useContext(P), r = p.useRef(null), i = a(t, r);
162
- return p.useEffect(() => {
163
- let e = r.current;
164
- if (e) return n.branches.add(e), () => {
165
- n.branches.delete(e);
166
- };
167
- }, [n.branches]), /* @__PURE__ */ y(A.div, {
168
- ...e,
169
- ref: i
170
- });
171
- });
172
- le.displayName = ce;
173
- function I(e, t = globalThis?.document) {
174
- let n = l(e), r = p.useRef(!1), i = p.useRef(() => {});
175
- return p.useEffect(() => {
176
- let e = (e) => {
177
- if (e.target && !r.current) {
178
- let r = function() {
179
- L(M, n, a, { discrete: !0 });
180
- }, a = { originalEvent: e };
181
- e.pointerType === "touch" ? (t.removeEventListener("click", i.current), i.current = r, t.addEventListener("click", i.current, { once: !0 })) : r();
182
- } else t.removeEventListener("click", i.current);
183
- r.current = !1;
184
- }, a = window.setTimeout(() => {
185
- t.addEventListener("pointerdown", e);
186
- }, 0);
187
- return () => {
188
- window.clearTimeout(a), t.removeEventListener("pointerdown", e), t.removeEventListener("click", i.current);
189
- };
190
- }, [t, n]), { onPointerDownCapture: () => r.current = !0 };
191
- }
192
- function ue(e, t = globalThis?.document) {
193
- let n = l(e), r = p.useRef(!1);
194
- return p.useEffect(() => {
195
- let e = (e) => {
196
- e.target && !r.current && L(se, n, { originalEvent: e }, { discrete: !1 });
197
- };
198
- return t.addEventListener("focusin", e), () => t.removeEventListener("focusin", e);
199
- }, [t, n]), {
200
- onFocusCapture: () => r.current = !0,
201
- onBlurCapture: () => r.current = !1
202
- };
203
- }
204
- function de() {
205
- let e = new CustomEvent(j);
206
- document.dispatchEvent(e);
207
- }
208
- function L(e, t, n, { discrete: r }) {
209
- let i = n.originalEvent.target, a = new CustomEvent(e, {
210
- bubbles: !1,
211
- cancelable: !0,
212
- detail: n
213
- });
214
- t && i.addEventListener(e, t, { once: !0 }), r ? ie(i, a) : i.dispatchEvent(a);
215
- }
216
- //#endregion
217
- //#region node_modules/vaul/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope/dist/index.mjs
218
- var R = "focusScope.autoFocusOnMount", z = "focusScope.autoFocusOnUnmount", fe = {
219
- bubbles: !1,
220
- cancelable: !0
221
- }, pe = "FocusScope", B = p.forwardRef((e, t) => {
222
- let { loop: n = !1, trapped: r = !1, onMountAutoFocus: i, onUnmountAutoFocus: o, ...s } = e, [c, u] = p.useState(null), d = l(i), f = l(o), m = p.useRef(null), h = a(t, (e) => u(e)), g = p.useRef({
223
- paused: !1,
224
- pause() {
225
- this.paused = !0;
226
- },
227
- resume() {
228
- this.paused = !1;
229
- }
230
- }).current;
231
- p.useEffect(() => {
232
- if (r) {
233
- let e = function(e) {
234
- if (g.paused || !c) return;
235
- let t = e.target;
236
- c.contains(t) ? m.current = t : H(m.current, { select: !0 });
237
- }, t = function(e) {
238
- if (g.paused || !c) return;
239
- let t = e.relatedTarget;
240
- t !== null && (c.contains(t) || H(m.current, { select: !0 }));
241
- }, n = function(e) {
242
- if (document.activeElement === document.body) for (let t of e) t.removedNodes.length > 0 && H(c);
243
- };
244
- document.addEventListener("focusin", e), document.addEventListener("focusout", t);
245
- let r = new MutationObserver(n);
246
- return c && r.observe(c, {
247
- childList: !0,
248
- subtree: !0
249
- }), () => {
250
- document.removeEventListener("focusin", e), document.removeEventListener("focusout", t), r.disconnect();
251
- };
252
- }
253
- }, [
254
- r,
255
- c,
256
- g.paused
257
- ]), p.useEffect(() => {
258
- if (c) {
259
- U.add(g);
260
- let e = document.activeElement;
261
- if (!c.contains(e)) {
262
- let t = new CustomEvent(R, fe);
263
- c.addEventListener(R, d), c.dispatchEvent(t), t.defaultPrevented || (me(xe(V(c)), { select: !0 }), document.activeElement === e && H(c));
264
- }
265
- return () => {
266
- c.removeEventListener(R, d), setTimeout(() => {
267
- let t = new CustomEvent(z, fe);
268
- c.addEventListener(z, f), c.dispatchEvent(t), t.defaultPrevented || H(e ?? document.body, { select: !0 }), c.removeEventListener(z, f), U.remove(g);
269
- }, 0);
270
- };
271
- }
272
- }, [
273
- c,
274
- d,
275
- f,
276
- g
277
- ]);
278
- let _ = p.useCallback((e) => {
279
- if (!n && !r || g.paused) return;
280
- let t = e.key === "Tab" && !e.altKey && !e.ctrlKey && !e.metaKey, i = document.activeElement;
281
- if (t && i) {
282
- let t = e.currentTarget, [r, a] = he(t);
283
- r && a ? !e.shiftKey && i === a ? (e.preventDefault(), n && H(r, { select: !0 })) : e.shiftKey && i === r && (e.preventDefault(), n && H(a, { select: !0 })) : i === t && e.preventDefault();
284
- }
285
- }, [
286
- n,
287
- r,
288
- g.paused
289
- ]);
290
- return /* @__PURE__ */ y(A.div, {
291
- tabIndex: -1,
292
- ...s,
293
- ref: h,
294
- onKeyDown: _
295
- });
296
- });
297
- B.displayName = pe;
298
- function me(e, { select: t = !1 } = {}) {
299
- let n = document.activeElement;
300
- for (let r of e) if (H(r, { select: t }), document.activeElement !== n) return;
301
- }
302
- function he(e) {
303
- let t = V(e);
304
- return [ge(t, e), ge(t.reverse(), e)];
305
- }
306
- function V(e) {
307
- let t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (e) => {
308
- let t = e.tagName === "INPUT" && e.type === "hidden";
309
- return e.disabled || e.hidden || t ? NodeFilter.FILTER_SKIP : e.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
310
- } });
311
- for (; n.nextNode();) t.push(n.currentNode);
312
- return t;
313
- }
314
- function ge(e, t) {
315
- for (let n of e) if (!_e(n, { upTo: t })) return n;
316
- }
317
- function _e(e, { upTo: t }) {
318
- if (getComputedStyle(e).visibility === "hidden") return !0;
319
- for (; e;) {
320
- if (t !== void 0 && e === t) return !1;
321
- if (getComputedStyle(e).display === "none") return !0;
322
- e = e.parentElement;
323
- }
324
- return !1;
325
- }
326
- function ve(e) {
327
- return e instanceof HTMLInputElement && "select" in e;
328
- }
329
- function H(e, { select: t = !1 } = {}) {
330
- if (e && e.focus) {
331
- let n = document.activeElement;
332
- e.focus({ preventScroll: !0 }), e !== n && ve(e) && t && e.select();
333
- }
334
- }
335
- var U = ye();
336
- function ye() {
337
- let e = [];
338
- return {
339
- add(t) {
340
- let n = e[0];
341
- t !== n && n?.pause(), e = be(e, t), e.unshift(t);
342
- },
343
- remove(t) {
344
- e = be(e, t), e[0]?.resume();
345
- }
346
- };
347
- }
348
- function be(e, t) {
349
- let n = [...e], r = n.indexOf(t);
350
- return r !== -1 && n.splice(r, 1), n;
351
- }
352
- function xe(e) {
353
- return e.filter((e) => e.tagName !== "A");
354
- }
355
- //#endregion
356
- //#region node_modules/vaul/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.mjs
357
- var W = "Portal", Se = p.forwardRef((e, t) => {
358
- let { container: n, ...i } = e, [a, o] = p.useState(!1);
359
- r(() => o(!0), []);
360
- let s = n || a && globalThis?.document?.body;
361
- return s ? x.createPortal(/* @__PURE__ */ y(A.div, {
362
- ...i,
363
- ref: t
364
- }), s) : null;
365
- });
366
- Se.displayName = W;
367
- //#endregion
368
- //#region node_modules/vaul/node_modules/@radix-ui/react-dialog/dist/index.mjs
369
- var G = "Dialog", [Ce, we] = n(G), [Te, K] = Ce(G), Ee = (e) => {
370
- let { __scopeDialog: t, children: n, open: r, defaultOpen: a, onOpenChange: o, modal: c = !0 } = e, l = p.useRef(null), u = p.useRef(null), [d, f] = i({
371
- prop: r,
372
- defaultProp: a ?? !1,
373
- onChange: o,
374
- caller: G
375
- });
376
- return /* @__PURE__ */ y(Te, {
377
- scope: t,
378
- triggerRef: l,
379
- contentRef: u,
380
- contentId: s(),
381
- titleId: s(),
382
- descriptionId: s(),
383
- open: d,
384
- onOpenChange: f,
385
- onOpenToggle: p.useCallback(() => f((e) => !e), [f]),
386
- modal: c,
387
- children: n
388
- });
389
- };
390
- Ee.displayName = G;
391
- var De = "DialogTrigger", Oe = p.forwardRef((e, n) => {
392
- let { __scopeDialog: r, ...i } = e, o = K(De, r), s = a(n, o.triggerRef);
393
- return /* @__PURE__ */ y(A.button, {
394
- type: "button",
395
- "aria-haspopup": "dialog",
396
- "aria-expanded": o.open,
397
- "aria-controls": o.open ? o.contentId : void 0,
398
- "data-state": qe(o.open),
399
- ...i,
400
- ref: s,
401
- onClick: t(e.onClick, o.onOpenToggle)
402
- });
403
- });
404
- Oe.displayName = De;
405
- var ke = "DialogPortal", [Ae, je] = Ce(ke, { forceMount: void 0 }), Me = (e) => {
406
- let { __scopeDialog: t, forceMount: n, children: r, container: i } = e, a = K(ke, t);
407
- return /* @__PURE__ */ y(Ae, {
408
- scope: t,
409
- forceMount: n,
410
- children: p.Children.map(r, (e) => /* @__PURE__ */ y(o, {
411
- present: n || a.open,
412
- children: /* @__PURE__ */ y(Se, {
413
- asChild: !0,
414
- container: i,
415
- children: e
416
- })
417
- }))
418
- });
419
- };
420
- Me.displayName = ke;
421
- var Ne = "DialogOverlay", Pe = p.forwardRef((e, t) => {
422
- let n = je(Ne, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, a = K(Ne, e.__scopeDialog);
423
- return a.modal ? /* @__PURE__ */ y(o, {
424
- present: r || a.open,
425
- children: /* @__PURE__ */ y(Ie, {
426
- ...i,
427
- ref: t
428
- })
429
- }) : null;
430
- });
431
- Pe.displayName = Ne;
432
- var Fe = /* @__PURE__ */ S("DialogOverlay.RemoveScroll"), Ie = p.forwardRef((e, t) => {
433
- let { __scopeDialog: n, ...r } = e, i = K(Ne, n);
434
- return /* @__PURE__ */ y(u, {
435
- as: Fe,
436
- allowPinchZoom: !0,
437
- shards: [i.contentRef],
438
- children: /* @__PURE__ */ y(A.div, {
439
- "data-state": qe(i.open),
440
- ...r,
441
- ref: t,
442
- style: {
443
- pointerEvents: "auto",
444
- ...r.style
445
- }
446
- })
447
- });
448
- }), q = "DialogContent", Le = p.forwardRef((e, t) => {
449
- let n = je(q, e.__scopeDialog), { forceMount: r = n.forceMount, ...i } = e, a = K(q, e.__scopeDialog);
450
- return /* @__PURE__ */ y(o, {
451
- present: r || a.open,
452
- children: a.modal ? /* @__PURE__ */ y(Re, {
453
- ...i,
454
- ref: t
455
- }) : /* @__PURE__ */ y(ze, {
456
- ...i,
457
- ref: t
458
- })
459
- });
460
- });
461
- Le.displayName = q;
462
- var Re = p.forwardRef((e, n) => {
463
- let r = K(q, e.__scopeDialog), i = p.useRef(null), o = a(n, r.contentRef, i);
464
- return p.useEffect(() => {
465
- let e = i.current;
466
- if (e) return f(e);
467
- }, []), /* @__PURE__ */ y(Be, {
468
- ...e,
469
- ref: o,
470
- trapFocus: r.open,
471
- disableOutsidePointerEvents: r.open,
472
- onCloseAutoFocus: t(e.onCloseAutoFocus, (e) => {
473
- e.preventDefault(), r.triggerRef.current?.focus();
474
- }),
475
- onPointerDownOutside: t(e.onPointerDownOutside, (e) => {
476
- let t = e.detail.originalEvent, n = t.button === 0 && t.ctrlKey === !0;
477
- (t.button === 2 || n) && e.preventDefault();
478
- }),
479
- onFocusOutside: t(e.onFocusOutside, (e) => e.preventDefault())
480
- });
481
- }), ze = p.forwardRef((e, t) => {
482
- let n = K(q, e.__scopeDialog), r = p.useRef(!1), i = p.useRef(!1);
483
- return /* @__PURE__ */ y(Be, {
484
- ...e,
485
- ref: t,
486
- trapFocus: !1,
487
- disableOutsidePointerEvents: !1,
488
- onCloseAutoFocus: (t) => {
489
- e.onCloseAutoFocus?.(t), t.defaultPrevented || (r.current || n.triggerRef.current?.focus(), t.preventDefault()), r.current = !1, i.current = !1;
490
- },
491
- onInteractOutside: (t) => {
492
- e.onInteractOutside?.(t), t.defaultPrevented || (r.current = !0, t.detail.originalEvent.type === "pointerdown" && (i.current = !0));
493
- let a = t.target;
494
- n.triggerRef.current?.contains(a) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && i.current && t.preventDefault();
495
- }
496
- });
497
- }), Be = p.forwardRef((e, t) => {
498
- let { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: i, onCloseAutoFocus: o, ...s } = e, c = K(q, n), l = p.useRef(null), u = a(t, l);
499
- return d(), /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(B, {
500
- asChild: !0,
501
- loop: !0,
502
- trapped: r,
503
- onMountAutoFocus: i,
504
- onUnmountAutoFocus: o,
505
- children: /* @__PURE__ */ y(F, {
506
- role: "dialog",
507
- id: c.contentId,
508
- "aria-describedby": c.descriptionId,
509
- "aria-labelledby": c.titleId,
510
- "data-state": qe(c.open),
511
- ...s,
512
- ref: u,
513
- onDismiss: () => c.onOpenChange(!1)
514
- })
515
- }), /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(Ze, { titleId: c.titleId }), /* @__PURE__ */ y($e, {
516
- contentRef: l,
517
- descriptionId: c.descriptionId
518
- })] })] });
519
- }), Ve = "DialogTitle", He = p.forwardRef((e, t) => {
520
- let { __scopeDialog: n, ...r } = e, i = K(Ve, n);
521
- return /* @__PURE__ */ y(A.h2, {
522
- id: i.titleId,
523
- ...r,
524
- ref: t
525
- });
526
- });
527
- He.displayName = Ve;
528
- var Ue = "DialogDescription", We = p.forwardRef((e, t) => {
529
- let { __scopeDialog: n, ...r } = e, i = K(Ue, n);
530
- return /* @__PURE__ */ y(A.p, {
531
- id: i.descriptionId,
532
- ...r,
533
- ref: t
534
- });
535
- });
536
- We.displayName = Ue;
537
- var Ge = "DialogClose", Ke = p.forwardRef((e, n) => {
538
- let { __scopeDialog: r, ...i } = e, a = K(Ge, r);
539
- return /* @__PURE__ */ y(A.button, {
540
- type: "button",
541
- ...i,
542
- ref: n,
543
- onClick: t(e.onClick, () => a.onOpenChange(!1))
544
- });
545
- });
546
- Ke.displayName = Ge;
547
- function qe(e) {
548
- return e ? "open" : "closed";
549
- }
550
- var Je = "DialogTitleWarning", [Ye, Xe] = e(Je, {
551
- contentName: q,
552
- titleName: Ve,
553
- docsSlug: "dialog"
554
- }), Ze = ({ titleId: e }) => {
555
- let t = Xe(Je), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
556
-
557
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
558
-
559
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
560
- return p.useEffect(() => {
561
- e && (document.getElementById(e) || console.error(n));
562
- }, [n, e]), null;
563
- }, Qe = "DialogDescriptionWarning", $e = ({ contentRef: e, descriptionId: t }) => {
564
- let n = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xe(Qe).contentName}}.`;
565
- return p.useEffect(() => {
566
- let r = e.current?.getAttribute("aria-describedby");
567
- t && r && (document.getElementById(t) || console.warn(n));
568
- }, [
569
- n,
570
- e,
571
- t
572
- ]), null;
573
- }, et = Ee, tt = Oe, nt = Me, rt = Pe, it = Le, at = He, ot = We, st = Ke;
574
- //#endregion
575
- //#region node_modules/vaul/dist/index.mjs
576
- function ct(e) {
577
- if (!e || typeof document > "u") return;
578
- let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
579
- n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
580
- }
581
- var lt = m.createContext({
582
- drawerRef: { current: null },
583
- overlayRef: { current: null },
584
- onPress: () => {},
585
- onRelease: () => {},
586
- onDrag: () => {},
587
- onNestedDrag: () => {},
588
- onNestedOpenChange: () => {},
589
- onNestedRelease: () => {},
590
- openProp: void 0,
591
- dismissible: !1,
592
- isOpen: !1,
593
- isDragging: !1,
594
- keyboardIsOpen: { current: !1 },
595
- snapPointsOffset: null,
596
- snapPoints: null,
597
- handleOnly: !1,
598
- modal: !1,
599
- shouldFade: !1,
600
- activeSnapPoint: null,
601
- onOpenChange: () => {},
602
- setActiveSnapPoint: () => {},
603
- closeDrawer: () => {},
604
- direction: "bottom",
605
- shouldAnimate: { current: !0 },
606
- shouldScaleBackground: !1,
607
- setBackgroundColorOnScale: !0,
608
- noBodyStyles: !1,
609
- container: null,
610
- autoFocus: !1
611
- }), J = () => {
612
- let e = m.useContext(lt);
613
- if (!e) throw Error("useDrawerContext must be used within a Drawer.Root");
614
- return e;
615
- };
616
- ct("[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(\n[data-state=closed]\n){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)}}");
617
- function ut() {
618
- let e = navigator.userAgent;
619
- return typeof window < "u" && (/Firefox/.test(e) && /Mobile/.test(e) || /FxiOS/.test(e));
620
- }
621
- function dt() {
622
- return gt(/^Mac/);
623
- }
624
- function ft() {
625
- return gt(/^iPhone/);
626
- }
627
- function pt() {
628
- return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
629
- }
630
- function mt() {
631
- return gt(/^iPad/) || dt() && navigator.maxTouchPoints > 1;
632
- }
633
- function ht() {
634
- return ft() || mt();
635
- }
636
- function gt(e) {
637
- return typeof window < "u" && window.navigator != null ? e.test(window.navigator.platform) : void 0;
638
- }
639
- var _t = 24, vt = typeof window < "u" ? g : h;
640
- function yt(...e) {
641
- return (...t) => {
642
- for (let n of e) typeof n == "function" && n(...t);
643
- };
644
- }
645
- var bt = typeof document < "u" && window.visualViewport;
646
- function xt(e) {
647
- let t = window.getComputedStyle(e);
648
- return /(auto|scroll)/.test(t.overflow + t.overflowX + t.overflowY);
649
- }
650
- function St(e) {
651
- for (xt(e) && (e = e.parentElement); e && !xt(e);) e = e.parentElement;
652
- return e || document.scrollingElement || document.documentElement;
653
- }
654
- var Ct = /* @__PURE__ */ new Set([
655
- "checkbox",
656
- "radio",
657
- "range",
658
- "color",
659
- "file",
660
- "image",
661
- "button",
662
- "submit",
663
- "reset"
664
- ]), wt = 0, Tt;
665
- function Et(e = {}) {
666
- let { isDisabled: t } = e;
667
- vt(() => {
668
- if (!t) return wt++, wt === 1 && ht() && (Tt = Dt()), () => {
669
- wt--, wt === 0 && Tt?.();
670
- };
671
- }, [t]);
672
- }
673
- function Dt() {
674
- let e, t = 0, n = (n) => {
675
- e = St(n.target), !(e === document.documentElement && e === document.body) && (t = n.changedTouches[0].pageY);
676
- }, r = (n) => {
677
- if (!e || e === document.documentElement || e === document.body) {
678
- n.preventDefault();
679
- return;
680
- }
681
- let r = n.changedTouches[0].pageY, i = e.scrollTop, a = e.scrollHeight - e.clientHeight;
682
- a !== 0 && ((i <= 0 && r > t || i >= a && r < t) && n.preventDefault(), t = r);
683
- }, i = (e) => {
684
- let t = e.target;
685
- At(t) && t !== document.activeElement && (e.preventDefault(), t.style.transform = "translateY(-2000px)", t.focus(), requestAnimationFrame(() => {
686
- t.style.transform = "";
687
- }));
688
- }, a = (e) => {
689
- let t = e.target;
690
- At(t) && (t.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
691
- t.style.transform = "", bt && (bt.height < window.innerHeight ? requestAnimationFrame(() => {
692
- kt(t);
693
- }) : bt.addEventListener("resize", () => kt(t), { once: !0 }));
694
- }));
695
- }, o = () => {
696
- window.scrollTo(0, 0);
697
- }, s = window.pageXOffset, c = window.pageYOffset, l = yt(Ot(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
698
- window.scrollTo(0, 0);
699
- let u = yt(Y(document, "touchstart", n, {
700
- passive: !1,
701
- capture: !0
702
- }), Y(document, "touchmove", r, {
703
- passive: !1,
704
- capture: !0
705
- }), Y(document, "touchend", i, {
706
- passive: !1,
707
- capture: !0
708
- }), Y(document, "focus", a, !0), Y(window, "scroll", o));
709
- return () => {
710
- l(), u(), window.scrollTo(s, c);
711
- };
712
- }
713
- function Ot(e, t, n) {
714
- let r = e.style[t];
715
- return e.style[t] = n, () => {
716
- e.style[t] = r;
717
- };
718
- }
719
- function Y(e, t, n, r) {
720
- return e.addEventListener(t, n, r), () => {
721
- e.removeEventListener(t, n, r);
722
- };
723
- }
724
- function kt(e) {
725
- let t = document.scrollingElement || document.documentElement;
726
- for (; e && e !== t;) {
727
- let t = St(e);
728
- if (t !== document.documentElement && t !== document.body && t !== e) {
729
- let n = t.getBoundingClientRect().top, r = e.getBoundingClientRect().top;
730
- e.getBoundingClientRect().bottom > t.getBoundingClientRect().bottom + _t && (t.scrollTop += r - n);
731
- }
732
- e = t.parentElement;
733
- }
734
- }
735
- function At(e) {
736
- return e instanceof HTMLInputElement && !Ct.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
737
- }
738
- function jt(e, t) {
739
- typeof e == "function" ? e(t) : e != null && (e.current = t);
740
- }
741
- function Mt(...e) {
742
- return (t) => e.forEach((e) => jt(e, t));
743
- }
744
- function Nt(...e) {
745
- return p.useCallback(Mt(...e), e);
746
- }
747
- var Pt = /* @__PURE__ */ new WeakMap();
748
- function X(e, t, n = !1) {
749
- if (!e || !(e instanceof HTMLElement)) return;
750
- let r = {};
751
- Object.entries(t).forEach(([t, n]) => {
752
- if (t.startsWith("--")) {
753
- e.style.setProperty(t, n);
754
- return;
755
- }
756
- r[t] = e.style[t], e.style[t] = n;
757
- }), !n && Pt.set(e, r);
758
- }
759
- function Ft(e, t) {
760
- if (!e || !(e instanceof HTMLElement)) return;
761
- let n = Pt.get(e);
762
- n && (e.style[t] = n[t]);
763
- }
764
- var Z = (e) => {
765
- switch (e) {
766
- case "top":
767
- case "bottom": return !0;
768
- case "left":
769
- case "right": return !1;
770
- default: return e;
771
- }
772
- };
773
- function It(e, t) {
774
- if (!e) return null;
775
- let n = window.getComputedStyle(e), r = n.transform || n.webkitTransform || n.mozTransform, i = r.match(/^matrix3d\((.+)\)$/);
776
- return i ? parseFloat(i[1].split(", ")[Z(t) ? 13 : 12]) : (i = r.match(/^matrix\((.+)\)$/), i ? parseFloat(i[1].split(", ")[Z(t) ? 5 : 4]) : null);
777
- }
778
- function Lt(e) {
779
- return 8 * (Math.log(e + 1) - 2);
780
- }
781
- function Rt(e, t) {
782
- if (!e) return () => {};
783
- let n = e.style.cssText;
784
- return Object.assign(e.style, t), () => {
785
- e.style.cssText = n;
786
- };
787
- }
788
- var Q = {
789
- DURATION: .5,
790
- EASE: [
791
- .32,
792
- .72,
793
- 0,
794
- 1
795
- ]
796
- }, zt = .4, Bt = .25, Vt = 100, Ht = 8, Ut = 16, Wt = 26, Gt = "vaul-dragging";
797
- function Kt(e) {
798
- let t = m.useRef(e);
799
- return m.useEffect(() => {
800
- t.current = e;
801
- }), m.useMemo(() => (...e) => t.current == null ? void 0 : t.current.call(t, ...e), []);
802
- }
803
- function qt({ defaultProp: e, onChange: t }) {
804
- let n = m.useState(e), [r] = n, i = m.useRef(r), a = Kt(t);
805
- return m.useEffect(() => {
806
- i.current !== r && (a(r), i.current = r);
807
- }, [
808
- r,
809
- i,
810
- a
811
- ]), n;
812
- }
813
- function Jt({ prop: e, defaultProp: t, onChange: n = () => {} }) {
814
- let [r, i] = qt({
815
- defaultProp: t,
816
- onChange: n
817
- }), a = e !== void 0, o = a ? e : r, s = Kt(n);
818
- return [o, m.useCallback((t) => {
819
- if (a) {
820
- let n = typeof t == "function" ? t(e) : t;
821
- n !== e && s(n);
822
- } else i(t);
823
- }, [
824
- a,
825
- e,
826
- i,
827
- s
828
- ])];
829
- }
830
- function Yt({ activeSnapPointProp: e, setActiveSnapPointProp: t, snapPoints: n, drawerRef: r, overlayRef: i, fadeFromIndex: a, onSnapPointChange: o, direction: s = "bottom", container: c, snapToSequentialPoint: l }) {
831
- let [u, d] = Jt({
832
- prop: e,
833
- defaultProp: n?.[0],
834
- onChange: t
835
- }), [f, p] = m.useState(typeof window < "u" ? {
836
- innerWidth: window.innerWidth,
837
- innerHeight: window.innerHeight
838
- } : void 0);
839
- m.useEffect(() => {
840
- function e() {
841
- p({
842
- innerWidth: window.innerWidth,
843
- innerHeight: window.innerHeight
844
- });
845
- }
846
- return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
847
- }, []);
848
- let h = m.useMemo(() => u === n?.[n.length - 1] || null, [n, u]), g = m.useMemo(() => n?.findIndex((e) => e === u) ?? null, [n, u]), _ = n && n.length > 0 && (a || a === 0) && !Number.isNaN(a) && n[a] === u || !n, v = m.useMemo(() => {
849
- let e = c ? {
850
- width: c.getBoundingClientRect().width,
851
- height: c.getBoundingClientRect().height
852
- } : typeof window < "u" ? {
853
- width: window.innerWidth,
854
- height: window.innerHeight
855
- } : {
856
- width: 0,
857
- height: 0
858
- };
859
- return n?.map((t) => {
860
- let n = typeof t == "string", r = 0;
861
- if (n && (r = parseInt(t, 10)), Z(s)) {
862
- let i = n ? r : f ? t * e.height : 0;
863
- return f ? s === "bottom" ? e.height - i : -e.height + i : i;
864
- }
865
- let i = n ? r : f ? t * e.width : 0;
866
- return f ? s === "right" ? e.width - i : -e.width + i : i;
867
- }) ?? [];
868
- }, [
869
- n,
870
- f,
871
- c
872
- ]), y = m.useMemo(() => g === null ? null : v?.[g], [v, g]), b = m.useCallback((e) => {
873
- let t = v?.findIndex((t) => t === e) ?? null;
874
- o(t), X(r.current, {
875
- transition: `transform ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`,
876
- transform: Z(s) ? `translate3d(0, ${e}px, 0)` : `translate3d(${e}px, 0, 0)`
877
- }), v && t !== v.length - 1 && a !== void 0 && t !== a && t < a ? X(i.current, {
878
- transition: `opacity ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`,
879
- opacity: "0"
880
- }) : X(i.current, {
881
- transition: `opacity ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`,
882
- opacity: "1"
883
- }), d(n?.[Math.max(t, 0)]);
884
- }, [
885
- r.current,
886
- n,
887
- v,
888
- a,
889
- i,
890
- d
891
- ]);
892
- m.useEffect(() => {
893
- if (u || e) {
894
- let t = n?.findIndex((t) => t === e || t === u) ?? -1;
895
- v && t !== -1 && typeof v[t] == "number" && b(v[t]);
896
- }
897
- }, [
898
- u,
899
- e,
900
- n,
901
- v,
902
- b
903
- ]);
904
- function x({ draggedDistance: e, closeDrawer: t, velocity: r, dismissible: o }) {
905
- if (a === void 0) return;
906
- let c = s === "bottom" || s === "right" ? (y ?? 0) - e : (y ?? 0) + e, u = g === a - 1, d = g === 0, f = e > 0;
907
- if (u && X(i.current, { transition: `opacity ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})` }), !l && r > 2 && !f) {
908
- o ? t() : b(v[0]);
909
- return;
910
- }
911
- if (!l && r > 2 && f && v && n) {
912
- b(v[n.length - 1]);
913
- return;
914
- }
915
- let p = v?.reduce((e, t) => typeof e != "number" || typeof t != "number" ? e : Math.abs(t - c) < Math.abs(e - c) ? t : e), m = Z(s) ? window.innerHeight : window.innerWidth;
916
- if (r > zt && Math.abs(e) < m * .4) {
917
- let e = f ? 1 : -1;
918
- if (e > 0 && h && n) {
919
- b(v[n.length - 1]);
920
- return;
921
- }
922
- if (d && e < 0 && o && t(), g === null) return;
923
- b(v[g + e]);
924
- return;
925
- }
926
- b(p);
927
- }
928
- function S({ draggedDistance: e }) {
929
- if (y === null) return;
930
- let t = s === "bottom" || s === "right" ? y - e : y + e;
931
- (s === "bottom" || s === "right") && t < v[v.length - 1] || (s === "top" || s === "left") && t > v[v.length - 1] || X(r.current, { transform: Z(s) ? `translate3d(0, ${t}px, 0)` : `translate3d(${t}px, 0, 0)` });
932
- }
933
- function C(e, t) {
934
- if (!n || typeof g != "number" || !v || a === void 0) return null;
935
- let r = g === a - 1;
936
- if (g >= a && t) return 0;
937
- if (r && !t) return 1;
938
- if (!_ && !r) return null;
939
- let i = r ? g + 1 : g - 1, o = r ? v[i] - v[i - 1] : v[i + 1] - v[i], s = e / Math.abs(o);
940
- return r ? 1 - s : s;
941
- }
942
- return {
943
- isLastSnapPoint: h,
944
- activeSnapPoint: u,
945
- shouldFade: _,
946
- getPercentageDragged: C,
947
- setActiveSnapPoint: d,
948
- activeSnapPointIndex: g,
949
- onRelease: x,
950
- onDrag: S,
951
- snapPointsOffset: v
952
- };
953
- }
954
- function Xt() {
955
- let { direction: e, isOpen: t, shouldScaleBackground: n, setBackgroundColorOnScale: r, noBodyStyles: i } = J(), a = m.useRef(null), o = _(() => document.body.style.backgroundColor, []);
956
- function s() {
957
- return (window.innerWidth - Wt) / window.innerWidth;
958
- }
959
- m.useEffect(() => {
960
- if (t && n) {
961
- a.current && clearTimeout(a.current);
962
- let t = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
963
- if (!t) return;
964
- r && !i && Rt(document.body, { background: "black" }), Rt(t, {
965
- transformOrigin: Z(e) ? "top" : "left",
966
- transitionProperty: "transform, border-radius",
967
- transitionDuration: `${Q.DURATION}s`,
968
- transitionTimingFunction: `cubic-bezier(${Q.EASE.join(",")})`
969
- });
970
- let n = Rt(t, {
971
- borderRadius: `${Ht}px`,
972
- overflow: "hidden",
973
- ...Z(e) ? { transform: `scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)` } : { transform: `scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)` }
974
- });
975
- return () => {
976
- n(), a.current = window.setTimeout(() => {
977
- o ? document.body.style.background = o : document.body.style.removeProperty("background");
978
- }, Q.DURATION * 1e3);
979
- };
980
- }
981
- }, [
982
- t,
983
- n,
984
- o
985
- ]);
986
- }
987
- var Zt = null;
988
- function Qt({ isOpen: e, modal: t, nested: n, hasBeenOpened: r, preventScrollRestoration: i, noBodyStyles: a }) {
989
- let [o, s] = m.useState(() => typeof window < "u" ? window.location.href : ""), c = m.useRef(0), l = m.useCallback(() => {
990
- if (pt() && Zt === null && e && !a) {
991
- Zt = {
992
- position: document.body.style.position,
993
- top: document.body.style.top,
994
- left: document.body.style.left,
995
- height: document.body.style.height,
996
- right: "unset"
997
- };
998
- let { scrollX: e, innerHeight: t } = window;
999
- document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
1000
- top: `${-c.current}px`,
1001
- left: `${-e}px`,
1002
- right: "0px",
1003
- height: "auto"
1004
- }), window.setTimeout(() => window.requestAnimationFrame(() => {
1005
- let e = t - window.innerHeight;
1006
- e && c.current >= t && (document.body.style.top = `${-(c.current + e)}px`);
1007
- }), 300);
1008
- }
1009
- }, [e]), u = m.useCallback(() => {
1010
- if (pt() && Zt !== null && !a) {
1011
- let e = -parseInt(document.body.style.top, 10), t = -parseInt(document.body.style.left, 10);
1012
- Object.assign(document.body.style, Zt), window.requestAnimationFrame(() => {
1013
- if (i && o !== window.location.href) {
1014
- s(window.location.href);
1015
- return;
1016
- }
1017
- window.scrollTo(t, e);
1018
- }), Zt = null;
1019
- }
1020
- }, [o]);
1021
- return m.useEffect(() => {
1022
- function e() {
1023
- c.current = window.scrollY;
1024
- }
1025
- return e(), window.addEventListener("scroll", e), () => {
1026
- window.removeEventListener("scroll", e);
1027
- };
1028
- }, []), m.useEffect(() => {
1029
- if (t) return () => {
1030
- typeof document > "u" || document.querySelector("[data-vaul-drawer]") || u();
1031
- };
1032
- }, [t, u]), m.useEffect(() => {
1033
- n || !r || (e ? (!window.matchMedia("(display-mode: standalone)").matches && l(), t || window.setTimeout(() => {
1034
- u();
1035
- }, 500)) : u());
1036
- }, [
1037
- e,
1038
- r,
1039
- o,
1040
- t,
1041
- n,
1042
- l,
1043
- u
1044
- ]), { restorePositionSetting: u };
1045
- }
1046
- function $t({ open: e, onOpenChange: t, children: n, onDrag: r, onRelease: i, snapPoints: a, shouldScaleBackground: o = !1, setBackgroundColorOnScale: s = !0, closeThreshold: c = Bt, scrollLockTimeout: l = Vt, dismissible: u = !0, handleOnly: d = !1, fadeFromIndex: f = a && a.length - 1, activeSnapPoint: p, setActiveSnapPoint: h, fixed: g, modal: _ = !0, onClose: v, nested: y, noBodyStyles: b = !1, direction: x = "bottom", defaultOpen: S = !1, disablePreventScroll: C = !0, snapToSequentialPoint: w = !1, preventScrollRestoration: T = !1, repositionInputs: E = !0, onAnimationEnd: ee, container: te, autoFocus: D = !1 }) {
1047
- let [O = !1, ne] = Jt({
1048
- defaultProp: S,
1049
- prop: e,
1050
- onChange: (e) => {
1051
- t?.(e), !e && !y && H(), setTimeout(() => {
1052
- ee?.(e);
1053
- }, Q.DURATION * 1e3), e && !_ && typeof window < "u" && window.requestAnimationFrame(() => {
1054
- document.body.style.pointerEvents = "auto";
1055
- }), e || (document.body.style.pointerEvents = "auto");
1056
- }
1057
- }), [re, k] = m.useState(!1), [A, ie] = m.useState(!1), [ae, oe] = m.useState(!1), j = m.useRef(null), M = m.useRef(null), se = m.useRef(null), N = m.useRef(null), P = m.useRef(null), F = m.useRef(!1), ce = m.useRef(null), le = m.useRef(0), I = m.useRef(!1), ue = m.useRef(!S), de = m.useRef(0), L = m.useRef(null), R = m.useRef(L.current?.getBoundingClientRect().height || 0), z = m.useRef(L.current?.getBoundingClientRect().width || 0), fe = m.useRef(0), { activeSnapPoint: pe, activeSnapPointIndex: B, setActiveSnapPoint: me, onRelease: he, snapPointsOffset: V, onDrag: ge, shouldFade: _e, getPercentageDragged: ve } = Yt({
1058
- snapPoints: a,
1059
- activeSnapPointProp: p,
1060
- setActiveSnapPointProp: h,
1061
- drawerRef: L,
1062
- fadeFromIndex: f,
1063
- overlayRef: j,
1064
- onSnapPointChange: m.useCallback((e) => {
1065
- a && e === V.length - 1 && (M.current = /* @__PURE__ */ new Date());
1066
- }, []),
1067
- direction: x,
1068
- container: te,
1069
- snapToSequentialPoint: w
1070
- });
1071
- Et({ isDisabled: !O || A || !_ || ae || !re || !E || !C });
1072
- let { restorePositionSetting: H } = Qt({
1073
- isOpen: O,
1074
- modal: _,
1075
- nested: y ?? !1,
1076
- hasBeenOpened: re,
1077
- preventScrollRestoration: T,
1078
- noBodyStyles: b
1079
- });
1080
- function U() {
1081
- return (window.innerWidth - Wt) / window.innerWidth;
1082
- }
1083
- function ye(e) {
1084
- !u && !a || L.current && !L.current.contains(e.target) || (R.current = L.current?.getBoundingClientRect().height || 0, z.current = L.current?.getBoundingClientRect().width || 0, ie(!0), se.current = /* @__PURE__ */ new Date(), ht() && window.addEventListener("touchend", () => F.current = !1, { once: !0 }), e.target.setPointerCapture(e.pointerId), le.current = Z(x) ? e.pageY : e.pageX);
1085
- }
1086
- function be(e, t) {
1087
- let n = e, r = window.getSelection()?.toString(), i = L.current ? It(L.current, x) : null, a = /* @__PURE__ */ new Date();
1088
- if (n.tagName === "SELECT" || n.hasAttribute("data-vaul-no-drag") || n.closest("[data-vaul-no-drag]")) return !1;
1089
- if (x === "right" || x === "left") return !0;
1090
- if (M.current && a.getTime() - M.current.getTime() < 500) return !1;
1091
- if (i !== null && (x === "bottom" ? i > 0 : i < 0)) return !0;
1092
- if (r && r.length > 0) return !1;
1093
- if (P.current && a.getTime() - P.current.getTime() < l && i === 0 || t) return P.current = a, !1;
1094
- for (; n;) {
1095
- if (n.scrollHeight > n.clientHeight) {
1096
- if (n.scrollTop !== 0) return P.current = /* @__PURE__ */ new Date(), !1;
1097
- if (n.getAttribute("role") === "dialog") return !0;
1098
- }
1099
- n = n.parentNode;
1100
- }
1101
- return !0;
1102
- }
1103
- function xe(e) {
1104
- if (L.current && A) {
1105
- let t = x === "bottom" || x === "right" ? 1 : -1, n = (le.current - (Z(x) ? e.pageY : e.pageX)) * t, i = n > 0, s = a && !u && !i;
1106
- if (s && B === 0) return;
1107
- let c = Math.abs(n), l = document.querySelector("[data-vaul-drawer-wrapper]"), d = c / (x === "bottom" || x === "top" ? R.current : z.current), p = ve(c, i);
1108
- if (p !== null && (d = p), s && d >= 1 || !F.current && !be(e.target, i)) return;
1109
- if (L.current.classList.add(Gt), F.current = !0, X(L.current, { transition: "none" }), X(j.current, { transition: "none" }), a && ge({ draggedDistance: n }), i && !a) {
1110
- let e = Lt(n), r = Math.min(e * -1, 0) * t;
1111
- X(L.current, { transform: Z(x) ? `translate3d(0, ${r}px, 0)` : `translate3d(${r}px, 0, 0)` });
1112
- return;
1113
- }
1114
- let m = 1 - d;
1115
- if ((_e || f && B === f - 1) && (r?.(e, d), X(j.current, {
1116
- opacity: `${m}`,
1117
- transition: "none"
1118
- }, !0)), l && j.current && o) {
1119
- let e = Math.min(U() + d * (1 - U()), 1), t = 8 - d * 8, n = Math.max(0, 14 - d * 14);
1120
- X(l, {
1121
- borderRadius: `${t}px`,
1122
- transform: Z(x) ? `scale(${e}) translate3d(0, ${n}px, 0)` : `scale(${e}) translate3d(${n}px, 0, 0)`,
1123
- transition: "none"
1124
- }, !0);
1125
- }
1126
- if (!a) {
1127
- let e = c * t;
1128
- X(L.current, { transform: Z(x) ? `translate3d(0, ${e}px, 0)` : `translate3d(${e}px, 0, 0)` });
1129
- }
1130
- }
1131
- }
1132
- m.useEffect(() => {
1133
- window.requestAnimationFrame(() => {
1134
- ue.current = !0;
1135
- });
1136
- }, []), m.useEffect(() => {
1137
- var e;
1138
- function t() {
1139
- if (!L.current || !E) return;
1140
- let e = document.activeElement;
1141
- if (At(e) || I.current) {
1142
- let e = window.visualViewport?.height || 0, t = window.innerHeight, n = t - e, r = L.current.getBoundingClientRect().height || 0, i = r > t * .8;
1143
- fe.current ||= r;
1144
- let o = L.current.getBoundingClientRect().top;
1145
- if (Math.abs(de.current - n) > 60 && (I.current = !I.current), a && a.length > 0 && V && B) {
1146
- let e = V[B] || 0;
1147
- n += e;
1148
- }
1149
- if (de.current = n, r > e || I.current) {
1150
- let t = L.current.getBoundingClientRect().height, r = t;
1151
- t > e && (r = e - (i ? o : Wt)), g ? L.current.style.height = `${t - Math.max(n, 0)}px` : L.current.style.height = `${Math.max(r, e - o)}px`;
1152
- } else ut() || (L.current.style.height = `${fe.current}px`);
1153
- a && a.length > 0 && !I.current ? L.current.style.bottom = "0px" : L.current.style.bottom = `${Math.max(n, 0)}px`;
1154
- }
1155
- }
1156
- return (e = window.visualViewport) == null || e.addEventListener("resize", t), () => window.visualViewport?.removeEventListener("resize", t);
1157
- }, [
1158
- B,
1159
- a,
1160
- V
1161
- ]);
1162
- function W(e) {
1163
- G(), v?.(), e || ne(!1), setTimeout(() => {
1164
- a && me(a[0]);
1165
- }, Q.DURATION * 1e3);
1166
- }
1167
- function Se() {
1168
- if (!L.current) return;
1169
- let e = document.querySelector("[data-vaul-drawer-wrapper]"), t = It(L.current, x);
1170
- X(L.current, {
1171
- transform: "translate3d(0, 0, 0)",
1172
- transition: `transform ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`
1173
- }), X(j.current, {
1174
- transition: `opacity ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`,
1175
- opacity: "1"
1176
- }), o && t && t > 0 && O && X(e, {
1177
- borderRadius: `${Ht}px`,
1178
- overflow: "hidden",
1179
- ...Z(x) ? {
1180
- transform: `scale(${U()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
1181
- transformOrigin: "top"
1182
- } : {
1183
- transform: `scale(${U()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
1184
- transformOrigin: "left"
1185
- },
1186
- transitionProperty: "transform, border-radius",
1187
- transitionDuration: `${Q.DURATION}s`,
1188
- transitionTimingFunction: `cubic-bezier(${Q.EASE.join(",")})`
1189
- }, !0);
1190
- }
1191
- function G() {
1192
- !A || !L.current || (L.current.classList.remove(Gt), F.current = !1, ie(!1), N.current = /* @__PURE__ */ new Date());
1193
- }
1194
- function Ce(e) {
1195
- if (!A || !L.current) return;
1196
- L.current.classList.remove(Gt), F.current = !1, ie(!1), N.current = /* @__PURE__ */ new Date();
1197
- let t = It(L.current, x);
1198
- if (!e || !be(e.target, !1) || !t || Number.isNaN(t) || se.current === null) return;
1199
- let n = N.current.getTime() - se.current.getTime(), r = le.current - (Z(x) ? e.pageY : e.pageX), o = Math.abs(r) / n;
1200
- if (o > .05 && (oe(!0), setTimeout(() => {
1201
- oe(!1);
1202
- }, 200)), a) {
1203
- he({
1204
- draggedDistance: r * (x === "bottom" || x === "right" ? 1 : -1),
1205
- closeDrawer: W,
1206
- velocity: o,
1207
- dismissible: u
1208
- }), i?.(e, !0);
1209
- return;
1210
- }
1211
- if (x === "bottom" || x === "right" ? r > 0 : r < 0) {
1212
- Se(), i?.(e, !0);
1213
- return;
1214
- }
1215
- if (o > zt) {
1216
- W(), i?.(e, !1);
1217
- return;
1218
- }
1219
- let s = Math.min(L.current.getBoundingClientRect().height ?? 0, window.innerHeight), l = Math.min(L.current.getBoundingClientRect().width ?? 0, window.innerWidth);
1220
- if (Math.abs(t) >= (x === "left" || x === "right" ? l : s) * c) {
1221
- W(), i?.(e, !1);
1222
- return;
1223
- }
1224
- i?.(e, !0), Se();
1225
- }
1226
- m.useEffect(() => (O && (X(document.documentElement, { scrollBehavior: "auto" }), M.current = /* @__PURE__ */ new Date()), () => {
1227
- Ft(document.documentElement, "scrollBehavior");
1228
- }), [O]);
1229
- function we(e) {
1230
- let t = e ? (window.innerWidth - Ut) / window.innerWidth : 1, n = e ? -16 : 0;
1231
- ce.current && window.clearTimeout(ce.current), X(L.current, {
1232
- transition: `transform ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`,
1233
- transform: Z(x) ? `scale(${t}) translate3d(0, ${n}px, 0)` : `scale(${t}) translate3d(${n}px, 0, 0)`
1234
- }), !e && L.current && (ce.current = setTimeout(() => {
1235
- let e = It(L.current, x);
1236
- X(L.current, {
1237
- transition: "none",
1238
- transform: Z(x) ? `translate3d(0, ${e}px, 0)` : `translate3d(${e}px, 0, 0)`
1239
- });
1240
- }, 500));
1241
- }
1242
- function Te(e, t) {
1243
- if (t < 0) return;
1244
- let n = (window.innerWidth - Ut) / window.innerWidth, r = n + t * (1 - n), i = -16 + t * Ut;
1245
- X(L.current, {
1246
- transform: Z(x) ? `scale(${r}) translate3d(0, ${i}px, 0)` : `scale(${r}) translate3d(${i}px, 0, 0)`,
1247
- transition: "none"
1248
- });
1249
- }
1250
- function K(e, t) {
1251
- let n = Z(x) ? window.innerHeight : window.innerWidth, r = t ? (n - Ut) / n : 1, i = t ? -16 : 0;
1252
- t && X(L.current, {
1253
- transition: `transform ${Q.DURATION}s cubic-bezier(${Q.EASE.join(",")})`,
1254
- transform: Z(x) ? `scale(${r}) translate3d(0, ${i}px, 0)` : `scale(${r}) translate3d(${i}px, 0, 0)`
1255
- });
1256
- }
1257
- return m.useEffect(() => {
1258
- _ || window.requestAnimationFrame(() => {
1259
- document.body.style.pointerEvents = "auto";
1260
- });
1261
- }, [_]), /*#__PURE__*/ m.createElement(et, {
1262
- defaultOpen: S,
1263
- onOpenChange: (e) => {
1264
- !u && !e || (e ? k(!0) : W(!0), ne(e));
1265
- },
1266
- open: O
1267
- }, /*#__PURE__*/ m.createElement(lt.Provider, { value: {
1268
- activeSnapPoint: pe,
1269
- snapPoints: a,
1270
- setActiveSnapPoint: me,
1271
- drawerRef: L,
1272
- overlayRef: j,
1273
- onOpenChange: t,
1274
- onPress: ye,
1275
- onRelease: Ce,
1276
- onDrag: xe,
1277
- dismissible: u,
1278
- shouldAnimate: ue,
1279
- handleOnly: d,
1280
- isOpen: O,
1281
- isDragging: A,
1282
- shouldFade: _e,
1283
- closeDrawer: W,
1284
- onNestedDrag: Te,
1285
- onNestedOpenChange: we,
1286
- onNestedRelease: K,
1287
- keyboardIsOpen: I,
1288
- modal: _,
1289
- snapPointsOffset: V,
1290
- activeSnapPointIndex: B,
1291
- direction: x,
1292
- shouldScaleBackground: o,
1293
- setBackgroundColorOnScale: s,
1294
- noBodyStyles: b,
1295
- container: te,
1296
- autoFocus: D
1297
- } }, n));
1298
- }
1299
- var en = /*#__PURE__*/ m.forwardRef(function({ ...e }, t) {
1300
- let { overlayRef: n, snapPoints: r, onRelease: i, shouldFade: a, isOpen: o, modal: s, shouldAnimate: c } = J(), l = Nt(t, n), u = r && r.length > 0;
1301
- if (!s) return null;
1302
- let d = m.useCallback((e) => i(e), [i]);
1303
- return /*#__PURE__*/ m.createElement(rt, {
1304
- onMouseUp: d,
1305
- ref: l,
1306
- "data-vaul-overlay": "",
1307
- "data-vaul-snap-points": o && u ? "true" : "false",
1308
- "data-vaul-snap-points-overlay": o && a ? "true" : "false",
1309
- "data-vaul-animate": c?.current ? "true" : "false",
1310
- ...e
1311
- });
1312
- });
1313
- en.displayName = "Drawer.Overlay";
1314
- var tn = /*#__PURE__*/ m.forwardRef(function({ onPointerDownOutside: e, style: t, onOpenAutoFocus: n, ...r }, i) {
1315
- let { drawerRef: a, onPress: o, onRelease: s, onDrag: c, keyboardIsOpen: l, snapPointsOffset: u, activeSnapPointIndex: d, modal: f, isOpen: p, direction: h, snapPoints: g, container: _, handleOnly: v, shouldAnimate: y, autoFocus: b } = J(), [x, S] = m.useState(!1), C = Nt(i, a), w = m.useRef(null), T = m.useRef(null), E = m.useRef(!1), ee = g && g.length > 0;
1316
- Xt();
1317
- let te = (e, t, n = 0) => {
1318
- if (E.current) return !0;
1319
- let r = Math.abs(e.y), i = Math.abs(e.x), a = i > r, o = ["bottom", "right"].includes(t) ? 1 : -1;
1320
- if (t === "left" || t === "right") {
1321
- if (!(e.x * o < 0) && i >= 0 && i <= n) return a;
1322
- } else if (!(e.y * o < 0) && r >= 0 && r <= n) return !a;
1323
- return E.current = !0, !0;
1324
- };
1325
- m.useEffect(() => {
1326
- ee && window.requestAnimationFrame(() => {
1327
- S(!0);
1328
- });
1329
- }, []);
1330
- function D(e) {
1331
- w.current = null, E.current = !1, s(e);
1332
- }
1333
- return /*#__PURE__*/ m.createElement(it, {
1334
- "data-vaul-drawer-direction": h,
1335
- "data-vaul-drawer": "",
1336
- "data-vaul-delayed-snap-points": x ? "true" : "false",
1337
- "data-vaul-snap-points": p && ee ? "true" : "false",
1338
- "data-vaul-custom-container": _ ? "true" : "false",
1339
- "data-vaul-animate": y?.current ? "true" : "false",
1340
- ...r,
1341
- ref: C,
1342
- style: u && u.length > 0 ? {
1343
- "--snap-point-height": `${u[d ?? 0]}px`,
1344
- ...t
1345
- } : t,
1346
- onPointerDown: (e) => {
1347
- v || (r.onPointerDown == null || r.onPointerDown.call(r, e), w.current = {
1348
- x: e.pageX,
1349
- y: e.pageY
1350
- }, o(e));
1351
- },
1352
- onOpenAutoFocus: (e) => {
1353
- n?.(e), b || e.preventDefault();
1354
- },
1355
- onPointerDownOutside: (t) => {
1356
- if (e?.(t), !f || t.defaultPrevented) {
1357
- t.preventDefault();
1358
- return;
1359
- }
1360
- l.current &&= !1;
1361
- },
1362
- onFocusOutside: (e) => {
1363
- if (!f) {
1364
- e.preventDefault();
1365
- return;
1366
- }
1367
- },
1368
- onPointerMove: (e) => {
1369
- if (T.current = e, v || (r.onPointerMove == null || r.onPointerMove.call(r, e), !w.current)) return;
1370
- let t = e.pageY - w.current.y, n = e.pageX - w.current.x, i = e.pointerType === "touch" ? 10 : 2;
1371
- te({
1372
- x: n,
1373
- y: t
1374
- }, h, i) ? c(e) : (Math.abs(n) > i || Math.abs(t) > i) && (w.current = null);
1375
- },
1376
- onPointerUp: (e) => {
1377
- r.onPointerUp == null || r.onPointerUp.call(r, e), w.current = null, E.current = !1, s(e);
1378
- },
1379
- onPointerOut: (e) => {
1380
- r.onPointerOut == null || r.onPointerOut.call(r, e), D(T.current);
1381
- },
1382
- onContextMenu: (e) => {
1383
- r.onContextMenu == null || r.onContextMenu.call(r, e), T.current && D(T.current);
1384
- }
1385
- });
1386
- });
1387
- tn.displayName = "Drawer.Content";
1388
- var nn = 250, rn = 120, an = /*#__PURE__*/ m.forwardRef(function({ preventCycle: e = !1, children: t, ...n }, r) {
1389
- let { closeDrawer: i, isDragging: a, snapPoints: o, activeSnapPoint: s, setActiveSnapPoint: c, dismissible: l, handleOnly: u, isOpen: d, onPress: f, onDrag: p } = J(), h = m.useRef(null), g = m.useRef(!1);
1390
- function _() {
1391
- if (g.current) {
1392
- b();
1393
- return;
1394
- }
1395
- window.setTimeout(() => {
1396
- v();
1397
- }, rn);
1398
- }
1399
- function v() {
1400
- if (a || e || g.current) {
1401
- b();
1402
- return;
1403
- }
1404
- if (b(), !o || o.length === 0) {
1405
- l || i();
1406
- return;
1407
- }
1408
- if (s === o[o.length - 1] && l) {
1409
- i();
1410
- return;
1411
- }
1412
- let t = o.findIndex((e) => e === s);
1413
- if (t === -1) return;
1414
- let n = o[t + 1];
1415
- c(n);
1416
- }
1417
- function y() {
1418
- h.current = window.setTimeout(() => {
1419
- g.current = !0;
1420
- }, nn);
1421
- }
1422
- function b() {
1423
- h.current && window.clearTimeout(h.current), g.current = !1;
1424
- }
1425
- return /*#__PURE__*/ m.createElement("div", {
1426
- onClick: _,
1427
- onPointerCancel: b,
1428
- onPointerDown: (e) => {
1429
- u && f(e), y();
1430
- },
1431
- onPointerMove: (e) => {
1432
- u && p(e);
1433
- },
1434
- ref: r,
1435
- "data-vaul-drawer-visible": d ? "true" : "false",
1436
- "data-vaul-handle": "",
1437
- "aria-hidden": "true",
1438
- ...n
1439
- }, /*#__PURE__*/ m.createElement("span", {
1440
- "data-vaul-handle-hitarea": "",
1441
- "aria-hidden": "true"
1442
- }, t));
1443
- });
1444
- an.displayName = "Drawer.Handle";
1445
- function on({ onDrag: e, onOpenChange: t, open: n, ...r }) {
1446
- let { onNestedDrag: i, onNestedOpenChange: a, onNestedRelease: o } = J();
1447
- if (!i) throw Error("Drawer.NestedRoot must be placed in another drawer");
1448
- return /*#__PURE__*/ m.createElement($t, {
1449
- nested: !0,
1450
- open: n,
1451
- onClose: () => {
1452
- a(!1);
1453
- },
1454
- onDrag: (t, n) => {
1455
- i(t, n), e?.(t, n);
1456
- },
1457
- onOpenChange: (e) => {
1458
- e && a(e), t?.(e);
1459
- },
1460
- onRelease: o,
1461
- ...r
1462
- });
1463
- }
1464
- function sn(e) {
1465
- let t = J(), { container: n = t.container, ...r } = e;
1466
- return /*#__PURE__*/ m.createElement(nt, {
1467
- container: n,
1468
- ...r
1469
- });
1470
- }
1471
- var $ = {
1472
- Root: $t,
1473
- NestedRoot: on,
1474
- Content: tn,
1475
- Overlay: en,
1476
- Trigger: tt,
1477
- Portal: sn,
1478
- Handle: an,
1479
- Close: st,
1480
- Title: at,
1481
- Description: ot
1482
- };
1483
- //#endregion
1484
- //#region src/components/ui/drawer.tsx
1485
- function cn({ ...e }) {
1486
- return /* @__PURE__ */ y($.Root, {
1487
- "data-slot": "drawer",
1488
- ...e
1489
- });
1490
- }
1491
- function ln({ ...e }) {
1492
- return /* @__PURE__ */ y($.Trigger, {
1493
- "data-slot": "drawer-trigger",
1494
- ...e
1495
- });
1496
- }
1497
- function un({ ...e }) {
1498
- return /* @__PURE__ */ y($.Portal, {
1499
- "data-slot": "drawer-portal",
1500
- ...e
1501
- });
1502
- }
1503
- function dn({ ...e }) {
1504
- return /* @__PURE__ */ y($.Close, {
1505
- "data-slot": "drawer-close",
1506
- ...e
1507
- });
1508
- }
1509
- function fn({ className: e, ...t }) {
1510
- return /* @__PURE__ */ y($.Overlay, {
1511
- className: c("data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-1000 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in", e),
1512
- "data-slot": "drawer-overlay",
1513
- ...t
1514
- });
1515
- }
1516
- function pn({ className: e, children: t, ...n }) {
1517
- return /* @__PURE__ */ b(un, {
1518
- "data-slot": "drawer-portal",
1519
- children: [/* @__PURE__ */ y(fn, {}), /* @__PURE__ */ y($.Content, {
1520
- className: c("group/drawer-content fixed z-1000 flex h-auto flex-col bg-white", "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b", "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-0", "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm", "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm", e),
1521
- "data-slot": "drawer-content",
1522
- ...n,
1523
- children: t
1524
- })]
1525
- });
1526
- }
1527
- function mn({ className: e, ...t }) {
1528
- return /* @__PURE__ */ y("div", {
1529
- className: c("flex flex-col gap-2 p-5", e),
1530
- "data-slot": "drawer-header",
1531
- ...t
1532
- });
1533
- }
1534
- function hn({ className: e, ...t }) {
1535
- return /* @__PURE__ */ y("div", {
1536
- className: c("mt-auto flex flex-col gap-2 p-5", e),
1537
- "data-slot": "drawer-footer",
1538
- ...t
1539
- });
1540
- }
1541
- function gn({ className: e, ...t }) {
1542
- return /* @__PURE__ */ y($.Title, {
1543
- className: c("font-semibold text-foreground", e),
1544
- "data-slot": "drawer-title",
1545
- ...t
1546
- });
1547
- }
1548
- function _n({ className: e, ...t }) {
1549
- return /* @__PURE__ */ y($.Description, {
1550
- className: c("text-muted-foreground text-sm", e),
1551
- "data-slot": "drawer-description",
1552
- ...t
1553
- });
1554
- }
1555
- //#endregion
1556
- export { hn as a, un as c, _n as i, gn as l, dn as n, mn as o, pn as r, fn as s, cn as t, ln as u };