react-spring-carousel 3.0.0-beta-2.0.258 → 3.0.0-beta-2.0.260

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.
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsxs as Ot, jsx as X } from "react/jsx-runtime";
2
- import { useSpring as At } from "@react-spring/web";
3
- import q, { useRef as S, useEffect as vt, useState as Pt } from "react";
4
- function $t(r, t, e) {
1
+ import { jsxs as At, jsx as q } from "react/jsx-runtime";
2
+ import { useSpring as Pt } from "@react-spring/web";
3
+ import J, { useRef as D, useEffect as tt, useState as $t } from "react";
4
+ function Nt(r, t, e) {
5
5
  return Math.max(t, Math.min(r, e));
6
6
  }
7
7
  const g = {
@@ -21,17 +21,17 @@ const g = {
21
21
  r[0] -= t[0], r[1] -= t[1];
22
22
  }
23
23
  };
24
- function ot(r, t, e) {
24
+ function ct(r, t, e) {
25
25
  return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(r, e * 5) : r * t * e / (t + e * r);
26
26
  }
27
- function at(r, t, e, n = 0.15) {
28
- return n === 0 ? $t(r, t, e) : r < t ? -ot(t - r, e - t, n) + t : r > e ? +ot(r - e, e - t, n) + e : r;
27
+ function ut(r, t, e, n = 0.15) {
28
+ return n === 0 ? Nt(r, t, e) : r < t ? -ct(t - r, e - t, n) + t : r > e ? +ct(r - e, e - t, n) + e : r;
29
29
  }
30
- function Nt(r, [t, e], [n, s]) {
30
+ function Mt(r, [t, e], [n, s]) {
31
31
  const [[o, c], [a, d]] = r;
32
- return [at(t, o, c, n), at(e, a, d, s)];
32
+ return [ut(t, o, c, n), ut(e, a, d, s)];
33
33
  }
34
- function Mt(r, t) {
34
+ function Rt(r, t) {
35
35
  if (typeof r != "object" || r === null) return r;
36
36
  var e = r[Symbol.toPrimitive];
37
37
  if (e !== void 0) {
@@ -41,19 +41,19 @@ function Mt(r, t) {
41
41
  }
42
42
  return (t === "string" ? String : Number)(r);
43
43
  }
44
- function Rt(r) {
45
- var t = Mt(r, "string");
44
+ function Lt(r) {
45
+ var t = Rt(r, "string");
46
46
  return typeof t == "symbol" ? t : String(t);
47
47
  }
48
48
  function y(r, t, e) {
49
- return t = Rt(t), t in r ? Object.defineProperty(r, t, {
49
+ return t = Lt(t), t in r ? Object.defineProperty(r, t, {
50
50
  value: e,
51
51
  enumerable: !0,
52
52
  configurable: !0,
53
53
  writable: !0
54
54
  }) : r[t] = e, r;
55
55
  }
56
- function ct(r, t) {
56
+ function ft(r, t) {
57
57
  var e = Object.keys(r);
58
58
  if (Object.getOwnPropertySymbols) {
59
59
  var n = Object.getOwnPropertySymbols(r);
@@ -66,15 +66,15 @@ function ct(r, t) {
66
66
  function h(r) {
67
67
  for (var t = 1; t < arguments.length; t++) {
68
68
  var e = arguments[t] != null ? arguments[t] : {};
69
- t % 2 ? ct(Object(e), !0).forEach(function(n) {
69
+ t % 2 ? ft(Object(e), !0).forEach(function(n) {
70
70
  y(r, n, e[n]);
71
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : ct(Object(e)).forEach(function(n) {
71
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : ft(Object(e)).forEach(function(n) {
72
72
  Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(e, n));
73
73
  });
74
74
  }
75
75
  return r;
76
76
  }
77
- const yt = {
77
+ const _t = {
78
78
  pointer: {
79
79
  start: "down",
80
80
  change: "move",
@@ -96,63 +96,63 @@ const yt = {
96
96
  end: "end"
97
97
  }
98
98
  };
99
- function ut(r) {
99
+ function lt(r) {
100
100
  return r ? r[0].toUpperCase() + r.slice(1) : "";
101
101
  }
102
- const Lt = ["enter", "leave"];
103
- function Vt(r = !1, t) {
104
- return r && !Lt.includes(t);
102
+ const Vt = ["enter", "leave"];
103
+ function jt(r = !1, t) {
104
+ return r && !Vt.includes(t);
105
105
  }
106
- function jt(r, t = "", e = !1) {
107
- const n = yt[r], s = n && n[t] || t;
108
- return "on" + ut(r) + ut(s) + (Vt(e, s) ? "Capture" : "");
106
+ function Ut(r, t = "", e = !1) {
107
+ const n = _t[r], s = n && n[t] || t;
108
+ return "on" + lt(r) + lt(s) + (jt(e, s) ? "Capture" : "");
109
109
  }
110
- const Ut = ["gotpointercapture", "lostpointercapture"];
111
- function Kt(r) {
110
+ const Kt = ["gotpointercapture", "lostpointercapture"];
111
+ function Bt(r) {
112
112
  let t = r.substring(2).toLowerCase();
113
113
  const e = !!~t.indexOf("passive");
114
114
  e && (t = t.replace("passive", ""));
115
- const n = Ut.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
115
+ const n = Kt.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
116
116
  return s && (t = t.replace("capture", "")), {
117
117
  device: t,
118
118
  capture: s,
119
119
  passive: e
120
120
  };
121
121
  }
122
- function Bt(r, t = "") {
123
- const e = yt[r], n = e && e[t] || t;
122
+ function zt(r, t = "") {
123
+ const e = _t[r], n = e && e[t] || t;
124
124
  return r + n;
125
125
  }
126
126
  function Y(r) {
127
127
  return "touches" in r;
128
128
  }
129
- function _t(r) {
129
+ function bt(r) {
130
130
  return Y(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
131
131
  }
132
- function zt(r) {
132
+ function Yt(r) {
133
133
  return Array.from(r.touches).filter((t) => {
134
134
  var e, n;
135
135
  return t.target === r.currentTarget || ((e = r.currentTarget) === null || e === void 0 || (n = e.contains) === null || n === void 0 ? void 0 : n.call(e, t.target));
136
136
  });
137
137
  }
138
- function Yt(r) {
138
+ function Ft(r) {
139
139
  return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
140
140
  }
141
- function bt(r) {
142
- return Y(r) ? Yt(r)[0] : r;
141
+ function wt(r) {
142
+ return Y(r) ? Ft(r)[0] : r;
143
143
  }
144
- function Ft(r) {
145
- return zt(r).map((t) => t.identifier);
144
+ function Wt(r) {
145
+ return Yt(r).map((t) => t.identifier);
146
146
  }
147
- function J(r) {
148
- const t = bt(r);
147
+ function Q(r) {
148
+ const t = wt(r);
149
149
  return Y(r) ? t.identifier : t.pointerId;
150
150
  }
151
- function ft(r) {
152
- const t = bt(r);
151
+ function dt(r) {
152
+ const t = wt(r);
153
153
  return [t.clientX, t.clientY];
154
154
  }
155
- function Wt(r) {
155
+ function Gt(r) {
156
156
  const t = {};
157
157
  if ("buttons" in r && (t.buttons = r.buttons), "shiftKey" in r) {
158
158
  const {
@@ -173,21 +173,21 @@ function Wt(r) {
173
173
  function z(r, ...t) {
174
174
  return typeof r == "function" ? r(...t) : r;
175
175
  }
176
- function Gt() {
176
+ function Ht() {
177
177
  }
178
- function Ht(...r) {
179
- return r.length === 0 ? Gt : r.length === 1 ? r[0] : function() {
178
+ function Xt(...r) {
179
+ return r.length === 0 ? Ht : r.length === 1 ? r[0] : function() {
180
180
  let t;
181
181
  for (const e of r)
182
182
  t = e.apply(this, arguments) || t;
183
183
  return t;
184
184
  };
185
185
  }
186
- function lt(r, t) {
186
+ function ht(r, t) {
187
187
  return Object.assign({}, t, r || {});
188
188
  }
189
- const Xt = 32;
190
- class qt {
189
+ const qt = 32;
190
+ class Jt {
191
191
  constructor(t, e, n) {
192
192
  this.ctrl = t, this.args = e, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
193
193
  }
@@ -244,9 +244,9 @@ class qt {
244
244
  } = this;
245
245
  e.args = this.args;
246
246
  let o = 0;
247
- if (t && (e.event = t, n.preventDefault && t.cancelable && e.event.preventDefault(), e.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, Wt(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = t.timeStamp - e.timeStamp, e.timeStamp = t.timeStamp, e.elapsedTime = e.timeStamp - e.startTime), e._active) {
248
- const f = e._delta.map(Math.abs);
249
- g.addTo(e._distance, f);
247
+ if (t && (e.event = t, n.preventDefault && t.cancelable && e.event.preventDefault(), e.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, Gt(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = t.timeStamp - e.timeStamp, e.timeStamp = t.timeStamp, e.elapsedTime = e.timeStamp - e.startTime), e._active) {
248
+ const I = e._delta.map(Math.abs);
249
+ g.addTo(e._distance, I);
250
250
  }
251
251
  this.axisIntent && this.axisIntent(t);
252
252
  const [c, a] = e._movement, [d, p] = n.threshold, {
@@ -256,20 +256,20 @@ class qt {
256
256
  if (n.hasCustomTransform ? (u[0] === !1 && (u[0] = Math.abs(c) >= d && E[0]), u[1] === !1 && (u[1] = Math.abs(a) >= p && E[1])) : (u[0] === !1 && (u[0] = Math.abs(c) >= d && Math.sign(c) * d), u[1] === !1 && (u[1] = Math.abs(a) >= p && Math.sign(a) * p)), e.intentional = u[0] !== !1 || u[1] !== !1, !e.intentional) return;
257
257
  const m = [0, 0];
258
258
  if (n.hasCustomTransform) {
259
- const [f, R] = E;
260
- m[0] = u[0] !== !1 ? f - u[0] : 0, m[1] = u[1] !== !1 ? R - u[1] : 0;
259
+ const [I, l] = E;
260
+ m[0] = u[0] !== !1 ? I - u[0] : 0, m[1] = u[1] !== !1 ? l - u[1] : 0;
261
261
  } else
262
262
  m[0] = u[0] !== !1 ? c - u[0] : 0, m[1] = u[1] !== !1 ? a - u[1] : 0;
263
263
  this.restrictToAxis && !e._blocked && this.restrictToAxis(m);
264
- const P = e.offset, D = e._active && !e._blocked || e.active;
265
- D && (e.first = e._active && !e.active, e.last = !e._active && e.active, e.active = s[this.ingKey] = e._active, t && (e.first && ("bounds" in n && (e._bounds = z(n.bounds, e)), this.setup && this.setup()), e.movement = m, this.computeOffset()));
266
- const [k, A] = e.offset, [[$, T], [C, O]] = e._bounds;
267
- e.overflow = [k < $ ? -1 : k > T ? 1 : 0, A < C ? -1 : A > O ? 1 : 0], e._movementBound[0] = e.overflow[0] ? e._movementBound[0] === !1 ? e._movement[0] : e._movementBound[0] : !1, e._movementBound[1] = e.overflow[1] ? e._movementBound[1] === !1 ? e._movement[1] : e._movementBound[1] : !1;
268
- const M = e._active ? n.rubberband || [0, 0] : [0, 0];
269
- if (e.offset = Nt(e._bounds, e.offset, M), e.delta = g.sub(e.offset, P), this.computeMovement(), D && (!e.last || o > Xt)) {
264
+ const P = e.offset, N = e._active && !e._blocked || e.active;
265
+ N && (e.first = e._active && !e.active, e.last = !e._active && e.active, e.active = s[this.ingKey] = e._active, t && (e.first && ("bounds" in n && (e._bounds = z(n.bounds, e)), this.setup && this.setup()), e.movement = m, this.computeOffset()));
266
+ const [k, C] = e.offset, [[$, j], [T, O]] = e._bounds;
267
+ e.overflow = [k < $ ? -1 : k > j ? 1 : 0, C < T ? -1 : C > O ? 1 : 0], e._movementBound[0] = e.overflow[0] ? e._movementBound[0] === !1 ? e._movement[0] : e._movementBound[0] : !1, e._movementBound[1] = e.overflow[1] ? e._movementBound[1] === !1 ? e._movement[1] : e._movementBound[1] : !1;
268
+ const A = e._active ? n.rubberband || [0, 0] : [0, 0];
269
+ if (e.offset = Mt(e._bounds, e.offset, A), e.delta = g.sub(e.offset, P), this.computeMovement(), N && (!e.last || o > qt)) {
270
270
  e.delta = g.sub(e.offset, P);
271
- const f = e.delta.map(Math.abs);
272
- g.addTo(e.distance, f), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && o > 0 && (e.velocity = [f[0] / o, f[1] / o], e.timeDelta = o);
271
+ const I = e.delta.map(Math.abs);
272
+ g.addTo(e.distance, I), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && o > 0 && (e.velocity = [I[0] / o, I[1] / o], e.timeDelta = o);
273
273
  }
274
274
  }
275
275
  emit() {
@@ -284,14 +284,14 @@ class qt {
284
284
  this.eventStore.clean(), this.timeoutStore.clean();
285
285
  }
286
286
  }
287
- function Jt([r, t], e) {
287
+ function Qt([r, t], e) {
288
288
  const n = Math.abs(r), s = Math.abs(t);
289
289
  if (n > s && n > e)
290
290
  return "x";
291
291
  if (s > n && s > e)
292
292
  return "y";
293
293
  }
294
- class Qt extends qt {
294
+ class Zt extends Jt {
295
295
  constructor(...t) {
296
296
  super(...t), y(this, "aliasKey", "xy");
297
297
  }
@@ -310,8 +310,8 @@ class Qt extends qt {
310
310
  axisIntent(t) {
311
311
  const e = this.state, n = this.config;
312
312
  if (!e.axis && t) {
313
- const s = typeof n.axisThreshold == "object" ? n.axisThreshold[_t(t)] : n.axisThreshold;
314
- e.axis = Jt(e._movement, s);
313
+ const s = typeof n.axisThreshold == "object" ? n.axisThreshold[bt(t)] : n.axisThreshold;
314
+ e.axis = Qt(e._movement, s);
315
315
  }
316
316
  e._blocked = (n.lockDirection || !!n.axis) && !e.axis || !!n.axis && n.axis !== e.axis;
317
317
  }
@@ -327,7 +327,7 @@ class Qt extends qt {
327
327
  }
328
328
  }
329
329
  }
330
- const dt = (r) => r, ht = 0.15, tt = {
330
+ const pt = (r) => r, mt = 0.15, rt = {
331
331
  enabled(r = !0) {
332
332
  return r;
333
333
  },
@@ -343,7 +343,7 @@ const dt = (r) => r, ht = 0.15, tt = {
343
343
  rubberband(r = 0) {
344
344
  switch (r) {
345
345
  case !0:
346
- return [ht, ht];
346
+ return [mt, mt];
347
347
  case !1:
348
348
  return [0, 0];
349
349
  default:
@@ -357,19 +357,19 @@ const dt = (r) => r, ht = 0.15, tt = {
357
357
  transform(r, t, e) {
358
358
  const n = r || e.shared.transform;
359
359
  if (this.hasCustomTransform = !!n, process.env.NODE_ENV === "development") {
360
- const s = n || dt;
360
+ const s = n || pt;
361
361
  return (o) => {
362
362
  const c = s(o);
363
363
  return (!isFinite(c[0]) || !isFinite(c[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${c[0]},${[1]}]`), c;
364
364
  };
365
365
  }
366
- return n || dt;
366
+ return n || pt;
367
367
  },
368
368
  threshold(r) {
369
369
  return g.toVector(r, 0);
370
370
  }
371
371
  };
372
- process.env.NODE_ENV === "development" && Object.assign(tt, {
372
+ process.env.NODE_ENV === "development" && Object.assign(rt, {
373
373
  domTarget(r) {
374
374
  if (r !== void 0)
375
375
  throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
@@ -386,18 +386,18 @@ process.env.NODE_ENV === "development" && Object.assign(tt, {
386
386
  return NaN;
387
387
  }
388
388
  });
389
- const Zt = 0, V = h(h({}, tt), {}, {
389
+ const te = 0, L = h(h({}, rt), {}, {
390
390
  axis(r, t, {
391
391
  axis: e
392
392
  }) {
393
393
  if (this.lockDirection = e === "lock", !this.lockDirection) return e;
394
394
  },
395
- axisThreshold(r = Zt) {
395
+ axisThreshold(r = te) {
396
396
  return r;
397
397
  },
398
398
  bounds(r = {}) {
399
399
  if (typeof r == "function")
400
- return (o) => V.bounds(r(o));
400
+ return (o) => L.bounds(r(o));
401
401
  if ("current" in r)
402
402
  return () => r.current;
403
403
  if (typeof HTMLElement == "function" && r instanceof HTMLElement)
@@ -410,13 +410,13 @@ const Zt = 0, V = h(h({}, tt), {}, {
410
410
  } = r;
411
411
  return [[t, e], [n, s]];
412
412
  }
413
- }), pt = {
413
+ }), gt = {
414
414
  ArrowRight: (r, t = 1) => [r * t, 0],
415
415
  ArrowLeft: (r, t = 1) => [-1 * r * t, 0],
416
416
  ArrowUp: (r, t = 1) => [0, -1 * r * t],
417
417
  ArrowDown: (r, t = 1) => [0, r * t]
418
418
  };
419
- class te extends Qt {
419
+ class ee extends Zt {
420
420
  constructor(...t) {
421
421
  super(...t), y(this, "ingKey", "dragging");
422
422
  }
@@ -434,7 +434,7 @@ class te extends Qt {
434
434
  top: e.top - n.top + t.offset[1],
435
435
  bottom: e.bottom - n.bottom + t.offset[1]
436
436
  };
437
- t._bounds = V.bounds(s);
437
+ t._bounds = L.bounds(s);
438
438
  }
439
439
  }
440
440
  cancel() {
@@ -453,7 +453,7 @@ class te extends Qt {
453
453
  const e = this.config, n = this.state;
454
454
  if (t.buttons != null && (Array.isArray(e.pointerButtons) ? !e.pointerButtons.includes(t.buttons) : e.pointerButtons !== -1 && e.pointerButtons !== t.buttons)) return;
455
455
  const s = this.ctrl.setEventIds(t);
456
- e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = J(t), n._pointerActive = !0, this.computeValues(ft(t)), this.computeInitial(), e.preventScrollAxis && _t(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : e.delay > 0 ? (this.setupDelayTrigger(t), e.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
456
+ e.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = Q(t), n._pointerActive = !0, this.computeValues(dt(t)), this.computeInitial(), e.preventScrollAxis && bt(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : e.delay > 0 ? (this.setupDelayTrigger(t), e.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
457
457
  }
458
458
  startPointerDrag(t) {
459
459
  const e = this.state;
@@ -462,9 +462,9 @@ class te extends Qt {
462
462
  pointerMove(t) {
463
463
  const e = this.state, n = this.config;
464
464
  if (!e._pointerActive) return;
465
- const s = J(t);
465
+ const s = Q(t);
466
466
  if (e._pointerId !== void 0 && s !== e._pointerId) return;
467
- const o = ft(t);
467
+ const o = dt(t);
468
468
  if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = g.sub(o, e._values), this.computeValues(o)), g.addTo(e._movement, e._delta), this.compute(t), e._delayed && e.intentional) {
469
469
  this.timeoutStore.remove("dragDelay"), e.active = !1, this.startPointerDrag(t);
470
470
  return;
@@ -491,17 +491,17 @@ class te extends Qt {
491
491
  }
492
492
  const e = this.state, n = this.config;
493
493
  if (!e._active || !e._pointerActive) return;
494
- const s = J(t);
494
+ const s = Q(t);
495
495
  if (e._pointerId !== void 0 && s !== e._pointerId) return;
496
496
  this.state._pointerActive = !1, this.setActive(), this.compute(t);
497
497
  const [o, c] = e._distance;
498
498
  if (e.tap = o <= n.tapsThreshold && c <= n.tapsThreshold, e.tap && n.filterTaps)
499
499
  e._force = !0;
500
500
  else {
501
- const [a, d] = e._delta, [p, u] = e._movement, [E, m] = n.swipe.velocity, [P, D] = n.swipe.distance, k = n.swipe.duration;
501
+ const [a, d] = e._delta, [p, u] = e._movement, [E, m] = n.swipe.velocity, [P, N] = n.swipe.distance, k = n.swipe.duration;
502
502
  if (e.elapsedTime < k) {
503
- const A = Math.abs(a / e.timeDelta), $ = Math.abs(d / e.timeDelta);
504
- A > E && Math.abs(p) > P && (e.swipe[0] = Math.sign(a)), $ > m && Math.abs(u) > D && (e.swipe[1] = Math.sign(d));
503
+ const C = Math.abs(a / e.timeDelta), $ = Math.abs(d / e.timeDelta);
504
+ C > E && Math.abs(p) > P && (e.swipe[0] = Math.sign(a)), $ > m && Math.abs(u) > N && (e.swipe[1] = Math.sign(d));
505
505
  }
506
506
  }
507
507
  this.emit();
@@ -528,7 +528,7 @@ class te extends Qt {
528
528
  this.state._preventScroll && t.cancelable && t.preventDefault();
529
529
  }
530
530
  setupScrollPrevention(t) {
531
- this.state._preventScroll = !1, ee(t);
531
+ this.state._preventScroll = !1, re(t);
532
532
  const e = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
533
533
  passive: !1
534
534
  });
@@ -540,14 +540,14 @@ class te extends Qt {
540
540
  }, this.config.delay);
541
541
  }
542
542
  keyDown(t) {
543
- const e = pt[t.key];
543
+ const e = gt[t.key];
544
544
  if (e) {
545
545
  const n = this.state, s = t.shiftKey ? 10 : t.altKey ? 0.1 : 1;
546
546
  this.start(t), n._delta = e(this.config.keyboardDisplacement, s), n._keyboardActive = !0, g.addTo(n._movement, n._delta), this.compute(t), this.emit();
547
547
  }
548
548
  }
549
549
  keyUp(t) {
550
- t.key in pt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
550
+ t.key in gt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
551
551
  }
552
552
  bind(t) {
553
553
  const e = this.config.device;
@@ -557,23 +557,23 @@ class te extends Qt {
557
557
  });
558
558
  }
559
559
  }
560
- function ee(r) {
560
+ function re(r) {
561
561
  "persist" in r && typeof r.persist == "function" && r.persist();
562
562
  }
563
- const j = typeof window < "u" && window.document && window.document.createElement;
564
- function wt() {
565
- return j && "ontouchstart" in window;
566
- }
567
- function re() {
568
- return wt() || j && window.navigator.maxTouchPoints > 1;
563
+ const V = typeof window < "u" && window.document && window.document.createElement;
564
+ function Et() {
565
+ return V && "ontouchstart" in window;
569
566
  }
570
567
  function ne() {
571
- return j && "onpointerdown" in window;
568
+ return Et() || V && window.navigator.maxTouchPoints > 1;
572
569
  }
573
570
  function se() {
574
- return j && "exitPointerLock" in window.document;
571
+ return V && "onpointerdown" in window;
575
572
  }
576
573
  function ie() {
574
+ return V && "exitPointerLock" in window.document;
575
+ }
576
+ function oe() {
577
577
  try {
578
578
  return "constructor" in GestureEvent;
579
579
  } catch {
@@ -581,17 +581,17 @@ function ie() {
581
581
  }
582
582
  }
583
583
  const x = {
584
- isBrowser: j,
585
- gesture: ie(),
586
- touch: wt(),
587
- touchscreen: re(),
588
- pointer: ne(),
589
- pointerLock: se()
590
- }, oe = 250, ae = 180, ce = 0.5, ue = 50, fe = 250, le = 10, mt = {
584
+ isBrowser: V,
585
+ gesture: oe(),
586
+ touch: Et(),
587
+ touchscreen: ne(),
588
+ pointer: se(),
589
+ pointerLock: ie()
590
+ }, ae = 250, ce = 180, ue = 0.5, fe = 50, le = 250, de = 10, vt = {
591
591
  mouse: 0,
592
592
  touch: 0,
593
593
  pen: 8
594
- }, Et = h(h({}, V), {}, {
594
+ }, Tt = h(h({}, L), {}, {
595
595
  device(r, t, {
596
596
  pointer: {
597
597
  touch: e = !1,
@@ -604,7 +604,7 @@ const x = {
604
604
  preventScrollAxis(r, t, {
605
605
  preventScroll: e
606
606
  }) {
607
- if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ? oe : void 0, !(!x.touchscreen || e === !1))
607
+ if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ? ae : void 0, !(!x.touchscreen || e === !1))
608
608
  return r || (e !== void 0 ? "y" : void 0);
609
609
  },
610
610
  pointerCapture(r, t, {
@@ -625,9 +625,9 @@ const x = {
625
625
  return this.filterTaps = e, this.tapsThreshold = n, o;
626
626
  },
627
627
  swipe({
628
- velocity: r = ce,
629
- distance: t = ue,
630
- duration: e = fe
628
+ velocity: r = ue,
629
+ distance: t = fe,
630
+ duration: e = le
631
631
  } = {}) {
632
632
  return {
633
633
  velocity: this.transform(g.toVector(r)),
@@ -638,7 +638,7 @@ const x = {
638
638
  delay(r = 0) {
639
639
  switch (r) {
640
640
  case !0:
641
- return ae;
641
+ return ce;
642
642
  case !1:
643
643
  return 0;
644
644
  default:
@@ -646,13 +646,13 @@ const x = {
646
646
  }
647
647
  },
648
648
  axisThreshold(r) {
649
- return r ? h(h({}, mt), r) : mt;
649
+ return r ? h(h({}, vt), r) : vt;
650
650
  },
651
- keyboardDisplacement(r = le) {
651
+ keyboardDisplacement(r = de) {
652
652
  return r;
653
653
  }
654
654
  });
655
- process.env.NODE_ENV === "development" && Object.assign(Et, {
655
+ process.env.NODE_ENV === "development" && Object.assign(Tt, {
656
656
  useTouch(r) {
657
657
  if (r !== void 0)
658
658
  throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
@@ -679,7 +679,7 @@ process.env.NODE_ENV === "development" && Object.assign(Et, {
679
679
  return NaN;
680
680
  }
681
681
  });
682
- h(h({}, tt), {}, {
682
+ h(h({}, rt), {}, {
683
683
  device(r, t, {
684
684
  shared: e,
685
685
  pointer: {
@@ -698,13 +698,13 @@ h(h({}, tt), {}, {
698
698
  angleBounds: n = {}
699
699
  }) {
700
700
  const s = (c) => {
701
- const a = lt(z(e, c), {
701
+ const a = ht(z(e, c), {
702
702
  min: -1 / 0,
703
703
  max: 1 / 0
704
704
  });
705
705
  return [a.min, a.max];
706
706
  }, o = (c) => {
707
- const a = lt(z(n, c), {
707
+ const a = ht(z(n, c), {
708
708
  min: -1 / 0,
709
709
  max: 1 / 0
710
710
  });
@@ -722,31 +722,31 @@ h(h({}, tt), {}, {
722
722
  return r;
723
723
  }
724
724
  });
725
- h(h({}, V), {}, {
725
+ h(h({}, L), {}, {
726
726
  mouseOnly: (r = !0) => r
727
727
  });
728
- h(h({}, V), {}, {
728
+ h(h({}, L), {}, {
729
729
  mouseOnly: (r = !0) => r
730
730
  });
731
- const Tt = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
732
- function de(r) {
733
- Tt.set(r.key, r.engine), Z.set(r.key, r.resolver);
731
+ const xt = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new Map();
732
+ function he(r) {
733
+ xt.set(r.key, r.engine), et.set(r.key, r.resolver);
734
734
  }
735
- const he = {
735
+ const pe = {
736
736
  key: "drag",
737
- engine: te,
738
- resolver: Et
737
+ engine: ee,
738
+ resolver: Tt
739
739
  };
740
- function pe(r, t) {
740
+ function me(r, t) {
741
741
  if (r == null) return {};
742
742
  var e = {}, n = Object.keys(r), s, o;
743
743
  for (o = 0; o < n.length; o++)
744
744
  s = n[o], !(t.indexOf(s) >= 0) && (e[s] = r[s]);
745
745
  return e;
746
746
  }
747
- function me(r, t) {
747
+ function ge(r, t) {
748
748
  if (r == null) return {};
749
- var e = pe(r, t), n, s;
749
+ var e = me(r, t), n, s;
750
750
  if (Object.getOwnPropertySymbols) {
751
751
  var o = Object.getOwnPropertySymbols(r);
752
752
  for (s = 0; s < o.length; s++)
@@ -754,7 +754,7 @@ function me(r, t) {
754
754
  }
755
755
  return e;
756
756
  }
757
- const ge = {
757
+ const ve = {
758
758
  target(r) {
759
759
  if (r)
760
760
  return () => "current" in r ? r.current : r;
@@ -777,7 +777,7 @@ const ge = {
777
777
  transform(r) {
778
778
  return r;
779
779
  }
780
- }, ve = ["target", "eventOptions", "window", "enabled", "transform"];
780
+ }, ye = ["target", "eventOptions", "window", "enabled", "transform"];
781
781
  function B(r = {}, t) {
782
782
  const e = {};
783
783
  for (const [n, s] of Object.entries(t))
@@ -798,28 +798,28 @@ function B(r = {}, t) {
798
798
  }
799
799
  return e;
800
800
  }
801
- function ye(r, t, e = {}) {
801
+ function _e(r, t, e = {}) {
802
802
  const n = r, {
803
803
  target: s,
804
804
  eventOptions: o,
805
805
  window: c,
806
806
  enabled: a,
807
807
  transform: d
808
- } = n, p = me(n, ve);
808
+ } = n, p = ge(n, ye);
809
809
  if (e.shared = B({
810
810
  target: s,
811
811
  eventOptions: o,
812
812
  window: c,
813
813
  enabled: a,
814
814
  transform: d
815
- }, ge), t) {
816
- const u = Z.get(t);
815
+ }, ve), t) {
816
+ const u = et.get(t);
817
817
  e[t] = B(h({
818
818
  shared: e.shared
819
819
  }, p), u);
820
820
  } else
821
821
  for (const u in p) {
822
- const E = Z.get(u);
822
+ const E = et.get(u);
823
823
  if (E)
824
824
  e[u] = B(h({
825
825
  shared: e.shared
@@ -832,12 +832,12 @@ function ye(r, t, e = {}) {
832
832
  }
833
833
  return e;
834
834
  }
835
- class xt {
835
+ class It {
836
836
  constructor(t, e) {
837
837
  y(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
838
838
  }
839
839
  add(t, e, n, s, o) {
840
- const c = this._listeners, a = Bt(e, n), d = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = h(h({}, d), o);
840
+ const c = this._listeners, a = zt(e, n), d = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = h(h({}, d), o);
841
841
  t.addEventListener(a, s, p);
842
842
  const u = () => {
843
843
  t.removeEventListener(a, s, p), c.delete(u);
@@ -848,7 +848,7 @@ class xt {
848
848
  this._listeners.forEach((t) => t()), this._listeners.clear();
849
849
  }
850
850
  }
851
- class _e {
851
+ class be {
852
852
  constructor() {
853
853
  y(this, "_timeouts", /* @__PURE__ */ new Map());
854
854
  }
@@ -863,20 +863,20 @@ class _e {
863
863
  this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
864
864
  }
865
865
  }
866
- class be {
866
+ class we {
867
867
  constructor(t) {
868
- y(this, "gestures", /* @__PURE__ */ new Set()), y(this, "_targetEventStore", new xt(this)), y(this, "gestureEventStores", {}), y(this, "gestureTimeoutStores", {}), y(this, "handlers", {}), y(this, "config", {}), y(this, "pointerIds", /* @__PURE__ */ new Set()), y(this, "touchIds", /* @__PURE__ */ new Set()), y(this, "state", {
868
+ y(this, "gestures", /* @__PURE__ */ new Set()), y(this, "_targetEventStore", new It(this)), y(this, "gestureEventStores", {}), y(this, "gestureTimeoutStores", {}), y(this, "handlers", {}), y(this, "config", {}), y(this, "pointerIds", /* @__PURE__ */ new Set()), y(this, "touchIds", /* @__PURE__ */ new Set()), y(this, "state", {
869
869
  shared: {
870
870
  shiftKey: !1,
871
871
  metaKey: !1,
872
872
  ctrlKey: !1,
873
873
  altKey: !1
874
874
  }
875
- }), we(this, t);
875
+ }), Ee(this, t);
876
876
  }
877
877
  setEventIds(t) {
878
878
  if (Y(t))
879
- return this.touchIds = new Set(Ft(t)), this.touchIds;
879
+ return this.touchIds = new Set(Wt(t)), this.touchIds;
880
880
  if ("pointerId" in t)
881
881
  return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
882
882
  }
@@ -884,7 +884,7 @@ class be {
884
884
  this.handlers = t, this.nativeHandlers = e;
885
885
  }
886
886
  applyConfig(t, e) {
887
- this.config = ye(t, e, this.config);
887
+ this.config = _e(t, e, this.config);
888
888
  }
889
889
  clean() {
890
890
  this._targetEventStore.clean();
@@ -900,13 +900,13 @@ class be {
900
900
  if (!(e.target && (s = e.target(), !s))) {
901
901
  if (e.enabled) {
902
902
  for (const c of this.gestures) {
903
- const a = this.config[c], d = gt(n, a.eventOptions, !!s);
903
+ const a = this.config[c], d = yt(n, a.eventOptions, !!s);
904
904
  if (a.enabled) {
905
- const p = Tt.get(c);
905
+ const p = xt.get(c);
906
906
  new p(this, t, c).bind(d);
907
907
  }
908
908
  }
909
- const o = gt(n, e.eventOptions, !!s);
909
+ const o = yt(n, e.eventOptions, !!s);
910
910
  for (const c in this.nativeHandlers)
911
911
  o(c, "", (a) => this.nativeHandlers[c](h(h({}, this.state.shared), {}, {
912
912
  event: a,
@@ -914,14 +914,14 @@ class be {
914
914
  })), void 0, !0);
915
915
  }
916
916
  for (const o in n)
917
- n[o] = Ht(...n[o]);
917
+ n[o] = Xt(...n[o]);
918
918
  if (!s) return n;
919
919
  for (const o in n) {
920
920
  const {
921
921
  device: c,
922
922
  capture: a,
923
923
  passive: d
924
- } = Kt(o);
924
+ } = Bt(o);
925
925
  this._targetEventStore.add(s, c, "", n[o], {
926
926
  capture: a,
927
927
  passive: d
@@ -930,42 +930,42 @@ class be {
930
930
  }
931
931
  }
932
932
  }
933
- function N(r, t) {
934
- r.gestures.add(t), r.gestureEventStores[t] = new xt(r, t), r.gestureTimeoutStores[t] = new _e();
933
+ function R(r, t) {
934
+ r.gestures.add(t), r.gestureEventStores[t] = new It(r, t), r.gestureTimeoutStores[t] = new be();
935
935
  }
936
- function we(r, t) {
937
- t.drag && N(r, "drag"), t.wheel && N(r, "wheel"), t.scroll && N(r, "scroll"), t.move && N(r, "move"), t.pinch && N(r, "pinch"), t.hover && N(r, "hover");
936
+ function Ee(r, t) {
937
+ t.drag && R(r, "drag"), t.wheel && R(r, "wheel"), t.scroll && R(r, "scroll"), t.move && R(r, "move"), t.pinch && R(r, "pinch"), t.hover && R(r, "hover");
938
938
  }
939
- const gt = (r, t, e) => (n, s, o, c = {}, a = !1) => {
939
+ const yt = (r, t, e) => (n, s, o, c = {}, a = !1) => {
940
940
  var d, p;
941
941
  const u = (d = c.capture) !== null && d !== void 0 ? d : t.capture, E = (p = c.passive) !== null && p !== void 0 ? p : t.passive;
942
- let m = a ? n : jt(n, s, u);
942
+ let m = a ? n : Ut(n, s, u);
943
943
  e && E && (m += "Passive"), r[m] = r[m] || [], r[m].push(o);
944
944
  };
945
- function Ee(r, t = {}, e, n) {
946
- const s = q.useMemo(() => new be(r), []);
947
- if (s.applyHandlers(r, n), s.applyConfig(t, e), q.useEffect(s.effect.bind(s)), q.useEffect(() => s.clean.bind(s), []), t.target === void 0)
945
+ function Te(r, t = {}, e, n) {
946
+ const s = J.useMemo(() => new we(r), []);
947
+ if (s.applyHandlers(r, n), s.applyConfig(t, e), J.useEffect(s.effect.bind(s)), J.useEffect(() => s.clean.bind(s), []), t.target === void 0)
948
948
  return s.bind.bind(s);
949
949
  }
950
- function Te(r, t) {
951
- return de(he), Ee({
950
+ function xe(r, t) {
951
+ return he(pe), Te({
952
952
  drag: r
953
953
  }, t || {}, "drag");
954
954
  }
955
- const Q = "RSC::Event";
956
- function xe() {
957
- const r = S(null);
955
+ const Z = "RSC::Event";
956
+ function Ie() {
957
+ const r = D(null);
958
958
  function t(n) {
959
- vt(() => {
959
+ tt(() => {
960
960
  r.current || (r.current = document.createElement("div"));
961
961
  function s(o) {
962
962
  n(o.detail);
963
963
  }
964
964
  if (r.current)
965
- return r.current.addEventListener(Q, s, !1), () => {
965
+ return r.current.addEventListener(Z, s, !1), () => {
966
966
  var o;
967
967
  (o = r.current) == null || o.removeEventListener(
968
- Q,
968
+ Z,
969
969
  s,
970
970
  !1
971
971
  );
@@ -974,7 +974,7 @@ function xe() {
974
974
  }
975
975
  function e(n) {
976
976
  if (r.current) {
977
- const s = new CustomEvent(Q, {
977
+ const s = new CustomEvent(Z, {
978
978
  detail: n
979
979
  });
980
980
  r.current.dispatchEvent(s);
@@ -985,7 +985,7 @@ function xe() {
985
985
  emitEvent: e
986
986
  };
987
987
  }
988
- function Ce({
988
+ function Oe({
989
989
  init: r = !0,
990
990
  items: t,
991
991
  withLoop: e = !1,
@@ -997,20 +997,21 @@ function Ce({
997
997
  startingPosition: d = "start",
998
998
  enableGestures: p = !0,
999
999
  slideWhenDragThresholdIsReached: u = !0,
1000
- onInit: E
1000
+ onInit: E,
1001
+ initialActiveItem: m = 0
1001
1002
  }) {
1002
- const [m, P] = Pt(!1), D = S(r), k = S(null), A = S(null), $ = S(0), T = S(0), C = S(!e), O = S(!1), M = S(0), f = S(0), [R, F] = At(
1003
+ const [P, N] = $t(!1), k = D(r), C = D(null), $ = D(null), j = D(0), T = D(0), O = D(!e), A = D(!1), I = D(0), l = D(m), [F, W] = Pt(
1003
1004
  () => ({
1004
1005
  value: 0,
1005
1006
  onChange({ value: i }) {
1006
- k.current.style.setProperty(
1007
+ C.current.style.setProperty(
1007
1008
  `--${n}-offset-position`,
1008
1009
  `${i.value}px`
1009
1010
  );
1010
1011
  }
1011
1012
  }),
1012
1013
  [a]
1013
- ), It = e ? [
1014
+ ), St = e ? [
1014
1015
  ...t.map((i) => ({
1015
1016
  ...i,
1016
1017
  id: `prev-repeated-item-${i.id}`,
@@ -1022,59 +1023,59 @@ function Ce({
1022
1023
  id: `next-repeated-item-${i.id}`,
1023
1024
  isClonedItem: !0
1024
1025
  }))
1025
- ] : t, { useListenToCustomEvent: et, emitEvent: U } = xe();
1026
- function W(i) {
1027
- D.current && (O.current || L({
1026
+ ] : t, { useListenToCustomEvent: nt, emitEvent: U } = Ie();
1027
+ function G(i) {
1028
+ k.current && (A.current || M({
1028
1029
  type: "next",
1029
1030
  toIndex: i,
1030
1031
  actionType: "click"
1031
1032
  }));
1032
1033
  }
1033
- function G(i) {
1034
- D.current && (C.current || L({
1034
+ function H(i) {
1035
+ k.current && (O.current || M({
1035
1036
  type: "prev",
1036
1037
  toIndex: i,
1037
1038
  actionType: "click"
1038
1039
  }));
1039
1040
  }
1040
- function L({
1041
+ function M({
1041
1042
  type: i,
1042
- shouldAnimate: l = !0,
1043
+ shouldAnimate: f = !0,
1043
1044
  toIndex: _,
1044
1045
  actionType: v
1045
1046
  }) {
1046
- var nt, st;
1047
- const I = !l;
1048
- C.current = !1, O.current = !1;
1049
- let b = R.value.get(), w = 0;
1050
- if (i === "next" && (f.current += 1), i === "prev" && (f.current === 0 ? f.current = t.length - 1 : f.current -= 1), i === "next") {
1051
- const K = H(
1047
+ var it, ot;
1048
+ const S = !f;
1049
+ O.current = !1, A.current = !1;
1050
+ let b = F.value.get(), w = 0;
1051
+ if (i === "next" && (l.current += 1), i === "prev" && (l.current === 0 ? l.current = t.length - 1 : l.current -= 1), _ !== void 0 && (l.current = _), i === "next") {
1052
+ const K = X(
1052
1053
  e ? T.current * (t.length * 2) : 0
1053
1054
  );
1054
- w = -(f.current * T.current), e && f.current === t.length && (f.current = 0, b = b + T.current * t.length, w = 0), !e && Math.abs(w) >= K && (O.current = !0, w = -K);
1055
+ w = -(l.current * T.current), e && l.current === t.length && (l.current = 0, b = b + T.current * t.length, w = 0), !e && Math.abs(w) >= K && (A.current = !0, w = -K);
1055
1056
  }
1056
- i === "prev" && (w = -(f.current * T.current), f.current === t.length - 1 && (b = b - t.length * T.current), !e && w >= 0 && (C.current = !0, w = 0)), $.current = w, v === "resize" ? (w = -(f.current * T.current), U({
1057
+ i === "prev" && (w = -(l.current * T.current), l.current === t.length - 1 && (b = b - t.length * T.current), !e && w >= 0 && (O.current = !0, w = 0)), j.current = w, v === "resize" ? (w = -(l.current * T.current), U({
1057
1058
  eventName: "onResize",
1058
1059
  sliceActionType: v,
1059
1060
  slideDirection: i,
1060
1061
  currentItem: {
1061
- index: f.current,
1062
- id: ((nt = t.at(f.current)) == null ? void 0 : nt.id) ?? "",
1063
- startReached: C.current,
1064
- endReached: O.current
1062
+ index: l.current,
1063
+ id: ((it = t.at(l.current)) == null ? void 0 : it.id) ?? "",
1064
+ startReached: O.current,
1065
+ endReached: A.current
1065
1066
  }
1066
1067
  })) : U({
1067
1068
  eventName: "onSlideStartChange",
1068
1069
  sliceActionType: v,
1069
1070
  slideDirection: i,
1070
1071
  nextItem: {
1071
- index: f.current,
1072
- id: ((st = t.at(f.current)) == null ? void 0 : st.id) ?? "",
1073
- startReached: C.current,
1074
- endReached: O.current
1072
+ index: l.current,
1073
+ id: ((ot = t.at(l.current)) == null ? void 0 : ot.id) ?? "",
1074
+ startReached: O.current,
1075
+ endReached: A.current
1075
1076
  }
1076
- }), _ !== void 0 && (f.current = _), F.start({
1077
- immediate: I,
1077
+ }), W.start({
1078
+ immediate: S,
1078
1079
  from: {
1079
1080
  value: b
1080
1081
  },
@@ -1082,137 +1083,143 @@ function Ce({
1082
1083
  value: w
1083
1084
  },
1084
1085
  onRest({ finished: K }) {
1085
- var it;
1086
+ var at;
1086
1087
  K && U({
1087
1088
  eventName: "onSlideChangeComplete",
1088
1089
  sliceActionType: v,
1089
1090
  slideDirection: i,
1090
1091
  currentItem: {
1091
- index: f.current,
1092
- id: ((it = t.at(f.current)) == null ? void 0 : it.id) ?? "",
1093
- startReached: C.current,
1094
- endReached: O.current
1092
+ index: l.current,
1093
+ id: ((at = t.at(l.current)) == null ? void 0 : at.id) ?? "",
1094
+ startReached: O.current,
1095
+ endReached: A.current
1095
1096
  }
1096
1097
  });
1097
1098
  }
1098
1099
  });
1099
1100
  }
1100
- function St() {
1101
- const i = A.current.children[0];
1102
- let l = 0;
1103
- return l = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + o, l;
1101
+ function Dt() {
1102
+ const i = $.current.children[0];
1103
+ let f = 0;
1104
+ return f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + o, f;
1104
1105
  }
1105
- function H(i) {
1106
- const l = A.current;
1107
- return l[a === "x" ? "scrollWidth" : "scrollHeight"] - l.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
1106
+ function X(i) {
1107
+ const f = $.current;
1108
+ return f[a === "x" ? "scrollWidth" : "scrollHeight"] - f.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
1108
1109
  }
1109
- function Dt() {
1110
+ function kt() {
1110
1111
  let i = 0;
1111
- const l = getComputedStyle(
1112
+ const f = getComputedStyle(
1112
1113
  document.documentElement
1113
1114
  ).getPropertyValue(`--${n}-start-end-gutter`);
1114
- return l.includes("px") && (i = Number(
1115
- l.replace("px", "")
1115
+ return f.includes("px") && (i = Number(
1116
+ f.replace("px", "")
1116
1117
  )), { totalStartEndGutterCssVar: i };
1117
1118
  }
1118
- vt(() => {
1119
- function i(v, I) {
1119
+ tt(() => {
1120
+ function i(v, S) {
1120
1121
  switch (v) {
1121
1122
  case "start":
1122
1123
  return 0;
1123
1124
  case "middle-start":
1124
- return Math.floor((I - 1) * 0.25);
1125
+ return Math.floor((S - 1) * 0.25);
1125
1126
  case "center":
1126
- return Math.floor((I - 1) * 0.5);
1127
+ return Math.floor((S - 1) * 0.5);
1127
1128
  case "middle-end":
1128
- return Math.floor((I - 1) * 0.75);
1129
+ return Math.floor((S - 1) * 0.75);
1129
1130
  case "end":
1130
- return I - 1;
1131
+ return S - 1;
1131
1132
  default:
1132
1133
  return 0;
1133
1134
  }
1134
1135
  }
1135
- function l(v) {
1136
- if (T.current = St(), M.current = T.current / 4, k.current) {
1137
- const { totalStartEndGutterCssVar: I } = Dt();
1136
+ function f(v) {
1137
+ if (T.current = Dt(), I.current = T.current / 4, C.current) {
1138
+ const { totalStartEndGutterCssVar: S } = kt();
1138
1139
  let b = 0;
1139
- e && (b = T.current * t.length), b -= T.current * i(d, s), b -= I / 2, k.current.style.setProperty(
1140
+ e && (b = T.current * t.length), b -= T.current * i(d, s), b -= S / 2, C.current.style.setProperty(
1140
1141
  `--${n}-offset-modifier`,
1141
1142
  `${-b}px`
1142
- ), P(!0), v && v();
1143
+ ), N(!0), v && v();
1143
1144
  }
1144
1145
  }
1145
1146
  function _() {
1146
- console.log("resize"), l(), L({
1147
+ console.log("resize"), f(), M({
1147
1148
  type: "resize",
1148
- toIndex: f.current,
1149
+ toIndex: l.current,
1149
1150
  shouldAnimate: !1,
1150
1151
  actionType: "resize"
1151
1152
  });
1152
1153
  }
1153
1154
  if (r)
1154
- return D.current = !0, l(E), window.addEventListener("resize", _), () => {
1155
+ return k.current = !0, f(E), window.addEventListener("resize", _), () => {
1155
1156
  window.removeEventListener("resize", _);
1156
1157
  };
1157
- }, [r, e, n, a, o, d]);
1158
- const rt = p, kt = Te(
1158
+ }, [r, e, n, a, o, d]), tt(() => {
1159
+ r && m !== l.current && M({
1160
+ type: "next",
1161
+ toIndex: m,
1162
+ actionType: "resize"
1163
+ });
1164
+ }, [r, m]);
1165
+ const st = p, Ct = xe(
1159
1166
  (i) => {
1160
- if (!D.current)
1167
+ if (!k.current)
1161
1168
  return;
1162
- const l = i.dragging, _ = i.offset[a === "x" ? 0 : 1], v = i.movement[a === "x" ? 0 : 1], I = v > M.current, b = v < -M.current, w = i.velocity;
1163
- l && (U({
1169
+ const f = i.dragging, _ = i.offset[a === "x" ? 0 : 1], v = i.movement[a === "x" ? 0 : 1], S = v > I.current, b = v < -I.current, w = i.velocity;
1170
+ f && (U({
1164
1171
  ...i,
1165
1172
  eventName: "onDrag",
1166
1173
  slideActionType: "drag"
1167
- }), F.start({
1174
+ }), W.start({
1168
1175
  value: _,
1169
1176
  immediate: !0,
1170
1177
  config: {
1171
1178
  velocity: w
1172
1179
  }
1173
- }), u && (I || b) && i.cancel()), i.last && (I ? (L({
1180
+ }), u && (S || b) && i.cancel()), i.last && (S ? (M({
1174
1181
  actionType: "drag",
1175
1182
  type: "prev"
1176
- }), i.cancel()) : b ? (L({
1183
+ }), i.cancel()) : b ? (M({
1177
1184
  actionType: "drag",
1178
1185
  type: "next"
1179
- }), i.cancel()) : (F.start({
1180
- value: $.current,
1186
+ }), i.cancel()) : (W.start({
1187
+ value: j.current,
1181
1188
  config: {
1182
1189
  velocity: w
1183
1190
  }
1184
1191
  }), i.cancel()));
1185
1192
  },
1186
1193
  {
1187
- enabled: rt,
1194
+ enabled: st,
1188
1195
  axis: a,
1189
1196
  rubberband: !e,
1190
1197
  ...e ? {} : {
1191
1198
  bounds: () => ({
1192
1199
  right: 0,
1193
- left: -H(0),
1194
- top: -H(0),
1200
+ left: -X(0),
1201
+ top: -X(0),
1195
1202
  bottom: 0
1196
1203
  })
1197
1204
  },
1198
- from: () => [R.value.get(), R.value.get()]
1205
+ from: () => [F.value.get(), F.value.get()]
1199
1206
  }
1200
1207
  );
1201
- function Ct(i) {
1202
- var l, _;
1203
- return typeof i == "number" ? f.current === i : ((l = t.find((v) => v.id === i)) == null ? void 0 : l.id) === ((_ = t[f.current]) == null ? void 0 : _.id);
1208
+ function Ot(i) {
1209
+ var f, _;
1210
+ return typeof i == "number" ? l.current === i : ((f = t.find((v) => v.id === i)) == null ? void 0 : f.id) === ((_ = t[l.current]) == null ? void 0 : _.id);
1204
1211
  }
1205
1212
  return {
1206
- carouselFragment: /* @__PURE__ */ Ot(
1213
+ carouselFragment: /* @__PURE__ */ At(
1207
1214
  "div",
1208
1215
  {
1209
- ref: k,
1216
+ ref: C,
1210
1217
  className: "ReactSpringCarouselContainer",
1211
1218
  "data-part": "Container",
1212
1219
  "data-part-internal": `${n}-Container`,
1213
- ...kt(),
1220
+ ...Ct(),
1214
1221
  children: [
1215
- /* @__PURE__ */ X(
1222
+ /* @__PURE__ */ q(
1216
1223
  "style",
1217
1224
  {
1218
1225
  dangerouslySetInnerHTML: {
@@ -1231,7 +1238,7 @@ function Ce({
1231
1238
  --${n}-offset-modifier: 0px;
1232
1239
  --${n}-scroll-x-value: ${a === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
1233
1240
  --${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
1234
- touch-action: ${rt ? a === "x" ? "pan-y" : "pan-x" : "auto"};
1241
+ touch-action: ${st ? a === "x" ? "pan-y" : "pan-x" : "auto"};
1235
1242
  }
1236
1243
  [data-part-internal="${n}-Track"] {
1237
1244
  display: flex;
@@ -1239,8 +1246,8 @@ function Ce({
1239
1246
  --initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${t.length} * ${s}) + var(--${n}-start-end-gutter)) * ${t.length} / ${s});
1240
1247
 
1241
1248
 
1242
- left: ${e && a === "x" && !m ? "var(--initial-offset-modifier)" : "0px"};
1243
- top: ${e && a === "y" && !m ? "var(--initial-offset-modifier)" : "0px"};
1249
+ left: ${e && a === "x" && !P ? "var(--initial-offset-modifier)" : "0px"};
1250
+ top: ${e && a === "y" && !P ? "var(--initial-offset-modifier)" : "0px"};
1244
1251
  flex-direction: ${a === "x" ? "row" : "column"};
1245
1252
  width: 100%;
1246
1253
  height: 100%;
@@ -1255,17 +1262,17 @@ function Ce({
1255
1262
  }
1256
1263
  }
1257
1264
  ),
1258
- /* @__PURE__ */ X(
1265
+ /* @__PURE__ */ q(
1259
1266
  "div",
1260
1267
  {
1261
- ref: A,
1268
+ ref: $,
1262
1269
  className: "ReactSpringCarouselTrack",
1263
1270
  "data-part": "Track",
1264
1271
  "data-part-internal": `${n}-Track`,
1265
1272
  onScroll: () => {
1266
- C.current = !1, O.current = !1;
1273
+ O.current = !1, A.current = !1;
1267
1274
  },
1268
- children: It.map((i, l) => /* @__PURE__ */ X(
1275
+ children: St.map((i, f) => /* @__PURE__ */ q(
1269
1276
  "div",
1270
1277
  {
1271
1278
  className: "ReactSpringCarouselItem",
@@ -1273,22 +1280,22 @@ function Ce({
1273
1280
  "data-part-internal": `${n}-Item`,
1274
1281
  "data-id": i.id,
1275
1282
  children: typeof i.renderItem == "function" ? i.renderItem({
1276
- useListenToCustomEvent: et,
1277
- index: l,
1283
+ useListenToCustomEvent: nt,
1284
+ index: f,
1278
1285
  isClonedItem: !!i.isClonedItem,
1279
- isActiveItem: Ct
1286
+ isActiveItem: Ot
1280
1287
  }) : i.renderItem
1281
1288
  },
1282
- `${i.id}-${l}`
1289
+ `${i.id}-${f}`
1283
1290
  ))
1284
1291
  }
1285
1292
  )
1286
1293
  ]
1287
1294
  }
1288
1295
  ),
1289
- useListenToCustomEvent: et,
1290
- slideToNextItem: () => W(),
1291
- slideToPrevItem: () => G(),
1296
+ useListenToCustomEvent: nt,
1297
+ slideToNextItem: () => G(),
1298
+ slideToPrevItem: () => H(),
1292
1299
  slideToItem: (i) => {
1293
1300
  if (typeof i == "number") {
1294
1301
  if (!t[i]) {
@@ -1297,21 +1304,21 @@ function Ce({
1297
1304
  );
1298
1305
  return;
1299
1306
  }
1300
- i > f.current ? W(i) : G(i);
1307
+ i > l.current ? G(i) : H(i);
1301
1308
  }
1302
1309
  if (typeof i == "string") {
1303
- const l = t.findIndex((_) => _.id === i);
1304
- if (l < 0) {
1310
+ const f = t.findIndex((_) => _.id === i);
1311
+ if (f < 0) {
1305
1312
  console.warn(
1306
1313
  `The item you're trying to slide doesn't exist. id: ${i}`
1307
1314
  );
1308
1315
  return;
1309
1316
  }
1310
- l > f.current ? W(l) : G(l);
1317
+ f > l.current ? G(f) : H(f);
1311
1318
  }
1312
1319
  }
1313
1320
  };
1314
1321
  }
1315
1322
  export {
1316
- Ce as useSpringCarousel
1323
+ Oe as useSpringCarousel
1317
1324
  };