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