@orioncactuscorp/ui 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +56 -27
  2. package/dist/components/Accordion/Accordion.css +1 -1
  3. package/dist/components/Accordion/Accordion.js +39 -38
  4. package/dist/components/Accordion/Accordion.module.scss.js +5 -5
  5. package/dist/components/ActionArea/ActionArea.css +1 -1
  6. package/dist/components/ActionArea/ActionArea.js +101 -71
  7. package/dist/components/ActionArea/ActionAreaLayout.css +1 -0
  8. package/dist/components/ActionArea/ActionAreaLayout.js +145 -0
  9. package/dist/components/ActionArea/ActionAreaLayout.module.scss.js +11 -0
  10. package/dist/components/ActionArea.js +10 -4
  11. package/dist/components/Alert/Alert.css +1 -1
  12. package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -1
  13. package/dist/components/BackgroundIconButton/BackgroundIconButton.js +72 -52
  14. package/dist/components/Badge/Badge.css +1 -1
  15. package/dist/components/Badge/Badge.js +69 -25
  16. package/dist/components/Button/Button.css +1 -1
  17. package/dist/components/Button/Button.js +79 -139
  18. package/dist/components/Cell/Cell.css +1 -1
  19. package/dist/components/Cell/Cell.js +98 -88
  20. package/dist/components/CheckMark/CheckMark.css +1 -1
  21. package/dist/components/CheckMark/CheckMark.js +20 -18
  22. package/dist/components/CheckMark/CheckMark.module.scss.js +7 -3
  23. package/dist/components/Checkbox/Checkbox.css +1 -1
  24. package/dist/components/Checkbox/Checkbox.module.scss.js +10 -8
  25. package/dist/components/Field/Field.css +1 -1
  26. package/dist/components/Fieldset/Fieldset.css +1 -1
  27. package/dist/components/IconButton/IconButton.css +1 -1
  28. package/dist/components/IconButton/IconButton.js +48 -29
  29. package/dist/components/Interaction/Interaction.css +1 -1
  30. package/dist/components/Loading/Loading.css +1 -1
  31. package/dist/components/Loading/Loading.js +10 -10
  32. package/dist/components/Menu/Menu.css +1 -1
  33. package/dist/components/Modal/Modal.css +1 -1
  34. package/dist/components/Modal/Modal.js +377 -346
  35. package/dist/components/Modal/useModalDrag.js +654 -614
  36. package/dist/components/Radio/Radio.css +1 -1
  37. package/dist/components/Radio/Radio.module.scss.js +9 -7
  38. package/dist/components/ScrollArea/ScrollArea.css +1 -1
  39. package/dist/components/SectionHeader/SectionHeader.css +1 -1
  40. package/dist/components/Select/Select.css +1 -1
  41. package/dist/components/Select/Select.js +15 -15
  42. package/dist/components/Select/SelectContent.css +1 -1
  43. package/dist/components/Switch/Switch.css +1 -1
  44. package/dist/components/Switch/Switch.module.scss.js +6 -4
  45. package/dist/components/TextArea/TextArea.css +1 -1
  46. package/dist/components/TextArea/TextAreaContent.css +1 -1
  47. package/dist/components/TextButton/TextButton.css +1 -1
  48. package/dist/components/TextInput/TextInput.css +1 -1
  49. package/dist/components/TextInput/TextInputContent.css +1 -1
  50. package/dist/components/Tooltip/Tooltip.css +1 -1
  51. package/dist/components/internal/Pressable.js +90 -0
  52. package/dist/foundations/atomic.css +1 -1
  53. package/dist/foundations/motion.css +1 -1
  54. package/dist/foundations/typo.css +1 -1
  55. package/dist/foundations.css +3 -3
  56. package/dist/index.js +102 -96
  57. package/dist/react/motion.js +109 -106
  58. package/dist/styles.css +32 -31
  59. package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
  60. package/dist/ui/src/components/ActionArea/ActionArea.d.ts +1 -1
  61. package/dist/ui/src/components/ActionArea/ActionArea.d.ts.map +1 -1
  62. package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts +12 -0
  63. package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts.map +1 -0
  64. package/dist/ui/src/components/ActionArea/index.d.ts +2 -1
  65. package/dist/ui/src/components/ActionArea/index.d.ts.map +1 -1
  66. package/dist/ui/src/components/ActionArea/types.d.ts +13 -2
  67. package/dist/ui/src/components/ActionArea/types.d.ts.map +1 -1
  68. package/dist/ui/src/components/BackgroundIconButton/BackgroundIconButton.d.ts +1 -1
  69. package/dist/ui/src/components/BackgroundIconButton/BackgroundIconButton.d.ts.map +1 -1
  70. package/dist/ui/src/components/BackgroundIconButton/index.d.ts +1 -1
  71. package/dist/ui/src/components/BackgroundIconButton/index.d.ts.map +1 -1
  72. package/dist/ui/src/components/BackgroundIconButton/types.d.ts +6 -5
  73. package/dist/ui/src/components/BackgroundIconButton/types.d.ts.map +1 -1
  74. package/dist/ui/src/components/Badge/Badge.d.ts +1 -1
  75. package/dist/ui/src/components/Badge/Badge.d.ts.map +1 -1
  76. package/dist/ui/src/components/Badge/types.d.ts +19 -2
  77. package/dist/ui/src/components/Badge/types.d.ts.map +1 -1
  78. package/dist/ui/src/components/Button/Button.d.ts.map +1 -1
  79. package/dist/ui/src/components/Button/types.d.ts +3 -7
  80. package/dist/ui/src/components/Button/types.d.ts.map +1 -1
  81. package/dist/ui/src/components/Cell/Cell.d.ts.map +1 -1
  82. package/dist/ui/src/components/CheckMark/CheckMark.d.ts +1 -1
  83. package/dist/ui/src/components/CheckMark/CheckMark.d.ts.map +1 -1
  84. package/dist/ui/src/components/CheckMark/index.d.ts +1 -1
  85. package/dist/ui/src/components/CheckMark/index.d.ts.map +1 -1
  86. package/dist/ui/src/components/CheckMark/types.d.ts +2 -0
  87. package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -1
  88. package/dist/ui/src/components/IconButton/IconButton.d.ts +1 -1
  89. package/dist/ui/src/components/IconButton/IconButton.d.ts.map +1 -1
  90. package/dist/ui/src/components/IconButton/index.d.ts +1 -1
  91. package/dist/ui/src/components/IconButton/index.d.ts.map +1 -1
  92. package/dist/ui/src/components/IconButton/types.d.ts +6 -5
  93. package/dist/ui/src/components/IconButton/types.d.ts.map +1 -1
  94. package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
  95. package/dist/ui/src/components/Modal/contexts.d.ts +1 -0
  96. package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -1
  97. package/dist/ui/src/components/Modal/types.d.ts +7 -6
  98. package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
  99. package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
  100. package/dist/ui/src/components/internal/Pressable.d.ts +19 -0
  101. package/dist/ui/src/components/internal/Pressable.d.ts.map +1 -0
  102. package/dist/ui/src/index.d.ts +5 -5
  103. package/dist/ui/src/index.d.ts.map +1 -1
  104. package/dist/ui/src/react/motion/index.d.ts +9 -8
  105. package/dist/ui/src/react/motion/index.d.ts.map +1 -1
  106. package/dist/ui/src/utils/motion.d.ts +15 -14
  107. package/dist/ui/src/utils/motion.d.ts.map +1 -1
  108. package/dist/utils/motion.js +282 -183
  109. package/dist/vscode/oc-ui-vars.css +31 -16
  110. package/package.json +2 -2
  111. package/src/scss/foundations/atomic.scss +12 -10
  112. package/src/scss/foundations/atomic.test.ts +34 -0
  113. package/src/scss/foundations/motion.scss +30 -16
  114. package/src/scss/foundations/typo.scss +1 -1
  115. package/src/scss/index.scss +1 -0
  116. package/src/scss/mixins/_motion.scss +168 -77
  117. package/src/scss/mixins/_motion.test.ts +137 -54
  118. package/src/scss/mixins/_radius.scss +3 -0
  119. package/src/scss/mixins/_radius.test.ts +52 -0
  120. package/src/scss/mixins/_typo.scss +2 -2
@@ -1,10 +1,10 @@
1
- import { useRef as v, useLayoutEffect as lt, useCallback as d, useEffect as At } from "react";
2
- import { ocSpring as Pe } from "../../utils/spring.js";
3
- import { resolveOcMotion as It } from "../../utils/motion.js";
4
- import { resolveModalPopupSnapPositions as we } from "./snapPoints.js";
5
- import { setModalBodyTouchScrollLock as Ct, shouldLockModalBodyTouchScroll as Xe, shouldIgnoreDragTarget as Lt, getScrollableAncestor as De, getBottomTouchDragDecision as Se, getPopupTouchDragDecision as Ye } from "./modalScrollArbitration.js";
6
- import { createSpringAnimator as Ot } from "../../utils/spring/animator.js";
7
- const M = {
1
+ import { useRef as E, useLayoutEffect as lt, useCallback as p, useEffect as kt } from "react";
2
+ import { ocSpring as Xe } from "../../utils/spring.js";
3
+ import { resolveOcMotion as At } from "../../utils/motion.js";
4
+ import { resolveModalPopupSnapPositions as De } from "./snapPoints.js";
5
+ import { setModalBodyTouchScrollLock as Bt, shouldLockModalBodyTouchScroll as ve, shouldIgnoreDragTarget as Ct, getScrollableAncestor as Se, getBottomTouchDragDecision as Ye, getPopupTouchDragDecision as Me } from "./modalScrollArbitration.js";
6
+ import { createSpringAnimator as It } from "../../utils/spring/animator.js";
7
+ const b = {
8
8
  dragStartThresholdPx: {
9
9
  touch: 10,
10
10
  mouse: 2
@@ -22,124 +22,131 @@ const M = {
22
22
  minDistancePx: 24
23
23
  },
24
24
  rubberBand: {
25
- resistance: 0.55
25
+ resistance: 0.55,
26
+ // Calibrated from iOS bottom-sheet recordings: upward approx 10.3vh, downward approx 15.6vh.
27
+ observedViewportLimitRatio: {
28
+ top: 0.105,
29
+ bottom: 0.16
30
+ }
26
31
  },
27
32
  settleSpring: {
28
33
  durationSeconds: 0.5
29
34
  },
30
35
  popupDragFollower: {
31
- settleDurationScale: 1 / 6
36
+ settleDurationFactor: 1 / 6
32
37
  }
33
- }, ve = Pe.snappy({
34
- duration: M.settleSpring.durationSeconds * M.popupDragFollower.settleDurationScale
35
- }), Me = [], be = [];
36
- function Zt(r) {
38
+ }, Ee = Xe.snappy({
39
+ duration: b.settleSpring.durationSeconds * b.popupDragFollower.settleDurationFactor
40
+ }), be = [], Le = [];
41
+ function te(r) {
37
42
  r.cancelable !== !1 && r.preventDefault();
38
43
  }
39
- function b(r, n, l) {
44
+ function L(r, n, l) {
40
45
  return Math.min(Math.max(r, n), l);
41
46
  }
42
- function te(r) {
47
+ function ee(r) {
43
48
  return [...new Set(r)].sort((n, l) => n - l);
44
49
  }
45
- function Ee(r, n) {
50
+ function Fe(r, n) {
46
51
  return r.reduce(
47
- (l, o) => Math.abs(o - n) < Math.abs(l - n) ? o : l
52
+ (l, a) => Math.abs(a - n) < Math.abs(l - n) ? a : l
48
53
  );
49
54
  }
50
- function ee({
55
+ function re({
51
56
  deltaX: r,
52
57
  deltaY: n,
53
58
  placement: l
54
59
  }) {
55
60
  return l === "bottom" ? Math.abs(n) : Math.hypot(r, n);
56
61
  }
57
- function Fe(r, n, l) {
62
+ function ke(r, n, l) {
58
63
  if (l === "down")
59
64
  return r.find((i) => i > n + 1) ?? r[r.length - 1] ?? 0;
60
65
  for (let i = r.length - 1; i >= 0; i -= 1) {
61
- const g = r[i];
62
- if (g !== void 0 && g < n - 1)
63
- return g;
66
+ const f = r[i];
67
+ if (f !== void 0 && f < n - 1)
68
+ return f;
64
69
  }
65
70
  return r[0] ?? 0;
66
71
  }
67
- function ke(r, n, l, o, i = l) {
68
- const T = Fe(r, n, o), h = o === "down" ? Math.max(l, i) : Math.min(l, i);
69
- if (o === "down") {
72
+ function Ae(r, n, l, a, i = l) {
73
+ const T = ke(r, n, a), y = a === "down" ? Math.max(l, i) : Math.min(l, i);
74
+ if (a === "down") {
70
75
  if (r.filter(
71
76
  (F) => F > n + 1 && F <= l + 1
72
77
  ).length === 0) return T;
73
- const $ = r.filter(
74
- (F) => F > n + 1 && F <= h + 1
78
+ const nt = r.filter(
79
+ (F) => F > n + 1 && F <= y + 1
75
80
  );
76
- return $[$.length - 1] ?? T;
81
+ return nt[nt.length - 1] ?? T;
77
82
  }
78
83
  return r.filter(
79
- (E) => E < n - 1 && E >= l - 1
84
+ (S) => S < n - 1 && S >= l - 1
80
85
  ).length === 0 ? T : r.filter(
81
- (E) => E < n - 1 && E >= h - 1
86
+ (S) => S < n - 1 && S >= y - 1
82
87
  )[0] ?? T;
83
88
  }
84
- function re(r, n) {
85
- const l = Math.max(n, 1), { resistance: o } = M.rubberBand;
86
- return r * o * l / (l + o * r);
89
+ function ne(r, n) {
90
+ if (n <= 0) return 0;
91
+ const l = n, { resistance: a } = b.rubberBand;
92
+ return r * a * l / (l + a * r);
87
93
  }
88
- function Nt({
94
+ function Ot({
89
95
  targetTranslate: r,
90
96
  minTranslate: n,
91
97
  maxTranslate: l,
92
- dimension: o
98
+ minBoundaryLimit: a,
99
+ maxBoundaryLimit: i
93
100
  }) {
94
- return r < n ? n - re(n - r, o) : r > l ? l + re(r - l, o) : r;
101
+ return r < n ? n - ne(n - r, a) : r > l ? l + ne(r - l, i) : r;
95
102
  }
96
- function ne(r) {
103
+ function ae(r) {
97
104
  return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
98
105
  }
99
- function Ae(r, n) {
106
+ function Be(r, n) {
100
107
  return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
101
108
  }
102
- function ae(r, n) {
109
+ function oe(r, n) {
103
110
  if (!r.length)
104
111
  return {
105
112
  minTranslate: 0,
106
113
  maxTranslate: 0
107
114
  };
108
- const l = r.map((g) => g[n]), o = Math.min(...l), i = Math.max(...l);
109
- if (Math.abs(i - o) < 0.5) {
110
- const g = (o + i) / 2;
115
+ const l = r.map((f) => f[n]), a = Math.min(...l), i = Math.max(...l);
116
+ if (Math.abs(i - a) < 0.5) {
117
+ const f = (a + i) / 2;
111
118
  return {
112
- minTranslate: g,
113
- maxTranslate: g
119
+ minTranslate: f,
120
+ maxTranslate: f
114
121
  };
115
122
  }
116
123
  return {
117
- minTranslate: o,
124
+ minTranslate: a,
118
125
  maxTranslate: i
119
126
  };
120
127
  }
121
- function oe(r, n) {
128
+ function se(r, n) {
122
129
  for (let l = 0; l < r.length; l += 1) {
123
- const o = "item" in r && typeof r.item == "function" ? r.item(l) : r[l];
124
- if (o?.identifier === n) return o;
130
+ const a = "item" in r && typeof r.item == "function" ? r.item(l) : r[l];
131
+ if (a?.identifier === n) return a;
125
132
  }
126
133
  return null;
127
134
  }
128
- function de(r) {
135
+ function ge(r) {
129
136
  if (!r) return { x: 0, y: 0 };
130
137
  const n = window.getComputedStyle(r).transform;
131
138
  if (!n || n === "none") return { x: 0, y: 0 };
132
139
  const l = n.match(/^matrix\((.+)\)$/);
133
140
  if (l) {
134
- const i = l[1].split(",").map((g) => g.trim());
141
+ const i = l[1].split(",").map((f) => f.trim());
135
142
  return {
136
143
  x: Number.parseFloat(i[4] ?? "0") || 0,
137
144
  y: Number.parseFloat(i[5] ?? "0") || 0
138
145
  };
139
146
  }
140
- const o = n.match(/^matrix3d\((.+)\)$/);
141
- if (o) {
142
- const i = o[1].split(",").map((g) => g.trim());
147
+ const a = n.match(/^matrix3d\((.+)\)$/);
148
+ if (a) {
149
+ const i = a[1].split(",").map((f) => f.trim());
143
150
  return {
144
151
  x: Number.parseFloat(i[12] ?? "0") || 0,
145
152
  y: Number.parseFloat(i[13] ?? "0") || 0
@@ -147,65 +154,65 @@ function de(r) {
147
154
  }
148
155
  return { x: 0, y: 0 };
149
156
  }
150
- function se(r) {
151
- return de(r).y;
157
+ function Vt(r) {
158
+ return ge(r).y;
152
159
  }
153
160
  function le(r) {
154
- return de(r);
161
+ return ge(r);
155
162
  }
156
- function nt(r) {
163
+ function rt(r) {
157
164
  if (!r) return;
158
165
  const n = Number.parseFloat(r);
159
166
  return Number.isFinite(n) ? n : void 0;
160
167
  }
161
- function ct() {
168
+ function it() {
162
169
  return Date.now();
163
170
  }
164
- function Ie(r, n) {
165
- const l = n - M.releaseVelocity.sampleWindowMs;
171
+ function Ce(r, n) {
172
+ const l = n - b.releaseVelocity.sampleWindowMs;
166
173
  for (; r.length > 2 && (r[1]?.time ?? n) < l; )
167
174
  r.shift();
168
175
  }
169
- function it(r, n) {
170
- const l = n.time ?? ct();
176
+ function ct(r, n) {
177
+ const l = n.time ?? it();
171
178
  r.samples.push({
172
179
  time: l,
173
180
  pageX: n.pageX,
174
181
  pageY: n.pageY,
175
182
  translateX: n.translateX,
176
183
  translateY: n.translateY
177
- }), Ie(r.samples, l);
184
+ }), Ce(r.samples, l);
178
185
  }
179
- function Yt(r, n) {
186
+ function St(r, n) {
180
187
  return {
181
188
  x: r.startTranslateX + n.pageX - r.startX,
182
189
  y: r.startTranslate + n.pageY - r.startY
183
190
  };
184
191
  }
185
- function ce(r, n) {
186
- const l = Yt(r, n);
187
- it(r, {
192
+ function ie(r, n) {
193
+ const l = St(r, n);
194
+ ct(r, {
188
195
  pageX: n.pageX,
189
196
  pageY: n.pageY,
190
197
  translateX: l.x,
191
198
  translateY: l.y
192
199
  });
193
200
  }
194
- function ie({
201
+ function ce({
195
202
  session: r,
196
203
  fallbackDeltaY: n,
197
204
  fallbackElapsed: l
198
205
  }) {
199
- const o = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: g } = M.releaseVelocity;
200
- if (o) {
201
- const T = o.time - g, h = r.samples.find((X) => X.time >= T) ?? r.samples[0];
202
- if (h && h !== o) {
203
- const X = Math.max(o.time - h.time, 1), D = (o.translateY - h.translateY) / X * 1e3;
204
- if (Number.isFinite(D))
205
- return b(D, -i, i);
206
+ const a = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: f } = b.releaseVelocity;
207
+ if (a) {
208
+ const T = a.time - f, y = r.samples.find((w) => w.time >= T) ?? r.samples[0];
209
+ if (y && y !== a) {
210
+ const w = Math.max(a.time - y.time, 1), P = (a.translateY - y.translateY) / w * 1e3;
211
+ if (Number.isFinite(P))
212
+ return L(P, -i, i);
206
213
  }
207
214
  }
208
- return b(
215
+ return L(
209
216
  n / Math.max(l, 1) * 1e3,
210
217
  -i,
211
218
  i
@@ -216,169 +223,195 @@ function ue({
216
223
  fallbackDelta: n,
217
224
  fallbackElapsed: l
218
225
  }) {
219
- const o = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: g } = M.releaseVelocity;
220
- if (o) {
221
- const T = o.time - g, h = r.samples.find((X) => X.time >= T) ?? r.samples[0];
222
- if (h && h !== o) {
223
- const X = Math.max(o.time - h.time, 1), D = {
224
- x: (o.translateX - h.translateX) / X * 1e3,
225
- y: (o.translateY - h.translateY) / X * 1e3
226
+ const a = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: f } = b.releaseVelocity;
227
+ if (a) {
228
+ const T = a.time - f, y = r.samples.find((w) => w.time >= T) ?? r.samples[0];
229
+ if (y && y !== a) {
230
+ const w = Math.max(a.time - y.time, 1), P = {
231
+ x: (a.translateX - y.translateX) / w * 1e3,
232
+ y: (a.translateY - y.translateY) / w * 1e3
226
233
  };
227
- if (Number.isFinite(D.x) && Number.isFinite(D.y))
234
+ if (Number.isFinite(P.x) && Number.isFinite(P.y))
228
235
  return {
229
- x: b(D.x, -i, i),
230
- y: b(D.y, -i, i)
236
+ x: L(P.x, -i, i),
237
+ y: L(P.y, -i, i)
231
238
  };
232
239
  }
233
240
  }
234
241
  return {
235
- x: b(
242
+ x: L(
236
243
  n.x / Math.max(l, 1) * 1e3,
237
244
  -i,
238
245
  i
239
246
  ),
240
- y: b(
247
+ y: L(
241
248
  n.y / Math.max(l, 1) * 1e3,
242
249
  -i,
243
250
  i
244
251
  )
245
252
  };
246
253
  }
247
- function Ce({
254
+ function Ie({
248
255
  currentTranslate: r,
249
256
  releaseVelocity: n
250
257
  }) {
251
- const { lookaheadSeconds: l, maxDistancePx: o } = M.snapProjection;
252
- return r + b(n * l, -o, o);
258
+ const { lookaheadSeconds: l, maxDistancePx: a } = b.snapProjection;
259
+ return r + L(n * l, -a, a);
253
260
  }
254
- function Le({
261
+ function Oe({
255
262
  currentTranslate: r,
256
263
  releaseVelocity: n
257
264
  }) {
258
- const { lookaheadSeconds: l, maxDistancePx: o } = M.snapProjection;
265
+ const { lookaheadSeconds: l, maxDistancePx: a } = b.snapProjection;
259
266
  return {
260
- x: r.x + b(
267
+ x: r.x + L(
261
268
  n.x * l,
262
- -o,
263
- o
269
+ -a,
270
+ a
264
271
  ),
265
- y: r.y + b(
272
+ y: r.y + L(
266
273
  n.y * l,
267
- -o,
268
- o
274
+ -a,
275
+ a
269
276
  )
270
277
  };
271
278
  }
272
- function Oe(r) {
273
- return Math.abs(r) / 1e3 > M.releaseVelocity.flickThresholdPxPerMs;
279
+ function Ve(r) {
280
+ return Math.abs(r) / 1e3 > b.releaseVelocity.flickThresholdPxPerMs;
274
281
  }
275
282
  function Ne(r) {
276
- return Math.hypot(r.x, r.y) / 1e3 > M.releaseVelocity.flickThresholdPxPerMs;
283
+ return Math.hypot(r.x, r.y) / 1e3 > b.releaseVelocity.flickThresholdPxPerMs;
277
284
  }
278
285
  function ut(r, n) {
279
286
  return Math.hypot(r.x - n.x, r.y - n.y);
280
287
  }
281
288
  function pe(r, n) {
282
289
  return r.reduce(
283
- (l, o) => ut(o, n) < ut(l, n) ? o : l
290
+ (l, a) => ut(a, n) < ut(l, n) ? a : l
284
291
  );
285
292
  }
286
- function Ve({
293
+ function He({
287
294
  currentTranslate: r,
288
295
  releaseVelocity: n,
289
296
  targets: l
290
297
  }) {
291
- const o = Le({
298
+ const a = Oe({
292
299
  currentTranslate: r,
293
300
  releaseVelocity: n
294
301
  });
295
302
  if (!Ne(n))
296
303
  return pe(l, r);
297
- const i = l.filter((g) => {
298
- const T = g.x - r.x, h = g.y - r.y;
299
- return T * n.x + h * n.y > 0;
304
+ const i = l.filter((f) => {
305
+ const T = f.x - r.x, y = f.y - r.y;
306
+ return T * n.x + y * n.y > 0;
300
307
  });
301
308
  return pe(
302
309
  i.length ? i : l,
303
- o
310
+ a
304
311
  );
305
312
  }
306
- function Be({
313
+ function je({
307
314
  presentationState: r,
308
315
  releaseTranslate: n,
309
316
  visibleTranslate: l
310
317
  }) {
311
318
  return r !== "visible" || Math.abs(n - l) > 1;
312
319
  }
313
- function je({
320
+ function ze({
314
321
  drag: r,
315
322
  placement: n,
316
323
  snapPositionCount: l
317
324
  }) {
318
325
  return n === "popup" && r === "content" && l > 0;
319
326
  }
320
- function ze({
327
+ function Re({
321
328
  dismissible: r,
322
329
  peekTranslate: n,
323
330
  sheetHeight: l,
324
- visibleTranslate: o
331
+ visibleTranslate: a
325
332
  }) {
326
333
  return {
327
- maxTranslate: n > 0 ? n : r ? l : o,
334
+ maxTranslate: n > 0 ? n : r ? l : a,
328
335
  minTranslate: 0
329
336
  };
330
337
  }
338
+ function de(r, n = 1) {
339
+ const l = Math.max(n, 1);
340
+ return r && Math.abs(r.maxTranslate - r.minTranslate) || l;
341
+ }
342
+ function fe({
343
+ limit: r,
344
+ viewportSize: n,
345
+ viewportLimitRatio: l
346
+ }) {
347
+ const a = Math.max(r, 0);
348
+ return n <= 0 ? a : Math.min(a, n * l);
349
+ }
331
350
  function _e({
351
+ minTranslate: r,
352
+ sheetHeight: n,
353
+ surfaceMotion: l
354
+ }) {
355
+ const a = l.parentElement?.getBoundingClientRect(), i = a?.top ?? 0, f = a && a.height > 0 ? a.height : window.innerHeight, T = l.getBoundingClientRect(), y = Vt(l), w = T.top - y + r, P = Math.max(w - i, 0), { observedViewportLimitRatio: S } = b.rubberBand;
356
+ return {
357
+ minBoundaryLimit: fe({
358
+ limit: P,
359
+ viewportSize: f,
360
+ viewportLimitRatio: S.top
361
+ }),
362
+ maxBoundaryLimit: fe({
363
+ limit: n,
364
+ viewportSize: f,
365
+ viewportLimitRatio: S.bottom
366
+ })
367
+ };
368
+ }
369
+ function Ue({
332
370
  rubberBand: r,
333
371
  targetTranslate: n,
334
372
  sheetHeight: l,
335
- peekTranslate: o,
336
- visibleTranslate: i,
337
- dismissible: g
373
+ peekTranslate: a,
374
+ bounds: i,
375
+ rubberBandLimits: f
338
376
  }) {
339
- const T = ze({
340
- dismissible: g,
341
- peekTranslate: o,
342
- sheetHeight: l,
343
- visibleTranslate: i
344
- }), h = b(
345
- r ? Nt({
377
+ const T = L(
378
+ r ? Ot({
346
379
  targetTranslate: n,
347
- dimension: l,
348
- ...T
380
+ ...f,
381
+ ...i
349
382
  }) : n,
350
- -l,
351
- T.maxTranslate + l
352
- ), X = Math.max(-h, 0), D = Math.max(h, 0), E = o > 0 ? o : l, $ = E > 0 ? 1 - D / Math.max(E, 1) : 0;
383
+ i.minTranslate - f.minBoundaryLimit,
384
+ i.maxTranslate + f.maxBoundaryLimit
385
+ ), y = Math.max(-T, 0), w = Math.max(T, 0), P = a > 0 ? a : l, S = P > 0 ? 1 - w / Math.max(P, 1) : 0;
353
386
  return {
354
- translate: h,
355
- overshootFillHeight: X,
356
- backdropOpacity: b($, 0, 1)
387
+ translate: T,
388
+ overshootFillHeight: y,
389
+ backdropOpacity: L(S, 0, 1)
357
390
  };
358
391
  }
359
- function Ke({
392
+ function Qe({
360
393
  enabled: r,
361
394
  drag: n,
362
395
  open: l,
363
- placement: o,
396
+ placement: a,
364
397
  surfaceMotionRef: i,
365
- backdropRef: g,
398
+ backdropRef: f,
366
399
  bodyNode: T,
367
- snapHeights: h = Me,
368
- snapPositions: X = be,
369
- defaultSnapPosition: D,
370
- peekHeight: E,
371
- peekFallback: $,
400
+ snapHeights: y = be,
401
+ snapPositions: w = Le,
402
+ defaultSnapPosition: P,
403
+ peekHeight: S,
404
+ peekFallback: nt,
372
405
  presentationState: F,
373
- setPresentationState: vt,
406
+ setPresentationState: Yt,
374
407
  requestClose: pt,
375
- canCloseAttempt: Vt,
376
- dismissible: _ = !0,
377
- visibleTranslate: N = 0,
408
+ canCloseAttempt: Nt,
409
+ dismissible: z = !0,
410
+ visibleTranslate: O = 0,
378
411
  closeThreshold: Mt = 0.35,
379
- scrollLockTimeout: Bt = 500
412
+ scrollLockTimeout: Ht = 500
380
413
  }) {
381
- const y = v({
414
+ const x = E({
382
415
  dragging: !1,
383
416
  allowed: !1,
384
417
  chrome: !1,
@@ -397,366 +430,373 @@ function Ke({
397
430
  samples: [],
398
431
  pointerId: null,
399
432
  touchId: null
400
- }), H = v(T), jt = v(!1), dt = v(0), bt = v(!1), U = v(null), V = v(
433
+ }), U = E(T), jt = E(!1), dt = E(0), Et = E(!1), R = E(null), V = E(
401
434
  null
402
- ), ft = v(null), at = v(null), B = v(null), Et = v(!1), Ft = v(!1), ot = v(!1), P = je({
435
+ ), ft = E(null), at = E(null), N = E(null), bt = E(!1), Lt = E(!1), ot = E(!1), X = ze({
403
436
  drag: n,
404
- placement: o,
405
- snapPositionCount: X.length
406
- }), zt = `${D ?? ""}:${X.join("|")}`, _t = v(X), gt = v(D);
437
+ placement: a,
438
+ snapPositionCount: w.length
439
+ }), zt = `${P ?? ""}:${w.join("|")}`, Rt = E(w), gt = E(P);
407
440
  lt(() => {
408
- _t.current = X, gt.current = D;
409
- }, [D, zt, X]), lt(() => {
410
- const t = H.current;
411
- t && t !== T && Ct(t, !1), H.current = T, jt.current && Ct(T, !0);
441
+ Rt.current = w, gt.current = P;
442
+ }, [P, zt, w]), lt(() => {
443
+ const t = U.current;
444
+ t && t !== T && Bt(t, !1), U.current = T, jt.current && Bt(T, !0);
412
445
  }, [T]);
413
- const R = d((t) => {
414
- jt.current = t, Ct(H.current, t);
415
- }, []), mt = d(
446
+ const $ = p((t) => {
447
+ jt.current = t, Bt(U.current, t);
448
+ }, []), mt = p(
416
449
  ({ chrome: t, target: e }) => {
417
- const a = Xe({
450
+ const o = ve({
418
451
  target: e,
419
452
  chrome: t,
420
- bodyNode: H.current
453
+ bodyNode: U.current
421
454
  });
422
- return R(a), a;
455
+ return $(o), o;
423
456
  },
424
- [R]
425
- ), I = d(() => i.current?.getBoundingClientRect().height ?? window.innerHeight, [i]), Ut = d(() => {
426
- if (E !== void 0) return E;
427
- if ($ === "header")
457
+ [$]
458
+ ), B = p(() => i.current?.getBoundingClientRect().height ?? window.innerHeight, [i]), _t = p(() => {
459
+ if (S !== void 0) return S;
460
+ if (nt === "header")
428
461
  return i.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
429
- }, [$, E, i]), k = d(() => {
430
- const t = Ut();
462
+ }, [nt, S, i]), k = p(() => {
463
+ const t = _t();
431
464
  if (t === void 0 || t <= 0) return 0;
432
- const e = I();
433
- return b(e - t, 0, e);
434
- }, [Ut, I]), kt = d(
435
- () => F === "peeked" ? k() : N,
436
- [k, F, N]
437
- ), ht = d(() => {
465
+ const e = B();
466
+ return L(e - t, 0, e);
467
+ }, [_t, B]), Ft = p(
468
+ () => F === "peeked" ? k() : O,
469
+ [k, F, O]
470
+ ), ht = p(() => {
438
471
  const t = i.current;
439
- if (!t) return kt();
440
- const e = nt(
472
+ if (!t) return Ft();
473
+ const e = rt(
441
474
  t.style.getPropertyValue("--oc-modal-translate-y")
442
475
  );
443
476
  if (e !== void 0) return e;
444
- const a = nt(
477
+ const o = rt(
445
478
  window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
446
479
  );
447
- return a !== void 0 ? a : kt();
448
- }, [kt, i]), Tt = d(() => {
480
+ return o !== void 0 ? o : Ft();
481
+ }, [Ft, i]), Tt = p(() => {
449
482
  const t = i.current;
450
483
  if (!t) return { x: 0, y: 0 };
451
- const e = nt(
484
+ const e = rt(
452
485
  t.style.getPropertyValue("--oc-modal-translate-x")
453
- ), a = nt(
486
+ ), o = rt(
454
487
  t.style.getPropertyValue("--oc-modal-translate-y")
455
488
  );
456
- if (e !== void 0 || a !== void 0)
489
+ if (e !== void 0 || o !== void 0)
457
490
  return {
458
491
  x: e ?? 0,
459
- y: a ?? 0
492
+ y: o ?? 0
460
493
  };
461
494
  const c = window.getComputedStyle(t);
462
495
  return {
463
- x: nt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
464
- y: nt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
496
+ x: rt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
497
+ y: rt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
465
498
  };
466
- }, [i]), yt = d(() => {
467
- const t = ht(), e = se(i.current);
499
+ }, [i]), yt = p(() => {
500
+ const t = ht(), e = Vt(i.current);
468
501
  return Math.abs(e - t) > 1 ? e : t;
469
- }, [ht, i]), K = d(() => {
502
+ }, [ht, i]), G = p(() => {
470
503
  const t = Tt(), e = le(i.current);
471
504
  return ut(e, t) > 1 ? e : t;
472
- }, [Tt, i]), j = d(
505
+ }, [Tt, i]), H = p(
473
506
  (t, {
474
507
  active: e,
475
- nextDismissible: a = _,
508
+ nextDismissible: o = z,
476
509
  rubberBand: c = !1
477
510
  }) => {
478
511
  const s = i.current;
479
512
  if (!s) return;
480
- const u = I(), p = s.parentElement, f = k(), m = _e({
513
+ const u = B(), d = s.parentElement, g = k(), m = Re({
514
+ dismissible: o,
515
+ peekTranslate: g,
516
+ sheetHeight: u,
517
+ visibleTranslate: O
518
+ }), h = _e({
519
+ minTranslate: m.minTranslate,
520
+ sheetHeight: u,
521
+ surfaceMotion: s
522
+ }), v = Ue({
481
523
  rubberBand: c,
482
524
  targetTranslate: t,
483
525
  sheetHeight: u,
484
- peekTranslate: f,
485
- visibleTranslate: N,
486
- dismissible: a
526
+ peekTranslate: g,
527
+ bounds: m,
528
+ rubberBandLimits: h
487
529
  });
488
- y.current.lastTranslate = m.translate, s.style.setProperty(
530
+ x.current.lastTranslate = v.translate, s.style.setProperty(
489
531
  "--oc-modal-translate-y",
490
- `${m.translate}px`
532
+ `${v.translate}px`
491
533
  ), s.style.setProperty(
492
534
  "--_-modal-elevation-shadow-opacity",
493
- String(1 - m.backdropOpacity)
494
- ), s.dataset.ocModalDragging = e ? "true" : "false", p?.style.setProperty(
535
+ String(1 - v.backdropOpacity)
536
+ ), s.dataset.ocModalDragging = e ? "true" : "false", d?.style.setProperty(
495
537
  "--oc-modal-overshoot-fill-height",
496
- `${m.overshootFillHeight}px`
497
- ), p && (p.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), g.current && (g.current.style.setProperty(
538
+ `${v.overshootFillHeight}px`
539
+ ), d && (d.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), f.current && (f.current.style.setProperty(
498
540
  "--oc-modal-backdrop-opacity",
499
- String(m.backdropOpacity)
500
- ), g.current.style.transition = e ? "none" : "");
541
+ String(v.backdropOpacity)
542
+ ), f.current.style.transition = e ? "none" : "");
501
543
  },
502
544
  [
503
- g,
504
- _,
545
+ f,
546
+ z,
505
547
  k,
506
- I,
548
+ B,
507
549
  i,
508
- N
550
+ O
509
551
  ]
510
- ), q = d(() => {
511
- const t = i.current, e = _t.current;
552
+ ), K = p(() => {
553
+ const t = i.current, e = Rt.current;
512
554
  if (!(!t || !e.length))
513
- return we({
555
+ return De({
514
556
  defaultSnapPosition: gt.current,
515
557
  snapPositions: e,
516
558
  surfaceMotion: t
517
559
  });
518
- }, [i]), J = d(
560
+ }, [i]), q = p(
519
561
  ({ destroy: t = !0 } = {}) => {
520
562
  t && V.current?.destroy(), V.current = null, ft.current = null;
521
563
  },
522
564
  []
523
- ), S = d(
565
+ ), Y = p(
524
566
  (t, { active: e }) => {
525
- const a = i.current;
526
- if (!a) return;
527
- const c = q(), s = c ? a.getBoundingClientRect() : void 0, u = c ? ae(c.targets, "x") : void 0, p = c ? ae(c.targets, "y") : void 0, f = c ? {
528
- x: Nt({
567
+ const o = i.current;
568
+ if (!o) return;
569
+ const c = K(), s = c ? o.getBoundingClientRect() : void 0, u = c ? oe(c.targets, "x") : void 0, d = c ? oe(c.targets, "y") : void 0, g = de(u, s?.width), m = de(d, s?.height), h = c ? {
570
+ x: Ot({
529
571
  targetTranslate: t.x,
530
572
  minTranslate: u?.minTranslate ?? 0,
531
573
  maxTranslate: u?.maxTranslate ?? 0,
532
- dimension: Math.abs(
533
- (u?.maxTranslate ?? 0) - (u?.minTranslate ?? 0)
534
- ) || s?.width || 1
574
+ minBoundaryLimit: g,
575
+ maxBoundaryLimit: g
535
576
  }),
536
- y: Nt({
577
+ y: Ot({
537
578
  targetTranslate: t.y,
538
- minTranslate: p?.minTranslate ?? 0,
539
- maxTranslate: p?.maxTranslate ?? 0,
540
- dimension: Math.abs(
541
- (p?.maxTranslate ?? 0) - (p?.minTranslate ?? 0)
542
- ) || s?.height || 1
579
+ minTranslate: d?.minTranslate ?? 0,
580
+ maxTranslate: d?.maxTranslate ?? 0,
581
+ minBoundaryLimit: m,
582
+ maxBoundaryLimit: m
543
583
  })
544
584
  } : t;
545
- y.current.lastTranslateX = f.x, y.current.lastTranslate = f.y, a.style.setProperty(
585
+ x.current.lastTranslateX = h.x, x.current.lastTranslate = h.y, o.style.setProperty(
546
586
  "--oc-modal-translate-x",
547
- `${f.x}px`
548
- ), a.style.setProperty(
587
+ `${h.x}px`
588
+ ), o.style.setProperty(
549
589
  "--oc-modal-translate-y",
550
- `${f.y}px`
551
- ), a.dataset.ocModalDragging = e ? "true" : "false", a.parentElement && (a.parentElement.dataset.ocModalDragging = e ? "true" : "false"), a.style.transition = e ? "none" : "";
590
+ `${h.y}px`
591
+ ), o.dataset.ocModalDragging = e ? "true" : "false", o.parentElement && (o.parentElement.dataset.ocModalDragging = e ? "true" : "false"), o.style.transition = e ? "none" : "";
552
592
  },
553
- [q, i]
554
- ), Y = d(() => {
555
- U.current?.destroy(), U.current = null, J();
556
- }, [J]), Q = d(
557
- (t, e = _) => {
558
- Y(), j(t, {
593
+ [K, i]
594
+ ), M = p(() => {
595
+ R.current?.destroy(), R.current = null, q();
596
+ }, [q]), J = p(
597
+ (t, e = z) => {
598
+ M(), H(t, {
559
599
  active: !0,
560
600
  nextDismissible: e,
561
601
  rubberBand: !0
562
602
  });
563
603
  },
564
- [j, Y, _]
565
- ), w = d(() => {
604
+ [H, M, z]
605
+ ), D = p(() => {
566
606
  const t = i.current;
567
- t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), g.current?.style.removeProperty("transition"));
568
- }, [g, i]), Wt = d(
607
+ t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), f.current?.style.removeProperty("transition"));
608
+ }, [f, i]), Ut = p(
569
609
  ({ resetY: t = !0 } = {}) => {
570
610
  const e = i.current;
571
- e && (at.current = null, y.current.lastTranslateX = 0, e.style.removeProperty("--oc-modal-translate-x"), t && (y.current.lastTranslate = 0, e.style.removeProperty("--oc-modal-translate-y")), w());
611
+ e && (at.current = null, x.current.lastTranslateX = 0, e.style.removeProperty("--oc-modal-translate-x"), t && (x.current.lastTranslate = 0, e.style.removeProperty("--oc-modal-translate-y")), D());
572
612
  },
573
- [w, i]
574
- ), A = d(
613
+ [D, i]
614
+ ), A = p(
575
615
  (t, {
576
616
  initialVelocity: e = 0,
577
- intent: a = "gesture",
578
- phase: c = "settle",
617
+ intent: o = "sheet",
618
+ phase: c = "release",
579
619
  from: s,
580
620
  onComplete: u
581
621
  } = {}) => {
582
- const p = i.current;
583
- if (!p) return;
584
- Y();
585
- const f = s ?? se(p);
586
- if (Math.abs(f - t) < 0.5) {
587
- j(t, { active: !1 }), w(), u?.();
622
+ const d = i.current;
623
+ if (!d) return;
624
+ M();
625
+ const g = s ?? Vt(d);
626
+ if (Math.abs(g - t) < 0.5) {
627
+ H(t, { active: !1 }), D(), u?.();
588
628
  return;
589
629
  }
590
- j(f, { active: !0 });
591
- const m = It({
592
- element: p,
593
- intent: a,
630
+ H(g, { active: !0 });
631
+ const m = At({
632
+ element: d,
633
+ intent: o,
594
634
  phase: c,
595
635
  reduced: "preserve",
596
636
  reducedMotion: !1,
597
637
  property: "transform"
598
- }), x = Ot({
599
- value: f,
638
+ }), h = It({
639
+ value: g,
600
640
  target: t,
601
641
  velocity: e,
602
642
  spring: m.spring,
603
643
  epsilon: 0.5,
604
644
  velocityEpsilon: 50,
605
645
  stabilityWindow: 0.02,
606
- onUpdate: (C) => {
607
- j(C, { active: !0 });
646
+ onUpdate: (v) => {
647
+ H(v, { active: !0 });
608
648
  },
609
649
  onComplete: () => {
610
- U.current === x && (U.current = null), j(t, { active: !1 }), w(), u?.();
650
+ R.current === h && (R.current = null), H(t, { active: !1 }), D(), u?.();
611
651
  }
612
652
  });
613
- U.current = x;
653
+ R.current = h;
614
654
  },
615
- [j, Y, w, i]
616
- ), W = d(
655
+ [H, M, D, i]
656
+ ), _ = p(
617
657
  (t, {
618
658
  from: e,
619
- initialVelocity: a = { x: 0, y: 0 }
659
+ initialVelocity: o = { x: 0, y: 0 }
620
660
  } = {}) => {
621
661
  const c = i.current;
622
662
  if (!c) return;
623
- Y();
663
+ M();
624
664
  const s = e ?? le(c), u = { x: t.x, y: t.y };
625
665
  if (ut(s, u) < 0.5) {
626
- S(u, { active: !1 }), w();
666
+ Y(u, { active: !1 }), D();
627
667
  return;
628
668
  }
629
- S(s, { active: !0 });
630
- const f = It({
669
+ Y(s, { active: !0 });
670
+ const g = At({
631
671
  element: c,
632
672
  intent: "gesture",
633
- phase: "settle",
673
+ phase: "release",
634
674
  reduced: "preserve",
635
675
  reducedMotion: !1,
636
676
  property: "transform"
637
- }), m = Ot({
677
+ }), m = It({
638
678
  value: s,
639
679
  target: u,
640
- velocity: a,
641
- spring: f.spring,
680
+ velocity: o,
681
+ spring: g.spring,
642
682
  epsilon: 0.5,
643
683
  velocityEpsilon: 50,
644
684
  stabilityWindow: 0.02,
645
- onUpdate: (x) => {
646
- S(x, { active: !0 });
685
+ onUpdate: (h) => {
686
+ Y(h, { active: !0 });
647
687
  },
648
688
  onComplete: () => {
649
- U.current === m && (U.current = null), S(u, { active: !1 }), w();
689
+ R.current === m && (R.current = null), Y(u, { active: !1 }), D();
650
690
  }
651
691
  });
652
- U.current = m;
692
+ R.current = m;
653
693
  },
654
694
  [
655
- S,
656
695
  Y,
657
- w,
696
+ M,
697
+ D,
658
698
  i
659
699
  ]
660
- ), Z = d(() => {
700
+ ), Q = p(() => {
661
701
  const t = V.current;
662
702
  if (!t) return null;
663
703
  const e = t.sample();
664
- return S(e.value, { active: !0 }), e;
665
- }, [S]), $t = d(
704
+ return Y(e.value, { active: !0 }), e;
705
+ }, [Y]), Wt = p(
666
706
  (t) => {
667
707
  if (!i.current) return null;
668
- Y(), S(t, { active: !0 });
669
- const a = Ot({
708
+ M(), Y(t, { active: !0 });
709
+ const o = It({
670
710
  value: t,
671
711
  target: t,
672
- spring: ve,
712
+ spring: Ee,
673
713
  autoplay: !1,
674
714
  epsilon: 0.5,
675
715
  velocityEpsilon: 50,
676
716
  stabilityWindow: 0.02,
677
717
  onUpdate: (c) => {
678
- S(c, { active: !0 });
718
+ Y(c, { active: !0 });
679
719
  },
680
720
  onComplete: () => {
681
721
  const c = ft.current;
682
- !c || V.current !== a || (J({ destroy: !1 }), S(c, { active: !1 }), w());
722
+ !c || V.current !== o || (q({ destroy: !1 }), Y(c, { active: !1 }), D());
683
723
  }
684
724
  });
685
- return V.current = a, a;
725
+ return V.current = o, o;
686
726
  },
687
727
  [
688
- S,
689
728
  Y,
690
- J,
691
- w,
729
+ M,
730
+ q,
731
+ D,
692
732
  i
693
733
  ]
694
- ), Ht = d(
734
+ ), $t = p(
695
735
  (t) => {
696
- const e = V.current ?? $t(K());
736
+ const e = V.current ?? Wt(G());
697
737
  e && (ft.current = null, e.setTarget(t));
698
738
  },
699
- [K, $t]
700
- ), tt = d(
739
+ [G, Wt]
740
+ ), Z = p(
701
741
  (t, e) => {
702
- const a = Yt(t, e);
703
- return Ht(a), Z(), a;
742
+ const o = St(t, e);
743
+ return $t(o), Q(), o;
704
744
  },
705
- [Z, Ht]
706
- ), xt = d(
745
+ [Q, $t]
746
+ ), xt = p(
707
747
  (t) => {
708
- const e = i.current, a = V.current;
709
- if (!e || !a) {
710
- W(t);
748
+ const e = i.current, o = V.current;
749
+ if (!e || !o) {
750
+ _(t);
711
751
  return;
712
752
  }
713
- const s = Z() ? Tt() : a.value, u = { x: t.x, y: t.y };
753
+ const s = Q() ? Tt() : o.value, u = { x: t.x, y: t.y };
714
754
  if (ut(s, u) < 0.5) {
715
- J(), S(u, { active: !1 }), w();
755
+ q(), Y(u, { active: !1 }), D();
716
756
  return;
717
757
  }
718
- const p = It({
758
+ const d = At({
719
759
  element: e,
720
760
  intent: "gesture",
721
- phase: "settle",
761
+ phase: "release",
722
762
  reduced: "preserve",
723
763
  reducedMotion: !1,
724
764
  property: "transform"
725
765
  });
726
- ft.current = u, a.setTarget(u, { spring: p.spring });
766
+ ft.current = u, o.setTarget(u, { spring: d.spring });
727
767
  },
728
768
  [
729
- S,
730
- J,
731
- w,
769
+ Y,
770
+ q,
771
+ D,
732
772
  Tt,
733
- Z,
734
- W,
773
+ Q,
774
+ _,
735
775
  i
736
776
  ]
737
- ), Pt = d(
777
+ ), wt = p(
738
778
  ({
739
779
  key: t,
740
780
  settle: e
741
781
  }) => {
742
- if (y.current.dragging) return !1;
743
- const a = q();
744
- if (!a) return !1;
745
- const c = (t ? a.targets.find((s) => s.key === t) : void 0) ?? a.defaultTarget;
746
- return at.current = c.key, e ? W(c) : (Y(), S(c, { active: !1 }), w()), !0;
782
+ if (x.current.dragging) return !1;
783
+ const o = K();
784
+ if (!o) return !1;
785
+ const c = (t ? o.targets.find((s) => s.key === t) : void 0) ?? o.defaultTarget;
786
+ return at.current = c.key, e ? _(c) : (M(), Y(c, { active: !1 }), D()), !0;
747
787
  },
748
788
  [
749
- S,
750
789
  Y,
751
- w,
752
- q,
753
- W
790
+ M,
791
+ D,
792
+ K,
793
+ _
754
794
  ]
755
- ), Gt = d(
756
- (t, { from: e, initialVelocity: a = 0 }) => {
795
+ ), Gt = p(
796
+ (t, { from: e, initialVelocity: o = 0 }) => {
757
797
  A(t, {
758
798
  from: e,
759
- initialVelocity: a,
799
+ initialVelocity: o,
760
800
  onComplete: () => {
761
801
  pt({ reason: "drag-dismiss" }, { skipAttempt: !0 });
762
802
  }
@@ -764,24 +804,24 @@ function Ke({
764
804
  },
765
805
  [pt, A]
766
806
  );
767
- At(
807
+ kt(
768
808
  () => () => {
769
- Y(), i.current && w();
809
+ M(), i.current && D();
770
810
  },
771
- [Y, w, i]
811
+ [M, D, i]
772
812
  ), lt(() => {
773
- if (!l || !r || o !== "bottom") {
774
- Et.current = l;
813
+ if (!l || !r || a !== "bottom") {
814
+ bt.current = l;
775
815
  return;
776
816
  }
777
- const t = Et.current;
778
- Et.current = !0;
779
- const e = F === "peeked" ? k() : N;
817
+ const t = bt.current;
818
+ bt.current = !0;
819
+ const e = F === "peeked" ? k() : O;
780
820
  if (!t) {
781
- const a = I();
782
- j(a, { active: !0 }), A(e, {
783
- from: a,
784
- intent: "move",
821
+ const o = B();
822
+ H(o, { active: !0 }), A(e, {
823
+ from: o,
824
+ intent: "sheet",
785
825
  phase: "enter"
786
826
  });
787
827
  return;
@@ -790,178 +830,178 @@ function Ke({
790
830
  A(k());
791
831
  return;
792
832
  }
793
- if (bt.current) {
794
- bt.current = !1;
833
+ if (Et.current) {
834
+ Et.current = !1;
795
835
  return;
796
836
  }
797
- A(N);
837
+ A(O);
798
838
  }, [
799
839
  r,
800
840
  k,
801
- I,
841
+ B,
802
842
  l,
803
- o,
843
+ a,
804
844
  F,
805
- j,
845
+ H,
806
846
  A,
807
- N
847
+ O
808
848
  ]), lt(() => {
809
- if (!l || !r || !P) {
810
- const c = !l && o === "popup" && ot.current;
811
- ot.current && !c && (B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null), Y(), Wt()), ot.current && c && (Y(), w()), Ft.current = l && o === "popup", ot.current = !1;
849
+ if (!l || !r || !X) {
850
+ const c = !l && a === "popup" && ot.current;
851
+ ot.current && !c && (N.current !== null && (window.cancelAnimationFrame(N.current), N.current = null), M(), Ut()), ot.current && c && (M(), D()), Lt.current = l && a === "popup", ot.current = !1;
812
852
  return;
813
853
  }
814
- const t = Ft.current;
815
- Ft.current = !0, ot.current = !0;
854
+ const t = Lt.current;
855
+ Lt.current = !0, ot.current = !0;
816
856
  let e = null;
817
- const a = (c) => Pt({
857
+ const o = (c) => wt({
818
858
  key: c,
819
859
  settle: t
820
860
  });
821
- return a(gt.current) || (e = window.requestAnimationFrame(() => {
822
- e = null, a(
861
+ return o(gt.current) || (e = window.requestAnimationFrame(() => {
862
+ e = null, o(
823
863
  at.current ?? gt.current
824
864
  );
825
865
  })), () => {
826
866
  e !== null && window.cancelAnimationFrame(e);
827
867
  };
828
868
  }, [
829
- Y,
869
+ M,
830
870
  r,
831
- w,
871
+ D,
832
872
  l,
833
- o,
873
+ a,
834
874
  zt,
835
- P,
836
- Wt,
837
- Pt
875
+ X,
876
+ Ut,
877
+ wt
838
878
  ]), lt(() => {
839
- if (!l || !r || !P) return;
879
+ if (!l || !r || !X) return;
840
880
  const t = () => {
841
- y.current.dragging || B.current === null && (B.current = window.requestAnimationFrame(() => {
842
- B.current = null, !y.current.dragging && Pt({
881
+ x.current.dragging || N.current === null && (N.current = window.requestAnimationFrame(() => {
882
+ N.current = null, !x.current.dragging && wt({
843
883
  key: at.current,
844
884
  settle: !1
845
885
  });
846
886
  }));
847
887
  };
848
888
  window.addEventListener("resize", t), window.visualViewport?.addEventListener("resize", t);
849
- const e = i.current, a = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
850
- return c && (e && c.observe(e), a && c.observe(a)), () => {
851
- window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), c?.disconnect(), B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null);
889
+ const e = i.current, o = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
890
+ return c && (e && c.observe(e), o && c.observe(o)), () => {
891
+ window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), c?.disconnect(), N.current !== null && (window.cancelAnimationFrame(N.current), N.current = null);
852
892
  };
853
893
  }, [
854
894
  r,
855
895
  l,
856
- P,
896
+ X,
857
897
  i,
858
- Pt
898
+ wt
859
899
  ]);
860
- const Rt = d(
861
- (t, e, a) => {
862
- if (typeof Element > "u" || !(t instanceof Element) || Lt(t)) return !1;
863
- const c = Date.now(), s = e > 0, u = De(t, H.current);
864
- return !a && u && s && u.scrollTop > 0 || !a && dt.current && c - dt.current < Bt && Math.abs(ht()) <= 1 ? (dt.current = c, !1) : !0;
900
+ const Kt = p(
901
+ (t, e, o) => {
902
+ if (typeof Element > "u" || !(t instanceof Element) || Ct(t)) return !1;
903
+ const c = Date.now(), s = e > 0, u = Se(t, U.current);
904
+ return !o && u && s && u.scrollTop > 0 || !o && dt.current && c - dt.current < Ht && Math.abs(ht()) <= 1 ? (dt.current = c, !1) : !0;
865
905
  },
866
- [ht, Bt]
867
- ), wt = d(
906
+ [ht, Ht]
907
+ ), Pt = p(
868
908
  ({
869
909
  chrome: t,
870
910
  pointerId: e = null,
871
- source: a,
911
+ source: o,
872
912
  startX: c = 0,
873
913
  startY: s,
874
914
  touchId: u = null
875
915
  }) => {
876
- const p = yt(), f = K(), m = ct();
877
- y.current = {
916
+ const d = yt(), g = G(), m = it();
917
+ x.current = {
878
918
  dragging: !0,
879
919
  allowed: !1,
880
920
  chrome: t,
881
921
  closeAllowed: null,
882
922
  started: !1,
883
- source: a,
923
+ source: o,
884
924
  startX: c,
885
925
  startY: s,
886
926
  lastX: c,
887
927
  lastY: s,
888
- startTranslateX: f.x,
889
- startTranslate: p,
890
- lastTranslateX: f.x,
891
- lastTranslate: p,
928
+ startTranslateX: g.x,
929
+ startTranslate: d,
930
+ lastTranslateX: g.x,
931
+ lastTranslate: d,
892
932
  startTime: m,
893
933
  samples: [
894
934
  {
895
935
  time: m,
896
936
  pageX: c,
897
937
  pageY: s,
898
- translateX: f.x,
899
- translateY: p
938
+ translateX: g.x,
939
+ translateY: d
900
940
  }
901
941
  ],
902
942
  pointerId: e,
903
943
  touchId: u
904
944
  };
905
945
  },
906
- [yt, K]
907
- ), et = d(
946
+ [yt, G]
947
+ ), tt = p(
908
948
  (t) => {
909
- t.source === "touch" && R(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
949
+ t.source === "touch" && $(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
910
950
  },
911
- [R]
912
- ), Kt = d(
951
+ [$]
952
+ ), qt = p(
913
953
  (t, e) => {
914
- const a = yt(), c = K();
915
- t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = a, t.lastTranslateX = c.x, t.lastTranslate = a, t.startTime = ct(), t.samples = [
954
+ const o = yt(), c = G();
955
+ t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = c.x, t.startTranslate = o, t.lastTranslateX = c.x, t.lastTranslate = o, t.startTime = it(), t.samples = [
916
956
  {
917
957
  time: t.startTime,
918
958
  pageX: e.x,
919
959
  pageY: e.y,
920
960
  translateX: c.x,
921
- translateY: a
961
+ translateY: o
922
962
  }
923
963
  ];
924
964
  },
925
- [yt, K]
926
- ), qt = d(
965
+ [yt, G]
966
+ ), Jt = p(
927
967
  ({
928
968
  currentTranslate: t,
929
969
  dismissible: e,
930
- releaseVelocity: a,
970
+ releaseVelocity: o,
931
971
  deltaY: c,
932
972
  startTranslate: s
933
973
  }) => {
934
- const u = I(), p = k(), f = p > 0, m = u, x = Math.max(
935
- M.dismissal.minDistancePx,
936
- (u - p) * Mt
937
- ), C = h.map(
938
- (O) => b(u - O, 0, u)
939
- ), z = te(
940
- C.length ? C : [0]
941
- ), L = Ce({
974
+ const u = B(), d = k(), g = d > 0, m = u, h = Math.max(
975
+ b.dismissal.minDistancePx,
976
+ (u - d) * Mt
977
+ ), v = y.map(
978
+ (I) => L(u - I, 0, u)
979
+ ), j = ee(
980
+ v.length ? v : [0]
981
+ ), C = Ie({
942
982
  currentTranslate: t,
943
- releaseVelocity: a
983
+ releaseVelocity: o
944
984
  });
945
- f && z.push(p);
946
- const st = te(z);
947
- return e && !f && c > 0 && t >= p + x ? m : Oe(a) ? st.length > 1 ? ke(
985
+ g && j.push(d);
986
+ const st = ee(j);
987
+ return e && !g && c > 0 && t >= d + h ? m : Ve(o) ? st.length > 1 ? Ae(
948
988
  st,
949
989
  s,
950
990
  t,
951
991
  c > 0 ? "down" : "up",
952
- L
953
- ) : 0 : e && t > u * Mt && !f ? m : Ee(st, t);
992
+ C
993
+ ) : 0 : e && t > u * Mt && !g ? m : Fe(st, t);
954
994
  },
955
- [Mt, k, I, h]
956
- ), fe = d(
995
+ [Mt, k, B, y]
996
+ ), me = p(
957
997
  (t) => {
958
- if (!r || o !== "bottom" && !P || n === !1 || t.pointerType === "touch" || Lt(t.target)) return;
998
+ if (!r || a !== "bottom" && !X || n === !1 || t.pointerType === "touch" || Ct(t.target)) return;
959
999
  let e = !1;
960
1000
  if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
961
1001
  e = !0;
962
1002
  else if (n === "handle")
963
1003
  return;
964
- n === "content" && (e = ne(t.target), !Ae(t, e)) || (wt({
1004
+ n === "content" && (e = ae(t.target), !Be(t, e)) || (Pt({
965
1005
  chrome: e,
966
1006
  pointerId: t.pointerId,
967
1007
  source: "pointer",
@@ -969,33 +1009,33 @@ function Ke({
969
1009
  startY: t.pageY
970
1010
  }), t.currentTarget.setPointerCapture(t.pointerId));
971
1011
  },
972
- [wt, n, r, o, P]
973
- ), rt = d(
1012
+ [Pt, n, r, a, X]
1013
+ ), et = p(
974
1014
  (t, e) => {
975
- if (!_) return !1;
1015
+ if (!z) return !1;
976
1016
  if (e <= 0) return !0;
977
1017
  if (t.closeAllowed !== null) return t.closeAllowed;
978
- const a = Vt({ reason: "drag-dismiss" });
979
- return t.closeAllowed = a, a;
1018
+ const o = Nt({ reason: "drag-dismiss" });
1019
+ return t.closeAllowed = o, o;
980
1020
  },
981
- [Vt, _]
982
- ), Xt = d(
1021
+ [Nt, z]
1022
+ ), Xt = p(
983
1023
  ({
984
1024
  closeAllowed: t,
985
1025
  currentTranslate: e,
986
- deltaY: a,
1026
+ deltaY: o,
987
1027
  releaseVelocity: c,
988
1028
  startTranslate: s
989
1029
  }) => {
990
- const p = qt({
1030
+ const d = Jt({
991
1031
  currentTranslate: e,
992
- dismissible: _ && t !== !1,
1032
+ dismissible: z && t !== !1,
993
1033
  releaseVelocity: c,
994
- deltaY: a,
1034
+ deltaY: o,
995
1035
  startTranslate: s
996
- }), f = I(), m = k();
997
- if (p >= f - 1) {
998
- pt({ reason: "drag-dismiss" }, { commit: !1 }) ? Gt(p, {
1036
+ }), g = B(), m = k();
1037
+ if (d >= g - 1) {
1038
+ pt({ reason: "drag-dismiss" }, { commit: !1 }) ? Gt(d, {
999
1039
  from: e,
1000
1040
  initialVelocity: c
1001
1041
  }) : A(s, {
@@ -1004,63 +1044,63 @@ function Ke({
1004
1044
  });
1005
1045
  return;
1006
1046
  }
1007
- m > 0 && p >= m - 1 ? vt("peeked") : (Be({
1047
+ m > 0 && d >= m - 1 ? Yt("peeked") : (je({
1008
1048
  presentationState: F,
1009
- releaseTranslate: p,
1010
- visibleTranslate: N
1011
- }) && (bt.current = !0), vt("visible")), A(p, {
1049
+ releaseTranslate: d,
1050
+ visibleTranslate: O
1051
+ }) && (Et.current = !0), Yt("visible")), A(d, {
1012
1052
  from: e,
1013
1053
  initialVelocity: c
1014
1054
  });
1015
1055
  },
1016
1056
  [
1017
1057
  Gt,
1018
- _,
1058
+ z,
1019
1059
  k,
1020
- qt,
1021
- I,
1060
+ Jt,
1061
+ B,
1022
1062
  F,
1023
1063
  pt,
1024
- vt,
1064
+ Yt,
1025
1065
  A,
1026
- N
1066
+ O
1027
1067
  ]
1028
- ), Dt = d(
1068
+ ), Dt = p(
1029
1069
  ({ currentTranslate: t, releaseVelocity: e }) => {
1030
- const a = q();
1031
- if (!a) return;
1032
- const c = Ve({
1070
+ const o = K();
1071
+ if (!o) return;
1072
+ const c = He({
1033
1073
  currentTranslate: t,
1034
1074
  releaseVelocity: e,
1035
- targets: a.targets
1075
+ targets: o.targets
1036
1076
  });
1037
1077
  if (at.current = c.key, V.current) {
1038
1078
  xt(c);
1039
1079
  return;
1040
1080
  }
1041
- W(c, {
1081
+ _(c, {
1042
1082
  from: t,
1043
1083
  initialVelocity: e
1044
1084
  });
1045
1085
  },
1046
- [q, xt, W]
1047
- ), ge = d(
1086
+ [K, xt, _]
1087
+ ), he = p(
1048
1088
  (t) => {
1049
- const e = y.current;
1050
- if (!e.dragging || e.source !== "pointer" || !r || o !== "bottom" && !P)
1089
+ const e = x.current;
1090
+ if (!e.dragging || e.source !== "pointer" || !r || a !== "bottom" && !X)
1051
1091
  return;
1052
- const a = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? M.dragStartThresholdPx.touch : M.dragStartThresholdPx.mouse;
1053
- if (!(!e.started && ee({ deltaX: a, deltaY: c, placement: o }) < s)) {
1092
+ const o = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? b.dragStartThresholdPx.touch : b.dragStartThresholdPx.mouse;
1093
+ if (!(!e.started && re({ deltaX: o, deltaY: c, placement: a }) < s)) {
1054
1094
  if (!e.allowed) {
1055
- if (o === "bottom" && !Rt(t.target, c, e.chrome))
1095
+ if (a === "bottom" && !Kt(t.target, c, e.chrome))
1056
1096
  return;
1057
1097
  e.allowed = !0, e.started = !0;
1058
1098
  }
1059
- if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, o === "popup")
1060
- tt(e, t), ce(e, t);
1099
+ if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, a === "popup")
1100
+ Z(e, t), ie(e, t);
1061
1101
  else {
1062
- const u = e.startTranslate + c, p = rt(e, c);
1063
- Q(u, p), it(e, {
1102
+ const u = e.startTranslate + c, d = et(e, c);
1103
+ J(u, d), ct(e, {
1064
1104
  pageX: t.pageX,
1065
1105
  pageY: t.pageY,
1066
1106
  translateX: e.lastTranslateX,
@@ -1071,84 +1111,84 @@ function Ke({
1071
1111
  },
1072
1112
  [
1073
1113
  r,
1074
- tt,
1075
- rt,
1076
- o,
1077
- P,
1078
- Q,
1079
- Rt
1114
+ Z,
1115
+ et,
1116
+ a,
1117
+ X,
1118
+ J,
1119
+ Kt
1080
1120
  ]
1081
- ), G = d(
1121
+ ), W = p(
1082
1122
  ({
1083
1123
  currentTarget: t,
1084
1124
  pageX: e,
1085
- pageY: a,
1125
+ pageY: o,
1086
1126
  releaseCapture: c = !0
1087
1127
  }) => {
1088
- const s = y.current;
1089
- if (!s.dragging || s.source !== "pointer" || !r || o !== "bottom" && !P)
1128
+ const s = x.current;
1129
+ if (!s.dragging || s.source !== "pointer" || !r || a !== "bottom" && !X)
1090
1130
  return;
1091
- const u = s.started, p = Number.isFinite(e) ? e : s.lastX, f = Number.isFinite(a) ? a : s.lastY, m = p - s.startX, x = f - s.startY, C = Math.max(ct() - s.startTime, 1);
1092
- let z = {
1131
+ const u = s.started, d = Number.isFinite(e) ? e : s.lastX, g = Number.isFinite(o) ? o : s.lastY, m = d - s.startX, h = g - s.startY, v = Math.max(it() - s.startTime, 1);
1132
+ let j = {
1093
1133
  x: s.lastTranslateX,
1094
1134
  y: s.lastTranslate
1095
1135
  };
1096
- const L = s.startTranslate;
1136
+ const C = s.startTranslate;
1097
1137
  if (u)
1098
- if (o === "popup")
1099
- tt(s, {
1100
- pageX: p,
1101
- pageY: f
1102
- }), z = {
1138
+ if (a === "popup")
1139
+ Z(s, {
1140
+ pageX: d,
1141
+ pageY: g
1142
+ }), j = {
1103
1143
  x: s.lastTranslateX,
1104
1144
  y: s.lastTranslate
1105
1145
  };
1106
1146
  else {
1107
- const O = s.startTranslate + x, xe = rt(s, x);
1108
- Q(O, xe), z = {
1147
+ const I = s.startTranslate + h, Pe = et(s, h);
1148
+ J(I, Pe), j = {
1109
1149
  x: s.lastTranslateX,
1110
1150
  y: s.lastTranslate
1111
1151
  };
1112
1152
  }
1113
1153
  const st = s.closeAllowed;
1114
1154
  if (c && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
1115
- const O = o === "popup" ? Yt(s, {
1116
- pageX: p,
1117
- pageY: f
1155
+ const I = a === "popup" ? St(s, {
1156
+ pageX: d,
1157
+ pageY: g
1118
1158
  }) : {
1119
1159
  x: s.lastTranslateX,
1120
1160
  y: s.lastTranslate
1121
1161
  };
1122
- it(s, {
1123
- pageX: p,
1124
- pageY: f,
1125
- translateX: O.x,
1126
- translateY: O.y
1162
+ ct(s, {
1163
+ pageX: d,
1164
+ pageY: g,
1165
+ translateX: I.x,
1166
+ translateY: I.y
1127
1167
  });
1128
1168
  }
1129
- if (et(s), !!u)
1130
- if (o === "popup") {
1131
- const O = ue({
1169
+ if (tt(s), !!u)
1170
+ if (a === "popup") {
1171
+ const I = ue({
1132
1172
  session: s,
1133
- fallbackDelta: { x: m, y: x },
1134
- fallbackElapsed: C
1173
+ fallbackDelta: { x: m, y: h },
1174
+ fallbackElapsed: v
1135
1175
  });
1136
1176
  Dt({
1137
- currentTranslate: z,
1138
- releaseVelocity: O
1177
+ currentTranslate: j,
1178
+ releaseVelocity: I
1139
1179
  });
1140
1180
  } else {
1141
- const O = ie({
1181
+ const I = ce({
1142
1182
  session: s,
1143
- fallbackDeltaY: x,
1144
- fallbackElapsed: C
1183
+ fallbackDeltaY: h,
1184
+ fallbackElapsed: v
1145
1185
  });
1146
1186
  Xt({
1147
1187
  closeAllowed: st,
1148
- currentTranslate: z.y,
1149
- deltaY: x,
1150
- releaseVelocity: O,
1151
- startTranslate: L
1188
+ currentTranslate: j.y,
1189
+ deltaY: h,
1190
+ releaseVelocity: I,
1191
+ startTranslate: C
1152
1192
  });
1153
1193
  }
1154
1194
  },
@@ -1156,64 +1196,64 @@ function Ke({
1156
1196
  Xt,
1157
1197
  Dt,
1158
1198
  r,
1159
- tt,
1160
- rt,
1161
- o,
1162
- P,
1199
+ Z,
1163
1200
  et,
1164
- Q
1201
+ a,
1202
+ X,
1203
+ tt,
1204
+ J
1165
1205
  ]
1166
- ), Jt = d(
1206
+ ), Qt = p(
1167
1207
  (t) => {
1168
- G({
1208
+ W({
1169
1209
  currentTarget: t.currentTarget,
1170
1210
  pageX: t.pageX,
1171
1211
  pageY: t.pageY
1172
1212
  });
1173
1213
  },
1174
- [G]
1175
- ), me = d(
1214
+ [W]
1215
+ ), Te = p(
1176
1216
  (t) => {
1177
- const e = y.current;
1178
- e.pointerId !== null && t.pointerId !== e.pointerId || G({
1217
+ const e = x.current;
1218
+ e.pointerId !== null && t.pointerId !== e.pointerId || W({
1179
1219
  pageX: t.pageX,
1180
1220
  pageY: t.pageY,
1181
1221
  releaseCapture: !1
1182
1222
  });
1183
1223
  },
1184
- [G]
1224
+ [W]
1185
1225
  );
1186
- At(() => {
1226
+ kt(() => {
1187
1227
  if (!r) return;
1188
1228
  const t = (s) => {
1189
- const u = y.current;
1190
- !u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || G({
1229
+ const u = x.current;
1230
+ !u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || W({
1191
1231
  pageX: s.pageX,
1192
1232
  pageY: s.pageY,
1193
1233
  releaseCapture: !1
1194
1234
  });
1195
1235
  }, e = () => {
1196
- const s = y.current;
1197
- !s.dragging || s.source !== "pointer" || G({
1236
+ const s = x.current;
1237
+ !s.dragging || s.source !== "pointer" || W({
1198
1238
  pageX: s.lastX,
1199
1239
  pageY: s.lastY,
1200
1240
  releaseCapture: !1
1201
1241
  });
1202
- }, a = (s) => {
1203
- const u = y.current;
1242
+ }, o = (s) => {
1243
+ const u = x.current;
1204
1244
  !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1205
1245
  }, c = (s) => {
1206
- const u = y.current;
1246
+ const u = x.current;
1207
1247
  !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1208
1248
  };
1209
- return document.addEventListener("pointerout", a, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
1249
+ return document.addEventListener("pointerout", o, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
1210
1250
  "pointercancel",
1211
1251
  t,
1212
1252
  !0
1213
1253
  ), window.addEventListener("blur", e), () => {
1214
1254
  document.removeEventListener(
1215
1255
  "pointerout",
1216
- a,
1256
+ o,
1217
1257
  !0
1218
1258
  ), document.removeEventListener("mouseout", c, !0), window.removeEventListener(
1219
1259
  "pointerup",
@@ -1225,78 +1265,78 @@ function Ke({
1225
1265
  !0
1226
1266
  ), window.removeEventListener("blur", e);
1227
1267
  };
1228
- }, [G, r]);
1229
- const St = d((t) => {
1230
- const e = y.current;
1231
- return e.touchId !== null ? oe(t.changedTouches, e.touchId) ?? oe(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1232
- }, []), he = d(
1268
+ }, [W, r]);
1269
+ const vt = p((t) => {
1270
+ const e = x.current;
1271
+ return e.touchId !== null ? se(t.changedTouches, e.touchId) ?? se(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1272
+ }, []), ye = p(
1233
1273
  (t) => {
1234
- if (!r || o !== "bottom" && !P || n === !1 || t.touches.length !== 1 || Lt(t.target)) return;
1274
+ if (!r || a !== "bottom" && !X || n === !1 || t.touches.length !== 1 || Ct(t.target)) return;
1235
1275
  let e = !1;
1236
1276
  if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
1237
1277
  e = !0;
1238
1278
  else if (n === "handle")
1239
1279
  return;
1240
- n === "content" && (e = ne(t.target));
1241
- const a = t.touches[0];
1242
- o === "bottom" && mt({
1280
+ n === "content" && (e = ae(t.target));
1281
+ const o = t.touches[0];
1282
+ a === "bottom" && mt({
1243
1283
  target: t.target,
1244
1284
  chrome: e
1245
- }), wt({
1285
+ }), Pt({
1246
1286
  chrome: e,
1247
1287
  source: "touch",
1248
- startX: a.pageX,
1249
- startY: a.pageY,
1250
- touchId: a.identifier
1288
+ startX: o.pageX,
1289
+ startY: o.pageY,
1290
+ touchId: o.identifier
1251
1291
  });
1252
1292
  },
1253
1293
  [
1254
- wt,
1294
+ Pt,
1255
1295
  n,
1256
1296
  r,
1257
- o,
1258
- P,
1297
+ a,
1298
+ X,
1259
1299
  mt
1260
1300
  ]
1261
- ), Qt = d(
1301
+ ), Zt = p(
1262
1302
  (t) => {
1263
- const e = y.current;
1264
- if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !P)
1303
+ const e = x.current;
1304
+ if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !X)
1265
1305
  return;
1266
- const a = St(t);
1267
- if (!a) return;
1268
- const c = a.pageX - e.startX, s = a.pageY - e.startY, u = ee({
1306
+ const o = vt(t);
1307
+ if (!o) return;
1308
+ const c = o.pageX - e.startX, s = o.pageY - e.startY, u = re({
1269
1309
  deltaX: c,
1270
1310
  deltaY: s,
1271
- placement: o
1272
- }), p = M.dragStartThresholdPx.touch, f = o === "bottom" ? Se({
1311
+ placement: a
1312
+ }), d = b.dragStartThresholdPx.touch, g = a === "bottom" ? Ye({
1273
1313
  target: t.target,
1274
1314
  deltaY: s,
1275
1315
  chrome: e.chrome,
1276
- bodyNode: H.current
1277
- }) : Ye({
1316
+ bodyNode: U.current
1317
+ }) : Me({
1278
1318
  target: t.target,
1279
- bodyNode: H.current
1319
+ bodyNode: U.current
1280
1320
  });
1281
- if (f.preventDefault) {
1282
- const x = o === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < p && !e.started && u < p;
1283
- !x && o === "bottom" && mt({
1321
+ if (g.preventDefault) {
1322
+ const h = a === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < d && !e.started && u < d;
1323
+ !h && a === "bottom" && mt({
1284
1324
  target: t.target,
1285
1325
  chrome: e.chrome
1286
- }), x || Zt(t);
1326
+ }), h || te(t);
1287
1327
  }
1288
- if (f.resetAnchor) {
1289
- R(!1), Kt(e, { x: a.pageX, y: a.pageY });
1328
+ if (g.resetAnchor) {
1329
+ $(!1), qt(e, { x: o.pageX, y: o.pageY });
1290
1330
  return;
1291
1331
  }
1292
- if (f.allowDrag && !(!e.started && u < p))
1293
- if (e.allowed || (e.allowed = !0, e.started = !0), f.preventDefault || Zt(t), e.lastX = a.pageX, e.lastY = a.pageY, o === "popup")
1294
- tt(e, a), ce(e, a);
1332
+ if (g.allowDrag && !(!e.started && u < d))
1333
+ if (e.allowed || (e.allowed = !0, e.started = !0), g.preventDefault || te(t), e.lastX = o.pageX, e.lastY = o.pageY, a === "popup")
1334
+ Z(e, o), ie(e, o);
1295
1335
  else {
1296
- const m = e.startTranslate + s, x = rt(e, s);
1297
- Q(m, x), it(e, {
1298
- pageX: a.pageX,
1299
- pageY: a.pageY,
1336
+ const m = e.startTranslate + s, h = et(e, s);
1337
+ J(m, h), ct(e, {
1338
+ pageX: o.pageX,
1339
+ pageY: o.pageY,
1300
1340
  translateX: e.lastTranslateX,
1301
1341
  translateY: e.lastTranslate
1302
1342
  });
@@ -1304,21 +1344,21 @@ function Ke({
1304
1344
  },
1305
1345
  [
1306
1346
  r,
1307
- tt,
1308
- rt,
1309
- St,
1310
- o,
1311
- P,
1312
- Kt,
1313
- R,
1314
- Q,
1347
+ Z,
1348
+ et,
1349
+ vt,
1350
+ a,
1351
+ X,
1352
+ qt,
1353
+ $,
1354
+ J,
1315
1355
  mt
1316
1356
  ]
1317
1357
  );
1318
- At(() => {
1319
- if (!l || !r || o !== "bottom" && !P || n === !1 || typeof window > "u") return;
1358
+ kt(() => {
1359
+ if (!l || !r || a !== "bottom" && !X || n === !1 || typeof window > "u") return;
1320
1360
  const t = (e) => {
1321
- Qt(e);
1361
+ Zt(e);
1322
1362
  };
1323
1363
  return window.addEventListener("touchmove", t, {
1324
1364
  capture: !0,
@@ -1326,56 +1366,56 @@ function Ke({
1326
1366
  }), () => {
1327
1367
  window.removeEventListener("touchmove", t, !0);
1328
1368
  };
1329
- }, [n, r, Qt, l, o, P]);
1330
- const Te = d(
1369
+ }, [n, r, Zt, l, a, X]);
1370
+ const xe = p(
1331
1371
  (t) => {
1332
- const e = y.current;
1333
- if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !P)
1372
+ const e = x.current;
1373
+ if (!e.dragging || e.source !== "touch" || !r || a !== "bottom" && !X)
1334
1374
  return;
1335
- const a = St(t), c = a?.pageX ?? e.lastX, s = a?.pageY ?? e.lastY, u = e.started, p = e.closeAllowed, f = c - e.startX, m = s - e.startY, x = Math.max(ct() - e.startTime, 1);
1336
- o === "popup" && Z();
1337
- const C = {
1375
+ const o = vt(t), c = o?.pageX ?? e.lastX, s = o?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, g = c - e.startX, m = s - e.startY, h = Math.max(it() - e.startTime, 1);
1376
+ a === "popup" && Q();
1377
+ const v = {
1338
1378
  x: e.lastTranslateX,
1339
1379
  y: e.lastTranslate
1340
- }, z = e.startTranslate;
1380
+ }, j = e.startTranslate;
1341
1381
  if (u) {
1342
- const L = o === "popup" ? Yt(e, {
1382
+ const C = a === "popup" ? St(e, {
1343
1383
  pageX: c,
1344
1384
  pageY: s
1345
1385
  }) : {
1346
1386
  x: e.lastTranslateX,
1347
1387
  y: e.lastTranslate
1348
1388
  };
1349
- it(e, {
1389
+ ct(e, {
1350
1390
  pageX: c,
1351
1391
  pageY: s,
1352
- translateX: L.x,
1353
- translateY: L.y
1392
+ translateX: C.x,
1393
+ translateY: C.y
1354
1394
  });
1355
1395
  }
1356
- if (et(e), !!u)
1357
- if (o === "popup") {
1358
- const L = ue({
1396
+ if (tt(e), !!u)
1397
+ if (a === "popup") {
1398
+ const C = ue({
1359
1399
  session: e,
1360
- fallbackDelta: { x: f, y: m },
1361
- fallbackElapsed: x
1400
+ fallbackDelta: { x: g, y: m },
1401
+ fallbackElapsed: h
1362
1402
  });
1363
1403
  Dt({
1364
- currentTranslate: C,
1365
- releaseVelocity: L
1404
+ currentTranslate: v,
1405
+ releaseVelocity: C
1366
1406
  });
1367
1407
  } else {
1368
- const L = ie({
1408
+ const C = ce({
1369
1409
  session: e,
1370
1410
  fallbackDeltaY: m,
1371
- fallbackElapsed: x
1411
+ fallbackElapsed: h
1372
1412
  });
1373
1413
  Xt({
1374
- closeAllowed: p,
1375
- currentTranslate: C.y,
1414
+ closeAllowed: d,
1415
+ currentTranslate: v.y,
1376
1416
  deltaY: m,
1377
- releaseVelocity: L,
1378
- startTranslate: z
1417
+ releaseVelocity: C,
1418
+ startTranslate: j
1379
1419
  });
1380
1420
  }
1381
1421
  },
@@ -1383,47 +1423,47 @@ function Ke({
1383
1423
  Xt,
1384
1424
  Dt,
1385
1425
  r,
1386
- St,
1387
- o,
1388
- P,
1389
- et,
1390
- Z
1426
+ vt,
1427
+ a,
1428
+ X,
1429
+ tt,
1430
+ Q
1391
1431
  ]
1392
- ), ye = d(() => {
1393
- const t = y.current;
1432
+ ), we = p(() => {
1433
+ const t = x.current;
1394
1434
  if (!t.dragging || t.source !== "touch") return;
1395
- const e = t.started, a = t.startTranslate, c = t.lastTranslate, s = {
1435
+ const e = t.started, o = t.startTranslate, c = t.lastTranslate, s = {
1396
1436
  x: t.startTranslateX,
1397
1437
  y: t.startTranslate
1398
1438
  }, u = {
1399
1439
  x: t.lastTranslateX,
1400
1440
  y: t.lastTranslate
1401
- }, p = o;
1402
- if (et(t), !!e) {
1403
- if (p === "popup") {
1404
- V.current ? xt(s) : W(s, { from: u });
1441
+ }, d = a;
1442
+ if (tt(t), !!e) {
1443
+ if (d === "popup") {
1444
+ V.current ? xt(s) : _(s, { from: u });
1405
1445
  return;
1406
1446
  }
1407
- A(a, { from: c });
1447
+ A(o, { from: c });
1408
1448
  }
1409
1449
  }, [
1410
- o,
1411
- et,
1450
+ a,
1451
+ tt,
1412
1452
  xt,
1413
- W,
1453
+ _,
1414
1454
  A
1415
1455
  ]);
1416
1456
  return {
1417
- onPointerDown: fe,
1418
- onPointerMove: ge,
1419
- onPointerUp: Jt,
1420
- onPointerCancel: Jt,
1421
- onLostPointerCapture: me,
1422
- onTouchStart: he,
1423
- onTouchEnd: Te,
1424
- onTouchCancel: ye
1457
+ onPointerDown: me,
1458
+ onPointerMove: he,
1459
+ onPointerUp: Qt,
1460
+ onPointerCancel: Qt,
1461
+ onLostPointerCapture: Te,
1462
+ onTouchStart: ye,
1463
+ onTouchEnd: xe,
1464
+ onTouchCancel: we
1425
1465
  };
1426
1466
  }
1427
1467
  export {
1428
- Ke as useModalDrag
1468
+ Qe as useModalDrag
1429
1469
  };