react-spring-carousel 3.0.0-beta-2.0.31 → 3.0.0-beta-2.0.4

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 $t, jsx as X } from "react/jsx-runtime";
1
+ import { jsxs as Ot, jsx as X } from "react/jsx-runtime";
2
2
  import { useSpring as At } from "@react-spring/web";
3
- import q, { useRef as k, useEffect as Z, useState as Pt } from "react";
4
- function Nt(r, t, e) {
3
+ import q, { useRef as k, useEffect as Z, useState as Nt } from "react";
4
+ function Mt(r, t, e) {
5
5
  return Math.max(t, Math.min(r, e));
6
6
  }
7
7
  const y = {
@@ -21,17 +21,17 @@ const y = {
21
21
  r[0] -= t[0], r[1] -= t[1];
22
22
  }
23
23
  };
24
- function ct(r, t, e) {
24
+ function lt(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 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;
27
+ function ft(r, t, e, n = 0.15) {
28
+ return n === 0 ? Mt(r, t, e) : r < t ? -lt(t - r, e - t, n) + t : r > e ? +lt(r - e, e - t, n) + e : r;
29
29
  }
30
- function Mt(r, [t, e], [n, s]) {
30
+ function Rt(r, [t, e], [n, s]) {
31
31
  const [[o, a], [u, h]] = r;
32
- return [ut(t, o, a, n), ut(e, u, h, s)];
32
+ return [ft(t, o, a, n), ft(e, u, h, s)];
33
33
  }
34
- function Rt(r, t) {
34
+ function Vt(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) {
@@ -42,7 +42,7 @@ function Rt(r, t) {
42
42
  return (t === "string" ? String : Number)(r);
43
43
  }
44
44
  function Lt(r) {
45
- var t = Rt(r, "string");
45
+ var t = Vt(r, "string");
46
46
  return typeof t == "symbol" ? t : String(t);
47
47
  }
48
48
  function w(r, t, e) {
@@ -53,7 +53,7 @@ function w(r, t, e) {
53
53
  writable: !0
54
54
  }) : r[t] = e, r;
55
55
  }
56
- function lt(r, t) {
56
+ function dt(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 lt(r, t) {
66
66
  function d(r) {
67
67
  for (var t = 1; t < arguments.length; t++) {
68
68
  var e = arguments[t] != null ? arguments[t] : {};
69
- t % 2 ? lt(Object(e), !0).forEach(function(n) {
69
+ t % 2 ? dt(Object(e), !0).forEach(function(n) {
70
70
  w(r, n, e[n]);
71
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : lt(Object(e)).forEach(function(n) {
71
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(e)) : dt(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 _t = {
77
+ const wt = {
78
78
  pointer: {
79
79
  start: "down",
80
80
  change: "move",
@@ -96,38 +96,38 @@ const _t = {
96
96
  end: "end"
97
97
  }
98
98
  };
99
- function ft(r) {
99
+ function ht(r) {
100
100
  return r ? r[0].toUpperCase() + r.slice(1) : "";
101
101
  }
102
- const Vt = ["enter", "leave"];
103
- function jt(r = !1, t) {
104
- return r && !Vt.includes(t);
102
+ const jt = ["enter", "leave"];
103
+ function Ut(r = !1, t) {
104
+ return r && !jt.includes(t);
105
105
  }
106
- function Ut(r, t = "", e = !1) {
107
- const n = _t[r], s = n && n[t] || t;
108
- return "on" + ft(r) + ft(s) + (jt(e, s) ? "Capture" : "");
106
+ function Kt(r, t = "", e = !1) {
107
+ const n = wt[r], s = n && n[t] || t;
108
+ return "on" + ht(r) + ht(s) + (Ut(e, s) ? "Capture" : "");
109
109
  }
110
- const Kt = ["gotpointercapture", "lostpointercapture"];
111
- function Bt(r) {
110
+ const Bt = ["gotpointercapture", "lostpointercapture"];
111
+ function zt(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 = Kt.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
115
+ const n = Bt.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 zt(r, t = "") {
123
- const e = _t[r], n = e && e[t] || t;
122
+ function Gt(r, t = "") {
123
+ const e = wt[r], n = e && e[t] || t;
124
124
  return r + n;
125
125
  }
126
- function Y(r) {
126
+ function G(r) {
127
127
  return "touches" in r;
128
128
  }
129
- function bt(r) {
130
- return Y(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
129
+ function Et(r) {
130
+ return G(r) ? "touch" : "pointerType" in r ? r.pointerType : "mouse";
131
131
  }
132
132
  function Yt(r) {
133
133
  return Array.from(r.touches).filter((t) => {
@@ -135,24 +135,24 @@ function Yt(r) {
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 Gt(r) {
138
+ function Ft(r) {
139
139
  return r.type === "touchend" || r.type === "touchcancel" ? r.changedTouches : r.targetTouches;
140
140
  }
141
- function wt(r) {
142
- return Y(r) ? Gt(r)[0] : r;
141
+ function Tt(r) {
142
+ return G(r) ? Ft(r)[0] : r;
143
143
  }
144
- function Ft(r) {
144
+ function Wt(r) {
145
145
  return Yt(r).map((t) => t.identifier);
146
146
  }
147
147
  function J(r) {
148
- const t = wt(r);
149
- return Y(r) ? t.identifier : t.pointerId;
148
+ const t = Tt(r);
149
+ return G(r) ? t.identifier : t.pointerId;
150
150
  }
151
- function dt(r) {
152
- const t = wt(r);
151
+ function pt(r) {
152
+ const t = Tt(r);
153
153
  return [t.clientX, t.clientY];
154
154
  }
155
- function Wt(r) {
155
+ function Ht(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 Ht() {
176
+ function Xt() {
177
177
  }
178
- function Xt(...r) {
179
- return r.length === 0 ? Ht : r.length === 1 ? r[0] : function() {
178
+ function qt(...r) {
179
+ return r.length === 0 ? Xt : 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 ht(r, t) {
186
+ function mt(r, t) {
187
187
  return Object.assign({}, t, r || {});
188
188
  }
189
- const qt = 32;
190
- class Jt {
189
+ const Jt = 32;
190
+ class Qt {
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 Jt {
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 l = e._delta.map(Math.abs);
249
- y.addTo(e._distance, l);
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, Ht(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
+ y.addTo(e._distance, f);
250
250
  }
251
251
  this.axisIntent && this.axisIntent(t);
252
252
  const [a, u] = e._movement, [h, p] = n.threshold, {
@@ -254,22 +254,22 @@ class Jt {
254
254
  values: b
255
255
  } = e;
256
256
  if (n.hasCustomTransform ? (c[0] === !1 && (c[0] = Math.abs(a) >= h && b[0]), c[1] === !1 && (c[1] = Math.abs(u) >= p && b[1])) : (c[0] === !1 && (c[0] = Math.abs(a) >= h && Math.sign(a) * h), c[1] === !1 && (c[1] = Math.abs(u) >= p && Math.sign(u) * p)), e.intentional = c[0] !== !1 || c[1] !== !1, !e.intentional) return;
257
- const m = [0, 0];
257
+ const g = [0, 0];
258
258
  if (n.hasCustomTransform) {
259
- const [l, L] = b;
260
- m[0] = c[0] !== !1 ? l - c[0] : 0, m[1] = c[1] !== !1 ? L - c[1] : 0;
259
+ const [f, V] = b;
260
+ g[0] = c[0] !== !1 ? f - c[0] : 0, g[1] = c[1] !== !1 ? V - c[1] : 0;
261
261
  } else
262
- m[0] = c[0] !== !1 ? a - c[0] : 0, m[1] = c[1] !== !1 ? u - c[1] : 0;
263
- this.restrictToAxis && !e._blocked && this.restrictToAxis(m);
264
- const A = 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 [S, $] = e.offset, [[P, x], [C, O]] = e._bounds;
267
- e.overflow = [S < P ? -1 : S > x ? 1 : 0, $ < C ? -1 : $ > 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;
262
+ g[0] = c[0] !== !1 ? a - c[0] : 0, g[1] = c[1] !== !1 ? u - c[1] : 0;
263
+ this.restrictToAxis && !e._blocked && this.restrictToAxis(g);
264
+ const O = 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 = g, this.computeOffset()));
266
+ const [E, $] = e.offset, [[A, x], [C, P]] = e._bounds;
267
+ e.overflow = [E < A ? -1 : E > x ? 1 : 0, $ < C ? -1 : $ > P ? 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
268
  const R = e._active ? n.rubberband || [0, 0] : [0, 0];
269
- if (e.offset = Mt(e._bounds, e.offset, R), e.delta = y.sub(e.offset, A), this.computeMovement(), D && (!e.last || o > qt)) {
270
- e.delta = y.sub(e.offset, A);
271
- const l = e.delta.map(Math.abs);
272
- y.addTo(e.distance, l), e.direction = e.delta.map(Math.sign), e._direction = e._delta.map(Math.sign), !e.first && o > 0 && (e.velocity = [l[0] / o, l[1] / o], e.timeDelta = o);
269
+ if (e.offset = Rt(e._bounds, e.offset, R), e.delta = y.sub(e.offset, O), this.computeMovement(), D && (!e.last || o > Jt)) {
270
+ e.delta = y.sub(e.offset, O);
271
+ const f = e.delta.map(Math.abs);
272
+ y.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);
273
273
  }
274
274
  }
275
275
  emit() {
@@ -284,14 +284,14 @@ class Jt {
284
284
  this.eventStore.clean(), this.timeoutStore.clean();
285
285
  }
286
286
  }
287
- function Qt([r, t], e) {
287
+ function Zt([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 Zt extends Jt {
294
+ class te extends Qt {
295
295
  constructor(...t) {
296
296
  super(...t), w(this, "aliasKey", "xy");
297
297
  }
@@ -310,8 +310,8 @@ class Zt extends Jt {
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[bt(t)] : n.axisThreshold;
314
- e.axis = Qt(e._movement, s);
313
+ const s = typeof n.axisThreshold == "object" ? n.axisThreshold[Et(t)] : n.axisThreshold;
314
+ e.axis = Zt(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 Zt extends Jt {
327
327
  }
328
328
  }
329
329
  }
330
- const pt = (r) => r, gt = 0.15, et = {
330
+ const gt = (r) => r, vt = 0.15, et = {
331
331
  enabled(r = !0) {
332
332
  return r;
333
333
  },
@@ -343,7 +343,7 @@ const pt = (r) => r, gt = 0.15, et = {
343
343
  rubberband(r = 0) {
344
344
  switch (r) {
345
345
  case !0:
346
- return [gt, gt];
346
+ return [vt, vt];
347
347
  case !1:
348
348
  return [0, 0];
349
349
  default:
@@ -357,13 +357,13 @@ const pt = (r) => r, gt = 0.15, et = {
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 || pt;
360
+ const s = n || gt;
361
361
  return (o) => {
362
362
  const a = s(o);
363
363
  return (!isFinite(a[0]) || !isFinite(a[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${a[0]},${[1]}]`), a;
364
364
  };
365
365
  }
366
- return n || pt;
366
+ return n || gt;
367
367
  },
368
368
  threshold(r) {
369
369
  return y.toVector(r, 0);
@@ -386,18 +386,18 @@ process.env.NODE_ENV === "development" && Object.assign(et, {
386
386
  return NaN;
387
387
  }
388
388
  });
389
- const te = 0, V = d(d({}, et), {}, {
389
+ const ee = 0, L = d(d({}, et), {}, {
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 = te) {
395
+ axisThreshold(r = ee) {
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 te = 0, V = d(d({}, et), {}, {
410
410
  } = r;
411
411
  return [[t, e], [n, s]];
412
412
  }
413
- }), mt = {
413
+ }), yt = {
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 ee extends Zt {
419
+ class re extends te {
420
420
  constructor(...t) {
421
421
  super(...t), w(this, "ingKey", "dragging");
422
422
  }
@@ -434,7 +434,7 @@ class ee extends Zt {
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 ee extends Zt {
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(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));
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(pt(t)), this.computeInitial(), e.preventScrollAxis && Et(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;
@@ -464,7 +464,7 @@ class ee extends Zt {
464
464
  if (!e._pointerActive) return;
465
465
  const s = J(t);
466
466
  if (e._pointerId !== void 0 && s !== e._pointerId) return;
467
- const o = dt(t);
467
+ const o = pt(t);
468
468
  if (document.pointerLockElement === t.target ? e._delta = [t.movementX, t.movementY] : (e._delta = y.sub(o, e._values), this.computeValues(o)), y.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;
@@ -498,10 +498,10 @@ class ee extends Zt {
498
498
  if (e.tap = o <= n.tapsThreshold && a <= n.tapsThreshold, e.tap && n.filterTaps)
499
499
  e._force = !0;
500
500
  else {
501
- const [u, h] = e._delta, [p, c] = e._movement, [b, m] = n.swipe.velocity, [A, D] = n.swipe.distance, S = n.swipe.duration;
502
- if (e.elapsedTime < S) {
503
- const $ = Math.abs(u / e.timeDelta), P = Math.abs(h / e.timeDelta);
504
- $ > b && Math.abs(p) > A && (e.swipe[0] = Math.sign(u)), P > m && Math.abs(c) > D && (e.swipe[1] = Math.sign(h));
501
+ const [u, h] = e._delta, [p, c] = e._movement, [b, g] = n.swipe.velocity, [O, D] = n.swipe.distance, E = n.swipe.duration;
502
+ if (e.elapsedTime < E) {
503
+ const $ = Math.abs(u / e.timeDelta), A = Math.abs(h / e.timeDelta);
504
+ $ > b && Math.abs(p) > O && (e.swipe[0] = Math.sign(u)), A > g && Math.abs(c) > D && (e.swipe[1] = Math.sign(h));
505
505
  }
506
506
  }
507
507
  this.emit();
@@ -528,7 +528,7 @@ class ee extends Zt {
528
528
  this.state._preventScroll && t.cancelable && t.preventDefault();
529
529
  }
530
530
  setupScrollPrevention(t) {
531
- this.state._preventScroll = !1, re(t);
531
+ this.state._preventScroll = !1, ne(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 ee extends Zt {
540
540
  }, this.config.delay);
541
541
  }
542
542
  keyDown(t) {
543
- const e = mt[t.key];
543
+ const e = yt[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, y.addTo(n._movement, n._delta), this.compute(t), this.emit();
547
547
  }
548
548
  }
549
549
  keyUp(t) {
550
- t.key in mt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
550
+ t.key in yt && (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 ee extends Zt {
557
557
  });
558
558
  }
559
559
  }
560
- function re(r) {
560
+ function ne(r) {
561
561
  "persist" in r && typeof r.persist == "function" && r.persist();
562
562
  }
563
563
  const j = typeof window < "u" && window.document && window.document.createElement;
564
- function Et() {
564
+ function St() {
565
565
  return j && "ontouchstart" in window;
566
566
  }
567
- function ne() {
568
- return Et() || j && window.navigator.maxTouchPoints > 1;
569
- }
570
567
  function se() {
571
- return j && "onpointerdown" in window;
568
+ return St() || j && window.navigator.maxTouchPoints > 1;
572
569
  }
573
570
  function ie() {
574
- return j && "exitPointerLock" in window.document;
571
+ return j && "onpointerdown" in window;
575
572
  }
576
573
  function oe() {
574
+ return j && "exitPointerLock" in window.document;
575
+ }
576
+ function ae() {
577
577
  try {
578
578
  return "constructor" in GestureEvent;
579
579
  } catch {
@@ -582,16 +582,16 @@ function oe() {
582
582
  }
583
583
  const I = {
584
584
  isBrowser: j,
585
- gesture: oe(),
586
- touch: Et(),
587
- touchscreen: ne(),
588
- pointer: se(),
589
- pointerLock: ie()
590
- }, ae = 250, ce = 180, ue = 0.5, le = 50, fe = 250, de = 10, vt = {
585
+ gesture: ae(),
586
+ touch: St(),
587
+ touchscreen: se(),
588
+ pointer: ie(),
589
+ pointerLock: oe()
590
+ }, ce = 250, ue = 180, le = 0.5, fe = 50, de = 250, he = 10, bt = {
591
591
  mouse: 0,
592
592
  touch: 0,
593
593
  pen: 8
594
- }, Tt = d(d({}, V), {}, {
594
+ }, xt = d(d({}, L), {}, {
595
595
  device(r, t, {
596
596
  pointer: {
597
597
  touch: e = !1,
@@ -604,7 +604,7 @@ const I = {
604
604
  preventScrollAxis(r, t, {
605
605
  preventScroll: e
606
606
  }) {
607
- if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ? ae : void 0, !(!I.touchscreen || e === !1))
607
+ if (this.preventScrollDelay = typeof e == "number" ? e : e || e === void 0 && r ? ce : void 0, !(!I.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 I = {
625
625
  return this.filterTaps = e, this.tapsThreshold = n, o;
626
626
  },
627
627
  swipe({
628
- velocity: r = ue,
629
- distance: t = le,
630
- duration: e = fe
628
+ velocity: r = le,
629
+ distance: t = fe,
630
+ duration: e = de
631
631
  } = {}) {
632
632
  return {
633
633
  velocity: this.transform(y.toVector(r)),
@@ -638,7 +638,7 @@ const I = {
638
638
  delay(r = 0) {
639
639
  switch (r) {
640
640
  case !0:
641
- return ce;
641
+ return ue;
642
642
  case !1:
643
643
  return 0;
644
644
  default:
@@ -646,13 +646,13 @@ const I = {
646
646
  }
647
647
  },
648
648
  axisThreshold(r) {
649
- return r ? d(d({}, vt), r) : vt;
649
+ return r ? d(d({}, bt), r) : bt;
650
650
  },
651
- keyboardDisplacement(r = de) {
651
+ keyboardDisplacement(r = he) {
652
652
  return r;
653
653
  }
654
654
  });
655
- process.env.NODE_ENV === "development" && Object.assign(Tt, {
655
+ process.env.NODE_ENV === "development" && Object.assign(xt, {
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 } }`.");
@@ -698,13 +698,13 @@ d(d({}, et), {}, {
698
698
  angleBounds: n = {}
699
699
  }) {
700
700
  const s = (a) => {
701
- const u = ht(z(e, a), {
701
+ const u = mt(z(e, a), {
702
702
  min: -1 / 0,
703
703
  max: 1 / 0
704
704
  });
705
705
  return [u.min, u.max];
706
706
  }, o = (a) => {
707
- const u = ht(z(n, a), {
707
+ const u = mt(z(n, a), {
708
708
  min: -1 / 0,
709
709
  max: 1 / 0
710
710
  });
@@ -722,20 +722,20 @@ d(d({}, et), {}, {
722
722
  return r;
723
723
  }
724
724
  });
725
- d(d({}, V), {}, {
725
+ d(d({}, L), {}, {
726
726
  mouseOnly: (r = !0) => r
727
727
  });
728
- d(d({}, V), {}, {
728
+ d(d({}, L), {}, {
729
729
  mouseOnly: (r = !0) => r
730
730
  });
731
- const xt = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Map();
732
- function he(r) {
733
- xt.set(r.key, r.engine), tt.set(r.key, r.resolver);
731
+ const It = /* @__PURE__ */ new Map(), tt = /* @__PURE__ */ new Map();
732
+ function pe(r) {
733
+ It.set(r.key, r.engine), tt.set(r.key, r.resolver);
734
734
  }
735
- const pe = {
735
+ const me = {
736
736
  key: "drag",
737
- engine: ee,
738
- resolver: Tt
737
+ engine: re,
738
+ resolver: xt
739
739
  };
740
740
  function ge(r, t) {
741
741
  if (r == null) return {};
@@ -744,7 +744,7 @@ function ge(r, t) {
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 ve(r, t) {
748
748
  if (r == null) return {};
749
749
  var e = ge(r, t), n, s;
750
750
  if (Object.getOwnPropertySymbols) {
@@ -754,7 +754,7 @@ function me(r, t) {
754
754
  }
755
755
  return e;
756
756
  }
757
- const ve = {
757
+ const ye = {
758
758
  target(r) {
759
759
  if (r)
760
760
  return () => "current" in r ? r.current : r;
@@ -777,7 +777,7 @@ const ve = {
777
777
  transform(r) {
778
778
  return r;
779
779
  }
780
- }, ye = ["target", "eventOptions", "window", "enabled", "transform"];
780
+ }, be = ["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))
@@ -805,14 +805,14 @@ function _e(r, t, e = {}) {
805
805
  window: a,
806
806
  enabled: u,
807
807
  transform: h
808
- } = n, p = me(n, ye);
808
+ } = n, p = ve(n, be);
809
809
  if (e.shared = B({
810
810
  target: s,
811
811
  eventOptions: o,
812
812
  window: a,
813
813
  enabled: u,
814
814
  transform: h
815
- }, ve), t) {
815
+ }, ye), t) {
816
816
  const c = tt.get(t);
817
817
  e[t] = B(d({
818
818
  shared: e.shared
@@ -832,12 +832,12 @@ function _e(r, t, e = {}) {
832
832
  }
833
833
  return e;
834
834
  }
835
- class It {
835
+ class kt {
836
836
  constructor(t, e) {
837
837
  w(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = e;
838
838
  }
839
839
  add(t, e, n, s, o) {
840
- const a = this._listeners, u = zt(e, n), h = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = d(d({}, h), o);
840
+ const a = this._listeners, u = Gt(e, n), h = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, p = d(d({}, h), o);
841
841
  t.addEventListener(u, s, p);
842
842
  const c = () => {
843
843
  t.removeEventListener(u, s, p), a.delete(c);
@@ -848,7 +848,7 @@ class It {
848
848
  this._listeners.forEach((t) => t()), this._listeners.clear();
849
849
  }
850
850
  }
851
- class be {
851
+ class we {
852
852
  constructor() {
853
853
  w(this, "_timeouts", /* @__PURE__ */ new Map());
854
854
  }
@@ -863,20 +863,20 @@ class be {
863
863
  this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
864
864
  }
865
865
  }
866
- class we {
866
+ class Ee {
867
867
  constructor(t) {
868
- w(this, "gestures", /* @__PURE__ */ new Set()), w(this, "_targetEventStore", new It(this)), w(this, "gestureEventStores", {}), w(this, "gestureTimeoutStores", {}), w(this, "handlers", {}), w(this, "config", {}), w(this, "pointerIds", /* @__PURE__ */ new Set()), w(this, "touchIds", /* @__PURE__ */ new Set()), w(this, "state", {
868
+ w(this, "gestures", /* @__PURE__ */ new Set()), w(this, "_targetEventStore", new kt(this)), w(this, "gestureEventStores", {}), w(this, "gestureTimeoutStores", {}), w(this, "handlers", {}), w(this, "config", {}), w(this, "pointerIds", /* @__PURE__ */ new Set()), w(this, "touchIds", /* @__PURE__ */ new Set()), w(this, "state", {
869
869
  shared: {
870
870
  shiftKey: !1,
871
871
  metaKey: !1,
872
872
  ctrlKey: !1,
873
873
  altKey: !1
874
874
  }
875
- }), Ee(this, t);
875
+ }), Te(this, t);
876
876
  }
877
877
  setEventIds(t) {
878
- if (Y(t))
879
- return this.touchIds = new Set(Ft(t)), this.touchIds;
878
+ if (G(t))
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
  }
@@ -900,13 +900,13 @@ class we {
900
900
  if (!(e.target && (s = e.target(), !s))) {
901
901
  if (e.enabled) {
902
902
  for (const a of this.gestures) {
903
- const u = this.config[a], h = yt(n, u.eventOptions, !!s);
903
+ const u = this.config[a], h = _t(n, u.eventOptions, !!s);
904
904
  if (u.enabled) {
905
- const p = xt.get(a);
905
+ const p = It.get(a);
906
906
  new p(this, t, a).bind(h);
907
907
  }
908
908
  }
909
- const o = yt(n, e.eventOptions, !!s);
909
+ const o = _t(n, e.eventOptions, !!s);
910
910
  for (const a in this.nativeHandlers)
911
911
  o(a, "", (u) => this.nativeHandlers[a](d(d({}, this.state.shared), {}, {
912
912
  event: u,
@@ -914,14 +914,14 @@ class we {
914
914
  })), void 0, !0);
915
915
  }
916
916
  for (const o in n)
917
- n[o] = Xt(...n[o]);
917
+ n[o] = qt(...n[o]);
918
918
  if (!s) return n;
919
919
  for (const o in n) {
920
920
  const {
921
921
  device: a,
922
922
  capture: u,
923
923
  passive: h
924
- } = Bt(o);
924
+ } = zt(o);
925
925
  this._targetEventStore.add(s, a, "", n[o], {
926
926
  capture: u,
927
927
  passive: h
@@ -931,24 +931,24 @@ class we {
931
931
  }
932
932
  }
933
933
  function M(r, t) {
934
- r.gestures.add(t), r.gestureEventStores[t] = new It(r, t), r.gestureTimeoutStores[t] = new be();
934
+ r.gestures.add(t), r.gestureEventStores[t] = new kt(r, t), r.gestureTimeoutStores[t] = new we();
935
935
  }
936
- function Ee(r, t) {
936
+ function Te(r, t) {
937
937
  t.drag && M(r, "drag"), t.wheel && M(r, "wheel"), t.scroll && M(r, "scroll"), t.move && M(r, "move"), t.pinch && M(r, "pinch"), t.hover && M(r, "hover");
938
938
  }
939
- const yt = (r, t, e) => (n, s, o, a = {}, u = !1) => {
939
+ const _t = (r, t, e) => (n, s, o, a = {}, u = !1) => {
940
940
  var h, p;
941
941
  const c = (h = a.capture) !== null && h !== void 0 ? h : t.capture, b = (p = a.passive) !== null && p !== void 0 ? p : t.passive;
942
- let m = u ? n : Ut(n, s, c);
943
- e && b && (m += "Passive"), r[m] = r[m] || [], r[m].push(o);
942
+ let g = u ? n : Kt(n, s, c);
943
+ e && b && (g += "Passive"), r[g] = r[g] || [], r[g].push(o);
944
944
  };
945
- function Te(r, t = {}, e, n) {
946
- const s = q.useMemo(() => new we(r), []);
945
+ function Se(r, t = {}, e, n) {
946
+ const s = q.useMemo(() => new Ee(r), []);
947
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)
948
948
  return s.bind.bind(s);
949
949
  }
950
950
  function xe(r, t) {
951
- return he(pe), Te({
951
+ return pe(me), Se({
952
952
  drag: r
953
953
  }, t || {}, "drag");
954
954
  }
@@ -985,13 +985,13 @@ function Ie() {
985
985
  emitEvent: e
986
986
  };
987
987
  }
988
- function Oe({
988
+ function $e({
989
989
  init: r = !0,
990
990
  items: t,
991
991
  withLoop: e = !1,
992
992
  id: n,
993
- itemsPerSlide: s = 1,
994
- responsiveGutter: o = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
993
+ gutter: s = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
994
+ itemsPerSlide: o = [{ breakpoint: 0, itemsPerSlide: 1 }],
995
995
  carouselAxis: a = "x",
996
996
  startingPosition: u = "start",
997
997
  enableGestures: h = !0,
@@ -999,18 +999,18 @@ function Oe({
999
999
  onInit: c,
1000
1000
  initialActiveItem: b = 0
1001
1001
  }) {
1002
- const [m, A] = Pt(!1), D = k(r), S = k(null), $ = k(null), P = k(0), x = k(0), C = k(!e), O = k(!1), R = k(0), l = k(0), [L, G] = At(
1002
+ const [g, O] = Nt(!1), D = k(r), E = k(null), $ = k(null), A = k(0), x = k(0), C = k(!e), P = k(!1), R = k(0), f = k(0), [V, Y] = At(
1003
1003
  () => ({
1004
1004
  value: 0,
1005
1005
  onChange({ value: i }) {
1006
- S.current.style.setProperty(
1006
+ E.current.style.setProperty(
1007
1007
  `--${n}-offset-position`,
1008
1008
  `${i.value}px`
1009
1009
  );
1010
1010
  }
1011
1011
  }),
1012
1012
  [a]
1013
- ), St = e ? [
1013
+ ), Dt = e ? [
1014
1014
  ...t.map((i) => ({
1015
1015
  ...i,
1016
1016
  id: `prev-repeated-item-${i.id}`,
@@ -1023,12 +1023,21 @@ function Oe({
1023
1023
  isClonedItem: !0
1024
1024
  }))
1025
1025
  ] : t, { useListenToCustomEvent: rt, emitEvent: U } = Ie();
1026
- function kt() {
1027
- const { totalGutterCssVar: i } = nt();
1026
+ function nt() {
1027
+ const { totalGutterCssVar: i } = it();
1028
1028
  return i;
1029
1029
  }
1030
+ function st() {
1031
+ if (E.current) {
1032
+ const l = window.getComputedStyle(
1033
+ E.current
1034
+ ).getPropertyValue(`--${n}-items-per-slide`).trim();
1035
+ return Number(l) || 1;
1036
+ }
1037
+ return 1;
1038
+ }
1030
1039
  function F(i) {
1031
- D.current && (O.current || N({
1040
+ D.current && (P.current || N({
1032
1041
  type: "next",
1033
1042
  toIndex: i,
1034
1043
  actionType: "click"
@@ -1043,90 +1052,91 @@ function Oe({
1043
1052
  }
1044
1053
  function N({
1045
1054
  type: i,
1046
- shouldAnimate: f = !0,
1055
+ shouldAnimate: l = !0,
1047
1056
  toIndex: v,
1048
- actionType: g
1057
+ actionType: m
1049
1058
  }) {
1050
- var it, ot;
1051
- const _ = !f;
1052
- C.current = !1, O.current = !1;
1053
- let E = L.value.get(), T = 0;
1054
- if (i === "next" && (l.current += 1), i === "prev" && (l.current === 0 ? l.current = t.length - 1 : l.current -= 1), v !== void 0 && (l.current = v), i === "next") {
1059
+ var at, ct;
1060
+ const _ = !l;
1061
+ C.current = !1, P.current = !1;
1062
+ let T = V.value.get(), S = 0;
1063
+ if (i === "next" && (f.current += 1), i === "prev" && (f.current === 0 ? f.current = t.length - 1 : f.current -= 1), v !== void 0 && (f.current = v), i === "next") {
1055
1064
  const K = H(
1056
1065
  e ? x.current * (t.length * 2) : 0
1057
1066
  );
1058
- T = -(l.current * x.current), e && l.current === t.length && (l.current = 0, E = E + x.current * t.length, T = 0), !e && Math.abs(T) >= K && (O.current = !0, T = -K);
1067
+ S = -(f.current * x.current), e && f.current === t.length && (f.current = 0, T = T + x.current * t.length, S = 0), !e && Math.abs(S) >= K && (P.current = !0, S = -K);
1059
1068
  }
1060
- i === "prev" && (T = -(l.current * x.current), l.current === t.length - 1 && (E = E - t.length * x.current), !e && T >= 0 && (C.current = !0, T = 0)), P.current = T, g === "resize" ? (T = -(l.current * x.current), U({
1069
+ i === "prev" && (S = -(f.current * x.current), f.current === t.length - 1 && (T = T - t.length * x.current), !e && S >= 0 && (C.current = !0, S = 0)), A.current = S, m === "resize" ? (S = -(f.current * x.current), U({
1061
1070
  eventName: "onResize",
1062
- sliceActionType: g,
1071
+ sliceActionType: m,
1063
1072
  slideDirection: i,
1064
1073
  currentItem: {
1065
- index: l.current,
1066
- id: ((it = t.at(l.current)) == null ? void 0 : it.id) ?? "",
1074
+ index: f.current,
1075
+ id: ((at = t.at(f.current)) == null ? void 0 : at.id) ?? "",
1067
1076
  startReached: C.current,
1068
- endReached: O.current
1077
+ endReached: P.current
1069
1078
  }
1070
1079
  })) : U({
1071
1080
  eventName: "onSlideStartChange",
1072
- sliceActionType: g,
1081
+ sliceActionType: m,
1073
1082
  slideDirection: i,
1074
1083
  nextItem: {
1075
- index: l.current,
1076
- id: ((ot = t.at(l.current)) == null ? void 0 : ot.id) ?? "",
1084
+ index: f.current,
1085
+ id: ((ct = t.at(f.current)) == null ? void 0 : ct.id) ?? "",
1077
1086
  startReached: C.current,
1078
- endReached: O.current
1087
+ endReached: P.current
1079
1088
  }
1080
- }), G.start({
1089
+ }), Y.start({
1081
1090
  immediate: _,
1082
1091
  from: {
1083
- value: E
1092
+ value: T
1084
1093
  },
1085
1094
  to: {
1086
- value: T
1095
+ value: S
1087
1096
  },
1088
1097
  onRest({ finished: K }) {
1089
- var at;
1098
+ var ut;
1090
1099
  K && U({
1091
1100
  eventName: "onSlideChangeComplete",
1092
- sliceActionType: g,
1101
+ sliceActionType: m,
1093
1102
  slideDirection: i,
1094
1103
  currentItem: {
1095
- index: l.current,
1096
- id: ((at = t.at(l.current)) == null ? void 0 : at.id) ?? "",
1104
+ index: f.current,
1105
+ id: ((ut = t.at(f.current)) == null ? void 0 : ut.id) ?? "",
1097
1106
  startReached: C.current,
1098
- endReached: O.current
1107
+ endReached: P.current
1099
1108
  }
1100
1109
  });
1101
1110
  }
1102
1111
  });
1103
1112
  }
1104
- function Dt() {
1113
+ function Ct() {
1105
1114
  const i = $.current.children[0];
1106
- let f = 0;
1107
- return f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + kt(), f;
1115
+ let l = 0;
1116
+ return l = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + nt(), l;
1108
1117
  }
1109
1118
  function H(i) {
1110
- const f = $.current;
1111
- return f[a === "x" ? "scrollWidth" : "scrollHeight"] - f.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
1119
+ const l = $.current;
1120
+ return l[a === "x" ? "scrollWidth" : "scrollHeight"] - l.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
1112
1121
  }
1113
- function nt() {
1114
- let i = 0, f = 0;
1115
- if (S.current) {
1122
+ function it() {
1123
+ let i = 0, l = 0;
1124
+ if (E.current) {
1116
1125
  const v = window.getComputedStyle(
1117
- S.current
1118
- ), g = v.getPropertyValue(`--${n}-start-end-gutter`).trim();
1119
- g.includes("px") && (i = Number(
1120
- g.replace("px", "")
1126
+ E.current
1127
+ ), m = v.getPropertyValue(`--${n}-start-end-gutter`).trim();
1128
+ m.includes("px") && (i = Number(
1129
+ m.replace("px", "")
1121
1130
  ));
1122
1131
  const _ = v.getPropertyValue(`--${n}-gutter`).trim();
1123
- _.includes("px") && (f = Number(_.replace("px", "")));
1132
+ _.includes("px") && (l = Number(_.replace("px", "")));
1124
1133
  }
1125
- return { totalStartEndGutterCssVar: i, totalGutterCssVar: f };
1134
+ return { totalStartEndGutterCssVar: i, totalGutterCssVar: l };
1126
1135
  }
1127
1136
  Z(() => {
1128
- function i(g, _) {
1129
- switch (g) {
1137
+ function i(m) {
1138
+ const _ = st();
1139
+ switch (m) {
1130
1140
  case "start":
1131
1141
  return 0;
1132
1142
  case "middle-start":
@@ -1141,67 +1151,66 @@ function Oe({
1141
1151
  return 0;
1142
1152
  }
1143
1153
  }
1144
- function f(g) {
1145
- if (x.current = Dt(), R.current = x.current / 4, S.current) {
1146
- const { totalStartEndGutterCssVar: _ } = nt();
1147
- console.log({ totalStartEndGutterCssVar: _ });
1148
- let E = 0;
1149
- e && (E = x.current * t.length), E -= x.current * i(u, s), E -= _ / 2, S.current.style.setProperty(
1154
+ function l(m) {
1155
+ if (x.current = Ct(), R.current = x.current / 4, E.current) {
1156
+ const { totalStartEndGutterCssVar: _ } = it();
1157
+ let T = 0;
1158
+ e && (T = x.current * t.length), T -= x.current * i(u), T -= _ / 2, E.current.style.setProperty(
1150
1159
  `--${n}-offset-modifier`,
1151
- `${-E}px`
1152
- ), A(!0), g && g();
1160
+ `${-T}px`
1161
+ ), O(!0), m && m();
1153
1162
  }
1154
1163
  }
1155
1164
  function v() {
1156
- f(), N({
1165
+ l(), N({
1157
1166
  type: "resize",
1158
- toIndex: l.current,
1167
+ toIndex: f.current,
1159
1168
  shouldAnimate: !1,
1160
1169
  actionType: "resize"
1161
1170
  });
1162
1171
  }
1163
1172
  if (r)
1164
- return D.current = !0, f(c), window.addEventListener("resize", v), () => {
1173
+ return D.current = !0, l(c), window.addEventListener("resize", v), () => {
1165
1174
  window.removeEventListener("resize", v);
1166
1175
  };
1167
- }, [r, e, n, a, o, u]), Z(() => {
1168
- r && b !== l.current && N({
1176
+ }, [r, e, n, a, s, u]), Z(() => {
1177
+ r && b !== f.current && N({
1169
1178
  type: "next",
1170
1179
  toIndex: b,
1171
1180
  actionType: "resize",
1172
1181
  shouldAnimate: !1
1173
1182
  });
1174
1183
  }, [r, b]);
1175
- const st = h, Ct = xe(
1184
+ const ot = h, Pt = xe(
1176
1185
  (i) => {
1177
1186
  if (!D.current)
1178
1187
  return;
1179
- const f = i.dragging, v = i.offset[a === "x" ? 0 : 1], g = i.movement[a === "x" ? 0 : 1], _ = g > R.current, E = g < -R.current, T = i.velocity;
1180
- f && (U({
1188
+ const l = i.dragging, v = i.offset[a === "x" ? 0 : 1], m = i.movement[a === "x" ? 0 : 1], _ = m > R.current, T = m < -R.current, S = i.velocity;
1189
+ l && (U({
1181
1190
  ...i,
1182
1191
  eventName: "onDrag",
1183
1192
  slideActionType: "drag"
1184
- }), G.start({
1193
+ }), Y.start({
1185
1194
  value: v,
1186
1195
  immediate: !0,
1187
1196
  config: {
1188
- velocity: T
1197
+ velocity: S
1189
1198
  }
1190
- }), p && (_ || E) && i.cancel()), i.last && (_ ? (N({
1199
+ }), p && (_ || T) && i.cancel()), i.last && (_ ? (N({
1191
1200
  actionType: "drag",
1192
1201
  type: "prev"
1193
- }), i.cancel()) : E ? (N({
1202
+ }), i.cancel()) : T ? (N({
1194
1203
  actionType: "drag",
1195
1204
  type: "next"
1196
- }), i.cancel()) : (G.start({
1197
- value: P.current,
1205
+ }), i.cancel()) : (Y.start({
1206
+ value: A.current,
1198
1207
  config: {
1199
- velocity: T
1208
+ velocity: S
1200
1209
  }
1201
1210
  }), i.cancel()));
1202
1211
  },
1203
1212
  {
1204
- enabled: st,
1213
+ enabled: ot,
1205
1214
  axis: a,
1206
1215
  rubberband: !e,
1207
1216
  ...e ? {} : {
@@ -1212,22 +1221,22 @@ function Oe({
1212
1221
  bottom: 0
1213
1222
  })
1214
1223
  },
1215
- from: () => [L.value.get(), L.value.get()]
1224
+ from: () => [V.value.get(), V.value.get()]
1216
1225
  }
1217
1226
  );
1218
- function Ot(i) {
1219
- var f, v;
1220
- return typeof i == "number" ? l.current === i : ((f = t.find((g) => g.id === i)) == null ? void 0 : f.id) === ((v = t[l.current]) == null ? void 0 : v.id);
1227
+ function $t(i) {
1228
+ var l, v;
1229
+ return typeof i == "number" ? f.current === i : ((l = t.find((m) => m.id === i)) == null ? void 0 : l.id) === ((v = t[f.current]) == null ? void 0 : v.id);
1221
1230
  }
1222
1231
  return {
1223
- carouselFragment: /* @__PURE__ */ $t(
1232
+ carouselFragment: /* @__PURE__ */ Ot(
1224
1233
  "div",
1225
1234
  {
1226
- ref: S,
1235
+ ref: E,
1227
1236
  className: "ReactSpringCarouselContainer",
1228
1237
  "data-part": "Container",
1229
1238
  "data-part-internal": `${n}-Container`,
1230
- ...Ct(),
1239
+ ...Pt(),
1231
1240
  children: [
1232
1241
  /* @__PURE__ */ X(
1233
1242
  "style",
@@ -1239,21 +1248,21 @@ function Oe({
1239
1248
  width: 100%;
1240
1249
  height: 100%;
1241
1250
  overflow: hidden;
1242
- --${n}-items-per-slide: ${s};
1251
+ --${n}-items-per-slide: 1;
1243
1252
  --${n}-offset-position: 0px;
1244
1253
  --${n}-offset-modifier: 0px;
1245
1254
  --${n}-scroll-x-value: ${a === "x" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
1246
1255
  --${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
1247
- --${n}-gutter: 0px;
1256
+ --${n}-gutter: 0px;
1248
1257
  --${n}-start-end-gutter: 0px;
1249
- touch-action: ${st ? a === "x" ? "pan-y" : "pan-x" : "auto"};
1258
+ touch-action: ${ot ? a === "x" ? "pan-y" : "pan-x" : "auto"};
1250
1259
  }
1251
1260
  [data-part-internal="${n}-Track"] {
1252
1261
  display: flex;
1253
1262
  position: relative;
1254
- --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});
1255
- left: ${e && a === "x" && !m ? "var(--initial-offset-modifier)" : "0px"};
1256
- top: ${e && a === "y" && !m ? "var(--initial-offset-modifier)" : "0px"};
1263
+ --initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${t.length} * var(--${n}-items-per-slide)) + var(--${n}-start-end-gutter)) * ${t.length} / var(--${n}-items-per-slide));
1264
+ left: ${e && a === "x" && !g ? "var(--initial-offset-modifier)" : "0px"};
1265
+ top: ${e && a === "y" && !g ? "var(--initial-offset-modifier)" : "0px"};
1257
1266
  flex-direction: ${a === "x" ? "row" : "column"};
1258
1267
  width: 100%;
1259
1268
  height: 100%;
@@ -1264,7 +1273,7 @@ function Oe({
1264
1273
  display: flex;
1265
1274
  flex: 1 0 calc(100% / var(--${n}-items-per-slide) - calc(var(--${n}-gutter) * (var(--${n}-items-per-slide) - 1)) / var(--${n}-items-per-slide) - calc(var(--${n}-start-end-gutter) / var(--${n}-items-per-slide)))
1266
1275
  }
1267
- ${o && o.length > 0 ? o.sort((i, f) => i.breakpoint - f.breakpoint).map(
1276
+ ${s && s.length > 0 ? s.sort((i, l) => i.breakpoint - l.breakpoint).map(
1268
1277
  (i) => `
1269
1278
  @media (min-width: ${i.breakpoint}px) {
1270
1279
  [data-part-internal="${n}-Container"] {
@@ -1274,6 +1283,17 @@ function Oe({
1274
1283
  }
1275
1284
  `
1276
1285
  ).join("") : ""}
1286
+ ${o && o.length > 0 ? o.sort(
1287
+ (i, l) => i.breakpoint - l.breakpoint
1288
+ ).map(
1289
+ (i) => `
1290
+ @media (min-width: ${i.breakpoint}px) {
1291
+ [data-part-internal="${n}-Container"] {
1292
+ --${n}-items-per-slide: ${i.itemsPerSlide || 1};
1293
+ }
1294
+ }
1295
+ `
1296
+ ).join("") : ""}
1277
1297
  `
1278
1298
  }
1279
1299
  }
@@ -1286,9 +1306,9 @@ function Oe({
1286
1306
  "data-part": "Track",
1287
1307
  "data-part-internal": `${n}-Track`,
1288
1308
  onScroll: () => {
1289
- C.current = !1, O.current = !1;
1309
+ C.current = !1, P.current = !1;
1290
1310
  },
1291
- children: St.map((i, f) => /* @__PURE__ */ X(
1311
+ children: Dt.map((i, l) => /* @__PURE__ */ X(
1292
1312
  "div",
1293
1313
  {
1294
1314
  className: "ReactSpringCarouselItem",
@@ -1297,12 +1317,12 @@ function Oe({
1297
1317
  "data-id": i.id,
1298
1318
  children: typeof i.renderItem == "function" ? i.renderItem({
1299
1319
  useListenToCustomEvent: rt,
1300
- index: f,
1320
+ index: l,
1301
1321
  isClonedItem: !!i.isClonedItem,
1302
- isActiveItem: Ot
1322
+ isActiveItem: $t
1303
1323
  }) : i.renderItem
1304
1324
  },
1305
- `${i.id}-${f}`
1325
+ `${i.id}-${l}`
1306
1326
  ))
1307
1327
  }
1308
1328
  )
@@ -1312,6 +1332,8 @@ function Oe({
1312
1332
  useListenToCustomEvent: rt,
1313
1333
  slideToNextItem: () => F(),
1314
1334
  slideToPrevItem: () => W(),
1335
+ getGutter: nt,
1336
+ getItemsPerSlide: st,
1315
1337
  slideToItem: (i) => {
1316
1338
  if (typeof i == "number") {
1317
1339
  if (!t[i]) {
@@ -1320,21 +1342,21 @@ function Oe({
1320
1342
  );
1321
1343
  return;
1322
1344
  }
1323
- i > l.current ? F(i) : W(i);
1345
+ i > f.current ? F(i) : W(i);
1324
1346
  }
1325
1347
  if (typeof i == "string") {
1326
- const f = t.findIndex((v) => v.id === i);
1327
- if (f < 0) {
1348
+ const l = t.findIndex((v) => v.id === i);
1349
+ if (l < 0) {
1328
1350
  console.warn(
1329
1351
  `The item you're trying to slide doesn't exist. id: ${i}`
1330
1352
  );
1331
1353
  return;
1332
1354
  }
1333
- f > l.current ? F(f) : W(f);
1355
+ l > f.current ? F(l) : W(l);
1334
1356
  }
1335
1357
  }
1336
1358
  };
1337
1359
  }
1338
1360
  export {
1339
- Oe as useSpringCarousel
1361
+ $e as useSpringCarousel
1340
1362
  };