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