@orioncactuscorp/ui 1.9.2 → 1.10.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.
@@ -1,11 +1,11 @@
1
- import { useRef as w, useLayoutEffect as ot, useCallback as p, useEffect as It } from "react";
2
- import { ocSpring as Ze } from "../../utils/spring.js";
3
- import { resolveOcMotion as zt } from "../../utils/motion.js";
4
- import { resolveModalPopupSnapPositions as qe } from "./snapPoints.js";
5
- import { setModalBodyTouchScrollLock as Ut, shouldLockModalBodyTouchScroll as tr, shouldIgnoreDragTarget as Wt, getScrollableAncestor as er, hasActiveTextSelection as rr, getBottomTouchDragDecision as nr, getPopupTouchDragDecision as or } from "./modalScrollArbitration.js";
6
- import { resolveResizedBottomSheetTranslate as ar, resolveBottomSheetRestState as sr } from "./bottomSheetGeometry.js";
7
- import { createSpringAnimator as Gt } from "../../utils/spring/animator.js";
8
- const F = {
1
+ import { useRef as w, useLayoutEffect as G, useCallback as p, useEffect as Nt } from "react";
2
+ import { ocSpring as sr } from "../../utils/spring.js";
3
+ import { resolveOcMotion as Qt } from "../../utils/motion.js";
4
+ import { resolveModalPopupSnapPositions as ir } from "./snapPoints.js";
5
+ import { setModalBodyTouchScrollLock as Zt, shouldLockModalBodyTouchScroll as lr, shouldIgnoreDragTarget as qt, getScrollableAncestor as cr, hasActiveTextSelection as ur, getBottomTouchDragDecision as dr, getPopupTouchDragDecision as pr } from "./modalScrollArbitration.js";
6
+ import { resolveResizedBottomSheetTranslate as fr, resolveBottomSheetRestState as gr, resolveUndimmedCollapseTranslate as mr } from "./bottomSheetGeometry.js";
7
+ import { createSpringAnimator as te } from "../../utils/spring/animator.js";
8
+ const k = {
9
9
  dragStartThresholdPx: {
10
10
  touch: 10,
11
11
  mouse: 2
@@ -40,463 +40,490 @@ const F = {
40
40
  popupDragFollower: {
41
41
  settleDurationFactor: 1 / 6
42
42
  }
43
- }, ir = Ze.snappy({
44
- duration: F.settleSpring.durationSeconds * F.popupDragFollower.settleDurationFactor
45
- }), lr = [], cr = [];
46
- function Ye(r) {
43
+ }, hr = sr.snappy({
44
+ duration: k.settleSpring.durationSeconds * k.popupDragFollower.settleDurationFactor
45
+ }), yr = [], Tr = [];
46
+ function Ie(r) {
47
47
  r.cancelable !== !1 && r.preventDefault();
48
48
  }
49
- function A(r, n, i) {
50
- return Math.min(Math.max(r, n), i);
49
+ function I(r, o, s) {
50
+ return Math.min(Math.max(r, o), s);
51
51
  }
52
- function Me(r) {
53
- return [...new Set(r)].sort((n, i) => n - i);
52
+ function Fe(r) {
53
+ return [...new Set(r)].sort((o, s) => o - s);
54
54
  }
55
- function ur(r, n) {
55
+ function xr(r, o) {
56
56
  return r.reduce(
57
- (i, o) => Math.abs(o - n) < Math.abs(i - n) ? o : i
57
+ (s, n) => Math.abs(n - o) < Math.abs(s - o) ? n : s
58
58
  );
59
59
  }
60
- function Ee({
60
+ function Oe({
61
61
  deltaX: r,
62
- deltaY: n,
63
- placement: i
62
+ deltaY: o,
63
+ placement: s
64
64
  }) {
65
- return i === "bottom" ? Math.abs(n) : Math.hypot(r, n);
65
+ return s === "bottom" ? Math.abs(o) : Math.hypot(r, o);
66
66
  }
67
- function dr(r, n, i) {
68
- if (i === "down")
69
- return r.find((l) => l > n + 1) ?? r[r.length - 1] ?? 0;
70
- for (let l = r.length - 1; l >= 0; l -= 1) {
71
- const h = r[l];
72
- if (h !== void 0 && h < n - 1)
73
- return h;
67
+ function Pr(r, o, s) {
68
+ if (s === "down")
69
+ return r.find((i) => i > o + 1) ?? r[r.length - 1] ?? 0;
70
+ for (let i = r.length - 1; i >= 0; i -= 1) {
71
+ const y = r[i];
72
+ if (y !== void 0 && y < o - 1)
73
+ return y;
74
74
  }
75
75
  return r[0] ?? 0;
76
76
  }
77
- function pr(r, n, i, o, l = i) {
78
- const y = dr(r, n, o), T = o === "down" ? Math.max(i, l) : Math.min(i, l);
79
- if (o === "down") {
77
+ function vr(r, o, s, n, i = s) {
78
+ const m = Pr(r, o, n), x = n === "down" ? Math.max(s, i) : Math.min(s, i);
79
+ if (n === "down") {
80
80
  if (r.filter(
81
- ($) => $ > n + 1 && $ <= i + 1
82
- ).length === 0) return y;
83
- const tt = r.filter(
84
- ($) => $ > n + 1 && $ <= T + 1
81
+ (V) => V > o + 1 && V <= s + 1
82
+ ).length === 0) return m;
83
+ const ot = r.filter(
84
+ (V) => V > o + 1 && V <= x + 1
85
85
  );
86
- return tt[tt.length - 1] ?? y;
86
+ return ot[ot.length - 1] ?? m;
87
87
  }
88
88
  return r.filter(
89
- (L) => L < n - 1 && L >= i - 1
90
- ).length === 0 ? y : r.filter(
91
- (L) => L < n - 1 && L >= T - 1
92
- )[0] ?? y;
89
+ (E) => E < o - 1 && E >= s - 1
90
+ ).length === 0 ? m : r.filter(
91
+ (E) => E < o - 1 && E >= x - 1
92
+ )[0] ?? m;
93
93
  }
94
- function be(r, n) {
95
- if (n <= 0) return 0;
96
- const i = n, { resistance: o } = F.rubberBand;
97
- return r * o * i / (i + o * r);
94
+ function Ne(r, o) {
95
+ if (o <= 0) return 0;
96
+ const s = o, { resistance: n } = k.rubberBand;
97
+ return r * n * s / (s + n * r);
98
98
  }
99
- function Kt({
99
+ function ee({
100
100
  targetTranslate: r,
101
- minTranslate: n,
102
- maxTranslate: i,
103
- minBoundaryLimit: o,
104
- maxBoundaryLimit: l
101
+ minTranslate: o,
102
+ maxTranslate: s,
103
+ minBoundaryLimit: n,
104
+ maxBoundaryLimit: i
105
105
  }) {
106
- return r < n ? n - be(n - r, o) : r > i ? i + be(r - i, l) : r;
106
+ return r < o ? o - Ne(o - r, n) : r > s ? s + Ne(r - s, i) : r;
107
107
  }
108
- function Le(r) {
108
+ function Ve(r) {
109
109
  return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
110
110
  }
111
- function ke(r) {
111
+ function ze(r) {
112
112
  return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest(
113
113
  '[data-oc-part="handle"], [data-oc-component="modal-navigation"]'
114
114
  );
115
115
  }
116
- function fr(r) {
116
+ function wr(r) {
117
117
  return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-component="modal-navigation"]');
118
118
  }
119
- function gr(r) {
119
+ function Sr(r) {
120
120
  return typeof Element > "u" || !(r instanceof Element) ? null : r.closest('[data-oc-component="modal-navigation"]');
121
121
  }
122
- function mr(r, n) {
123
- return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
122
+ function Dr(r, o) {
123
+ return o ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
124
124
  }
125
- function Ce(r, n) {
125
+ function Re(r, o) {
126
126
  if (!r.length)
127
127
  return {
128
128
  minTranslate: 0,
129
129
  maxTranslate: 0
130
130
  };
131
- const i = r.map((h) => h[n]), o = Math.min(...i), l = Math.max(...i);
132
- if (Math.abs(l - o) < 0.5) {
133
- const h = (o + l) / 2;
131
+ const s = r.map((y) => y[o]), n = Math.min(...s), i = Math.max(...s);
132
+ if (Math.abs(i - n) < 0.5) {
133
+ const y = (n + i) / 2;
134
134
  return {
135
- minTranslate: h,
136
- maxTranslate: h
135
+ minTranslate: y,
136
+ maxTranslate: y
137
137
  };
138
138
  }
139
139
  return {
140
- minTranslate: o,
141
- maxTranslate: l
140
+ minTranslate: n,
141
+ maxTranslate: i
142
142
  };
143
143
  }
144
- function Fe(r, n) {
145
- for (let i = 0; i < r.length; i += 1) {
146
- const o = "item" in r && typeof r.item == "function" ? r.item(i) : r[i];
147
- if (o?.identifier === n) return o;
144
+ function He(r, o) {
145
+ for (let s = 0; s < r.length; s += 1) {
146
+ const n = "item" in r && typeof r.item == "function" ? r.item(s) : r[s];
147
+ if (n?.identifier === o) return n;
148
148
  }
149
149
  return null;
150
150
  }
151
- function Re(r) {
151
+ function Je(r) {
152
152
  if (!r) return { x: 0, y: 0 };
153
- const n = window.getComputedStyle(r).transform;
154
- if (!n || n === "none") return { x: 0, y: 0 };
155
- const i = n.match(/^matrix\((.+)\)$/);
156
- if (i) {
157
- const l = i[1].split(",").map((h) => h.trim());
153
+ const o = window.getComputedStyle(r).transform;
154
+ if (!o || o === "none") return { x: 0, y: 0 };
155
+ const s = o.match(/^matrix\((.+)\)$/);
156
+ if (s) {
157
+ const i = s[1].split(",").map((y) => y.trim());
158
158
  return {
159
- x: Number.parseFloat(l[4] ?? "0") || 0,
160
- y: Number.parseFloat(l[5] ?? "0") || 0
159
+ x: Number.parseFloat(i[4] ?? "0") || 0,
160
+ y: Number.parseFloat(i[5] ?? "0") || 0
161
161
  };
162
162
  }
163
- const o = n.match(/^matrix3d\((.+)\)$/);
164
- if (o) {
165
- const l = o[1].split(",").map((h) => h.trim());
163
+ const n = o.match(/^matrix3d\((.+)\)$/);
164
+ if (n) {
165
+ const i = n[1].split(",").map((y) => y.trim());
166
166
  return {
167
- x: Number.parseFloat(l[12] ?? "0") || 0,
168
- y: Number.parseFloat(l[13] ?? "0") || 0
167
+ x: Number.parseFloat(i[12] ?? "0") || 0,
168
+ y: Number.parseFloat(i[13] ?? "0") || 0
169
169
  };
170
170
  }
171
171
  return { x: 0, y: 0 };
172
172
  }
173
- function Jt(r) {
174
- return Re(r).y;
173
+ function re(r) {
174
+ return Je(r).y;
175
175
  }
176
- function Ae(r) {
177
- return Re(r);
176
+ function $e(r) {
177
+ return Je(r);
178
178
  }
179
179
  function yt(r) {
180
180
  if (!r || !/^-?\d*\.?\d+(?:px)?$/.test(r.trim())) return;
181
- const n = Number.parseFloat(r);
182
- return Number.isFinite(n) ? n : void 0;
181
+ const o = Number.parseFloat(r);
182
+ return Number.isFinite(o) ? o : void 0;
183
183
  }
184
- function Z() {
184
+ function tt() {
185
185
  return Date.now();
186
186
  }
187
- function hr(r, n) {
188
- const i = n - F.releaseVelocity.sampleWindowMs;
189
- for (; r.length > 2 && (r[1]?.time ?? n) < i; )
187
+ function Xr(r, o) {
188
+ const s = o - k.releaseVelocity.sampleWindowMs;
189
+ for (; r.length > 2 && (r[1]?.time ?? o) < s; )
190
190
  r.shift();
191
191
  }
192
- function St(r, n) {
193
- const i = n.time ?? Z();
192
+ function Dt(r, o) {
193
+ const s = o.time ?? tt();
194
194
  r.samples.push({
195
- time: i,
196
- pageX: n.pageX,
197
- pageY: n.pageY,
198
- translateX: n.translateX,
199
- translateY: n.translateY
200
- }), hr(r.samples, i);
195
+ time: s,
196
+ pageX: o.pageX,
197
+ pageY: o.pageY,
198
+ translateX: o.translateX,
199
+ translateY: o.translateY
200
+ }), Xr(r.samples, s);
201
201
  }
202
- function Ot(r, n) {
202
+ function Vt(r, o) {
203
203
  return {
204
- x: r.startTranslateX + n.pageX - r.startX,
205
- y: r.startTranslate + n.pageY - r.startY
204
+ x: r.startTranslateX + o.pageX - r.startX,
205
+ y: r.startTranslate + o.pageY - r.startY
206
206
  };
207
207
  }
208
- function Be(r, n) {
209
- const i = Ot(r, n);
210
- St(r, {
211
- pageX: n.pageX,
212
- pageY: n.pageY,
213
- translateX: i.x,
214
- translateY: i.y
208
+ function Ue(r, o) {
209
+ const s = Vt(r, o);
210
+ Dt(r, {
211
+ pageX: o.pageX,
212
+ pageY: o.pageY,
213
+ translateX: s.x,
214
+ translateY: s.y
215
215
  });
216
216
  }
217
- function Ie({
217
+ function je({
218
218
  session: r,
219
- fallbackDeltaY: n,
220
- fallbackElapsed: i
219
+ fallbackDeltaY: o,
220
+ fallbackElapsed: s
221
221
  }) {
222
- const o = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: h } = F.releaseVelocity;
223
- if (o) {
224
- const y = o.time - h, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
225
- if (T && T !== o) {
226
- const D = Math.max(o.time - T.time, 1), b = (o.translateY - T.translateY) / D * 1e3;
227
- if (Number.isFinite(b))
228
- return A(b, -l, l);
222
+ const n = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: y } = k.releaseVelocity;
223
+ if (n) {
224
+ const m = n.time - y, x = r.samples.find((v) => v.time >= m) ?? r.samples[0];
225
+ if (x && x !== n) {
226
+ const v = Math.max(n.time - x.time, 1), L = (n.translateY - x.translateY) / v * 1e3;
227
+ if (Number.isFinite(L))
228
+ return I(L, -i, i);
229
229
  }
230
230
  }
231
- return A(
232
- n / Math.max(i, 1) * 1e3,
233
- -l,
234
- l
231
+ return I(
232
+ o / Math.max(s, 1) * 1e3,
233
+ -i,
234
+ i
235
235
  );
236
236
  }
237
- function Oe({
237
+ function _e({
238
238
  session: r,
239
- fallbackDelta: n,
240
- fallbackElapsed: i
239
+ fallbackDelta: o,
240
+ fallbackElapsed: s
241
241
  }) {
242
- const o = r.samples[r.samples.length - 1], { maxPxPerSecond: l, sampleWindowMs: h } = F.releaseVelocity;
243
- if (o) {
244
- const y = o.time - h, T = r.samples.find((D) => D.time >= y) ?? r.samples[0];
245
- if (T && T !== o) {
246
- const D = Math.max(o.time - T.time, 1), b = {
247
- x: (o.translateX - T.translateX) / D * 1e3,
248
- y: (o.translateY - T.translateY) / D * 1e3
242
+ const n = r.samples[r.samples.length - 1], { maxPxPerSecond: i, sampleWindowMs: y } = k.releaseVelocity;
243
+ if (n) {
244
+ const m = n.time - y, x = r.samples.find((v) => v.time >= m) ?? r.samples[0];
245
+ if (x && x !== n) {
246
+ const v = Math.max(n.time - x.time, 1), L = {
247
+ x: (n.translateX - x.translateX) / v * 1e3,
248
+ y: (n.translateY - x.translateY) / v * 1e3
249
249
  };
250
- if (Number.isFinite(b.x) && Number.isFinite(b.y))
250
+ if (Number.isFinite(L.x) && Number.isFinite(L.y))
251
251
  return {
252
- x: A(b.x, -l, l),
253
- y: A(b.y, -l, l)
252
+ x: I(L.x, -i, i),
253
+ y: I(L.y, -i, i)
254
254
  };
255
255
  }
256
256
  }
257
257
  return {
258
- x: A(
259
- n.x / Math.max(i, 1) * 1e3,
260
- -l,
261
- l
258
+ x: I(
259
+ o.x / Math.max(s, 1) * 1e3,
260
+ -i,
261
+ i
262
262
  ),
263
- y: A(
264
- n.y / Math.max(i, 1) * 1e3,
265
- -l,
266
- l
263
+ y: I(
264
+ o.y / Math.max(s, 1) * 1e3,
265
+ -i,
266
+ i
267
267
  )
268
268
  };
269
269
  }
270
- function yr({
270
+ function Mr({
271
271
  currentTranslate: r,
272
- releaseVelocity: n
272
+ releaseVelocity: o
273
273
  }) {
274
- const { lookaheadSeconds: i, maxDistancePx: o } = F.snapProjection;
275
- return r + A(n * i, -o, o);
274
+ const { lookaheadSeconds: s, maxDistancePx: n } = k.snapProjection;
275
+ return r + I(o * s, -n, n);
276
276
  }
277
- function Tr({
277
+ function Yr({
278
278
  currentTranslate: r,
279
- releaseVelocity: n
279
+ releaseVelocity: o
280
280
  }) {
281
- const { lookaheadSeconds: i, maxDistancePx: o } = F.snapProjection;
281
+ const { lookaheadSeconds: s, maxDistancePx: n } = k.snapProjection;
282
282
  return {
283
- x: r.x + A(
284
- n.x * i,
285
- -o,
286
- o
283
+ x: r.x + I(
284
+ o.x * s,
285
+ -n,
286
+ n
287
287
  ),
288
- y: r.y + A(
289
- n.y * i,
290
- -o,
291
- o
288
+ y: r.y + I(
289
+ o.y * s,
290
+ -n,
291
+ n
292
292
  )
293
293
  };
294
294
  }
295
- function xr(r) {
296
- return Math.abs(r) / 1e3 > F.releaseVelocity.flickThresholdPxPerMs;
295
+ function Er(r) {
296
+ return Math.abs(r) / 1e3 > k.releaseVelocity.flickThresholdPxPerMs;
297
297
  }
298
- function Pr(r) {
299
- return Math.hypot(r.x, r.y) / 1e3 > F.releaseVelocity.flickThresholdPxPerMs;
298
+ function br(r) {
299
+ return Math.hypot(r.x, r.y) / 1e3 > k.releaseVelocity.flickThresholdPxPerMs;
300
300
  }
301
- function q(r, n) {
302
- return Math.hypot(r.x - n.x, r.y - n.y);
301
+ function et(r, o) {
302
+ return Math.hypot(r.x - o.x, r.y - o.y);
303
303
  }
304
- function Ne(r, n) {
304
+ function We(r, o) {
305
305
  return r.reduce(
306
- (i, o) => q(o, n) < q(i, n) ? o : i
306
+ (s, n) => et(n, o) < et(s, o) ? n : s
307
307
  );
308
308
  }
309
- function vr({
309
+ function Lr({
310
310
  currentTranslate: r,
311
- releaseVelocity: n,
312
- targets: i
311
+ releaseVelocity: o,
312
+ targets: s
313
313
  }) {
314
- const o = Tr({
314
+ const n = Yr({
315
315
  currentTranslate: r,
316
- releaseVelocity: n
316
+ releaseVelocity: o
317
317
  });
318
- if (!Pr(n))
319
- return Ne(i, r);
320
- const l = i.filter((h) => {
321
- const y = h.x - r.x, T = h.y - r.y;
322
- return y * n.x + T * n.y > 0;
318
+ if (!br(o))
319
+ return We(s, r);
320
+ const i = s.filter((y) => {
321
+ const m = y.x - r.x, x = y.y - r.y;
322
+ return m * o.x + x * o.y > 0;
323
323
  });
324
- return Ne(
325
- l.length ? l : i,
326
- o
324
+ return We(
325
+ i.length ? i : s,
326
+ n
327
327
  );
328
328
  }
329
- function _e(r) {
329
+ function Qe(r) {
330
330
  return r === "top" || r.startsWith("top-") ? "top" : r === "bottom" || r.startsWith("bottom-") ? "bottom" : "center";
331
331
  }
332
- function wr({
332
+ function Ar({
333
333
  target: r,
334
- targets: n
334
+ targets: o
335
335
  }) {
336
- const i = n.filter((o) => o !== r);
337
- if (i.length)
338
- return i.reduce(
339
- (o, l) => Math.min(o, q(r, l)),
336
+ const s = o.filter((n) => n !== r);
337
+ if (s.length)
338
+ return s.reduce(
339
+ (n, i) => Math.min(n, et(r, i)),
340
340
  Number.POSITIVE_INFINITY
341
341
  );
342
342
  }
343
- function Dr({
343
+ function Cr({
344
344
  closeThreshold: r,
345
- currentTarget: n,
346
- surfaceSize: i,
347
- targets: o
345
+ currentTarget: o,
346
+ surfaceSize: s,
347
+ targets: n
348
348
  }) {
349
- const l = _e(n.key), h = l === "center" ? Math.min(i.width, i.height) : i.height, y = Math.max(
350
- F.dismissal.minDistancePx,
351
- h * r
349
+ const i = Qe(o.key), y = i === "center" ? Math.min(s.width, s.height) : s.height, m = Math.max(
350
+ k.dismissal.minDistancePx,
351
+ y * r
352
352
  );
353
- if (l !== "center") return y;
354
- const T = wr({
355
- target: n,
356
- targets: o
353
+ if (i !== "center") return m;
354
+ const x = Ar({
355
+ target: o,
356
+ targets: n
357
357
  });
358
- return !T || !Number.isFinite(T) ? y : Math.max(y, T * 0.75);
358
+ return !x || !Number.isFinite(x) ? m : Math.max(m, x * 0.75);
359
359
  }
360
- function Sr({
360
+ function kr({
361
361
  currentTarget: r,
362
- currentTranslate: n
362
+ currentTranslate: o
363
363
  }) {
364
- switch (_e(r.key)) {
364
+ switch (Qe(r.key)) {
365
365
  case "top":
366
- return r.y - n.y;
366
+ return r.y - o.y;
367
367
  case "bottom":
368
- return n.y - r.y;
368
+ return o.y - r.y;
369
369
  case "center":
370
- return q(r, n);
370
+ return et(r, o);
371
371
  }
372
372
  }
373
- function Xr({
373
+ function Br({
374
374
  closeThreshold: r,
375
- currentTarget: n,
376
- currentTranslate: i,
377
- releaseTarget: o,
378
- surfaceSize: l,
379
- targets: h
375
+ currentTarget: o,
376
+ currentTranslate: s,
377
+ releaseTarget: n,
378
+ surfaceSize: i,
379
+ targets: y
380
380
  }) {
381
- if (o.key !== n.key) return !1;
382
- const y = Sr({
383
- currentTarget: n,
384
- currentTranslate: i
381
+ if (n.key !== o.key) return !1;
382
+ const m = kr({
383
+ currentTarget: o,
384
+ currentTranslate: s
385
385
  });
386
- return y <= 0 ? !1 : y >= Dr({
386
+ return m <= 0 ? !1 : m >= Cr({
387
387
  closeThreshold: r,
388
- currentTarget: n,
389
- surfaceSize: l,
390
- targets: h
388
+ currentTarget: o,
389
+ surfaceSize: i,
390
+ targets: y
391
391
  });
392
392
  }
393
- function Yr({
393
+ function Ir({
394
394
  presentationState: r,
395
- releaseTranslate: n,
396
- visibleTranslate: i
395
+ releaseTranslate: o,
396
+ visibleTranslate: s
397
397
  }) {
398
- return r !== "visible" || Math.abs(n - i) > 1;
398
+ return r !== "visible" || Math.abs(o - s) > 1;
399
399
  }
400
- function Mr({
400
+ function Fr({
401
401
  drag: r,
402
- placement: n,
403
- snapPositionCount: i
402
+ placement: o,
403
+ snapPositionCount: s
404
404
  }) {
405
- return n === "popup" && (r === "content" || r === "handle") && i > 0;
405
+ return o === "popup" && (r === "content" || r === "handle") && s > 0;
406
406
  }
407
- function Er({
407
+ function Or({
408
408
  dismissible: r,
409
- peekTranslate: n,
410
- sheetHeight: i,
411
- visibleTranslate: o
409
+ peekTranslate: o,
410
+ sheetHeight: s,
411
+ visibleTranslate: n
412
412
  }) {
413
413
  return {
414
- maxTranslate: n > 0 ? n : r ? i : o,
414
+ maxTranslate: o > 0 ? o : r ? s : n,
415
415
  minTranslate: 0
416
416
  };
417
417
  }
418
- function Ve(r, n = 1) {
419
- const i = Math.max(n, 1);
420
- return r && Math.abs(r.maxTranslate - r.minTranslate) || i;
418
+ function Ge(r, o = 1) {
419
+ const s = Math.max(o, 1);
420
+ return r && Math.abs(r.maxTranslate - r.minTranslate) || s;
421
421
  }
422
- function He({
422
+ function Ke({
423
423
  limit: r,
424
- viewportSize: n,
425
- viewportLimitRatio: i
424
+ viewportSize: o,
425
+ viewportLimitRatio: s
426
426
  }) {
427
- const o = Math.max(r, 0);
428
- return n <= 0 ? o : Math.min(o, n * i);
427
+ const n = Math.max(r, 0);
428
+ return o <= 0 ? n : Math.min(n, o * s);
429
429
  }
430
- function br({
430
+ function Nr({
431
431
  minTranslate: r,
432
- sheetHeight: n,
433
- surfaceMotion: i
432
+ sheetHeight: o,
433
+ surfaceMotion: s
434
434
  }) {
435
- const o = i.parentElement?.getBoundingClientRect(), l = o?.top ?? 0, h = o && o.height > 0 ? o.height : window.innerHeight, y = i.getBoundingClientRect(), T = Jt(i), D = y.top - T + r, b = Math.max(D - l, 0), { observedViewportLimitRatio: L } = F.rubberBand;
435
+ const n = s.parentElement?.getBoundingClientRect(), i = n?.top ?? 0, y = n && n.height > 0 ? n.height : window.innerHeight, m = s.getBoundingClientRect(), x = re(s), v = m.top - x + r, L = Math.max(v - i, 0), { observedViewportLimitRatio: E } = k.rubberBand;
436
436
  return {
437
- minBoundaryLimit: He({
438
- limit: b,
439
- viewportSize: h,
440
- viewportLimitRatio: L.top
437
+ minBoundaryLimit: Ke({
438
+ limit: L,
439
+ viewportSize: y,
440
+ viewportLimitRatio: E.top
441
441
  }),
442
- maxBoundaryLimit: He({
443
- limit: n,
444
- viewportSize: h,
445
- viewportLimitRatio: L.bottom
442
+ maxBoundaryLimit: Ke({
443
+ limit: o,
444
+ viewportSize: y,
445
+ viewportLimitRatio: E.bottom
446
446
  })
447
447
  };
448
448
  }
449
- function Lr({
450
- rubberBand: r,
451
- targetTranslate: n,
452
- sheetHeight: i,
449
+ function Vr({
450
+ sheetHeight: r,
453
451
  peekTranslate: o,
454
- bounds: l,
455
- rubberBandLimits: h
452
+ snapHeights: s,
453
+ backdropFromHeight: n
454
+ }) {
455
+ const i = o > 0 ? Math.max(0, r - o) : 0;
456
+ if (n !== void 0) {
457
+ let m = -1;
458
+ for (const x of s)
459
+ x < n - 0.5 && x > m && (m = x);
460
+ return {
461
+ dimmedHeight: n,
462
+ undimmedHeight: m >= 0 ? m : i
463
+ };
464
+ }
465
+ let y = r;
466
+ for (const m of s)
467
+ m < y && (y = m);
468
+ return { dimmedHeight: y, undimmedHeight: i };
469
+ }
470
+ function zr({
471
+ rubberBand: r,
472
+ targetTranslate: o,
473
+ sheetHeight: s,
474
+ bounds: n,
475
+ rubberBandLimits: i,
476
+ backdropBoundaries: y
456
477
  }) {
457
- const y = A(
458
- r ? Kt({
459
- targetTranslate: n,
460
- ...h,
461
- ...l
462
- }) : n,
463
- l.minTranslate - h.minBoundaryLimit,
464
- l.maxTranslate + h.maxBoundaryLimit
465
- ), T = Math.max(-y, 0), D = Math.max(y, 0), b = o > 0 ? o : i, L = b > 0 ? 1 - D / Math.max(b, 1) : 0;
478
+ const m = I(
479
+ r ? ee({
480
+ targetTranslate: o,
481
+ ...i,
482
+ ...n
483
+ }) : o,
484
+ n.minTranslate - i.minBoundaryLimit,
485
+ n.maxTranslate + i.maxBoundaryLimit
486
+ ), x = Math.max(-m, 0), v = Math.max(m, 0), E = (s - v - y.undimmedHeight) / Math.max(
487
+ y.dimmedHeight - y.undimmedHeight,
488
+ 1
489
+ );
466
490
  return {
467
- translate: y,
468
- overshootFillHeight: T,
469
- backdropOpacity: A(L, 0, 1)
491
+ translate: m,
492
+ overshootFillHeight: x,
493
+ backdropOpacity: I(E, 0, 1)
470
494
  };
471
495
  }
472
- function Nr({
496
+ function Gr({
473
497
  enabled: r,
474
- drag: n,
475
- open: i,
476
- placement: o,
477
- surfaceMotionRef: l,
478
- surfaceMotionNode: h,
479
- backdropRef: y,
480
- bodyNode: T,
481
- snapHeights: D = lr,
482
- sheetHeight: b,
483
- snapPositions: L = cr,
484
- defaultSnapPosition: tt,
485
- peekHeight: $,
486
- peekFallback: Qt,
487
- presentationState: V,
488
- setPresentationState: Nt,
498
+ drag: o,
499
+ open: s,
500
+ placement: n,
501
+ surfaceMotionRef: i,
502
+ surfaceMotionNode: y,
503
+ backdropRef: m,
504
+ bodyNode: x,
505
+ snapHeights: v = yr,
506
+ sheetHeight: L,
507
+ backdropFromHeight: E,
508
+ onBackdropDimRestChange: ot,
509
+ snapPositions: V = Tr,
510
+ defaultSnapPosition: Xt,
511
+ peekHeight: zt,
512
+ peekFallback: ne,
513
+ presentationState: z,
514
+ setPresentationState: Rt,
489
515
  requestClose: at,
490
- canCloseAttempt: Zt,
516
+ canCloseAttempt: oe,
491
517
  dismissible: H = !0,
492
- preserveShadowOpacity: qt = !1,
493
- visibleTranslate: S = 0,
494
- shouldDeferBottomSettle: te,
518
+ backdropHidden: Ht = !1,
519
+ visibleTranslate: D = 0,
520
+ shouldDeferBottomSettle: ae,
521
+ refreshScrollState: $t,
495
522
  closeThreshold: Tt = 0.35,
496
- scrollLockTimeout: ee = 500,
497
- popupSnapLayoutVersion: re = 0
523
+ scrollLockTimeout: se = 500,
524
+ popupSnapLayoutVersion: ie = 0
498
525
  }) {
499
- const M = w({
526
+ const Y = w({
500
527
  dragging: !1,
501
528
  allowed: !1,
502
529
  chrome: !1,
@@ -516,63 +543,67 @@ function Nr({
516
543
  samples: [],
517
544
  pointerId: null,
518
545
  touchId: null
519
- }), z = w(T), ne = w(!1), oe = w(!1), $e = w((t) => {
546
+ }), j = w(x), Ut = w(null), le = w(Ht), ce = w(!1), ue = w(!1), Ze = w((t) => {
520
547
  t.preventDefault();
521
- }), Xt = w(0), Vt = w(!1), R = w(null), _ = w(
548
+ }), Mt = w(0), jt = w(!1), $ = w(null), U = w(
522
549
  null
523
- ), Yt = w(null), U = w(null), xt = w(0), j = w(null), Ht = w(!1), Rt = w(!1), ae = w(V), Mt = w({
550
+ ), Yt = w(null), K = w(null), xt = w(0), _ = w(null), _t = w(!1), Wt = w(!1), de = w(z), Et = w({
524
551
  kind: "default-snap"
525
- }), se = w(b ?? null), ie = w(S), le = w(D), _t = w(!1), st = w(!1), E = Mr({
526
- drag: n,
527
- placement: o,
528
- snapPositionCount: L.length
529
- }), ce = `${tt ?? ""}:${L.join("|")}`, ue = w(L), Et = w(tt);
530
- ot(() => {
531
- ue.current = L, Et.current = tt;
532
- }, [tt, ce, L]), ot(() => {
533
- const t = z.current;
534
- t && t !== T && Ut(t, !1), z.current = T, ne.current && Ut(T, !0);
535
- }, [T]);
552
+ }), pe = w(L ?? null), fe = w(D), ge = w(v), Gt = w(!1), st = w(!1), b = Fr({
553
+ drag: o,
554
+ placement: n,
555
+ snapPositionCount: V.length
556
+ }), me = `${Xt ?? ""}:${V.join("|")}`, he = w(V), bt = w(Xt);
557
+ G(() => {
558
+ he.current = V, bt.current = Xt;
559
+ }, [Xt, me, V]), G(() => {
560
+ le.current = Ht;
561
+ }, [Ht]), G(() => {
562
+ s || (Ut.current = null);
563
+ }, [s]), G(() => {
564
+ const t = j.current;
565
+ t && t !== x && Zt(t, !1), j.current = x, ce.current && Zt(x, !0);
566
+ }, [x]);
536
567
  const it = p((t) => {
537
- ne.current = t, Ut(z.current, t);
538
- }, []), W = p((t) => {
539
- if (oe.current === t) return;
540
- oe.current = t;
541
- const e = $e.current;
568
+ ce.current = t, Zt(j.current, t);
569
+ }, []), J = p((t) => {
570
+ if (ue.current === t) return;
571
+ ue.current = t;
572
+ const e = Ze.current;
542
573
  if (t) {
543
574
  document.addEventListener("selectstart", e, !0), document.addEventListener("dragstart", e, !0);
544
575
  return;
545
576
  }
546
577
  document.removeEventListener("selectstart", e, !0), document.removeEventListener("dragstart", e, !0);
547
- }, []), bt = p(
578
+ }, []), Lt = p(
548
579
  ({ chrome: t, target: e }) => {
549
- const a = tr({
580
+ const a = lr({
550
581
  target: e,
551
582
  chrome: t,
552
- bodyNode: z.current
583
+ bodyNode: j.current
553
584
  });
554
585
  return it(a), a;
555
586
  },
556
587
  [it]
557
- ), I = p(() => l.current?.getBoundingClientRect().height ?? window.innerHeight, [l]), Lt = p(() => {
558
- if ($ !== void 0) return $;
559
- if (Qt === "header")
560
- return l.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
561
- }, [Qt, $, l]), Pt = p(
588
+ ), F = p(() => i.current?.getBoundingClientRect().height ?? window.innerHeight, [i]), At = p(() => {
589
+ if (zt !== void 0) return zt;
590
+ if (ne === "header")
591
+ return i.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
592
+ }, [ne, zt, i]), Pt = p(
562
593
  (t) => {
563
- const e = Lt();
564
- return e === void 0 || e <= 0 ? 0 : A(t - e, 0, t);
594
+ const e = At();
595
+ return e === void 0 || e <= 0 ? 0 : I(t - e, 0, t);
565
596
  },
566
- [Lt]
567
- ), G = p(() => {
568
- const t = Lt();
569
- return t === void 0 || t <= 0 ? 0 : Pt(I());
570
- }, [Lt, Pt, I]), $t = p(
571
- () => V === "peeked" ? G() : S,
572
- [G, V, S]
573
- ), et = p(() => {
574
- const t = l.current;
575
- if (!t) return $t();
597
+ [At]
598
+ ), Q = p(() => {
599
+ const t = At();
600
+ return t === void 0 || t <= 0 ? 0 : Pt(F());
601
+ }, [At, Pt, F]), Kt = p(
602
+ () => z === "peeked" ? Q() : D,
603
+ [Q, z, D]
604
+ ), W = p(() => {
605
+ const t = i.current;
606
+ if (!t) return Kt();
576
607
  const e = yt(
577
608
  t.style.getPropertyValue("--oc-modal-translate-y")
578
609
  );
@@ -580,9 +611,9 @@ function Nr({
580
611
  const a = yt(
581
612
  window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
582
613
  );
583
- return a !== void 0 ? a : $t();
584
- }, [$t, l]), kt = p(() => {
585
- const t = l.current;
614
+ return a !== void 0 ? a : Kt();
615
+ }, [Kt, i]), Ct = p(() => {
616
+ const t = i.current;
586
617
  if (!t) return { x: 0, y: 0 };
587
618
  const e = yt(
588
619
  t.style.getPropertyValue("--oc-modal-translate-x")
@@ -599,44 +630,49 @@ function Nr({
599
630
  x: yt(c.getPropertyValue("--oc-modal-translate-x")) ?? 0,
600
631
  y: yt(c.getPropertyValue("--oc-modal-translate-y")) ?? 0
601
632
  };
602
- }, [l]), lt = p(() => {
603
- const t = et(), e = Jt(l.current);
633
+ }, [i]), lt = p(() => {
634
+ const t = W(), e = re(i.current);
604
635
  return Math.abs(e - t) > 1 ? e : t;
605
- }, [et, l]), vt = p(
636
+ }, [W, i]), vt = p(
606
637
  (t, e, a = 1) => Math.abs(t - e) <= a,
607
638
  []
608
639
  ), ct = p(() => {
609
- const t = kt(), e = Ae(l.current);
610
- return q(e, t) > 1 ? e : t;
611
- }, [kt, l]), B = p(
640
+ const t = Ct(), e = $e(i.current);
641
+ return et(e, t) > 1 ? e : t;
642
+ }, [Ct, i]), O = p(
612
643
  (t, {
613
644
  active: e,
614
645
  nextDismissible: a = H,
615
646
  rubberBand: c = !1,
616
- sheetHeightOverride: s,
647
+ sheetHeightOverride: l,
617
648
  peekTranslateOverride: u,
618
649
  settled: d
619
650
  }) => {
620
- const f = l.current;
651
+ const f = i.current;
621
652
  if (!f) return;
622
- const g = s ?? I(), m = f.parentElement, Y = u ?? G(), C = Er({
653
+ const g = l ?? F(), h = f.parentElement, M = u ?? Q(), C = Or({
623
654
  dismissible: a,
624
- peekTranslate: Y,
655
+ peekTranslate: M,
625
656
  sheetHeight: g,
626
- visibleTranslate: S
627
- }), x = br({
657
+ visibleTranslate: D
658
+ }), T = Nr({
628
659
  minTranslate: C.minTranslate,
629
660
  sheetHeight: g,
630
661
  surfaceMotion: f
631
- }), P = Lr({
662
+ }), P = zr({
632
663
  rubberBand: c,
633
664
  targetTranslate: t,
634
665
  sheetHeight: g,
635
- peekTranslate: Y,
636
666
  bounds: C,
637
- rubberBandLimits: x
667
+ rubberBandLimits: T,
668
+ backdropBoundaries: Vr({
669
+ sheetHeight: g,
670
+ peekTranslate: M,
671
+ snapHeights: v,
672
+ backdropFromHeight: E
673
+ })
638
674
  });
639
- M.current.lastTranslate = P.translate, f.style.setProperty(
675
+ Y.current.lastTranslate = P.translate, f.style.setProperty(
640
676
  "--oc-modal-translate-y",
641
677
  `${P.translate}px`
642
678
  ), d === "frame" || !e ? f.style.setProperty(
@@ -645,54 +681,60 @@ function Nr({
645
681
  ) : typeof d == "number" && f.style.setProperty(
646
682
  "--oc-modal-settled-translate-y",
647
683
  `${d}px`
648
- ), qt ? f.style.removeProperty(
649
- "--_-modal-elevation-shadow-opacity"
650
- ) : f.style.setProperty(
684
+ );
685
+ const R = le.current ? 0 : P.backdropOpacity;
686
+ if (f.style.setProperty(
651
687
  "--_-modal-elevation-shadow-opacity",
652
- String(1 - P.backdropOpacity)
653
- ), f.dataset.ocModalDragging = e ? "true" : "false", m?.style.setProperty(
688
+ String(1 - R)
689
+ ), f.dataset.ocModalDragging = e ? "true" : "false", h?.style.setProperty(
654
690
  "--oc-modal-overshoot-fill-height",
655
691
  `${P.overshootFillHeight}px`
656
- ), m && (m.dataset.ocModalDragging = e ? "true" : "false"), e ? f.style.setProperty("transition", "none") : f.style.removeProperty("transition"), y.current && (y.current.style.setProperty(
692
+ ), h && (h.dataset.ocModalDragging = e ? "true" : "false"), e ? f.style.setProperty("transition", "none") : f.style.removeProperty("transition"), m.current && (m.current.style.setProperty(
657
693
  "--oc-modal-backdrop-opacity",
658
694
  String(P.backdropOpacity)
659
- ), y.current.style.transition = e ? "none" : "");
695
+ ), m.current.style.transition = e ? "none" : ""), !e && n === "bottom" && ot) {
696
+ const B = E === void 0 || g - P.translate >= E - 0.5;
697
+ Ut.current !== B && (Ut.current = B, ot(B));
698
+ }
660
699
  },
661
700
  [
662
- y,
701
+ E,
702
+ m,
663
703
  H,
664
- G,
665
- I,
666
- qt,
667
- l,
668
- S
704
+ Q,
705
+ F,
706
+ ot,
707
+ n,
708
+ v,
709
+ i,
710
+ D
669
711
  ]
670
712
  ), ut = p(() => {
671
- const t = l.current, e = ue.current;
713
+ const t = i.current, e = he.current;
672
714
  if (!(!t || !e.length))
673
- return qe({
674
- defaultSnapPosition: Et.current,
715
+ return ir({
716
+ defaultSnapPosition: bt.current,
675
717
  snapPositions: e,
676
718
  surfaceMotion: t
677
719
  });
678
- }, [l]), K = p(
720
+ }, [i]), Z = p(
679
721
  ({ destroy: t = !0 } = {}) => {
680
- t && _.current?.destroy(), _.current = null, Yt.current = null;
722
+ t && U.current?.destroy(), U.current = null, Yt.current = null;
681
723
  },
682
724
  []
683
- ), k = p(
725
+ ), A = p(
684
726
  (t, { active: e }) => {
685
- const a = l.current;
727
+ const a = i.current;
686
728
  if (!a) return;
687
- const c = ut(), s = c ? a.getBoundingClientRect() : void 0, u = c ? Ce(c.targets, "x") : void 0, d = c ? Ce(c.targets, "y") : void 0, f = Ve(u, s?.width), g = Ve(d, s?.height), m = c ? {
688
- x: Kt({
729
+ const c = ut(), l = c ? a.getBoundingClientRect() : void 0, u = c ? Re(c.targets, "x") : void 0, d = c ? Re(c.targets, "y") : void 0, f = Ge(u, l?.width), g = Ge(d, l?.height), h = c ? {
730
+ x: ee({
689
731
  targetTranslate: t.x,
690
732
  minTranslate: u?.minTranslate ?? 0,
691
733
  maxTranslate: u?.maxTranslate ?? 0,
692
734
  minBoundaryLimit: f,
693
735
  maxBoundaryLimit: f
694
736
  }),
695
- y: Kt({
737
+ y: ee({
696
738
  targetTranslate: t.y,
697
739
  minTranslate: d?.minTranslate ?? 0,
698
740
  maxTranslate: d?.maxTranslate ?? 0,
@@ -700,92 +742,96 @@ function Nr({
700
742
  maxBoundaryLimit: g
701
743
  })
702
744
  } : t;
703
- M.current.lastTranslateX = m.x, M.current.lastTranslate = m.y;
704
- const Y = e ? void 0 : t.settledTranslate;
745
+ Y.current.lastTranslateX = h.x, Y.current.lastTranslate = h.y;
746
+ const M = e ? void 0 : t.settledTranslate;
705
747
  a.style.setProperty(
706
748
  "--oc-modal-translate-x",
707
- Y?.x ?? `${m.x}px`
749
+ M?.x ?? `${h.x}px`
708
750
  ), a.style.setProperty(
709
751
  "--oc-modal-translate-y",
710
- Y?.y ?? `${m.y}px`
752
+ M?.y ?? `${h.y}px`
711
753
  ), a.dataset.ocModalDragging = e ? "true" : "false", a.parentElement && (a.parentElement.dataset.ocModalDragging = e ? "true" : "false"), a.style.transition = e ? "none" : "";
712
754
  },
713
- [ut, l]
755
+ [ut, i]
714
756
  ), X = p(() => {
715
- R.current?.destroy(), R.current = null, K();
716
- }, [K]), dt = p(
757
+ $.current?.destroy(), $.current = null, Z();
758
+ const t = i.current;
759
+ t?.dataset.ocModalSheetResizing && (delete t.dataset.ocModalSheetResizing, t.style.removeProperty("--oc-modal-resize-rest-translate-y"), t.style.removeProperty(
760
+ "--oc-modal-resize-target-scrollport-height"
761
+ ));
762
+ }, [Z, i]), dt = p(
717
763
  (t, e = H) => {
718
- X(), B(t, {
764
+ X(), O(t, {
719
765
  active: !0,
720
766
  nextDismissible: e,
721
767
  rubberBand: !0,
722
768
  settled: "frame"
723
769
  });
724
770
  },
725
- [B, X, H]
726
- ), de = p(() => {
771
+ [O, X, H]
772
+ ), ye = p(() => {
727
773
  const t = lt(), e = ct();
728
- return R.current !== null || _.current !== null ? (X(), o === "popup" && q(e, { x: 0, y: 0 }) > 0.5 ? k(e, { active: !1 }) : o === "bottom" && Math.abs(t) > 0.5 && B(t, { active: !1 }), { startTranslate: t, startTranslatePoint: e }) : { startTranslate: t, startTranslatePoint: e };
774
+ return $.current !== null || U.current !== null ? (X(), n === "popup" && et(e, { x: 0, y: 0 }) > 0.5 ? A(e, { active: !1 }) : n === "bottom" && Math.abs(t) > 0.5 && O(t, { active: !1 }), { startTranslate: t, startTranslatePoint: e }) : { startTranslate: t, startTranslatePoint: e };
729
775
  }, [
730
- k,
731
- B,
776
+ A,
777
+ O,
732
778
  X,
733
779
  lt,
734
780
  ct,
735
- o
736
- ]), v = p(() => {
737
- const t = l.current;
738
- t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.style.removeProperty("--_-modal-elevation-shadow-opacity"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), y.current?.style.removeProperty("transition"), y.current?.style.removeProperty("--oc-modal-backdrop-opacity"));
739
- }, [y, l]), pe = p(() => {
740
- const t = l.current, e = t?.parentElement;
741
- M.current.lastTranslate = 0, t?.style.removeProperty("--oc-modal-translate-y"), t?.style.removeProperty("--oc-modal-settled-translate-y"), t?.style.removeProperty("--_-modal-elevation-shadow-opacity"), e?.style.removeProperty("--oc-modal-overshoot-fill-height"), y.current?.style.removeProperty("--oc-modal-backdrop-opacity"), v();
742
- }, [y, v, l]), fe = p(
781
+ n
782
+ ]), S = p(() => {
783
+ const t = i.current;
784
+ t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), m.current?.style.removeProperty("transition"), E === void 0 && m.current?.style.removeProperty("--oc-modal-backdrop-opacity"));
785
+ }, [E, m, i]), Te = p(() => {
786
+ const t = i.current, e = t?.parentElement;
787
+ Y.current.lastTranslate = 0, t?.style.removeProperty("--oc-modal-translate-y"), t?.style.removeProperty("--oc-modal-settled-translate-y"), t?.style.removeProperty("--_-modal-elevation-shadow-opacity"), e?.style.removeProperty("--oc-modal-overshoot-fill-height"), m.current?.style.removeProperty("--oc-modal-backdrop-opacity"), S();
788
+ }, [m, S, i]), xe = p(
743
789
  ({
744
790
  preserveSnapPosition: t = !1,
745
791
  resetY: e = !0
746
792
  } = {}) => {
747
- const a = l.current;
748
- a && (t || (U.current = null), M.current.lastTranslateX = 0, a.style.removeProperty("--oc-modal-translate-x"), e && (M.current.lastTranslate = 0, a.style.removeProperty("--oc-modal-translate-y")), v());
793
+ const a = i.current;
794
+ a && (t || (K.current = null), Y.current.lastTranslateX = 0, a.style.removeProperty("--oc-modal-translate-x"), e && (Y.current.lastTranslate = 0, a.style.removeProperty("--oc-modal-translate-y")), S());
749
795
  },
750
- [v, l]
751
- ), O = p(
796
+ [S, i]
797
+ ), N = p(
752
798
  (t, {
753
799
  initialVelocity: e = 0,
754
800
  intent: a = "sheet",
755
801
  phase: c = "release",
756
- from: s,
802
+ from: l,
757
803
  onComplete: u,
758
804
  peekTranslateOverride: d,
759
805
  sheetHeightOverride: f
760
806
  } = {}) => {
761
- const g = l.current;
807
+ const g = i.current;
762
808
  if (!g) return;
763
809
  X();
764
- const m = s ?? Jt(g);
765
- if (Math.abs(m - t) < 0.5) {
766
- B(t, {
810
+ const h = l ?? re(g);
811
+ if (Math.abs(h - t) < 0.5) {
812
+ O(t, {
767
813
  active: !1,
768
814
  peekTranslateOverride: d,
769
815
  sheetHeightOverride: f
770
- }), v(), u?.();
816
+ }), S(), u?.();
771
817
  return;
772
818
  }
773
- const Y = c === "enter" ? t : "frame";
774
- B(m, {
819
+ const M = c === "enter" ? t : "frame";
820
+ O(h, {
775
821
  active: !0,
776
822
  peekTranslateOverride: d,
777
- settled: Y,
823
+ settled: M,
778
824
  sheetHeightOverride: f
779
825
  });
780
- const C = zt({
826
+ const C = Qt({
781
827
  element: g,
782
828
  intent: a,
783
829
  phase: c,
784
830
  reduced: "preserve",
785
831
  reducedMotion: !1,
786
832
  property: "transform"
787
- }), x = Gt({
788
- value: m,
833
+ }), T = te({
834
+ value: h,
789
835
  target: t,
790
836
  velocity: e,
791
837
  spring: C.spring,
@@ -793,127 +839,127 @@ function Nr({
793
839
  velocityEpsilon: 50,
794
840
  stabilityWindow: 0.02,
795
841
  onUpdate: (P) => {
796
- B(P, {
842
+ O(P, {
797
843
  active: !0,
798
844
  peekTranslateOverride: d,
799
- settled: Y === "frame" ? "frame" : void 0,
845
+ settled: M === "frame" ? "frame" : void 0,
800
846
  sheetHeightOverride: f
801
847
  });
802
848
  },
803
849
  onComplete: () => {
804
- R.current === x && (R.current = null), B(t, {
850
+ $.current === T && ($.current = null), O(t, {
805
851
  active: !1,
806
852
  peekTranslateOverride: d,
807
853
  sheetHeightOverride: f
808
- }), v(), u?.();
854
+ }), S(), u?.();
809
855
  }
810
856
  });
811
- R.current = x;
857
+ $.current = T;
812
858
  },
813
- [B, X, v, l]
814
- ), J = p(
859
+ [O, X, S, i]
860
+ ), q = p(
815
861
  (t, {
816
862
  from: e,
817
863
  initialVelocity: a = { x: 0, y: 0 }
818
864
  } = {}) => {
819
- const c = l.current;
865
+ const c = i.current;
820
866
  if (!c) return;
821
867
  X();
822
- const s = e ?? Ae(c), u = { x: t.x, y: t.y };
823
- if (q(s, u) < 0.5) {
824
- k(t, { active: !1 }), v();
868
+ const l = e ?? $e(c), u = { x: t.x, y: t.y };
869
+ if (et(l, u) < 0.5) {
870
+ A(t, { active: !1 }), S();
825
871
  return;
826
872
  }
827
- k(s, { active: !0 });
828
- const f = zt({
873
+ A(l, { active: !0 });
874
+ const f = Qt({
829
875
  element: c,
830
876
  intent: "gesture",
831
877
  phase: "release",
832
878
  reduced: "preserve",
833
879
  reducedMotion: !1,
834
880
  property: "transform"
835
- }), g = Gt({
836
- value: s,
881
+ }), g = te({
882
+ value: l,
837
883
  target: u,
838
884
  velocity: a,
839
885
  spring: f.spring,
840
886
  epsilon: 0.5,
841
887
  velocityEpsilon: 50,
842
888
  stabilityWindow: 0.02,
843
- onUpdate: (m) => {
844
- k(m, { active: !0 });
889
+ onUpdate: (h) => {
890
+ A(h, { active: !0 });
845
891
  },
846
892
  onComplete: () => {
847
- R.current === g && (R.current = null), k(t, { active: !1 }), v();
893
+ $.current === g && ($.current = null), A(t, { active: !1 }), S();
848
894
  }
849
895
  });
850
- R.current = g;
896
+ $.current = g;
851
897
  },
852
898
  [
853
- k,
899
+ A,
854
900
  X,
855
- v,
856
- l
901
+ S,
902
+ i
857
903
  ]
858
904
  ), pt = p(() => {
859
- const t = _.current;
905
+ const t = U.current;
860
906
  if (!t) return null;
861
907
  const e = t.sample();
862
- return k(e.value, { active: !0 }), e;
863
- }, [k]), ge = p(
908
+ return A(e.value, { active: !0 }), e;
909
+ }, [A]), Pe = p(
864
910
  (t) => {
865
- if (!l.current) return null;
866
- X(), k(t, { active: !0 });
867
- const a = Gt({
911
+ if (!i.current) return null;
912
+ X(), A(t, { active: !0 });
913
+ const a = te({
868
914
  value: t,
869
915
  target: t,
870
- spring: ir,
916
+ spring: hr,
871
917
  autoplay: !1,
872
918
  epsilon: 0.5,
873
919
  velocityEpsilon: 50,
874
920
  stabilityWindow: 0.02,
875
921
  onUpdate: (c) => {
876
- k(c, { active: !0 });
922
+ A(c, { active: !0 });
877
923
  },
878
924
  onComplete: () => {
879
925
  const c = Yt.current;
880
- !c || _.current !== a || (K({ destroy: !1 }), k(c, { active: !1 }), v());
926
+ !c || U.current !== a || (Z({ destroy: !1 }), A(c, { active: !1 }), S());
881
927
  }
882
928
  });
883
- return _.current = a, a;
929
+ return U.current = a, a;
884
930
  },
885
931
  [
886
- k,
932
+ A,
887
933
  X,
888
- K,
889
- v,
890
- l
934
+ Z,
935
+ S,
936
+ i
891
937
  ]
892
- ), me = p(
938
+ ), ve = p(
893
939
  (t) => {
894
- const e = _.current ?? ge(ct());
940
+ const e = U.current ?? Pe(ct());
895
941
  e && (Yt.current = null, e.setTarget(t));
896
942
  },
897
- [ct, ge]
943
+ [ct, Pe]
898
944
  ), ft = p(
899
945
  (t, e) => {
900
- const a = Ot(t, e);
901
- return me(a), pt(), a;
946
+ const a = Vt(t, e);
947
+ return ve(a), pt(), a;
902
948
  },
903
- [pt, me]
904
- ), Ct = p(
949
+ [pt, ve]
950
+ ), kt = p(
905
951
  (t) => {
906
- const e = l.current, a = _.current;
952
+ const e = i.current, a = U.current;
907
953
  if (!e || !a) {
908
- J(t);
954
+ q(t);
909
955
  return;
910
956
  }
911
- const s = pt() ? kt() : a.value, u = { x: t.x, y: t.y };
912
- if (q(s, u) < 0.5) {
913
- K(), k(t, { active: !1 }), v();
957
+ const l = pt() ? Ct() : a.value, u = { x: t.x, y: t.y };
958
+ if (et(l, u) < 0.5) {
959
+ Z(), A(t, { active: !1 }), S();
914
960
  return;
915
961
  }
916
- const d = zt({
962
+ const d = Qt({
917
963
  element: e,
918
964
  intent: "gesture",
919
965
  phase: "release",
@@ -924,35 +970,35 @@ function Nr({
924
970
  Yt.current = t, a.setTarget(u, { spring: d.spring });
925
971
  },
926
972
  [
927
- k,
928
- K,
929
- v,
930
- kt,
973
+ A,
974
+ Z,
975
+ S,
976
+ Ct,
931
977
  pt,
932
- J,
933
- l
978
+ q,
979
+ i
934
980
  ]
935
981
  ), gt = p(
936
982
  ({
937
983
  key: t,
938
984
  settle: e
939
985
  }) => {
940
- if (M.current.dragging) return !1;
986
+ if (Y.current.dragging) return !1;
941
987
  const a = ut();
942
988
  if (!a) return !1;
943
- const c = (t ? a.targets.find((s) => s.key === t) : void 0) ?? a.defaultTarget;
944
- return U.current = c.key, e ? J(c) : (X(), k(c, { active: !1 }), v()), !0;
989
+ const c = (t ? a.targets.find((l) => l.key === t) : void 0) ?? a.defaultTarget;
990
+ return K.current = c.key, e ? q(c) : (X(), A(c, { active: !1 }), S()), !0;
945
991
  },
946
992
  [
947
- k,
993
+ A,
948
994
  X,
949
- v,
995
+ S,
950
996
  ut,
951
- J
997
+ q
952
998
  ]
953
- ), he = p(
999
+ ), we = p(
954
1000
  (t, { from: e, initialVelocity: a = 0 }) => {
955
- O(t, {
1001
+ N(t, {
956
1002
  from: e,
957
1003
  initialVelocity: a,
958
1004
  onComplete: () => {
@@ -960,39 +1006,39 @@ function Nr({
960
1006
  }
961
1007
  });
962
1008
  },
963
- [at, O]
1009
+ [at, N]
964
1010
  );
965
- It(
1011
+ Nt(
966
1012
  () => () => {
967
- X(), W(!1), l.current && v();
1013
+ X(), J(!1), i.current && S();
968
1014
  },
969
1015
  [
970
1016
  X,
971
- v,
972
- W,
973
- l
1017
+ S,
1018
+ J,
1019
+ i
974
1020
  ]
975
- ), ot(() => {
976
- if (!i || !r || o !== "bottom") {
977
- Ht.current = i;
1021
+ ), G(() => {
1022
+ if (!s || !r || n !== "bottom") {
1023
+ _t.current = s;
978
1024
  return;
979
1025
  }
980
- if (!l.current || te?.()) return;
981
- Rt.current = !0;
982
- const t = Ht.current;
983
- Ht.current = !0;
984
- const e = b ?? I(), a = se.current ?? e, c = ae.current, s = le.current, u = ie.current, d = () => {
985
- se.current = e, ae.current = V, ie.current = S, le.current = D;
1026
+ if (!i.current || ae?.()) return;
1027
+ Wt.current = !0;
1028
+ const t = _t.current;
1029
+ _t.current = !0;
1030
+ const e = L ?? F(), a = pe.current ?? e, c = de.current, l = ge.current, u = fe.current, d = () => {
1031
+ pe.current = e, de.current = z, fe.current = D, ge.current = v;
986
1032
  }, f = !vt(
987
1033
  a,
988
1034
  e
989
- ), g = Pt(e), m = V === "peeked" ? g : S;
1035
+ ), g = Pt(e), h = z === "peeked" ? g : D;
990
1036
  if (!t) {
991
- Mt.current = { kind: "default-snap" }, B(e, {
1037
+ Et.current = { kind: "default-snap" }, O(e, {
992
1038
  active: !0,
993
1039
  peekTranslateOverride: g,
994
1040
  sheetHeightOverride: e
995
- }), O(m, {
1041
+ }), N(h, {
996
1042
  from: e,
997
1043
  intent: "sheet",
998
1044
  peekTranslateOverride: g,
@@ -1001,138 +1047,154 @@ function Nr({
1001
1047
  }), d();
1002
1048
  return;
1003
1049
  }
1004
- if (V === "visible" && f) {
1005
- const x = l.current, P = et(), Q = c === "visible" && a > 0 ? ar({
1050
+ if (z === "visible" && f) {
1051
+ const T = i.current, P = W(), R = c === "visible" && a > 0 ? fr({
1006
1052
  currentTranslate: P,
1007
- fallbackTranslate: S,
1008
- restState: Mt.current,
1053
+ fallbackTranslate: D,
1054
+ restState: Et.current,
1009
1055
  previousDefaultTranslate: u,
1010
1056
  previousSheetHeight: a,
1011
- previousSnapHeights: s,
1057
+ previousSnapHeights: l,
1012
1058
  targetSheetHeight: e,
1013
- targetDefaultTranslate: S,
1014
- targetSnapHeights: D
1015
- }) : S;
1059
+ targetDefaultTranslate: D,
1060
+ targetSnapHeights: v
1061
+ }) : D;
1016
1062
  X();
1017
- const N = Number.parseFloat(x.style.height), Dt = Number.isFinite(N) && N > 0 ? N : a, Je = A(
1018
- Dt - P,
1063
+ const B = Number.parseFloat(T.style.height), St = Number.isFinite(B) && B > 0 ? B : a, Ee = I(
1064
+ St - P,
1019
1065
  0,
1020
- Dt
1021
- ), Qe = A(
1022
- e - Q,
1066
+ St
1067
+ ), be = I(
1068
+ e - R,
1023
1069
  0,
1024
1070
  e
1025
- ), nt = Math.max(Dt, e), jt = Math.max(
1071
+ ), nt = Math.max(St, e), Jt = Math.max(
1026
1072
  0,
1027
- nt - Je
1028
- ), De = Math.max(
1073
+ nt - Ee
1074
+ ), Le = Math.max(
1029
1075
  0,
1030
- nt - Qe
1031
- ), Se = Pt(nt), Xe = () => {
1032
- B(Q, {
1076
+ nt - be
1077
+ ), Ae = Pt(nt), Ce = () => {
1078
+ O(R, {
1033
1079
  active: !1,
1034
1080
  peekTranslateOverride: g,
1035
1081
  sheetHeightOverride: e
1036
- }), x.style.setProperty("transition", "none"), x.style.removeProperty("height"), x.style.setProperty(
1082
+ }), T.style.setProperty("transition", "none"), T.style.removeProperty("height"), T.style.setProperty(
1037
1083
  "--oc-modal-sheet-height",
1038
1084
  `${e}px`
1039
- ), x.getBoundingClientRect(), x.style.removeProperty("transition");
1085
+ ), delete T.dataset.ocModalSheetResizing, T.style.removeProperty(
1086
+ "--oc-modal-resize-rest-translate-y"
1087
+ ), T.style.removeProperty(
1088
+ "--oc-modal-resize-target-scrollport-height"
1089
+ ), T.getBoundingClientRect(), T.style.removeProperty("transition"), $t?.();
1040
1090
  };
1041
- if (vt(jt, De)) {
1042
- Xe(), d();
1091
+ if (vt(Jt, Le)) {
1092
+ Ce(), d();
1043
1093
  return;
1044
1094
  }
1045
- x.style.setProperty("transition", "none"), x.style.setProperty("height", `${nt}px`), x.style.setProperty(
1095
+ const ke = () => {
1096
+ T.dataset.ocModalSheetResizing = "true", T.style.setProperty(
1097
+ "--oc-modal-resize-rest-translate-y",
1098
+ `${R}px`
1099
+ );
1100
+ const Be = j.current;
1101
+ Be && T.style.setProperty(
1102
+ "--oc-modal-resize-target-scrollport-height",
1103
+ `${Be.clientHeight + (be - Ee)}px`
1104
+ );
1105
+ };
1106
+ ke(), T.style.setProperty("transition", "none"), T.style.setProperty("height", `${nt}px`), T.style.setProperty(
1046
1107
  "--oc-modal-sheet-height",
1047
1108
  `${nt}px`
1048
- ), B(jt, {
1109
+ ), O(Jt, {
1049
1110
  active: !0,
1050
- peekTranslateOverride: Se,
1111
+ peekTranslateOverride: Ae,
1051
1112
  sheetHeightOverride: nt
1052
- }), x.getBoundingClientRect(), x.style.removeProperty("transition"), O(De, {
1053
- from: jt,
1113
+ }), T.getBoundingClientRect(), T.style.removeProperty("transition"), N(Le, {
1114
+ from: Jt,
1054
1115
  intent: "sheet",
1055
- peekTranslateOverride: Se,
1116
+ peekTranslateOverride: Ae,
1056
1117
  sheetHeightOverride: nt,
1057
- onComplete: Xe
1058
- }), d();
1118
+ onComplete: Ce
1119
+ }), ke(), $t?.(), d();
1059
1120
  return;
1060
1121
  }
1061
- if (V === "peeked") {
1062
- O(g, {
1122
+ if (z === "peeked") {
1123
+ N(g, {
1063
1124
  peekTranslateOverride: g,
1064
1125
  sheetHeightOverride: e
1065
1126
  }), d();
1066
1127
  return;
1067
1128
  }
1068
- if (Vt.current) {
1069
- Vt.current = !1, d();
1129
+ if (jt.current) {
1130
+ jt.current = !1, d();
1070
1131
  return;
1071
1132
  }
1072
- const Y = c !== V;
1133
+ const M = c !== z;
1073
1134
  if (!vt(
1074
1135
  u,
1075
- S
1136
+ D
1076
1137
  )) {
1077
- const x = et(), Q = R.current !== null && (S > u && x < S || S < u && x > S);
1078
- if (vt(x, u) || Q) {
1079
- X(), B(S, {
1138
+ const T = W(), R = $.current !== null && (D > u && T < D || D < u && T > D);
1139
+ if (vt(T, u) || R) {
1140
+ X(), O(D, {
1080
1141
  active: !1,
1081
1142
  peekTranslateOverride: g,
1082
1143
  sheetHeightOverride: e
1083
- }), v(), d();
1144
+ }), S(), d();
1084
1145
  return;
1085
1146
  }
1086
1147
  }
1087
- if (!Y) {
1148
+ if (!M) {
1088
1149
  d();
1089
1150
  return;
1090
1151
  }
1091
- O(S, {
1152
+ N(D, {
1092
1153
  peekTranslateOverride: g,
1093
1154
  sheetHeightOverride: e
1094
- }), Mt.current = { kind: "default-snap" }, d();
1155
+ }), Et.current = { kind: "default-snap" }, d();
1095
1156
  }, [
1096
1157
  r,
1097
1158
  Pt,
1098
- I,
1099
- et,
1100
- b,
1101
- D,
1102
- i,
1103
- o,
1104
- V,
1105
- te,
1106
- B,
1107
- X,
1159
+ F,
1160
+ W,
1161
+ L,
1108
1162
  v,
1109
- vt,
1163
+ s,
1164
+ n,
1165
+ z,
1166
+ $t,
1167
+ ae,
1110
1168
  O,
1111
- h,
1112
- l,
1113
- S
1114
- ]), ot(() => {
1115
- o !== "bottom" && Rt.current && (Rt.current = !1, X(), pe());
1116
- }, [X, o, pe]), ot(() => {
1117
- if (!i || !r || !E) {
1118
- const c = !i && o === "popup" && st.current, s = i && o !== "popup" && st.current;
1119
- st.current && !c && (j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null), X(), fe({
1120
- preserveSnapPosition: s
1121
- })), st.current && c && (X(), v()), _t.current = i && o === "popup", st.current = !1;
1169
+ X,
1170
+ S,
1171
+ vt,
1172
+ N,
1173
+ y,
1174
+ i,
1175
+ D
1176
+ ]), G(() => {
1177
+ n !== "bottom" && Wt.current && (Wt.current = !1, X(), Te());
1178
+ }, [X, n, Te]), G(() => {
1179
+ if (!s || !r || !b) {
1180
+ const c = !s && n === "popup" && st.current, l = s && n !== "popup" && st.current;
1181
+ st.current && !c && (_.current !== null && (window.cancelAnimationFrame(_.current), _.current = null), X(), xe({
1182
+ preserveSnapPosition: l
1183
+ })), st.current && c && (X(), S()), Gt.current = s && n === "popup", st.current = !1;
1122
1184
  return;
1123
1185
  }
1124
- const t = _t.current;
1125
- _t.current = !0, st.current = !0;
1186
+ const t = Gt.current;
1187
+ Gt.current = !0, st.current = !0;
1126
1188
  let e = null;
1127
1189
  const a = (c) => gt({
1128
1190
  key: c,
1129
1191
  settle: t
1130
1192
  });
1131
1193
  return a(
1132
- U.current ?? Et.current
1194
+ K.current ?? bt.current
1133
1195
  ) || (e = window.requestAnimationFrame(() => {
1134
1196
  e = null, a(
1135
- U.current ?? Et.current
1197
+ K.current ?? bt.current
1136
1198
  );
1137
1199
  })), () => {
1138
1200
  e !== null && window.cancelAnimationFrame(e);
@@ -1140,58 +1202,58 @@ function Nr({
1140
1202
  }, [
1141
1203
  X,
1142
1204
  r,
1143
- v,
1144
- i,
1145
- o,
1146
- ce,
1147
- E,
1148
- fe,
1205
+ S,
1206
+ s,
1207
+ n,
1208
+ me,
1209
+ b,
1210
+ xe,
1149
1211
  gt
1150
- ]), ot(() => {
1151
- if (!i || !r || !E) return;
1212
+ ]), G(() => {
1213
+ if (!s || !r || !b) return;
1152
1214
  const t = () => {
1153
- M.current.dragging || j.current === null && (j.current = window.requestAnimationFrame(() => {
1154
- j.current = null, !M.current.dragging && gt({
1155
- key: U.current,
1215
+ Y.current.dragging || _.current === null && (_.current = window.requestAnimationFrame(() => {
1216
+ _.current = null, !Y.current.dragging && gt({
1217
+ key: K.current,
1156
1218
  settle: !1
1157
1219
  });
1158
1220
  }));
1159
1221
  };
1160
1222
  window.addEventListener("resize", t), window.visualViewport?.addEventListener("resize", t);
1161
- const e = l.current, a = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t), s = (u) => {
1223
+ const e = i.current, a = e?.parentElement, c = typeof ResizeObserver > "u" ? null : new ResizeObserver(t), l = (u) => {
1162
1224
  e && u.target instanceof Element && e.contains(u.target) && t();
1163
1225
  };
1164
1226
  return c && (e && c.observe(e), a && c.observe(a)), e?.addEventListener(
1165
1227
  "transitionend",
1166
- s,
1228
+ l,
1167
1229
  !0
1168
1230
  ), e?.addEventListener(
1169
1231
  "transitioncancel",
1170
- s,
1232
+ l,
1171
1233
  !0
1172
1234
  ), () => {
1173
1235
  window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), e?.removeEventListener(
1174
1236
  "transitionend",
1175
- s,
1237
+ l,
1176
1238
  !0
1177
1239
  ), e?.removeEventListener(
1178
1240
  "transitioncancel",
1179
- s,
1241
+ l,
1180
1242
  !0
1181
- ), c?.disconnect(), j.current !== null && (window.cancelAnimationFrame(j.current), j.current = null);
1243
+ ), c?.disconnect(), _.current !== null && (window.cancelAnimationFrame(_.current), _.current = null);
1182
1244
  };
1183
1245
  }, [
1184
1246
  r,
1247
+ s,
1248
+ b,
1185
1249
  i,
1186
- E,
1187
- l,
1188
1250
  gt
1189
- ]), ot(() => {
1190
- if (re <= 0 || !i || !r || !E)
1251
+ ]), G(() => {
1252
+ if (ie <= 0 || !s || !r || !b)
1191
1253
  return;
1192
1254
  let t = window.requestAnimationFrame(() => {
1193
1255
  t = null, gt({
1194
- key: U.current,
1256
+ key: K.current,
1195
1257
  settle: !1
1196
1258
  });
1197
1259
  });
@@ -1200,30 +1262,30 @@ function Nr({
1200
1262
  };
1201
1263
  }, [
1202
1264
  r,
1203
- i,
1204
- E,
1205
- re,
1265
+ s,
1266
+ b,
1267
+ ie,
1206
1268
  gt
1207
1269
  ]);
1208
- const ye = p(
1270
+ const Se = p(
1209
1271
  (t, e, a) => {
1210
- if (typeof Element > "u" || !(t instanceof Element) || Wt(t)) return !1;
1211
- const c = Date.now(), s = e > 0, u = er(t, z.current);
1212
- return !a && u && s && u.scrollTop > 0 || !a && Xt.current && c - Xt.current < ee && Math.abs(et()) <= 1 ? (Xt.current = c, !1) : !0;
1272
+ if (typeof Element > "u" || !(t instanceof Element) || qt(t)) return !1;
1273
+ const c = Date.now(), l = e > 0, u = cr(t, j.current);
1274
+ return !a && u && l && u.scrollTop > 0 || !a && Mt.current && c - Mt.current < se && Math.abs(W()) <= 1 ? (Mt.current = c, !1) : !0;
1213
1275
  },
1214
- [et, ee]
1276
+ [W, se]
1215
1277
  ), wt = p(
1216
1278
  ({
1217
1279
  chrome: t,
1218
1280
  pointerId: e = null,
1219
1281
  selectionArbitration: a = !1,
1220
1282
  source: c,
1221
- startX: s = 0,
1283
+ startX: l = 0,
1222
1284
  startY: u,
1223
1285
  touchId: d = null
1224
1286
  }) => {
1225
- const { startTranslate: f, startTranslatePoint: g } = de(), m = Z();
1226
- M.current = {
1287
+ const { startTranslate: f, startTranslatePoint: g } = ye(), h = tt();
1288
+ Y.current = {
1227
1289
  dragging: !0,
1228
1290
  allowed: !1,
1229
1291
  chrome: t,
@@ -1231,19 +1293,19 @@ function Nr({
1231
1293
  closeAllowed: null,
1232
1294
  started: !1,
1233
1295
  source: c,
1234
- startX: s,
1296
+ startX: l,
1235
1297
  startY: u,
1236
- lastX: s,
1298
+ lastX: l,
1237
1299
  lastY: u,
1238
1300
  startTranslateX: g.x,
1239
1301
  startTranslate: f,
1240
1302
  lastTranslateX: g.x,
1241
1303
  lastTranslate: f,
1242
- startTime: m,
1304
+ startTime: h,
1243
1305
  samples: [
1244
1306
  {
1245
- time: m,
1246
- pageX: s,
1307
+ time: h,
1308
+ pageX: l,
1247
1309
  pageY: u,
1248
1310
  translateX: g.x,
1249
1311
  translateY: f
@@ -1253,16 +1315,16 @@ function Nr({
1253
1315
  touchId: d
1254
1316
  };
1255
1317
  },
1256
- [de]
1318
+ [ye]
1257
1319
  ), mt = p(
1258
1320
  (t) => {
1259
- t.source === "touch" ? it(!1) : t.source === "pointer" && W(!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;
1321
+ t.source === "touch" ? it(!1) : t.source === "pointer" && 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;
1260
1322
  },
1261
- [W, it]
1262
- ), Te = p(
1323
+ [J, it]
1324
+ ), De = p(
1263
1325
  (t, e) => {
1264
1326
  const a = lt(), c = ct();
1265
- 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 = Z(), t.samples = [
1327
+ 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 = tt(), t.samples = [
1266
1328
  {
1267
1329
  time: t.startTime,
1268
1330
  pageX: e.x,
@@ -1273,60 +1335,78 @@ function Nr({
1273
1335
  ];
1274
1336
  },
1275
1337
  [lt, ct]
1276
- ), xe = p(
1338
+ ), Xe = p(
1277
1339
  ({
1278
1340
  currentTranslate: t,
1279
1341
  dismissible: e,
1280
1342
  releaseVelocity: a,
1281
1343
  deltaY: c,
1282
- startTranslate: s
1344
+ startTranslate: l
1283
1345
  }) => {
1284
- const u = I(), d = G(), f = d > 0, g = u, m = Math.max(
1285
- F.dismissal.minDistancePx,
1346
+ const u = F(), d = Q(), f = d > 0, g = u, h = Math.max(
1347
+ k.dismissal.minDistancePx,
1286
1348
  (u - d) * Tt
1287
- ), Y = D.map(
1288
- (Q) => A(u - Q, 0, u)
1289
- ), C = Me(
1290
- Y.length ? Y : [0]
1291
- ), x = yr({
1349
+ ), M = v.map(
1350
+ (R) => I(u - R, 0, u)
1351
+ ), C = Fe(
1352
+ M.length ? M : [0]
1353
+ ), T = Mr({
1292
1354
  currentTranslate: t,
1293
1355
  releaseVelocity: a
1294
1356
  });
1295
1357
  f && C.push(d);
1296
- const P = Me(C);
1297
- return e && !f && c > 0 && t >= d + m ? g : xr(a) ? P.length > 1 ? pr(
1358
+ const P = Fe(C);
1359
+ return e && !f && c > 0 && t >= d + h ? g : Er(a) ? P.length > 1 ? vr(
1298
1360
  P,
1299
- s,
1361
+ l,
1300
1362
  t,
1301
1363
  c > 0 ? "down" : "up",
1302
- x
1303
- ) : 0 : e && t > u * Tt && !f ? g : ur(P, t);
1364
+ T
1365
+ ) : 0 : e && t > u * Tt && !f ? g : xr(P, t);
1304
1366
  },
1305
- [Tt, G, I, D]
1306
- ), Pe = p(
1367
+ [Tt, Q, F, v]
1368
+ ), Bt = p(
1307
1369
  (t) => {
1308
- const e = b ?? I();
1309
- Mt.current = sr({
1310
- defaultTranslate: S,
1370
+ const e = L ?? F();
1371
+ Et.current = gr({
1372
+ defaultTranslate: D,
1311
1373
  sheetHeight: e,
1312
- snapHeights: D,
1374
+ snapHeights: v,
1313
1375
  translate: t
1314
1376
  });
1315
1377
  },
1316
- [I, b, D, S]
1317
- ), je = p(
1378
+ [F, L, v, D]
1379
+ ), qe = p(() => {
1380
+ if (n !== "bottom") return !1;
1381
+ const t = mr({
1382
+ backdropFromHeight: E,
1383
+ currentTranslate: W(),
1384
+ sheetHeight: L ?? F(),
1385
+ snapHeights: v
1386
+ });
1387
+ return t === null ? !1 : (N(t, { intent: "sheet" }), Bt(t), !0);
1388
+ }, [
1389
+ E,
1390
+ Bt,
1391
+ F,
1392
+ W,
1393
+ n,
1394
+ N,
1395
+ L,
1396
+ v
1397
+ ]), tr = p(
1318
1398
  (t) => {
1319
- if (!r || o !== "bottom" && !E || n === !1 || t.pointerType === "touch") return;
1399
+ if (!r || n !== "bottom" && !b || o === !1 || t.pointerType === "touch") return;
1320
1400
  let e = !1;
1321
- if (n === "handle" && ke(t.target))
1401
+ if (o === "handle" && ze(t.target))
1322
1402
  e = !0;
1323
- else if (n === "handle")
1403
+ else if (o === "handle")
1324
1404
  return;
1325
- if (!e && Wt(t.target)) return;
1326
- if (n === "content" && (e = Le(t.target), !mr(t, e))) {
1327
- o === "bottom" && !rr({
1405
+ if (!e && qt(t.target)) return;
1406
+ if (o === "content" && (e = Ve(t.target), !Dr(t, e))) {
1407
+ n === "bottom" && !ur({
1328
1408
  target: t.target,
1329
- boundary: z.current
1409
+ boundary: j.current
1330
1410
  }) && wt({
1331
1411
  chrome: !1,
1332
1412
  pointerId: t.pointerId,
@@ -1337,161 +1417,161 @@ function Nr({
1337
1417
  });
1338
1418
  return;
1339
1419
  }
1340
- const a = gr(t.target);
1420
+ const a = Sr(t.target);
1341
1421
  wt({
1342
1422
  chrome: e,
1343
1423
  pointerId: t.pointerId,
1344
1424
  source: "pointer",
1345
1425
  startX: t.pageX,
1346
1426
  startY: t.pageY
1347
- }), fr(t.target) || t.preventDefault(), W(!0), !a && typeof t.currentTarget.setPointerCapture == "function" && t.currentTarget.setPointerCapture(t.pointerId);
1427
+ }), wr(t.target) || t.preventDefault(), J(!0), !a && typeof t.currentTarget.setPointerCapture == "function" && t.currentTarget.setPointerCapture(t.pointerId);
1348
1428
  },
1349
1429
  [
1350
1430
  wt,
1351
- n,
1352
- r,
1353
1431
  o,
1354
- E,
1355
- W
1432
+ r,
1433
+ n,
1434
+ b,
1435
+ J
1356
1436
  ]
1357
1437
  ), ht = p(
1358
1438
  (t, e) => {
1359
1439
  if (!H) return !1;
1360
1440
  if (e <= 0) return !0;
1361
1441
  if (t.closeAllowed !== null) return t.closeAllowed;
1362
- const a = Zt({ reason: "drag-dismiss" });
1442
+ const a = oe({ reason: "drag-dismiss" });
1363
1443
  return t.closeAllowed = a, a;
1364
1444
  },
1365
- [Zt, H]
1366
- ), Ft = p(
1445
+ [oe, H]
1446
+ ), It = p(
1367
1447
  ({
1368
1448
  closeAllowed: t,
1369
1449
  currentTranslate: e,
1370
1450
  deltaY: a,
1371
1451
  releaseVelocity: c,
1372
- startTranslate: s
1452
+ startTranslate: l
1373
1453
  }) => {
1374
- const d = xe({
1454
+ const d = Xe({
1375
1455
  currentTranslate: e,
1376
1456
  dismissible: H && t !== !1,
1377
1457
  releaseVelocity: c,
1378
1458
  deltaY: a,
1379
- startTranslate: s
1380
- }), f = I(), g = G();
1459
+ startTranslate: l
1460
+ }), f = F(), g = Q();
1381
1461
  if (d >= f - 1) {
1382
- at({ reason: "drag-dismiss" }, { commit: !1 }) ? he(d, {
1462
+ at({ reason: "drag-dismiss" }, { commit: !1 }) ? we(d, {
1383
1463
  from: e,
1384
1464
  initialVelocity: c
1385
- }) : O(s, {
1465
+ }) : N(l, {
1386
1466
  from: e,
1387
1467
  initialVelocity: c
1388
1468
  });
1389
1469
  return;
1390
1470
  }
1391
- g > 0 && d >= g - 1 ? Nt("peeked") : (Yr({
1392
- presentationState: V,
1471
+ g > 0 && d >= g - 1 ? Rt("peeked") : (Ir({
1472
+ presentationState: z,
1393
1473
  releaseTranslate: d,
1394
- visibleTranslate: S
1395
- }) && (Vt.current = !0), Nt("visible"), Pe(d)), O(d, {
1474
+ visibleTranslate: D
1475
+ }) && (jt.current = !0), Rt("visible"), Bt(d)), N(d, {
1396
1476
  from: e,
1397
1477
  initialVelocity: c
1398
1478
  });
1399
1479
  },
1400
1480
  [
1401
- he,
1402
- Pe,
1481
+ we,
1482
+ Bt,
1403
1483
  H,
1404
- G,
1405
- xe,
1406
- I,
1407
- V,
1484
+ Q,
1485
+ Xe,
1486
+ F,
1487
+ z,
1408
1488
  at,
1409
- Nt,
1410
- O,
1411
- S
1489
+ Rt,
1490
+ N,
1491
+ D
1412
1492
  ]
1413
- ), At = p(
1493
+ ), Ft = p(
1414
1494
  ({
1415
1495
  currentTranslate: t,
1416
1496
  releaseDelta: e,
1417
1497
  releaseTranslate: a,
1418
1498
  releaseVelocity: c
1419
1499
  }) => {
1420
- const s = ut();
1421
- if (!s) return;
1422
- const u = vr({
1500
+ const l = ut();
1501
+ if (!l) return;
1502
+ const u = Lr({
1423
1503
  currentTranslate: a,
1424
1504
  releaseVelocity: c,
1425
- targets: s.targets
1426
- }), d = s.targets.find(
1427
- (Y) => Y.key === U.current
1428
- ) ?? s.defaultTarget, g = l.current?.getBoundingClientRect(), m = {
1505
+ targets: l.targets
1506
+ }), d = l.targets.find(
1507
+ (M) => M.key === K.current
1508
+ ) ?? l.defaultTarget, g = i.current?.getBoundingClientRect(), h = {
1429
1509
  x: d.x + e.x,
1430
1510
  y: d.y + e.y
1431
1511
  };
1432
- if (H && g && Xr({
1512
+ if (H && g && Br({
1433
1513
  closeThreshold: Tt,
1434
1514
  currentTarget: d,
1435
- currentTranslate: m,
1515
+ currentTranslate: h,
1436
1516
  releaseTarget: u,
1437
1517
  surfaceSize: {
1438
1518
  height: g.height,
1439
1519
  width: g.width
1440
1520
  },
1441
- targets: s.targets
1521
+ targets: l.targets
1442
1522
  }) && at({ reason: "drag-dismiss" })) {
1443
- K(), v();
1523
+ Z(), S();
1444
1524
  return;
1445
1525
  }
1446
- if (U.current = u.key, _.current) {
1447
- Ct(u);
1526
+ if (K.current = u.key, U.current) {
1527
+ kt(u);
1448
1528
  return;
1449
1529
  }
1450
- J(u, {
1530
+ q(u, {
1451
1531
  from: t,
1452
1532
  initialVelocity: c
1453
1533
  });
1454
1534
  },
1455
1535
  [
1456
- K,
1536
+ Z,
1457
1537
  Tt,
1458
1538
  H,
1459
- v,
1539
+ S,
1460
1540
  ut,
1461
1541
  at,
1462
- Ct,
1463
- J,
1464
- l
1542
+ kt,
1543
+ q,
1544
+ i
1465
1545
  ]
1466
- ), ze = p(
1546
+ ), er = p(
1467
1547
  (t) => {
1468
- const e = M.current;
1469
- if (!e.dragging || e.source !== "pointer" || !r || o !== "bottom" && !E)
1548
+ const e = Y.current;
1549
+ if (!e.dragging || e.source !== "pointer" || !r || n !== "bottom" && !b)
1470
1550
  return;
1471
- const a = t.pageX - e.startX, c = t.pageY - e.startY, s = t.pointerType === "touch" ? F.dragStartThresholdPx.touch : F.dragStartThresholdPx.mouse;
1472
- if (!(!e.started && Ee({ deltaX: a, deltaY: c, placement: o }) < s)) {
1551
+ const a = t.pageX - e.startX, c = t.pageY - e.startY, l = t.pointerType === "touch" ? k.dragStartThresholdPx.touch : k.dragStartThresholdPx.mouse;
1552
+ if (!(!e.started && Oe({ deltaX: a, deltaY: c, placement: n }) < l)) {
1473
1553
  if (e.selectionArbitration && !e.allowed) {
1474
- const u = Math.abs(a), d = Math.abs(c), f = F.selectionArbitrationThresholdPx;
1554
+ const u = Math.abs(a), d = Math.abs(c), f = k.selectionArbitrationThresholdPx;
1475
1555
  if (u >= f && u >= d) {
1476
1556
  e.dragging = !1;
1477
1557
  return;
1478
1558
  }
1479
1559
  if (d < f || d <= u)
1480
1560
  return;
1481
- window.getSelection?.()?.removeAllRanges(), W(!0);
1561
+ window.getSelection?.()?.removeAllRanges(), J(!0);
1482
1562
  }
1483
1563
  if (!e.allowed) {
1484
- if (o === "bottom" && !ye(t.target, c, e.chrome))
1564
+ if (n === "bottom" && !Se(t.target, c, e.chrome))
1485
1565
  return;
1486
1566
  e.allowed = !0, e.started = !0;
1487
1567
  const u = t.currentTarget;
1488
1568
  e.pointerId !== null && typeof u.hasPointerCapture == "function" && typeof u.setPointerCapture == "function" && !u.hasPointerCapture(e.pointerId) && u.setPointerCapture(e.pointerId);
1489
1569
  }
1490
- if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, o === "popup")
1491
- ft(e, t), Be(e, t);
1570
+ if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, n === "popup")
1571
+ ft(e, t), Ue(e, t);
1492
1572
  else {
1493
1573
  const u = e.startTranslate + c, d = ht(e, c);
1494
- dt(u, d), St(e, {
1574
+ dt(u, d), Dt(e, {
1495
1575
  pageX: t.pageX,
1496
1576
  pageY: t.pageY,
1497
1577
  translateX: e.lastTranslateX,
@@ -1504,11 +1584,11 @@ function Nr({
1504
1584
  r,
1505
1585
  ft,
1506
1586
  ht,
1507
- o,
1508
- E,
1509
- W,
1587
+ n,
1588
+ b,
1589
+ J,
1510
1590
  dt,
1511
- ye
1591
+ Se
1512
1592
  ]
1513
1593
  ), rt = p(
1514
1594
  ({
@@ -1517,87 +1597,87 @@ function Nr({
1517
1597
  pageY: a,
1518
1598
  releaseCapture: c = !0
1519
1599
  }) => {
1520
- const s = M.current;
1521
- if (!s.dragging || s.source !== "pointer" || !r || o !== "bottom" && !E)
1600
+ const l = Y.current;
1601
+ if (!l.dragging || l.source !== "pointer" || !r || n !== "bottom" && !b)
1522
1602
  return;
1523
- const u = s.started, d = Number.isFinite(e) ? e : s.lastX, f = Number.isFinite(a) ? a : s.lastY, g = d - s.startX, m = f - s.startY, Y = Math.max(Z() - s.startTime, 1);
1603
+ const u = l.started, d = Number.isFinite(e) ? e : l.lastX, f = Number.isFinite(a) ? a : l.lastY, g = d - l.startX, h = f - l.startY, M = Math.max(tt() - l.startTime, 1);
1524
1604
  let C = {
1525
- x: s.lastTranslateX,
1526
- y: s.lastTranslate
1527
- }, x = C;
1528
- const P = s.startTranslate;
1605
+ x: l.lastTranslateX,
1606
+ y: l.lastTranslate
1607
+ }, T = C;
1608
+ const P = l.startTranslate;
1529
1609
  if (u)
1530
- if (o === "popup")
1531
- ft(s, {
1610
+ if (n === "popup")
1611
+ ft(l, {
1532
1612
  pageX: d,
1533
1613
  pageY: f
1534
1614
  }), C = {
1535
- x: s.lastTranslateX,
1536
- y: s.lastTranslate
1537
- }, x = Ot(s, {
1615
+ x: l.lastTranslateX,
1616
+ y: l.lastTranslate
1617
+ }, T = Vt(l, {
1538
1618
  pageX: d,
1539
1619
  pageY: f
1540
1620
  });
1541
1621
  else {
1542
- const N = s.startTranslate + m, Dt = ht(s, m);
1543
- dt(N, Dt), C = {
1544
- x: s.lastTranslateX,
1545
- y: s.lastTranslate
1622
+ const B = l.startTranslate + h, St = ht(l, h);
1623
+ dt(B, St), C = {
1624
+ x: l.lastTranslateX,
1625
+ y: l.lastTranslate
1546
1626
  };
1547
1627
  }
1548
- const Q = s.closeAllowed;
1549
- if (c && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
1550
- const N = o === "popup" ? x : {
1551
- x: s.lastTranslateX,
1552
- y: s.lastTranslate
1628
+ const R = l.closeAllowed;
1629
+ if (c && t && l.pointerId !== null && t.hasPointerCapture(l.pointerId) && t.releasePointerCapture(l.pointerId), u) {
1630
+ const B = n === "popup" ? T : {
1631
+ x: l.lastTranslateX,
1632
+ y: l.lastTranslate
1553
1633
  };
1554
- St(s, {
1634
+ Dt(l, {
1555
1635
  pageX: d,
1556
1636
  pageY: f,
1557
- translateX: N.x,
1558
- translateY: N.y
1637
+ translateX: B.x,
1638
+ translateY: B.y
1559
1639
  });
1560
1640
  }
1561
- if (mt(s), !!u)
1562
- if (xt.current = Z() + 500, o === "popup") {
1563
- const N = Oe({
1564
- session: s,
1565
- fallbackDelta: { x: g, y: m },
1566
- fallbackElapsed: Y
1641
+ if (mt(l), !!u)
1642
+ if (xt.current = tt() + 500, n === "popup") {
1643
+ const B = _e({
1644
+ session: l,
1645
+ fallbackDelta: { x: g, y: h },
1646
+ fallbackElapsed: M
1567
1647
  });
1568
- At({
1648
+ Ft({
1569
1649
  currentTranslate: C,
1570
- releaseDelta: { x: g, y: m },
1571
- releaseTranslate: x,
1572
- releaseVelocity: N
1650
+ releaseDelta: { x: g, y: h },
1651
+ releaseTranslate: T,
1652
+ releaseVelocity: B
1573
1653
  });
1574
1654
  } else {
1575
- const N = Ie({
1576
- session: s,
1577
- fallbackDeltaY: m,
1578
- fallbackElapsed: Y
1655
+ const B = je({
1656
+ session: l,
1657
+ fallbackDeltaY: h,
1658
+ fallbackElapsed: M
1579
1659
  });
1580
- Ft({
1581
- closeAllowed: Q,
1660
+ It({
1661
+ closeAllowed: R,
1582
1662
  currentTranslate: C.y,
1583
- deltaY: m,
1584
- releaseVelocity: N,
1663
+ deltaY: h,
1664
+ releaseVelocity: B,
1585
1665
  startTranslate: P
1586
1666
  });
1587
1667
  }
1588
1668
  },
1589
1669
  [
1670
+ It,
1590
1671
  Ft,
1591
- At,
1592
1672
  r,
1593
1673
  ft,
1594
1674
  ht,
1595
- o,
1596
- E,
1675
+ n,
1676
+ b,
1597
1677
  mt,
1598
1678
  dt
1599
1679
  ]
1600
- ), ve = p(
1680
+ ), Me = p(
1601
1681
  (t) => {
1602
1682
  rt({
1603
1683
  currentTarget: t.currentTarget,
@@ -1606,9 +1686,9 @@ function Nr({
1606
1686
  });
1607
1687
  },
1608
1688
  [rt]
1609
- ), Ue = p(
1689
+ ), rr = p(
1610
1690
  (t) => {
1611
- const e = M.current;
1691
+ const e = Y.current;
1612
1692
  e.pointerId !== null && t.pointerId !== e.pointerId || rt({
1613
1693
  pageX: t.pageX,
1614
1694
  pageY: t.pageY,
@@ -1617,28 +1697,28 @@ function Nr({
1617
1697
  },
1618
1698
  [rt]
1619
1699
  );
1620
- It(() => {
1700
+ Nt(() => {
1621
1701
  if (!r) return;
1622
- const t = (s) => {
1623
- const u = M.current;
1624
- !u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || rt({
1625
- pageX: s.pageX,
1626
- pageY: s.pageY,
1702
+ const t = (l) => {
1703
+ const u = Y.current;
1704
+ !u.dragging || u.source !== "pointer" || "pointerId" in l && u.pointerId !== null && l.pointerId !== u.pointerId || rt({
1705
+ pageX: l.pageX,
1706
+ pageY: l.pageY,
1627
1707
  releaseCapture: !1
1628
1708
  });
1629
1709
  }, e = () => {
1630
- const s = M.current;
1631
- !s.dragging || s.source !== "pointer" || rt({
1632
- pageX: s.lastX,
1633
- pageY: s.lastY,
1710
+ const l = Y.current;
1711
+ !l.dragging || l.source !== "pointer" || rt({
1712
+ pageX: l.lastX,
1713
+ pageY: l.lastY,
1634
1714
  releaseCapture: !1
1635
1715
  });
1636
- }, a = (s) => {
1637
- const u = M.current;
1638
- !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1639
- }, c = (s) => {
1640
- const u = M.current;
1641
- !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1716
+ }, a = (l) => {
1717
+ const u = Y.current;
1718
+ !u.dragging || u.source !== "pointer" || l.relatedTarget === null && t(l);
1719
+ }, c = (l) => {
1720
+ const u = Y.current;
1721
+ !u.dragging || u.source !== "pointer" || l.relatedTarget === null && t(l);
1642
1722
  };
1643
1723
  return document.addEventListener("pointerout", a, !0), document.addEventListener("mouseout", c, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
1644
1724
  "pointercancel",
@@ -1659,37 +1739,37 @@ function Nr({
1659
1739
  !0
1660
1740
  ), window.removeEventListener("blur", e);
1661
1741
  };
1662
- }, [rt, r]), It(() => {
1742
+ }, [rt, r]), Nt(() => {
1663
1743
  if (!r) return;
1664
1744
  const t = (e) => {
1665
1745
  const a = xt.current;
1666
1746
  if (a <= 0) return;
1667
- if (Z() > a) {
1747
+ if (tt() > a) {
1668
1748
  xt.current = 0;
1669
1749
  return;
1670
1750
  }
1671
- const c = l.current;
1751
+ const c = i.current;
1672
1752
  c && e.target instanceof Node && c.contains(e.target) && (xt.current = 0, e.preventDefault(), e.stopPropagation());
1673
1753
  };
1674
1754
  return document.addEventListener("click", t, !0), () => {
1675
1755
  document.removeEventListener("click", t, !0);
1676
1756
  };
1677
- }, [r, l]);
1678
- const Bt = p((t) => {
1679
- const e = M.current;
1680
- return e.touchId !== null ? Fe(t.changedTouches, e.touchId) ?? Fe(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1681
- }, []), We = p(
1757
+ }, [r, i]);
1758
+ const Ot = p((t) => {
1759
+ const e = Y.current;
1760
+ return e.touchId !== null ? He(t.changedTouches, e.touchId) ?? He(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1761
+ }, []), nr = p(
1682
1762
  (t) => {
1683
- if (!r || o !== "bottom" && !E || n === !1 || t.touches.length !== 1) return;
1763
+ if (!r || n !== "bottom" && !b || o === !1 || t.touches.length !== 1) return;
1684
1764
  let e = !1;
1685
- if (n === "handle" && ke(t.target))
1765
+ if (o === "handle" && ze(t.target))
1686
1766
  e = !0;
1687
- else if (n === "handle")
1767
+ else if (o === "handle")
1688
1768
  return;
1689
- if (!e && Wt(t.target)) return;
1690
- n === "content" && (e = Le(t.target));
1769
+ if (!e && qt(t.target)) return;
1770
+ o === "content" && (e = Ve(t.target));
1691
1771
  const a = t.touches[0];
1692
- o === "bottom" && bt({
1772
+ n === "bottom" && Lt({
1693
1773
  target: t.target,
1694
1774
  chrome: e
1695
1775
  }), wt({
@@ -1702,50 +1782,50 @@ function Nr({
1702
1782
  },
1703
1783
  [
1704
1784
  wt,
1705
- n,
1706
- r,
1707
1785
  o,
1708
- E,
1709
- bt
1786
+ r,
1787
+ n,
1788
+ b,
1789
+ Lt
1710
1790
  ]
1711
- ), we = p(
1791
+ ), Ye = p(
1712
1792
  (t) => {
1713
- const e = M.current;
1714
- if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !E)
1793
+ const e = Y.current;
1794
+ if (!e.dragging || e.source !== "touch" || !r || n !== "bottom" && !b)
1715
1795
  return;
1716
- const a = Bt(t);
1796
+ const a = Ot(t);
1717
1797
  if (!a) return;
1718
- const c = a.pageX - e.startX, s = a.pageY - e.startY, u = Ee({
1798
+ const c = a.pageX - e.startX, l = a.pageY - e.startY, u = Oe({
1719
1799
  deltaX: c,
1720
- deltaY: s,
1721
- placement: o
1722
- }), d = F.dragStartThresholdPx.touch, f = o === "bottom" ? nr({
1800
+ deltaY: l,
1801
+ placement: n
1802
+ }), d = k.dragStartThresholdPx.touch, f = n === "bottom" ? dr({
1723
1803
  target: t.target,
1724
- deltaY: s,
1804
+ deltaY: l,
1725
1805
  chrome: e.chrome,
1726
- bodyNode: z.current,
1806
+ bodyNode: j.current,
1727
1807
  canExpand: lt() > 1
1728
- }) : or({
1808
+ }) : pr({
1729
1809
  target: t.target,
1730
- bodyNode: z.current
1810
+ bodyNode: j.current
1731
1811
  });
1732
1812
  if (f.preventDefault) {
1733
- const m = o === "bottom" && Math.abs(c) > Math.abs(s) && Math.abs(s) < d && !e.started && u < d;
1734
- !m && o === "bottom" && bt({
1813
+ const h = n === "bottom" && Math.abs(c) > Math.abs(l) && Math.abs(l) < d && !e.started && u < d;
1814
+ !h && n === "bottom" && Lt({
1735
1815
  target: t.target,
1736
1816
  chrome: e.chrome
1737
- }), m || Ye(t);
1817
+ }), h || Ie(t);
1738
1818
  }
1739
1819
  if (f.resetAnchor) {
1740
- it(!1), Te(e, { x: a.pageX, y: a.pageY });
1820
+ it(!1), De(e, { x: a.pageX, y: a.pageY });
1741
1821
  return;
1742
1822
  }
1743
1823
  if (f.allowDrag && !(!e.started && u < d))
1744
- if (e.allowed || (e.allowed = !0, e.started = !0), f.preventDefault || Ye(t), e.lastX = a.pageX, e.lastY = a.pageY, o === "popup")
1745
- ft(e, a), Be(e, a);
1824
+ if (e.allowed || (e.allowed = !0, e.started = !0), f.preventDefault || Ie(t), e.lastX = a.pageX, e.lastY = a.pageY, n === "popup")
1825
+ ft(e, a), Ue(e, a);
1746
1826
  else {
1747
- const g = e.startTranslate + s, m = ht(e, s);
1748
- dt(g, m), St(e, {
1827
+ const g = e.startTranslate + l, h = ht(e, l);
1828
+ dt(g, h), Dt(e, {
1749
1829
  pageX: a.pageX,
1750
1830
  pageY: a.pageY,
1751
1831
  translateX: e.lastTranslateX,
@@ -1758,19 +1838,19 @@ function Nr({
1758
1838
  ft,
1759
1839
  ht,
1760
1840
  lt,
1761
- Bt,
1762
- o,
1763
- E,
1764
- Te,
1841
+ Ot,
1842
+ n,
1843
+ b,
1844
+ De,
1765
1845
  it,
1766
1846
  dt,
1767
- bt
1847
+ Lt
1768
1848
  ]
1769
1849
  );
1770
- It(() => {
1771
- if (!i || !r || o !== "bottom" && !E || n === !1 || typeof window > "u") return;
1850
+ Nt(() => {
1851
+ if (!s || !r || n !== "bottom" && !b || o === !1 || typeof window > "u") return;
1772
1852
  const t = (e) => {
1773
- we(e);
1853
+ Ye(e);
1774
1854
  };
1775
1855
  return window.addEventListener("touchmove", t, {
1776
1856
  capture: !0,
@@ -1778,108 +1858,111 @@ function Nr({
1778
1858
  }), () => {
1779
1859
  window.removeEventListener("touchmove", t, !0);
1780
1860
  };
1781
- }, [n, r, we, i, o, E]);
1782
- const Ge = p(
1861
+ }, [o, r, Ye, s, n, b]);
1862
+ const or = p(
1783
1863
  (t) => {
1784
- const e = M.current;
1785
- if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !E)
1864
+ const e = Y.current;
1865
+ if (!e.dragging || e.source !== "touch" || !r || n !== "bottom" && !b)
1786
1866
  return;
1787
- const a = Bt(t), c = a?.pageX ?? e.lastX, s = a?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, f = c - e.startX, g = s - e.startY, m = Math.max(Z() - e.startTime, 1);
1788
- o === "popup" && pt();
1789
- const Y = {
1867
+ const a = Ot(t), c = a?.pageX ?? e.lastX, l = a?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, f = c - e.startX, g = l - e.startY, h = Math.max(tt() - e.startTime, 1);
1868
+ n === "popup" && pt();
1869
+ const M = {
1790
1870
  x: e.lastTranslateX,
1791
1871
  y: e.lastTranslate
1792
1872
  };
1793
- let C = Y;
1794
- const x = e.startTranslate;
1873
+ let C = M;
1874
+ const T = e.startTranslate;
1795
1875
  if (u) {
1796
- const P = o === "popup" ? Ot(e, {
1876
+ const P = n === "popup" ? Vt(e, {
1797
1877
  pageX: c,
1798
- pageY: s
1878
+ pageY: l
1799
1879
  }) : {
1800
1880
  x: e.lastTranslateX,
1801
1881
  y: e.lastTranslate
1802
1882
  };
1803
- C = P, St(e, {
1883
+ C = P, Dt(e, {
1804
1884
  pageX: c,
1805
- pageY: s,
1885
+ pageY: l,
1806
1886
  translateX: P.x,
1807
1887
  translateY: P.y
1808
1888
  });
1809
1889
  }
1810
1890
  if (mt(e), !!u)
1811
- if (xt.current = Z() + 500, o === "popup") {
1812
- const P = Oe({
1891
+ if (xt.current = tt() + 500, n === "popup") {
1892
+ const P = _e({
1813
1893
  session: e,
1814
1894
  fallbackDelta: { x: f, y: g },
1815
- fallbackElapsed: m
1895
+ fallbackElapsed: h
1816
1896
  });
1817
- At({
1818
- currentTranslate: Y,
1897
+ Ft({
1898
+ currentTranslate: M,
1819
1899
  releaseDelta: { x: f, y: g },
1820
1900
  releaseTranslate: C,
1821
1901
  releaseVelocity: P
1822
1902
  });
1823
1903
  } else {
1824
- const P = Ie({
1904
+ const P = je({
1825
1905
  session: e,
1826
1906
  fallbackDeltaY: g,
1827
- fallbackElapsed: m
1907
+ fallbackElapsed: h
1828
1908
  });
1829
- Ft({
1909
+ It({
1830
1910
  closeAllowed: d,
1831
- currentTranslate: Y.y,
1911
+ currentTranslate: M.y,
1832
1912
  deltaY: g,
1833
1913
  releaseVelocity: P,
1834
- startTranslate: x
1914
+ startTranslate: T
1835
1915
  });
1836
1916
  }
1837
1917
  },
1838
1918
  [
1919
+ It,
1839
1920
  Ft,
1840
- At,
1841
1921
  r,
1842
- Bt,
1843
- o,
1844
- E,
1922
+ Ot,
1923
+ n,
1924
+ b,
1845
1925
  mt,
1846
1926
  pt
1847
1927
  ]
1848
- ), Ke = p(() => {
1849
- const t = M.current;
1928
+ ), ar = p(() => {
1929
+ const t = Y.current;
1850
1930
  if (!t.dragging || t.source !== "touch") return;
1851
- const e = t.started, a = t.startTranslate, c = t.lastTranslate, s = {
1931
+ const e = t.started, a = t.startTranslate, c = t.lastTranslate, l = {
1852
1932
  x: t.startTranslateX,
1853
1933
  y: t.startTranslate
1854
1934
  }, u = {
1855
1935
  x: t.lastTranslateX,
1856
1936
  y: t.lastTranslate
1857
- }, d = o;
1937
+ }, d = n;
1858
1938
  if (mt(t), !!e) {
1859
1939
  if (d === "popup") {
1860
- _.current ? Ct(s) : J(s, { from: u });
1940
+ U.current ? kt(l) : q(l, { from: u });
1861
1941
  return;
1862
1942
  }
1863
- O(a, { from: c });
1943
+ N(a, { from: c });
1864
1944
  }
1865
1945
  }, [
1866
- o,
1946
+ n,
1867
1947
  mt,
1868
- Ct,
1869
- J,
1870
- O
1948
+ kt,
1949
+ q,
1950
+ N
1871
1951
  ]);
1872
1952
  return {
1873
- onPointerDown: je,
1874
- onPointerMove: ze,
1875
- onPointerUp: ve,
1876
- onPointerCancel: ve,
1877
- onLostPointerCapture: Ue,
1878
- onTouchStart: We,
1879
- onTouchEnd: Ge,
1880
- onTouchCancel: Ke
1953
+ collapseBottomSheetToUndimmedSnap: qe,
1954
+ handlers: {
1955
+ onPointerDown: tr,
1956
+ onPointerMove: er,
1957
+ onPointerUp: Me,
1958
+ onPointerCancel: Me,
1959
+ onLostPointerCapture: rr,
1960
+ onTouchStart: nr,
1961
+ onTouchEnd: or,
1962
+ onTouchCancel: ar
1963
+ }
1881
1964
  };
1882
1965
  }
1883
1966
  export {
1884
- Nr as useModalDrag
1967
+ Gr as useModalDrag
1885
1968
  };