react-spring-carousel 3.0.0-beta-2.0.93 → 3.0.0-beta-2.0.95

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,80 +1,80 @@
1
- import { jsxs as Mt, jsx as J } from "react/jsx-runtime";
2
- import { useSpring as Tt } from "@react-spring/web";
3
- import Q, { useRef as $, useEffect as R, useState as Vt } from "react";
4
- function Rt(e, t, r) {
5
- return Math.max(t, Math.min(e, r));
1
+ import { jsxs as Me, jsx as Q } from "react/jsx-runtime";
2
+ import { useSpringRef as Ve, useSpring as xe } from "@react-spring/web";
3
+ import Z, { useRef as $, useEffect as B, useState as Re } from "react";
4
+ function je(t, e, r) {
5
+ return Math.max(e, Math.min(t, r));
6
6
  }
7
7
  const b = {
8
- toVector(e, t) {
9
- return e === void 0 && (e = t), Array.isArray(e) ? e : [e, e];
8
+ toVector(t, e) {
9
+ return t === void 0 && (t = e), Array.isArray(t) ? t : [t, t];
10
10
  },
11
- add(e, t) {
12
- return [e[0] + t[0], e[1] + t[1]];
11
+ add(t, e) {
12
+ return [t[0] + e[0], t[1] + e[1]];
13
13
  },
14
- sub(e, t) {
15
- return [e[0] - t[0], e[1] - t[1]];
14
+ sub(t, e) {
15
+ return [t[0] - e[0], t[1] - e[1]];
16
16
  },
17
- addTo(e, t) {
18
- e[0] += t[0], e[1] += t[1];
17
+ addTo(t, e) {
18
+ t[0] += e[0], t[1] += e[1];
19
19
  },
20
- subTo(e, t) {
21
- e[0] -= t[0], e[1] -= t[1];
20
+ subTo(t, e) {
21
+ t[0] -= e[0], t[1] -= e[1];
22
22
  }
23
23
  };
24
- function ft(e, t, r) {
25
- return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(e, r * 5) : e * t * r / (t + r * e);
24
+ function fe(t, e, r) {
25
+ return e === 0 || Math.abs(e) === 1 / 0 ? Math.pow(t, r * 5) : t * e * r / (e + r * t);
26
26
  }
27
- function dt(e, t, r, n = 0.15) {
28
- return n === 0 ? Rt(e, t, r) : e < t ? -ft(t - e, r - t, n) + t : e > r ? +ft(e - r, r - t, n) + r : e;
27
+ function de(t, e, r, n = 0.15) {
28
+ return n === 0 ? je(t, e, r) : t < e ? -fe(e - t, r - e, n) + e : t > r ? +fe(t - r, r - e, n) + r : t;
29
29
  }
30
- function jt(e, [t, r], [n, s]) {
31
- const [[o, a], [c, l]] = e;
32
- return [dt(t, o, a, n), dt(r, c, l, s)];
30
+ function Be(t, [e, r], [n, s]) {
31
+ const [[o, a], [c, l]] = t;
32
+ return [de(e, o, a, n), de(r, c, l, s)];
33
33
  }
34
- function Bt(e, t) {
35
- if (typeof e != "object" || e === null) return e;
36
- var r = e[Symbol.toPrimitive];
34
+ function Ue(t, e) {
35
+ if (typeof t != "object" || t === null) return t;
36
+ var r = t[Symbol.toPrimitive];
37
37
  if (r !== void 0) {
38
- var n = r.call(e, t);
38
+ var n = r.call(t, e);
39
39
  if (typeof n != "object") return n;
40
40
  throw new TypeError("@@toPrimitive must return a primitive value.");
41
41
  }
42
- return (t === "string" ? String : Number)(e);
42
+ return (e === "string" ? String : Number)(t);
43
43
  }
44
- function Ut(e) {
45
- var t = Bt(e, "string");
46
- return typeof t == "symbol" ? t : String(t);
44
+ function Ke(t) {
45
+ var e = Ue(t, "string");
46
+ return typeof e == "symbol" ? e : String(e);
47
47
  }
48
- function S(e, t, r) {
49
- return t = Ut(t), t in e ? Object.defineProperty(e, t, {
48
+ function S(t, e, r) {
49
+ return e = Ke(e), e in t ? Object.defineProperty(t, e, {
50
50
  value: r,
51
51
  enumerable: !0,
52
52
  configurable: !0,
53
53
  writable: !0
54
- }) : e[t] = r, e;
54
+ }) : t[e] = r, t;
55
55
  }
56
- function ht(e, t) {
57
- var r = Object.keys(e);
56
+ function he(t, e) {
57
+ var r = Object.keys(t);
58
58
  if (Object.getOwnPropertySymbols) {
59
- var n = Object.getOwnPropertySymbols(e);
60
- t && (n = n.filter(function(s) {
61
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
59
+ var n = Object.getOwnPropertySymbols(t);
60
+ e && (n = n.filter(function(s) {
61
+ return Object.getOwnPropertyDescriptor(t, s).enumerable;
62
62
  })), r.push.apply(r, n);
63
63
  }
64
64
  return r;
65
65
  }
66
- function p(e) {
67
- for (var t = 1; t < arguments.length; t++) {
68
- var r = arguments[t] != null ? arguments[t] : {};
69
- t % 2 ? ht(Object(r), !0).forEach(function(n) {
70
- S(e, n, r[n]);
71
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ht(Object(r)).forEach(function(n) {
72
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
66
+ function p(t) {
67
+ for (var e = 1; e < arguments.length; e++) {
68
+ var r = arguments[e] != null ? arguments[e] : {};
69
+ e % 2 ? he(Object(r), !0).forEach(function(n) {
70
+ S(t, n, r[n]);
71
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : he(Object(r)).forEach(function(n) {
72
+ Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(r, n));
73
73
  });
74
74
  }
75
- return e;
75
+ return t;
76
76
  }
77
- const St = {
77
+ const Te = {
78
78
  pointer: {
79
79
  start: "down",
80
80
  change: "move",
@@ -96,106 +96,106 @@ const St = {
96
96
  end: "end"
97
97
  }
98
98
  };
99
- function pt(e) {
100
- return e ? e[0].toUpperCase() + e.slice(1) : "";
99
+ function pe(t) {
100
+ return t ? t[0].toUpperCase() + t.slice(1) : "";
101
101
  }
102
- const Kt = ["enter", "leave"];
103
- function Gt(e = !1, t) {
104
- return e && !Kt.includes(t);
102
+ const Ge = ["enter", "leave"];
103
+ function ze(t = !1, e) {
104
+ return t && !Ge.includes(e);
105
105
  }
106
- function zt(e, t = "", r = !1) {
107
- const n = St[e], s = n && n[t] || t;
108
- return "on" + pt(e) + pt(s) + (Gt(r, s) ? "Capture" : "");
106
+ function We(t, e = "", r = !1) {
107
+ const n = Te[t], s = n && n[e] || e;
108
+ return "on" + pe(t) + pe(s) + (ze(r, s) ? "Capture" : "");
109
109
  }
110
- const Wt = ["gotpointercapture", "lostpointercapture"];
111
- function Yt(e) {
112
- let t = e.substring(2).toLowerCase();
113
- const r = !!~t.indexOf("passive");
114
- r && (t = t.replace("passive", ""));
115
- const n = Wt.includes(t) ? "capturecapture" : "capture", s = !!~t.indexOf(n);
116
- return s && (t = t.replace("capture", "")), {
117
- device: t,
110
+ const Ye = ["gotpointercapture", "lostpointercapture"];
111
+ function Fe(t) {
112
+ let e = t.substring(2).toLowerCase();
113
+ const r = !!~e.indexOf("passive");
114
+ r && (e = e.replace("passive", ""));
115
+ const n = Ye.includes(e) ? "capturecapture" : "capture", s = !!~e.indexOf(n);
116
+ return s && (e = e.replace("capture", "")), {
117
+ device: e,
118
118
  capture: s,
119
119
  passive: r
120
120
  };
121
121
  }
122
- function Ft(e, t = "") {
123
- const r = St[e], n = r && r[t] || t;
124
- return e + n;
122
+ function He(t, e = "") {
123
+ const r = Te[t], n = r && r[e] || e;
124
+ return t + n;
125
125
  }
126
- function W(e) {
127
- return "touches" in e;
126
+ function F(t) {
127
+ return "touches" in t;
128
128
  }
129
- function xt(e) {
130
- return W(e) ? "touch" : "pointerType" in e ? e.pointerType : "mouse";
129
+ function Se(t) {
130
+ return F(t) ? "touch" : "pointerType" in t ? t.pointerType : "mouse";
131
131
  }
132
- function Ht(e) {
133
- return Array.from(e.touches).filter((t) => {
132
+ function Xe(t) {
133
+ return Array.from(t.touches).filter((e) => {
134
134
  var r, n;
135
- return t.target === e.currentTarget || ((r = e.currentTarget) === null || r === void 0 || (n = r.contains) === null || n === void 0 ? void 0 : n.call(r, t.target));
135
+ return e.target === t.currentTarget || ((r = t.currentTarget) === null || r === void 0 || (n = r.contains) === null || n === void 0 ? void 0 : n.call(r, e.target));
136
136
  });
137
137
  }
138
- function Xt(e) {
139
- return e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches : e.targetTouches;
138
+ function qe(t) {
139
+ return t.type === "touchend" || t.type === "touchcancel" ? t.changedTouches : t.targetTouches;
140
140
  }
141
- function It(e) {
142
- return W(e) ? Xt(e)[0] : e;
141
+ function Ie(t) {
142
+ return F(t) ? qe(t)[0] : t;
143
143
  }
144
- function qt(e) {
145
- return Ht(e).map((t) => t.identifier);
144
+ function Je(t) {
145
+ return Xe(t).map((e) => e.identifier);
146
146
  }
147
- function Z(e) {
148
- const t = It(e);
149
- return W(e) ? t.identifier : t.pointerId;
147
+ function ee(t) {
148
+ const e = Ie(t);
149
+ return F(t) ? e.identifier : e.pointerId;
150
150
  }
151
- function mt(e) {
152
- const t = It(e);
153
- return [t.clientX, t.clientY];
151
+ function me(t) {
152
+ const e = Ie(t);
153
+ return [e.clientX, e.clientY];
154
154
  }
155
- function Jt(e) {
156
- const t = {};
157
- if ("buttons" in e && (t.buttons = e.buttons), "shiftKey" in e) {
155
+ function Qe(t) {
156
+ const e = {};
157
+ if ("buttons" in t && (e.buttons = t.buttons), "shiftKey" in t) {
158
158
  const {
159
159
  shiftKey: r,
160
160
  altKey: n,
161
161
  metaKey: s,
162
162
  ctrlKey: o
163
- } = e;
164
- Object.assign(t, {
163
+ } = t;
164
+ Object.assign(e, {
165
165
  shiftKey: r,
166
166
  altKey: n,
167
167
  metaKey: s,
168
168
  ctrlKey: o
169
169
  });
170
170
  }
171
- return t;
171
+ return e;
172
172
  }
173
- function z(e, ...t) {
174
- return typeof e == "function" ? e(...t) : e;
173
+ function Y(t, ...e) {
174
+ return typeof t == "function" ? t(...e) : t;
175
175
  }
176
- function Qt() {
176
+ function Ze() {
177
177
  }
178
- function Zt(...e) {
179
- return e.length === 0 ? Qt : e.length === 1 ? e[0] : function() {
180
- let t;
181
- for (const r of e)
182
- t = r.apply(this, arguments) || t;
183
- return t;
178
+ function et(...t) {
179
+ return t.length === 0 ? Ze : t.length === 1 ? t[0] : function() {
180
+ let e;
181
+ for (const r of t)
182
+ e = r.apply(this, arguments) || e;
183
+ return e;
184
184
  };
185
185
  }
186
- function gt(e, t) {
187
- return Object.assign({}, t, e || {});
186
+ function ge(t, e) {
187
+ return Object.assign({}, e, t || {});
188
188
  }
189
- const te = 32;
190
- class ee {
191
- constructor(t, r, n) {
192
- this.ctrl = t, this.args = r, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
189
+ const tt = 32;
190
+ class rt {
191
+ constructor(e, r, n) {
192
+ this.ctrl = e, this.args = r, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
193
193
  }
194
194
  get state() {
195
195
  return this.ctrl.state[this.key];
196
196
  }
197
- set state(t) {
198
- this.ctrl.state[this.key] = t;
197
+ set state(e) {
198
+ this.ctrl.state[this.key] = e;
199
199
  }
200
200
  get shared() {
201
201
  return this.ctrl.state.shared;
@@ -217,26 +217,26 @@ class ee {
217
217
  }
218
218
  reset() {
219
219
  const {
220
- state: t,
220
+ state: e,
221
221
  shared: r,
222
222
  ingKey: n,
223
223
  args: s
224
224
  } = this;
225
- r[n] = t._active = t.active = t._blocked = t._force = !1, t._step = [!1, !1], t.intentional = !1, t._movement = [0, 0], t._distance = [0, 0], t._direction = [0, 0], t._delta = [0, 0], t._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], t.args = s, t.axis = void 0, t.memo = void 0, t.elapsedTime = t.timeDelta = 0, t.direction = [0, 0], t.distance = [0, 0], t.overflow = [0, 0], t._movementBound = [!1, !1], t.velocity = [0, 0], t.movement = [0, 0], t.delta = [0, 0], t.timeStamp = 0;
225
+ r[n] = e._active = e.active = e._blocked = e._force = !1, e._step = [!1, !1], e.intentional = !1, e._movement = [0, 0], e._distance = [0, 0], e._direction = [0, 0], e._delta = [0, 0], e._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], e.args = s, e.axis = void 0, e.memo = void 0, e.elapsedTime = e.timeDelta = 0, e.direction = [0, 0], e.distance = [0, 0], e.overflow = [0, 0], e._movementBound = [!1, !1], e.velocity = [0, 0], e.movement = [0, 0], e.delta = [0, 0], e.timeStamp = 0;
226
226
  }
227
- start(t) {
227
+ start(e) {
228
228
  const r = this.state, n = this.config;
229
- r._active || (this.reset(), this.computeInitial(), r._active = !0, r.target = t.target, r.currentTarget = t.currentTarget, r.lastOffset = n.from ? z(n.from, r) : r.offset, r.offset = r.lastOffset, r.startTime = r.timeStamp = t.timeStamp);
229
+ r._active || (this.reset(), this.computeInitial(), r._active = !0, r.target = e.target, r.currentTarget = e.currentTarget, r.lastOffset = n.from ? Y(n.from, r) : r.offset, r.offset = r.lastOffset, r.startTime = r.timeStamp = e.timeStamp);
230
230
  }
231
- computeValues(t) {
231
+ computeValues(e) {
232
232
  const r = this.state;
233
- r._values = t, r.values = this.config.transform(t);
233
+ r._values = e, r.values = this.config.transform(e);
234
234
  }
235
235
  computeInitial() {
236
- const t = this.state;
237
- t._initial = t._values, t.initial = t.values;
236
+ const e = this.state;
237
+ e._initial = e._values, e.initial = e.values;
238
238
  }
239
- compute(t) {
239
+ compute(e) {
240
240
  const {
241
241
  state: r,
242
242
  config: n,
@@ -244,11 +244,11 @@ class ee {
244
244
  } = this;
245
245
  r.args = this.args;
246
246
  let o = 0;
247
- if (t && (r.event = t, n.preventDefault && t.cancelable && r.event.preventDefault(), r.type = t.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, Jt(t)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = t.timeStamp - r.timeStamp, r.timeStamp = t.timeStamp, r.elapsedTime = r.timeStamp - r.startTime), r._active) {
247
+ if (e && (r.event = e, n.preventDefault && e.cancelable && r.event.preventDefault(), r.type = e.type, s.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, s.locked = !!document.pointerLockElement, Object.assign(s, Qe(e)), s.down = s.pressed = s.buttons % 2 === 1 || s.touches > 0, o = e.timeStamp - r.timeStamp, r.timeStamp = e.timeStamp, r.elapsedTime = r.timeStamp - r.startTime), r._active) {
248
248
  const A = r._delta.map(Math.abs);
249
249
  b.addTo(r._distance, A);
250
250
  }
251
- this.axisIntent && this.axisIntent(t);
251
+ this.axisIntent && this.axisIntent(e);
252
252
  const [a, c] = r._movement, [l, d] = n.threshold, {
253
253
  _step: u,
254
254
  values: _
@@ -261,39 +261,39 @@ class ee {
261
261
  } else
262
262
  m[0] = u[0] !== !1 ? a - u[0] : 0, m[1] = u[1] !== !1 ? c - u[1] : 0;
263
263
  this.restrictToAxis && !r._blocked && this.restrictToAxis(m);
264
- const x = r.offset, C = r._active && !r._blocked || r.active;
265
- C && (r.first = r._active && !r.active, r.last = !r._active && r.active, r.active = s[this.ingKey] = r._active, t && (r.first && ("bounds" in n && (r._bounds = z(n.bounds, r)), this.setup && this.setup()), r.movement = m, this.computeOffset()));
266
- const [O, w] = r.offset, [[D, L], [g, I]] = r._bounds;
267
- r.overflow = [O < D ? -1 : O > L ? 1 : 0, w < g ? -1 : w > I ? 1 : 0], r._movementBound[0] = r.overflow[0] ? r._movementBound[0] === !1 ? r._movement[0] : r._movementBound[0] : !1, r._movementBound[1] = r.overflow[1] ? r._movementBound[1] === !1 ? r._movement[1] : r._movementBound[1] : !1;
264
+ const I = r.offset, D = r._active && !r._blocked || r.active;
265
+ D && (r.first = r._active && !r.active, r.last = !r._active && r.active, r.active = s[this.ingKey] = r._active, e && (r.first && ("bounds" in n && (r._bounds = Y(n.bounds, r)), this.setup && this.setup()), r.movement = m, this.computeOffset()));
266
+ const [O, w] = r.offset, [[E, L], [g, k]] = r._bounds;
267
+ r.overflow = [O < E ? -1 : O > L ? 1 : 0, w < g ? -1 : w > k ? 1 : 0], r._movementBound[0] = r.overflow[0] ? r._movementBound[0] === !1 ? r._movement[0] : r._movementBound[0] : !1, r._movementBound[1] = r.overflow[1] ? r._movementBound[1] === !1 ? r._movement[1] : r._movementBound[1] : !1;
268
268
  const N = r._active ? n.rubberband || [0, 0] : [0, 0];
269
- if (r.offset = jt(r._bounds, r.offset, N), r.delta = b.sub(r.offset, x), this.computeMovement(), C && (!r.last || o > te)) {
270
- r.delta = b.sub(r.offset, x);
269
+ if (r.offset = Be(r._bounds, r.offset, N), r.delta = b.sub(r.offset, I), this.computeMovement(), D && (!r.last || o > tt)) {
270
+ r.delta = b.sub(r.offset, I);
271
271
  const A = r.delta.map(Math.abs);
272
272
  b.addTo(r.distance, A), r.direction = r.delta.map(Math.sign), r._direction = r._delta.map(Math.sign), !r.first && o > 0 && (r.velocity = [A[0] / o, A[1] / o], r.timeDelta = o);
273
273
  }
274
274
  }
275
275
  emit() {
276
- const t = this.state, r = this.shared, n = this.config;
277
- if (t._active || this.clean(), (t._blocked || !t.intentional) && !t._force && !n.triggerAllEvents) return;
278
- const s = this.handler(p(p(p({}, r), t), {}, {
279
- [this.aliasKey]: t.values
276
+ const e = this.state, r = this.shared, n = this.config;
277
+ if (e._active || this.clean(), (e._blocked || !e.intentional) && !e._force && !n.triggerAllEvents) return;
278
+ const s = this.handler(p(p(p({}, r), e), {}, {
279
+ [this.aliasKey]: e.values
280
280
  }));
281
- s !== void 0 && (t.memo = s);
281
+ s !== void 0 && (e.memo = s);
282
282
  }
283
283
  clean() {
284
284
  this.eventStore.clean(), this.timeoutStore.clean();
285
285
  }
286
286
  }
287
- function re([e, t], r) {
288
- const n = Math.abs(e), s = Math.abs(t);
287
+ function nt([t, e], r) {
288
+ const n = Math.abs(t), s = Math.abs(e);
289
289
  if (n > s && n > r)
290
290
  return "x";
291
291
  if (s > n && s > r)
292
292
  return "y";
293
293
  }
294
- class ne extends ee {
295
- constructor(...t) {
296
- super(...t), S(this, "aliasKey", "xy");
294
+ class st extends rt {
295
+ constructor(...e) {
296
+ super(...e), S(this, "aliasKey", "xy");
297
297
  }
298
298
  reset() {
299
299
  super.reset(), this.state.axis = void 0;
@@ -307,139 +307,139 @@ class ne extends ee {
307
307
  computeMovement() {
308
308
  this.state.movement = b.sub(this.state.offset, this.state.lastOffset);
309
309
  }
310
- axisIntent(t) {
310
+ axisIntent(e) {
311
311
  const r = this.state, n = this.config;
312
- if (!r.axis && t) {
313
- const s = typeof n.axisThreshold == "object" ? n.axisThreshold[xt(t)] : n.axisThreshold;
314
- r.axis = re(r._movement, s);
312
+ if (!r.axis && e) {
313
+ const s = typeof n.axisThreshold == "object" ? n.axisThreshold[Se(e)] : n.axisThreshold;
314
+ r.axis = nt(r._movement, s);
315
315
  }
316
316
  r._blocked = (n.lockDirection || !!n.axis) && !r.axis || !!n.axis && n.axis !== r.axis;
317
317
  }
318
- restrictToAxis(t) {
318
+ restrictToAxis(e) {
319
319
  if (this.config.axis || this.config.lockDirection)
320
320
  switch (this.state.axis) {
321
321
  case "x":
322
- t[1] = 0;
322
+ e[1] = 0;
323
323
  break;
324
324
  case "y":
325
- t[0] = 0;
325
+ e[0] = 0;
326
326
  break;
327
327
  }
328
328
  }
329
329
  }
330
- const vt = (e) => e, yt = 0.15, nt = {
331
- enabled(e = !0) {
332
- return e;
330
+ const ve = (t) => t, ye = 0.15, se = {
331
+ enabled(t = !0) {
332
+ return t;
333
333
  },
334
- eventOptions(e, t, r) {
335
- return p(p({}, r.shared.eventOptions), e);
334
+ eventOptions(t, e, r) {
335
+ return p(p({}, r.shared.eventOptions), t);
336
336
  },
337
- preventDefault(e = !1) {
338
- return e;
337
+ preventDefault(t = !1) {
338
+ return t;
339
339
  },
340
- triggerAllEvents(e = !1) {
341
- return e;
340
+ triggerAllEvents(t = !1) {
341
+ return t;
342
342
  },
343
- rubberband(e = 0) {
344
- switch (e) {
343
+ rubberband(t = 0) {
344
+ switch (t) {
345
345
  case !0:
346
- return [yt, yt];
346
+ return [ye, ye];
347
347
  case !1:
348
348
  return [0, 0];
349
349
  default:
350
- return b.toVector(e);
350
+ return b.toVector(t);
351
351
  }
352
352
  },
353
- from(e) {
354
- if (typeof e == "function") return e;
355
- if (e != null) return b.toVector(e);
353
+ from(t) {
354
+ if (typeof t == "function") return t;
355
+ if (t != null) return b.toVector(t);
356
356
  },
357
- transform(e, t, r) {
358
- const n = e || r.shared.transform;
357
+ transform(t, e, r) {
358
+ const n = t || r.shared.transform;
359
359
  if (this.hasCustomTransform = !!n, process.env.NODE_ENV === "development") {
360
- const s = n || vt;
360
+ const s = n || ve;
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 || vt;
366
+ return n || ve;
367
367
  },
368
- threshold(e) {
369
- return b.toVector(e, 0);
368
+ threshold(t) {
369
+ return b.toVector(t, 0);
370
370
  }
371
371
  };
372
- process.env.NODE_ENV === "development" && Object.assign(nt, {
373
- domTarget(e) {
374
- if (e !== void 0)
372
+ process.env.NODE_ENV === "development" && Object.assign(se, {
373
+ domTarget(t) {
374
+ if (t !== void 0)
375
375
  throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
376
376
  return NaN;
377
377
  },
378
- lockDirection(e) {
379
- if (e !== void 0)
378
+ lockDirection(t) {
379
+ if (t !== void 0)
380
380
  throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
381
381
  return NaN;
382
382
  },
383
- initial(e) {
384
- if (e !== void 0)
383
+ initial(t) {
384
+ if (t !== void 0)
385
385
  throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
386
386
  return NaN;
387
387
  }
388
388
  });
389
- const se = 0, j = p(p({}, nt), {}, {
390
- axis(e, t, {
389
+ const it = 0, U = p(p({}, se), {}, {
390
+ axis(t, e, {
391
391
  axis: r
392
392
  }) {
393
393
  if (this.lockDirection = r === "lock", !this.lockDirection) return r;
394
394
  },
395
- axisThreshold(e = se) {
396
- return e;
395
+ axisThreshold(t = it) {
396
+ return t;
397
397
  },
398
- bounds(e = {}) {
399
- if (typeof e == "function")
400
- return (o) => j.bounds(e(o));
401
- if ("current" in e)
402
- return () => e.current;
403
- if (typeof HTMLElement == "function" && e instanceof HTMLElement)
404
- return e;
398
+ bounds(t = {}) {
399
+ if (typeof t == "function")
400
+ return (o) => U.bounds(t(o));
401
+ if ("current" in t)
402
+ return () => t.current;
403
+ if (typeof HTMLElement == "function" && t instanceof HTMLElement)
404
+ return t;
405
405
  const {
406
- left: t = -1 / 0,
406
+ left: e = -1 / 0,
407
407
  right: r = 1 / 0,
408
408
  top: n = -1 / 0,
409
409
  bottom: s = 1 / 0
410
- } = e;
411
- return [[t, r], [n, s]];
412
- }
413
- }), bt = {
414
- ArrowRight: (e, t = 1) => [e * t, 0],
415
- ArrowLeft: (e, t = 1) => [-1 * e * t, 0],
416
- ArrowUp: (e, t = 1) => [0, -1 * e * t],
417
- ArrowDown: (e, t = 1) => [0, e * t]
410
+ } = t;
411
+ return [[e, r], [n, s]];
412
+ }
413
+ }), be = {
414
+ ArrowRight: (t, e = 1) => [t * e, 0],
415
+ ArrowLeft: (t, e = 1) => [-1 * t * e, 0],
416
+ ArrowUp: (t, e = 1) => [0, -1 * t * e],
417
+ ArrowDown: (t, e = 1) => [0, t * e]
418
418
  };
419
- class ie extends ne {
420
- constructor(...t) {
421
- super(...t), S(this, "ingKey", "dragging");
419
+ class ot extends st {
420
+ constructor(...e) {
421
+ super(...e), S(this, "ingKey", "dragging");
422
422
  }
423
423
  reset() {
424
424
  super.reset();
425
- const t = this.state;
426
- t._pointerId = void 0, t._pointerActive = !1, t._keyboardActive = !1, t._preventScroll = !1, t._delayed = !1, t.swipe = [0, 0], t.tap = !1, t.canceled = !1, t.cancel = this.cancel.bind(this);
425
+ const e = this.state;
426
+ e._pointerId = void 0, e._pointerActive = !1, e._keyboardActive = !1, e._preventScroll = !1, e._delayed = !1, e.swipe = [0, 0], e.tap = !1, e.canceled = !1, e.cancel = this.cancel.bind(this);
427
427
  }
428
428
  setup() {
429
- const t = this.state;
430
- if (t._bounds instanceof HTMLElement) {
431
- const r = t._bounds.getBoundingClientRect(), n = t.currentTarget.getBoundingClientRect(), s = {
432
- left: r.left - n.left + t.offset[0],
433
- right: r.right - n.right + t.offset[0],
434
- top: r.top - n.top + t.offset[1],
435
- bottom: r.bottom - n.bottom + t.offset[1]
429
+ const e = this.state;
430
+ if (e._bounds instanceof HTMLElement) {
431
+ const r = e._bounds.getBoundingClientRect(), n = e.currentTarget.getBoundingClientRect(), s = {
432
+ left: r.left - n.left + e.offset[0],
433
+ right: r.right - n.right + e.offset[0],
434
+ top: r.top - n.top + e.offset[1],
435
+ bottom: r.bottom - n.bottom + e.offset[1]
436
436
  };
437
- t._bounds = j.bounds(s);
437
+ e._bounds = U.bounds(s);
438
438
  }
439
439
  }
440
440
  cancel() {
441
- const t = this.state;
442
- t.canceled || (t.canceled = !0, t._active = !1, setTimeout(() => {
441
+ const e = this.state;
442
+ e.canceled || (e.canceled = !0, e._active = !1, setTimeout(() => {
443
443
  this.compute(), this.emit();
444
444
  }, 0));
445
445
  }
@@ -449,24 +449,24 @@ class ie extends ne {
449
449
  clean() {
450
450
  this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean();
451
451
  }
452
- pointerDown(t) {
452
+ pointerDown(e) {
453
453
  const r = this.config, n = this.state;
454
- if (t.buttons != null && (Array.isArray(r.pointerButtons) ? !r.pointerButtons.includes(t.buttons) : r.pointerButtons !== -1 && r.pointerButtons !== t.buttons)) return;
455
- const s = this.ctrl.setEventIds(t);
456
- r.pointerCapture && t.target.setPointerCapture(t.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(t), this.setupPointer(t), n._pointerId = Z(t), n._pointerActive = !0, this.computeValues(mt(t)), this.computeInitial(), r.preventScrollAxis && xt(t) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(t)) : r.delay > 0 ? (this.setupDelayTrigger(t), r.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
454
+ if (e.buttons != null && (Array.isArray(r.pointerButtons) ? !r.pointerButtons.includes(e.buttons) : r.pointerButtons !== -1 && r.pointerButtons !== e.buttons)) return;
455
+ const s = this.ctrl.setEventIds(e);
456
+ r.pointerCapture && e.target.setPointerCapture(e.pointerId), !(s && s.size > 1 && n._pointerActive) && (this.start(e), this.setupPointer(e), n._pointerId = ee(e), n._pointerActive = !0, this.computeValues(me(e)), this.computeInitial(), r.preventScrollAxis && Se(e) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(e)) : r.delay > 0 ? (this.setupDelayTrigger(e), r.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e));
457
457
  }
458
- startPointerDrag(t) {
458
+ startPointerDrag(e) {
459
459
  const r = this.state;
460
- r._active = !0, r._preventScroll = !0, r._delayed = !1, this.compute(t), this.emit();
460
+ r._active = !0, r._preventScroll = !0, r._delayed = !1, this.compute(e), this.emit();
461
461
  }
462
- pointerMove(t) {
462
+ pointerMove(e) {
463
463
  const r = this.state, n = this.config;
464
464
  if (!r._pointerActive) return;
465
- const s = Z(t);
465
+ const s = ee(e);
466
466
  if (r._pointerId !== void 0 && s !== r._pointerId) return;
467
- const o = mt(t);
468
- if (document.pointerLockElement === t.target ? r._delta = [t.movementX, t.movementY] : (r._delta = b.sub(o, r._values), this.computeValues(o)), b.addTo(r._movement, r._delta), this.compute(t), r._delayed && r.intentional) {
469
- this.timeoutStore.remove("dragDelay"), r.active = !1, this.startPointerDrag(t);
467
+ const o = me(e);
468
+ if (document.pointerLockElement === e.target ? r._delta = [e.movementX, e.movementY] : (r._delta = b.sub(o, r._values), this.computeValues(o)), b.addTo(r._movement, r._delta), this.compute(e), r._delayed && r.intentional) {
469
+ this.timeoutStore.remove("dragDelay"), r.active = !1, this.startPointerDrag(e);
470
470
  return;
471
471
  }
472
472
  if (n.preventScrollAxis && !r._preventScroll)
@@ -475,105 +475,105 @@ class ie extends ne {
475
475
  r._active = !1, this.clean();
476
476
  return;
477
477
  } else {
478
- this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(t);
478
+ this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(e);
479
479
  return;
480
480
  }
481
481
  else
482
482
  return;
483
483
  this.emit();
484
484
  }
485
- pointerUp(t) {
486
- this.ctrl.setEventIds(t);
485
+ pointerUp(e) {
486
+ this.ctrl.setEventIds(e);
487
487
  try {
488
- this.config.pointerCapture && t.target.hasPointerCapture(t.pointerId) && t.target.releasePointerCapture(t.pointerId);
488
+ this.config.pointerCapture && e.target.hasPointerCapture(e.pointerId) && e.target.releasePointerCapture(e.pointerId);
489
489
  } catch {
490
490
  process.env.NODE_ENV === "development" && console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.");
491
491
  }
492
492
  const r = this.state, n = this.config;
493
493
  if (!r._active || !r._pointerActive) return;
494
- const s = Z(t);
494
+ const s = ee(e);
495
495
  if (r._pointerId !== void 0 && s !== r._pointerId) return;
496
- this.state._pointerActive = !1, this.setActive(), this.compute(t);
496
+ this.state._pointerActive = !1, this.setActive(), this.compute(e);
497
497
  const [o, a] = r._distance;
498
498
  if (r.tap = o <= n.tapsThreshold && a <= n.tapsThreshold, r.tap && n.filterTaps)
499
499
  r._force = !0;
500
500
  else {
501
- const [c, l] = r._delta, [d, u] = r._movement, [_, m] = n.swipe.velocity, [x, C] = n.swipe.distance, O = n.swipe.duration;
501
+ const [c, l] = r._delta, [d, u] = r._movement, [_, m] = n.swipe.velocity, [I, D] = n.swipe.distance, O = n.swipe.duration;
502
502
  if (r.elapsedTime < O) {
503
- const w = Math.abs(c / r.timeDelta), D = Math.abs(l / r.timeDelta);
504
- w > _ && Math.abs(d) > x && (r.swipe[0] = Math.sign(c)), D > m && Math.abs(u) > C && (r.swipe[1] = Math.sign(l));
503
+ const w = Math.abs(c / r.timeDelta), E = Math.abs(l / r.timeDelta);
504
+ w > _ && Math.abs(d) > I && (r.swipe[0] = Math.sign(c)), E > m && Math.abs(u) > D && (r.swipe[1] = Math.sign(l));
505
505
  }
506
506
  }
507
507
  this.emit();
508
508
  }
509
- pointerClick(t) {
510
- !this.state.tap && t.detail > 0 && (t.preventDefault(), t.stopPropagation());
509
+ pointerClick(e) {
510
+ !this.state.tap && e.detail > 0 && (e.preventDefault(), e.stopPropagation());
511
511
  }
512
- setupPointer(t) {
512
+ setupPointer(e) {
513
513
  const r = this.config, n = r.device;
514
514
  if (process.env.NODE_ENV === "development")
515
515
  try {
516
516
  if (n === "pointer" && r.preventScrollDelay === void 0) {
517
- const s = "uv" in t ? t.sourceEvent.currentTarget : t.currentTarget;
517
+ const s = "uv" in e ? e.sourceEvent.currentTarget : e.currentTarget;
518
518
  window.getComputedStyle(s).touchAction === "auto" && console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.", s);
519
519
  }
520
520
  } catch {
521
521
  }
522
- r.pointerLock && t.currentTarget.requestPointerLock(), r.pointerCapture || (this.eventStore.add(this.sharedConfig.window, n, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "cancel", this.pointerUp.bind(this)));
522
+ r.pointerLock && e.currentTarget.requestPointerLock(), r.pointerCapture || (this.eventStore.add(this.sharedConfig.window, n, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "cancel", this.pointerUp.bind(this)));
523
523
  }
524
524
  pointerClean() {
525
525
  this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock();
526
526
  }
527
- preventScroll(t) {
528
- this.state._preventScroll && t.cancelable && t.preventDefault();
527
+ preventScroll(e) {
528
+ this.state._preventScroll && e.cancelable && e.preventDefault();
529
529
  }
530
- setupScrollPrevention(t) {
531
- this.state._preventScroll = !1, oe(t);
530
+ setupScrollPrevention(e) {
531
+ this.state._preventScroll = !1, at(e);
532
532
  const r = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
533
533
  passive: !1
534
534
  });
535
- this.eventStore.add(this.sharedConfig.window, "touch", "end", r), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", r), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, t);
535
+ this.eventStore.add(this.sharedConfig.window, "touch", "end", r), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", r), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, e);
536
536
  }
537
- setupDelayTrigger(t) {
537
+ setupDelayTrigger(e) {
538
538
  this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
539
- this.state._step = [0, 0], this.startPointerDrag(t);
539
+ this.state._step = [0, 0], this.startPointerDrag(e);
540
540
  }, this.config.delay);
541
541
  }
542
- keyDown(t) {
543
- const r = bt[t.key];
542
+ keyDown(e) {
543
+ const r = be[e.key];
544
544
  if (r) {
545
- const n = this.state, s = t.shiftKey ? 10 : t.altKey ? 0.1 : 1;
546
- this.start(t), n._delta = r(this.config.keyboardDisplacement, s), n._keyboardActive = !0, b.addTo(n._movement, n._delta), this.compute(t), this.emit();
545
+ const n = this.state, s = e.shiftKey ? 10 : e.altKey ? 0.1 : 1;
546
+ this.start(e), n._delta = r(this.config.keyboardDisplacement, s), n._keyboardActive = !0, b.addTo(n._movement, n._delta), this.compute(e), this.emit();
547
547
  }
548
548
  }
549
- keyUp(t) {
550
- t.key in bt && (this.state._keyboardActive = !1, this.setActive(), this.compute(t), this.emit());
549
+ keyUp(e) {
550
+ e.key in be && (this.state._keyboardActive = !1, this.setActive(), this.compute(e), this.emit());
551
551
  }
552
- bind(t) {
552
+ bind(e) {
553
553
  const r = this.config.device;
554
- t(r, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (t(r, "change", this.pointerMove.bind(this)), t(r, "end", this.pointerUp.bind(this)), t(r, "cancel", this.pointerUp.bind(this)), t("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (t("key", "down", this.keyDown.bind(this)), t("key", "up", this.keyUp.bind(this))), this.config.filterTaps && t("click", "", this.pointerClick.bind(this), {
554
+ e(r, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (e(r, "change", this.pointerMove.bind(this)), e(r, "end", this.pointerUp.bind(this)), e(r, "cancel", this.pointerUp.bind(this)), e("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (e("key", "down", this.keyDown.bind(this)), e("key", "up", this.keyUp.bind(this))), this.config.filterTaps && e("click", "", this.pointerClick.bind(this), {
555
555
  capture: !0,
556
556
  passive: !1
557
557
  });
558
558
  }
559
559
  }
560
- function oe(e) {
561
- "persist" in e && typeof e.persist == "function" && e.persist();
560
+ function at(t) {
561
+ "persist" in t && typeof t.persist == "function" && t.persist();
562
562
  }
563
- const B = typeof window < "u" && window.document && window.document.createElement;
564
- function kt() {
565
- return B && "ontouchstart" in window;
563
+ const K = typeof window < "u" && window.document && window.document.createElement;
564
+ function ke() {
565
+ return K && "ontouchstart" in window;
566
566
  }
567
- function ae() {
568
- return kt() || B && window.navigator.maxTouchPoints > 1;
567
+ function ct() {
568
+ return ke() || K && window.navigator.maxTouchPoints > 1;
569
569
  }
570
- function ce() {
571
- return B && "onpointerdown" in window;
570
+ function ut() {
571
+ return K && "onpointerdown" in window;
572
572
  }
573
- function ue() {
574
- return B && "exitPointerLock" in window.document;
573
+ function lt() {
574
+ return K && "exitPointerLock" in window.document;
575
575
  }
576
- function le() {
576
+ function ft() {
577
577
  try {
578
578
  return "constructor" in GestureEvent;
579
579
  } catch {
@@ -581,18 +581,18 @@ function le() {
581
581
  }
582
582
  }
583
583
  const P = {
584
- isBrowser: B,
585
- gesture: le(),
586
- touch: kt(),
587
- touchscreen: ae(),
588
- pointer: ce(),
589
- pointerLock: ue()
590
- }, fe = 250, de = 180, he = 0.5, pe = 50, me = 250, ge = 10, _t = {
584
+ isBrowser: K,
585
+ gesture: ft(),
586
+ touch: ke(),
587
+ touchscreen: ct(),
588
+ pointer: ut(),
589
+ pointerLock: lt()
590
+ }, dt = 250, ht = 180, pt = 0.5, mt = 50, gt = 250, vt = 10, _e = {
591
591
  mouse: 0,
592
592
  touch: 0,
593
593
  pen: 8
594
- }, Ct = p(p({}, j), {}, {
595
- device(e, t, {
594
+ }, Ce = p(p({}, U), {}, {
595
+ device(t, e, {
596
596
  pointer: {
597
597
  touch: r = !1,
598
598
  lock: n = !1,
@@ -601,13 +601,13 @@ const P = {
601
601
  }) {
602
602
  return this.pointerLock = n && P.pointerLock, P.touch && r ? "touch" : this.pointerLock ? "mouse" : P.pointer && !s ? "pointer" : P.touch ? "touch" : "mouse";
603
603
  },
604
- preventScrollAxis(e, t, {
604
+ preventScrollAxis(t, e, {
605
605
  preventScroll: r
606
606
  }) {
607
- if (this.preventScrollDelay = typeof r == "number" ? r : r || r === void 0 && e ? fe : void 0, !(!P.touchscreen || r === !1))
608
- return e || (r !== void 0 ? "y" : void 0);
607
+ if (this.preventScrollDelay = typeof r == "number" ? r : r || r === void 0 && t ? dt : void 0, !(!P.touchscreen || r === !1))
608
+ return t || (r !== void 0 ? "y" : void 0);
609
609
  },
610
- pointerCapture(e, t, {
610
+ pointerCapture(t, e, {
611
611
  pointer: {
612
612
  capture: r = !0,
613
613
  buttons: n = 1,
@@ -616,71 +616,71 @@ const P = {
616
616
  }) {
617
617
  return this.pointerButtons = n, this.keys = s, !this.pointerLock && this.device === "pointer" && r;
618
618
  },
619
- threshold(e, t, {
619
+ threshold(t, e, {
620
620
  filterTaps: r = !1,
621
621
  tapsThreshold: n = 3,
622
622
  axis: s = void 0
623
623
  }) {
624
- const o = b.toVector(e, r ? n : s ? 1 : 0);
624
+ const o = b.toVector(t, r ? n : s ? 1 : 0);
625
625
  return this.filterTaps = r, this.tapsThreshold = n, o;
626
626
  },
627
627
  swipe({
628
- velocity: e = he,
629
- distance: t = pe,
630
- duration: r = me
628
+ velocity: t = pt,
629
+ distance: e = mt,
630
+ duration: r = gt
631
631
  } = {}) {
632
632
  return {
633
- velocity: this.transform(b.toVector(e)),
634
- distance: this.transform(b.toVector(t)),
633
+ velocity: this.transform(b.toVector(t)),
634
+ distance: this.transform(b.toVector(e)),
635
635
  duration: r
636
636
  };
637
637
  },
638
- delay(e = 0) {
639
- switch (e) {
638
+ delay(t = 0) {
639
+ switch (t) {
640
640
  case !0:
641
- return de;
641
+ return ht;
642
642
  case !1:
643
643
  return 0;
644
644
  default:
645
- return e;
645
+ return t;
646
646
  }
647
647
  },
648
- axisThreshold(e) {
649
- return e ? p(p({}, _t), e) : _t;
648
+ axisThreshold(t) {
649
+ return t ? p(p({}, _e), t) : _e;
650
650
  },
651
- keyboardDisplacement(e = ge) {
652
- return e;
651
+ keyboardDisplacement(t = vt) {
652
+ return t;
653
653
  }
654
654
  });
655
- process.env.NODE_ENV === "development" && Object.assign(Ct, {
656
- useTouch(e) {
657
- if (e !== void 0)
655
+ process.env.NODE_ENV === "development" && Object.assign(Ce, {
656
+ useTouch(t) {
657
+ if (t !== void 0)
658
658
  throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
659
659
  return NaN;
660
660
  },
661
- experimental_preventWindowScrollY(e) {
662
- if (e !== void 0)
661
+ experimental_preventWindowScrollY(t) {
662
+ if (t !== void 0)
663
663
  throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");
664
664
  return NaN;
665
665
  },
666
- swipeVelocity(e) {
667
- if (e !== void 0)
666
+ swipeVelocity(t) {
667
+ if (t !== void 0)
668
668
  throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");
669
669
  return NaN;
670
670
  },
671
- swipeDistance(e) {
672
- if (e !== void 0)
671
+ swipeDistance(t) {
672
+ if (t !== void 0)
673
673
  throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");
674
674
  return NaN;
675
675
  },
676
- swipeDuration(e) {
677
- if (e !== void 0)
676
+ swipeDuration(t) {
677
+ if (t !== void 0)
678
678
  throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");
679
679
  return NaN;
680
680
  }
681
681
  });
682
- p(p({}, nt), {}, {
683
- device(e, t, {
682
+ p(p({}, se), {}, {
683
+ device(t, e, {
684
684
  shared: r,
685
685
  pointer: {
686
686
  touch: n = !1
@@ -693,18 +693,18 @@ p(p({}, nt), {}, {
693
693
  if (P.touch) return "touch";
694
694
  }
695
695
  },
696
- bounds(e, t, {
696
+ bounds(t, e, {
697
697
  scaleBounds: r = {},
698
698
  angleBounds: n = {}
699
699
  }) {
700
700
  const s = (a) => {
701
- const c = gt(z(r, a), {
701
+ const c = ge(Y(r, a), {
702
702
  min: -1 / 0,
703
703
  max: 1 / 0
704
704
  });
705
705
  return [c.min, c.max];
706
706
  }, o = (a) => {
707
- const c = gt(z(n, a), {
707
+ const c = ge(Y(n, a), {
708
708
  min: -1 / 0,
709
709
  max: 1 / 0
710
710
  });
@@ -712,116 +712,116 @@ p(p({}, nt), {}, {
712
712
  };
713
713
  return typeof r != "function" && typeof n != "function" ? [s(), o()] : (a) => [s(a), o(a)];
714
714
  },
715
- threshold(e, t, r) {
716
- return this.lockDirection = r.axis === "lock", b.toVector(e, this.lockDirection ? [0.1, 3] : 0);
715
+ threshold(t, e, r) {
716
+ return this.lockDirection = r.axis === "lock", b.toVector(t, this.lockDirection ? [0.1, 3] : 0);
717
717
  },
718
- modifierKey(e) {
719
- return e === void 0 ? "ctrlKey" : e;
718
+ modifierKey(t) {
719
+ return t === void 0 ? "ctrlKey" : t;
720
720
  },
721
- pinchOnWheel(e = !0) {
722
- return e;
721
+ pinchOnWheel(t = !0) {
722
+ return t;
723
723
  }
724
724
  });
725
- p(p({}, j), {}, {
726
- mouseOnly: (e = !0) => e
725
+ p(p({}, U), {}, {
726
+ mouseOnly: (t = !0) => t
727
727
  });
728
- p(p({}, j), {}, {
729
- mouseOnly: (e = !0) => e
728
+ p(p({}, U), {}, {
729
+ mouseOnly: (t = !0) => t
730
730
  });
731
- const Dt = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map();
732
- function ve(e) {
733
- Dt.set(e.key, e.engine), rt.set(e.key, e.resolver);
731
+ const De = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Map();
732
+ function yt(t) {
733
+ De.set(t.key, t.engine), ne.set(t.key, t.resolver);
734
734
  }
735
- const ye = {
735
+ const bt = {
736
736
  key: "drag",
737
- engine: ie,
738
- resolver: Ct
737
+ engine: ot,
738
+ resolver: Ce
739
739
  };
740
- function be(e, t) {
741
- if (e == null) return {};
742
- var r = {}, n = Object.keys(e), s, o;
740
+ function _t(t, e) {
741
+ if (t == null) return {};
742
+ var r = {}, n = Object.keys(t), s, o;
743
743
  for (o = 0; o < n.length; o++)
744
- s = n[o], !(t.indexOf(s) >= 0) && (r[s] = e[s]);
744
+ s = n[o], !(e.indexOf(s) >= 0) && (r[s] = t[s]);
745
745
  return r;
746
746
  }
747
- function _e(e, t) {
748
- if (e == null) return {};
749
- var r = be(e, t), n, s;
747
+ function wt(t, e) {
748
+ if (t == null) return {};
749
+ var r = _t(t, e), n, s;
750
750
  if (Object.getOwnPropertySymbols) {
751
- var o = Object.getOwnPropertySymbols(e);
751
+ var o = Object.getOwnPropertySymbols(t);
752
752
  for (s = 0; s < o.length; s++)
753
- n = o[s], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
753
+ n = o[s], !(e.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
754
754
  }
755
755
  return r;
756
756
  }
757
- const we = {
758
- target(e) {
759
- if (e)
760
- return () => "current" in e ? e.current : e;
757
+ const Et = {
758
+ target(t) {
759
+ if (t)
760
+ return () => "current" in t ? t.current : t;
761
761
  },
762
- enabled(e = !0) {
763
- return e;
762
+ enabled(t = !0) {
763
+ return t;
764
764
  },
765
- window(e = P.isBrowser ? window : void 0) {
766
- return e;
765
+ window(t = P.isBrowser ? window : void 0) {
766
+ return t;
767
767
  },
768
768
  eventOptions({
769
- passive: e = !0,
770
- capture: t = !1
769
+ passive: t = !0,
770
+ capture: e = !1
771
771
  } = {}) {
772
772
  return {
773
- passive: e,
774
- capture: t
773
+ passive: t,
774
+ capture: e
775
775
  };
776
776
  },
777
- transform(e) {
778
- return e;
777
+ transform(t) {
778
+ return t;
779
779
  }
780
- }, Ee = ["target", "eventOptions", "window", "enabled", "transform"];
781
- function G(e = {}, t) {
780
+ }, xt = ["target", "eventOptions", "window", "enabled", "transform"];
781
+ function W(t = {}, e) {
782
782
  const r = {};
783
- for (const [n, s] of Object.entries(t))
783
+ for (const [n, s] of Object.entries(e))
784
784
  switch (typeof s) {
785
785
  case "function":
786
786
  if (process.env.NODE_ENV === "development") {
787
- const o = s.call(r, e[n], n, e);
787
+ const o = s.call(r, t[n], n, t);
788
788
  Number.isNaN(o) || (r[n] = o);
789
789
  } else
790
- r[n] = s.call(r, e[n], n, e);
790
+ r[n] = s.call(r, t[n], n, t);
791
791
  break;
792
792
  case "object":
793
- r[n] = G(e[n], s);
793
+ r[n] = W(t[n], s);
794
794
  break;
795
795
  case "boolean":
796
- s && (r[n] = e[n]);
796
+ s && (r[n] = t[n]);
797
797
  break;
798
798
  }
799
799
  return r;
800
800
  }
801
- function Te(e, t, r = {}) {
802
- const n = e, {
801
+ function Tt(t, e, r = {}) {
802
+ const n = t, {
803
803
  target: s,
804
804
  eventOptions: o,
805
805
  window: a,
806
806
  enabled: c,
807
807
  transform: l
808
- } = n, d = _e(n, Ee);
809
- if (r.shared = G({
808
+ } = n, d = wt(n, xt);
809
+ if (r.shared = W({
810
810
  target: s,
811
811
  eventOptions: o,
812
812
  window: a,
813
813
  enabled: c,
814
814
  transform: l
815
- }, we), t) {
816
- const u = rt.get(t);
817
- r[t] = G(p({
815
+ }, Et), e) {
816
+ const u = ne.get(e);
817
+ r[e] = W(p({
818
818
  shared: r.shared
819
819
  }, d), u);
820
820
  } else
821
821
  for (const u in d) {
822
- const _ = rt.get(u);
822
+ const _ = ne.get(u);
823
823
  if (_)
824
- r[u] = G(p({
824
+ r[u] = W(p({
825
825
  shared: r.shared
826
826
  }, d[u]), _);
827
827
  else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(u)) {
@@ -832,96 +832,96 @@ function Te(e, t, r = {}) {
832
832
  }
833
833
  return r;
834
834
  }
835
- class $t {
836
- constructor(t, r) {
837
- S(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = r;
835
+ class $e {
836
+ constructor(e, r) {
837
+ S(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = e, this._gestureKey = r;
838
838
  }
839
- add(t, r, n, s, o) {
840
- const a = this._listeners, c = Ft(r, n), l = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = p(p({}, l), o);
841
- t.addEventListener(c, s, d);
839
+ add(e, r, n, s, o) {
840
+ const a = this._listeners, c = He(r, n), l = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = p(p({}, l), o);
841
+ e.addEventListener(c, s, d);
842
842
  const u = () => {
843
- t.removeEventListener(c, s, d), a.delete(u);
843
+ e.removeEventListener(c, s, d), a.delete(u);
844
844
  };
845
845
  return a.add(u), u;
846
846
  }
847
847
  clean() {
848
- this._listeners.forEach((t) => t()), this._listeners.clear();
848
+ this._listeners.forEach((e) => e()), this._listeners.clear();
849
849
  }
850
850
  }
851
- class Se {
851
+ class St {
852
852
  constructor() {
853
853
  S(this, "_timeouts", /* @__PURE__ */ new Map());
854
854
  }
855
- add(t, r, n = 140, ...s) {
856
- this.remove(t), this._timeouts.set(t, window.setTimeout(r, n, ...s));
855
+ add(e, r, n = 140, ...s) {
856
+ this.remove(e), this._timeouts.set(e, window.setTimeout(r, n, ...s));
857
857
  }
858
- remove(t) {
859
- const r = this._timeouts.get(t);
858
+ remove(e) {
859
+ const r = this._timeouts.get(e);
860
860
  r && window.clearTimeout(r);
861
861
  }
862
862
  clean() {
863
- this._timeouts.forEach((t) => void window.clearTimeout(t)), this._timeouts.clear();
863
+ this._timeouts.forEach((e) => void window.clearTimeout(e)), this._timeouts.clear();
864
864
  }
865
865
  }
866
- class xe {
867
- constructor(t) {
868
- S(this, "gestures", /* @__PURE__ */ new Set()), S(this, "_targetEventStore", new $t(this)), S(this, "gestureEventStores", {}), S(this, "gestureTimeoutStores", {}), S(this, "handlers", {}), S(this, "config", {}), S(this, "pointerIds", /* @__PURE__ */ new Set()), S(this, "touchIds", /* @__PURE__ */ new Set()), S(this, "state", {
866
+ class It {
867
+ constructor(e) {
868
+ S(this, "gestures", /* @__PURE__ */ new Set()), S(this, "_targetEventStore", new $e(this)), S(this, "gestureEventStores", {}), S(this, "gestureTimeoutStores", {}), S(this, "handlers", {}), S(this, "config", {}), S(this, "pointerIds", /* @__PURE__ */ new Set()), S(this, "touchIds", /* @__PURE__ */ new Set()), S(this, "state", {
869
869
  shared: {
870
870
  shiftKey: !1,
871
871
  metaKey: !1,
872
872
  ctrlKey: !1,
873
873
  altKey: !1
874
874
  }
875
- }), Ie(this, t);
875
+ }), kt(this, e);
876
876
  }
877
- setEventIds(t) {
878
- if (W(t))
879
- return this.touchIds = new Set(qt(t)), this.touchIds;
880
- if ("pointerId" in t)
881
- return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
877
+ setEventIds(e) {
878
+ if (F(e))
879
+ return this.touchIds = new Set(Je(e)), this.touchIds;
880
+ if ("pointerId" in e)
881
+ return e.type === "pointerup" || e.type === "pointercancel" ? this.pointerIds.delete(e.pointerId) : e.type === "pointerdown" && this.pointerIds.add(e.pointerId), this.pointerIds;
882
882
  }
883
- applyHandlers(t, r) {
884
- this.handlers = t, this.nativeHandlers = r;
883
+ applyHandlers(e, r) {
884
+ this.handlers = e, this.nativeHandlers = r;
885
885
  }
886
- applyConfig(t, r) {
887
- this.config = Te(t, r, this.config);
886
+ applyConfig(e, r) {
887
+ this.config = Tt(e, r, this.config);
888
888
  }
889
889
  clean() {
890
890
  this._targetEventStore.clean();
891
- for (const t of this.gestures)
892
- this.gestureEventStores[t].clean(), this.gestureTimeoutStores[t].clean();
891
+ for (const e of this.gestures)
892
+ this.gestureEventStores[e].clean(), this.gestureTimeoutStores[e].clean();
893
893
  }
894
894
  effect() {
895
895
  return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
896
896
  }
897
- bind(...t) {
897
+ bind(...e) {
898
898
  const r = this.config.shared, n = {};
899
899
  let s;
900
900
  if (!(r.target && (s = r.target(), !s))) {
901
901
  if (r.enabled) {
902
902
  for (const a of this.gestures) {
903
- const c = this.config[a], l = wt(n, c.eventOptions, !!s);
903
+ const c = this.config[a], l = we(n, c.eventOptions, !!s);
904
904
  if (c.enabled) {
905
- const d = Dt.get(a);
906
- new d(this, t, a).bind(l);
905
+ const d = De.get(a);
906
+ new d(this, e, a).bind(l);
907
907
  }
908
908
  }
909
- const o = wt(n, r.eventOptions, !!s);
909
+ const o = we(n, r.eventOptions, !!s);
910
910
  for (const a in this.nativeHandlers)
911
911
  o(a, "", (c) => this.nativeHandlers[a](p(p({}, this.state.shared), {}, {
912
912
  event: c,
913
- args: t
913
+ args: e
914
914
  })), void 0, !0);
915
915
  }
916
916
  for (const o in n)
917
- n[o] = Zt(...n[o]);
917
+ n[o] = et(...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: c,
923
923
  passive: l
924
- } = Yt(o);
924
+ } = Fe(o);
925
925
  this._targetEventStore.add(s, a, "", n[o], {
926
926
  capture: c,
927
927
  passive: l
@@ -930,42 +930,42 @@ class xe {
930
930
  }
931
931
  }
932
932
  }
933
- function V(e, t) {
934
- e.gestures.add(t), e.gestureEventStores[t] = new $t(e, t), e.gestureTimeoutStores[t] = new Se();
933
+ function j(t, e) {
934
+ t.gestures.add(e), t.gestureEventStores[e] = new $e(t, e), t.gestureTimeoutStores[e] = new St();
935
935
  }
936
- function Ie(e, t) {
937
- t.drag && V(e, "drag"), t.wheel && V(e, "wheel"), t.scroll && V(e, "scroll"), t.move && V(e, "move"), t.pinch && V(e, "pinch"), t.hover && V(e, "hover");
936
+ function kt(t, e) {
937
+ e.drag && j(t, "drag"), e.wheel && j(t, "wheel"), e.scroll && j(t, "scroll"), e.move && j(t, "move"), e.pinch && j(t, "pinch"), e.hover && j(t, "hover");
938
938
  }
939
- const wt = (e, t, r) => (n, s, o, a = {}, c = !1) => {
939
+ const we = (t, e, r) => (n, s, o, a = {}, c = !1) => {
940
940
  var l, d;
941
- const u = (l = a.capture) !== null && l !== void 0 ? l : t.capture, _ = (d = a.passive) !== null && d !== void 0 ? d : t.passive;
942
- let m = c ? n : zt(n, s, u);
943
- r && _ && (m += "Passive"), e[m] = e[m] || [], e[m].push(o);
941
+ const u = (l = a.capture) !== null && l !== void 0 ? l : e.capture, _ = (d = a.passive) !== null && d !== void 0 ? d : e.passive;
942
+ let m = c ? n : We(n, s, u);
943
+ r && _ && (m += "Passive"), t[m] = t[m] || [], t[m].push(o);
944
944
  };
945
- function ke(e, t = {}, r, n) {
946
- const s = Q.useMemo(() => new xe(e), []);
947
- if (s.applyHandlers(e, n), s.applyConfig(t, r), Q.useEffect(s.effect.bind(s)), Q.useEffect(() => s.clean.bind(s), []), t.target === void 0)
945
+ function Ct(t, e = {}, r, n) {
946
+ const s = Z.useMemo(() => new It(t), []);
947
+ if (s.applyHandlers(t, n), s.applyConfig(e, r), Z.useEffect(s.effect.bind(s)), Z.useEffect(() => s.clean.bind(s), []), e.target === void 0)
948
948
  return s.bind.bind(s);
949
949
  }
950
- function Ce(e, t) {
951
- return ve(ye), ke({
952
- drag: e
953
- }, t || {}, "drag");
950
+ function Dt(t, e) {
951
+ return yt(bt), Ct({
952
+ drag: t
953
+ }, e || {}, "drag");
954
954
  }
955
- const tt = "RSC::Event";
956
- function De() {
957
- const e = $(null);
958
- function t(n) {
959
- R(() => {
960
- e.current || (e.current = document.createElement("div"));
955
+ const te = "RSC::Event";
956
+ function $t() {
957
+ const t = $(null);
958
+ function e(n) {
959
+ B(() => {
960
+ t.current || (t.current = document.createElement("div"));
961
961
  function s(o) {
962
962
  n(o.detail);
963
963
  }
964
- if (e.current)
965
- return e.current.addEventListener(tt, s, !1), () => {
964
+ if (t.current)
965
+ return t.current.addEventListener(te, s, !1), () => {
966
966
  var o;
967
- (o = e.current) == null || o.removeEventListener(
968
- tt,
967
+ (o = t.current) == null || o.removeEventListener(
968
+ te,
969
969
  s,
970
970
  !1
971
971
  );
@@ -973,25 +973,25 @@ function De() {
973
973
  }, [n]);
974
974
  }
975
975
  function r(n) {
976
- if (e.current) {
977
- const s = new CustomEvent(tt, {
976
+ if (t.current) {
977
+ const s = new CustomEvent(te, {
978
978
  detail: n
979
979
  });
980
- e.current.dispatchEvent(s);
980
+ t.current.dispatchEvent(s);
981
981
  }
982
982
  }
983
983
  return {
984
- useListenToCustomEvent: t,
984
+ useListenToCustomEvent: e,
985
985
  emitEvent: r
986
986
  };
987
987
  }
988
- function $e(e) {
989
- let t = e.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
990
- return t = t.replace(/[\n\t]+/g, " "), t = t.replace(/\s*([{}:;,])\s*/g, "$1"), t = t.replace(/\s+}/g, "}"), t = t.replace(/{\s+/g, "{"), t = t.replace(/\s+/g, " "), t.trim();
988
+ function Pt(t) {
989
+ let e = t.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
990
+ return e = e.replace(/[\n\t]+/g, " "), e = e.replace(/\s*([{}:;,])\s*/g, "$1"), e = e.replace(/\s+}/g, "}"), e = e.replace(/{\s+/g, "{"), e = e.replace(/\s+/g, " "), e.trim();
991
991
  }
992
- function Me({
993
- init: e = !0,
994
- items: t,
992
+ function Vt({
993
+ init: t = !0,
994
+ items: e,
995
995
  withLoop: r = !1,
996
996
  id: n,
997
997
  gutter: s = [{ breakpoint: 0, gutter: 0, startEndGutter: 0 }],
@@ -1004,32 +1004,30 @@ function Me({
1004
1004
  slideType: _ = "item",
1005
1005
  initialActiveItem: m = 0
1006
1006
  }) {
1007
- const [x, C] = Vt(!1), O = $(e), w = $(null), D = $(null), L = $(0), g = $(0), I = $(!r), N = $(!1), A = $(0), h = $(0), [Y, F] = Tt(
1008
- () => ({
1009
- value: 0,
1010
- onChange({ value: i }) {
1011
- D.current.style.transform = `translate3d(calc(${i.value}px + var(--${n}-offset-modifier)), 0px, 0px)`;
1012
- }
1013
- }),
1014
- [a]
1015
- ), Pt = r ? [
1016
- ...t.map((i) => ({
1007
+ const [I, D] = Re(!1), O = $(t), w = $(null), E = $(null), L = $(0), g = $(0), k = $(!r), N = $(!1), A = $(0), h = $(0), G = Ve(), H = xe({
1008
+ value: 0,
1009
+ ref: G,
1010
+ onChange({ value: i }) {
1011
+ E.current.style.transform = `translate3d(calc(${i.value}px + var(--${n}-offset-modifier)), 0px, 0px)`;
1012
+ }
1013
+ }), Pe = r ? [
1014
+ ...e.map((i) => ({
1017
1015
  ...i,
1018
1016
  id: `prev-repeated-item-${i.id}`,
1019
1017
  isClonedItem: !0
1020
1018
  })),
1021
- ...t,
1022
- ...t.map((i) => ({
1019
+ ...e,
1020
+ ...e.map((i) => ({
1023
1021
  ...i,
1024
1022
  id: `next-repeated-item-${i.id}`,
1025
1023
  isClonedItem: !0
1026
1024
  }))
1027
- ] : t, { useListenToCustomEvent: st, emitEvent: U } = De();
1028
- function it() {
1029
- const { totalGutterCssVar: i } = ot();
1025
+ ] : e, { useListenToCustomEvent: ie, emitEvent: z } = $t();
1026
+ function oe() {
1027
+ const { totalGutterCssVar: i } = ae();
1030
1028
  return i;
1031
1029
  }
1032
- function Ot() {
1030
+ function Oe() {
1033
1031
  if (w.current) {
1034
1032
  const f = window.getComputedStyle(
1035
1033
  w.current
@@ -1038,15 +1036,15 @@ function Me({
1038
1036
  }
1039
1037
  return 1;
1040
1038
  }
1041
- function H(i) {
1039
+ function X(i) {
1042
1040
  O.current && (N.current || M({
1043
1041
  type: "next",
1044
1042
  toIndex: i,
1045
1043
  actionType: "click"
1046
1044
  }));
1047
1045
  }
1048
- function X(i) {
1049
- O.current && (I.current || M({
1046
+ function q(i) {
1047
+ O.current && (k.current || M({
1050
1048
  type: "prev",
1051
1049
  toIndex: i,
1052
1050
  actionType: "click"
@@ -1056,88 +1054,91 @@ function Me({
1056
1054
  type: i,
1057
1055
  shouldAnimate: f = !0,
1058
1056
  toIndex: y,
1059
- actionType: E
1057
+ actionType: x
1060
1058
  }) {
1061
- var ct, ut;
1059
+ var V, ue;
1062
1060
  const T = !f;
1063
- I.current = !1, N.current = !1;
1064
- let v = Y.value.get(), k = 0;
1065
- if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current = t.length - 1 : h.current -= 1), y !== void 0 && (h.current = y), i === "next") {
1066
- const K = q(
1067
- r ? g.current * (t.length * 2) : 0
1061
+ k.current = !1, N.current = !1;
1062
+ let v = H.value.get(), C = 0;
1063
+ if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current = e.length - 1 : h.current -= 1), y !== void 0 && (h.current = y), i === "next") {
1064
+ const R = J(
1065
+ r ? g.current * (e.length * 2) : 0
1068
1066
  );
1069
- k = -(h.current * g.current), r && h.current === t.length && (h.current = 0, v = v + g.current * t.length, k = 0), !r && (Math.abs(k) >= K || h.current === t.length - 1) && (N.current = !0, k = -K);
1067
+ C = -(h.current * g.current), r && h.current === e.length && (h.current = 0, v = v + g.current * e.length, C = 0), !r && (Math.abs(C) >= R || h.current === e.length - 1) && (N.current = !0, C = -R);
1070
1068
  }
1071
- i === "prev" && (k = -(h.current * g.current), h.current === t.length - 1 && (v = v - t.length * g.current), !r && k >= 0 && (I.current = !0, k = 0)), L.current = k, E === "resize" ? (k = -(h.current * g.current), U({
1069
+ i === "prev" && (C = -(h.current * g.current), h.current === e.length - 1 && (v = v - e.length * g.current), !r && C >= 0 && (k.current = !0, C = 0)), L.current = C, x === "resize" ? (C = -(h.current * g.current), z({
1072
1070
  eventName: "onResize",
1073
- sliceActionType: E,
1071
+ sliceActionType: x,
1074
1072
  slideDirection: i,
1075
1073
  currentItem: {
1076
1074
  index: h.current,
1077
- id: ((ct = t.at(h.current)) == null ? void 0 : ct.id) ?? "",
1078
- startReached: I.current,
1075
+ id: ((V = e.at(h.current)) == null ? void 0 : V.id) ?? "",
1076
+ startReached: k.current,
1079
1077
  endReached: N.current
1080
1078
  }
1081
- })) : U({
1079
+ })) : z({
1082
1080
  eventName: "onSlideStartChange",
1083
- sliceActionType: E,
1081
+ sliceActionType: x,
1084
1082
  slideDirection: i,
1085
1083
  nextItem: {
1086
1084
  index: h.current,
1087
- id: ((ut = t.at(h.current)) == null ? void 0 : ut.id) ?? "",
1088
- startReached: I.current,
1085
+ id: ((ue = e.at(h.current)) == null ? void 0 : ue.id) ?? "",
1086
+ startReached: k.current,
1089
1087
  endReached: N.current
1090
1088
  }
1091
- }), F.start({
1089
+ }), G.start({
1092
1090
  immediate: T,
1093
1091
  from: {
1094
1092
  value: v
1095
1093
  },
1096
1094
  to: {
1097
- value: k
1095
+ value: C
1096
+ },
1097
+ onChange({ value: R }) {
1098
+ E.current.style.transform = `translate3d(calc(${R.value}px + var(--${n}-offset-modifier)), 0px, 0px)`;
1098
1099
  },
1099
- onRest({ finished: K }) {
1100
- var lt;
1101
- K && U({
1100
+ onRest({ finished: R }) {
1101
+ var le;
1102
+ R && z({
1102
1103
  eventName: "onSlideChangeComplete",
1103
- sliceActionType: E,
1104
+ sliceActionType: x,
1104
1105
  slideDirection: i,
1105
1106
  currentItem: {
1106
1107
  index: h.current,
1107
- id: ((lt = t.at(h.current)) == null ? void 0 : lt.id) ?? "",
1108
- startReached: I.current,
1108
+ id: ((le = e.at(h.current)) == null ? void 0 : le.id) ?? "",
1109
+ startReached: k.current,
1109
1110
  endReached: N.current
1110
1111
  }
1111
1112
  });
1112
1113
  }
1113
1114
  });
1114
1115
  }
1115
- function At() {
1116
- const i = D.current;
1116
+ function Ae() {
1117
+ const i = E.current;
1117
1118
  let f = 0;
1118
- return _ === "item" ? f = i.children[0].getBoundingClientRect()[a === "x" ? "width" : "height"] + it() : f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + it(), f;
1119
+ return _ === "item" ? f = i.children[0].getBoundingClientRect()[a === "x" ? "width" : "height"] + oe() : f = i.getBoundingClientRect()[a === "x" ? "width" : "height"] + oe(), f;
1119
1120
  }
1120
- function q(i) {
1121
- const f = D.current;
1121
+ function J(i) {
1122
+ const f = E.current;
1122
1123
  return f[a === "x" ? "scrollWidth" : "scrollHeight"] - f.getBoundingClientRect()[a === "x" ? "width" : "height"] - i;
1123
1124
  }
1124
- function ot() {
1125
+ function ae() {
1125
1126
  let i = 0, f = 0;
1126
1127
  if (w.current) {
1127
1128
  const y = window.getComputedStyle(
1128
1129
  w.current
1129
- ), E = y.getPropertyValue(`--${n}-start-end-gutter`).trim();
1130
- E.includes("px") && (i = Number(
1131
- E.replace("px", "")
1130
+ ), x = y.getPropertyValue(`--${n}-start-end-gutter`).trim();
1131
+ x.includes("px") && (i = Number(
1132
+ x.replace("px", "")
1132
1133
  ));
1133
1134
  const T = y.getPropertyValue(`--${n}-gutter`).trim();
1134
1135
  T.includes("px") && (f = Number(T.replace("px", "")));
1135
1136
  }
1136
1137
  return { totalStartEndGutterCssVar: i, totalGutterCssVar: f };
1137
1138
  }
1138
- R(() => {
1139
+ B(() => {
1139
1140
  function i(T) {
1140
- const v = Ot();
1141
+ const v = Oe();
1141
1142
  switch (T) {
1142
1143
  case "start":
1143
1144
  return 0;
@@ -1154,11 +1155,11 @@ function Me({
1154
1155
  }
1155
1156
  }
1156
1157
  function f() {
1157
- g.current = At(), console.log("scrollAmountValue", g.current), A.current = g.current / 4;
1158
- const { totalStartEndGutterCssVar: T } = ot();
1158
+ g.current = Ae(), console.log("scrollAmountValue", g.current), A.current = g.current / 4;
1159
+ const { totalStartEndGutterCssVar: T } = ae();
1159
1160
  let v = 0;
1160
- r && (v = g.current * t.length), v -= g.current * i(c), v -= T / 2, console.log({
1161
- mod1: g.current * t.length,
1161
+ r && (v = g.current * e.length), v -= g.current * i(c), v -= T / 2, console.log({
1162
+ mod1: g.current * e.length,
1162
1163
  mod2: g.current * i(c),
1163
1164
  mod3: T / 2
1164
1165
  }), w.current.style.setProperty(
@@ -1167,9 +1168,9 @@ function Me({
1167
1168
  );
1168
1169
  }
1169
1170
  function y(T) {
1170
- w.current && (f(), C(!0), T && T());
1171
+ w.current && (f(), D(!0), T && T());
1171
1172
  }
1172
- function E() {
1173
+ function x() {
1173
1174
  y(), M({
1174
1175
  type: "resize",
1175
1176
  toIndex: h.current,
@@ -1177,32 +1178,35 @@ function Me({
1177
1178
  actionType: "resize"
1178
1179
  });
1179
1180
  }
1180
- if (e)
1181
- return O.current = !0, y(u), window.addEventListener("resize", E), () => {
1182
- window.removeEventListener("resize", E);
1181
+ if (t)
1182
+ return O.current = !0, y(u), window.addEventListener("resize", x), () => {
1183
+ window.removeEventListener("resize", x);
1183
1184
  };
1184
- }, [e, r, n, a, s, c]), R(() => {
1185
- e && m !== h.current && M({
1185
+ }, [t, r, n, a, s, c]), B(() => {
1186
+ t && m !== h.current && M({
1186
1187
  type: "next",
1187
1188
  toIndex: m,
1188
1189
  actionType: "resize",
1189
1190
  shouldAnimate: !1
1190
1191
  });
1191
- }, [e, m]);
1192
- const at = l, Nt = Ce(
1192
+ }, [t, m]);
1193
+ const ce = l, Ne = Dt(
1193
1194
  (i) => {
1194
1195
  if (!O.current)
1195
1196
  return;
1196
- const f = i.dragging, y = i.offset[a === "x" ? 0 : 1], E = i.movement[a === "x" ? 0 : 1], T = E > A.current, v = E < -A.current, k = i.velocity;
1197
- f && (U({
1197
+ const f = i.dragging, y = i.offset[a === "x" ? 0 : 1], x = i.movement[a === "x" ? 0 : 1], T = x > A.current, v = x < -A.current, C = i.velocity;
1198
+ f && (z({
1198
1199
  ...i,
1199
1200
  eventName: "onDrag",
1200
1201
  slideActionType: "drag"
1201
- }), F.start({
1202
+ }), G.start({
1202
1203
  value: y,
1203
1204
  immediate: !0,
1204
1205
  config: {
1205
- velocity: k
1206
+ velocity: C
1207
+ },
1208
+ onChange({ value: V }) {
1209
+ E.current.style.transform = `translate3d(calc(${V.value}px + var(--${n}-offset-modifier)), 0px, 0px)`;
1206
1210
  }
1207
1211
  }), d && (T || v) && i.cancel()), i.last && (T ? (M({
1208
1212
  actionType: "drag",
@@ -1210,47 +1214,50 @@ function Me({
1210
1214
  }), i.cancel()) : v ? (M({
1211
1215
  actionType: "drag",
1212
1216
  type: "next"
1213
- }), i.cancel()) : (F.start({
1217
+ }), i.cancel()) : (G.start({
1214
1218
  value: L.current,
1215
1219
  config: {
1216
- velocity: k
1220
+ velocity: C
1221
+ },
1222
+ onChange({ value: V }) {
1223
+ E.current.style.transform = `translate3d(calc(${V.value}px + var(--${n}-offset-modifier)), 0px, 0px)`;
1217
1224
  }
1218
1225
  }), i.cancel()));
1219
1226
  },
1220
1227
  {
1221
- enabled: at,
1228
+ enabled: ce,
1222
1229
  axis: a,
1223
1230
  rubberband: !r,
1224
1231
  ...r ? {} : {
1225
1232
  bounds: () => ({
1226
1233
  right: 0,
1227
- left: -q(0),
1228
- top: -q(0),
1234
+ left: -J(0),
1235
+ top: -J(0),
1229
1236
  bottom: 0
1230
1237
  })
1231
1238
  },
1232
- from: () => [Y.value.get(), Y.value.get()]
1239
+ from: () => [H.value.get(), H.value.get()]
1233
1240
  }
1234
1241
  );
1235
- function Lt(i) {
1242
+ function Le(i) {
1236
1243
  var f, y;
1237
- return typeof i == "number" ? h.current === i : ((f = t.find((E) => E.id === i)) == null ? void 0 : f.id) === ((y = t[h.current]) == null ? void 0 : y.id);
1244
+ return typeof i == "number" ? h.current === i : ((f = e.find((x) => x.id === i)) == null ? void 0 : f.id) === ((y = e[h.current]) == null ? void 0 : y.id);
1238
1245
  }
1239
1246
  return {
1240
- carouselFragment: /* @__PURE__ */ Mt(
1247
+ carouselFragment: /* @__PURE__ */ Me(
1241
1248
  "div",
1242
1249
  {
1243
1250
  ref: w,
1244
1251
  className: "ReactSpringCarouselContainer",
1245
1252
  "data-part": "Container",
1246
1253
  "data-part-internal": `${n}-Container`,
1247
- ...Nt(),
1254
+ ...Ne(),
1248
1255
  children: [
1249
- /* @__PURE__ */ J(
1256
+ /* @__PURE__ */ Q(
1250
1257
  "style",
1251
1258
  {
1252
1259
  dangerouslySetInnerHTML: {
1253
- __html: $e(`
1260
+ __html: Pt(`
1254
1261
  [data-part-internal="${n}-Container"] {
1255
1262
  display: flex;
1256
1263
  width: 100%;
@@ -1263,14 +1270,14 @@ function Me({
1263
1270
  --${n}-scroll-y-value: ${a === "y" ? `calc(var(--${n}-offset-position) + var(--${n}-offset-modifier))` : "0px"};
1264
1271
  --${n}-gutter: 0px;
1265
1272
  --${n}-start-end-gutter: 0px;
1266
- touch-action: ${at ? a === "x" ? "pan-y" : "pan-x" : "auto"};
1273
+ touch-action: ${ce ? a === "x" ? "pan-y" : "pan-x" : "auto"};
1267
1274
  }
1268
1275
  [data-part-internal="${n}-Track"] {
1269
1276
  display: flex;
1270
1277
  position: relative;
1271
- --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));
1272
- left: ${r && a === "x" && !x ? "var(--initial-offset-modifier)" : "0px"};
1273
- top: ${r && a === "y" && !x ? "var(--initial-offset-modifier)" : "0px"};
1278
+ --initial-offset-modifier: calc(calc(-100% - var(--${n}-gutter) + calc(var(--${n}-start-end-gutter) / 2 / ${e.length} * var(--${n}-items-per-slide)) + var(--${n}-start-end-gutter)) * ${e.length} / var(--${n}-items-per-slide));
1279
+ left: ${r && a === "x" && !I ? "var(--initial-offset-modifier)" : "0px"};
1280
+ top: ${r && a === "y" && !I ? "var(--initial-offset-modifier)" : "0px"};
1274
1281
  flex-direction: ${a === "x" ? "row" : "column"};
1275
1282
  width: 100%;
1276
1283
  height: 100%;
@@ -1304,17 +1311,17 @@ function Me({
1304
1311
  }
1305
1312
  }
1306
1313
  ),
1307
- /* @__PURE__ */ J(
1314
+ /* @__PURE__ */ Q(
1308
1315
  "div",
1309
1316
  {
1310
- ref: D,
1317
+ ref: E,
1311
1318
  className: "ReactSpringCarouselTrack",
1312
1319
  "data-part": "Track",
1313
1320
  "data-part-internal": `${n}-Track`,
1314
1321
  onScroll: () => {
1315
- I.current = !1, N.current = !1;
1322
+ k.current = !1, N.current = !1;
1316
1323
  },
1317
- children: Pt.map((i, f) => /* @__PURE__ */ J(
1324
+ children: Pe.map((i, f) => /* @__PURE__ */ Q(
1318
1325
  "div",
1319
1326
  {
1320
1327
  className: "ReactSpringCarouselItem",
@@ -1322,10 +1329,10 @@ function Me({
1322
1329
  "data-part-internal": `${n}-Item`,
1323
1330
  "data-id": i.id,
1324
1331
  children: typeof i.renderItem == "function" ? i.renderItem({
1325
- useListenToCustomEvent: st,
1332
+ useListenToCustomEvent: ie,
1326
1333
  index: f,
1327
1334
  isClonedItem: !!i.isClonedItem,
1328
- isActiveItem: Lt
1335
+ isActiveItem: Le
1329
1336
  }) : i.renderItem
1330
1337
  },
1331
1338
  `${i.id}-${f}`
@@ -1335,108 +1342,108 @@ function Me({
1335
1342
  ]
1336
1343
  }
1337
1344
  ),
1338
- useListenToCustomEvent: st,
1339
- slideToNextItem: () => H(),
1340
- slideToPrevItem: () => X(),
1345
+ useListenToCustomEvent: ie,
1346
+ slideToNextItem: () => X(),
1347
+ slideToPrevItem: () => q(),
1341
1348
  slideToItem: (i) => {
1342
1349
  if (typeof i == "number") {
1343
- if (!t[i]) {
1350
+ if (!e[i]) {
1344
1351
  console.warn(
1345
1352
  `The item you're trying to slide doesn't exist. index: ${i}`
1346
1353
  );
1347
1354
  return;
1348
1355
  }
1349
- i > h.current ? H(i) : X(i);
1356
+ i > h.current ? X(i) : q(i);
1350
1357
  }
1351
1358
  if (typeof i == "string") {
1352
- const f = t.findIndex((y) => y.id === i);
1359
+ const f = e.findIndex((y) => y.id === i);
1353
1360
  if (f < 0) {
1354
1361
  console.warn(
1355
1362
  `The item you're trying to slide doesn't exist. id: ${i}`
1356
1363
  );
1357
1364
  return;
1358
1365
  }
1359
- f > h.current ? H(f) : X(f);
1366
+ f > h.current ? X(f) : q(f);
1360
1367
  }
1361
1368
  }
1362
1369
  };
1363
1370
  }
1364
- function Pe(e) {
1365
- let t = 0;
1366
- const r = getComputedStyle(e).getPropertyValue("gap");
1367
- return r.includes("px") && (t = Number(r.replace("px", ""))), t;
1371
+ function Ot(t) {
1372
+ let e = 0;
1373
+ const r = getComputedStyle(t).getPropertyValue("gap");
1374
+ return r.includes("px") && (e = Number(r.replace("px", ""))), e;
1368
1375
  }
1369
- function Et(e) {
1370
- return e.scrollWidth - e.clientWidth;
1376
+ function Ee(t) {
1377
+ return t.scrollWidth - t.clientWidth;
1371
1378
  }
1372
- function et(e) {
1373
- const t = e.children[0], r = Pe(e);
1374
- return t.getBoundingClientRect().width + r;
1379
+ function re(t) {
1380
+ const e = t.children[0], r = Ot(t);
1381
+ return e.getBoundingClientRect().width + r;
1375
1382
  }
1376
- function Ve({ container: e, onReach: t }) {
1377
- const r = $("start"), n = $(0), [, s] = Tt(() => ({
1383
+ function Rt({ container: t, onReach: e }) {
1384
+ const r = $("start"), n = $(0), [, s] = xe(() => ({
1378
1385
  x: 0
1379
1386
  }));
1380
1387
  function o(c) {
1381
1388
  s.start({
1382
1389
  from: {
1383
- x: e.current.scrollLeft
1390
+ x: t.current.scrollLeft
1384
1391
  },
1385
1392
  to: {
1386
1393
  x: c
1387
1394
  },
1388
1395
  onChange({ value: l }) {
1389
- e.current && (e.current.scrollLeft = l.x);
1396
+ t.current && (t.current.scrollLeft = l.x);
1390
1397
  }
1391
1398
  });
1392
1399
  }
1393
1400
  function a(c) {
1394
- if (!e.current || c === "next" && r.current === "end" || c === "prev" && r.current === "start")
1401
+ if (!t.current || c === "next" && r.current === "end" || c === "prev" && r.current === "start")
1395
1402
  return;
1396
1403
  let l = 0;
1397
- if (c === "next" && (n.current += 1), c === "prev" && (n.current -= 1), l = n.current * et(e.current), c === "next") {
1398
- const d = Et(e.current);
1399
- l > d && (r.current = "end", l = d, t && t("end"));
1404
+ if (c === "next" && (n.current += 1), c === "prev" && (n.current -= 1), l = n.current * re(t.current), c === "next") {
1405
+ const d = Ee(t.current);
1406
+ l > d && (r.current = "end", l = d, e && e("end"));
1400
1407
  }
1401
- c === "prev" && l <= 0 && (r.current = "start", n.current = 0, l = 0, t && t("start")), o(l);
1408
+ c === "prev" && l <= 0 && (r.current = "start", n.current = 0, l = 0, e && e("start")), o(l);
1402
1409
  }
1403
- return R(() => {
1410
+ return B(() => {
1404
1411
  function c() {
1405
1412
  var L;
1406
- const x = et(e.current), C = ((L = [...e.current.children].at(0)) == null ? void 0 : L.getBoundingClientRect().width) || 0, O = Array(e.current.childElementCount).fill(0).map((g, I) => ({
1407
- index: I,
1408
- start: x * I,
1409
- end: x * (I + 1)
1410
- })), w = e.current.scrollLeft + C, D = O.find(
1413
+ const I = re(t.current), D = ((L = [...t.current.children].at(0)) == null ? void 0 : L.getBoundingClientRect().width) || 0, O = Array(t.current.childElementCount).fill(0).map((g, k) => ({
1414
+ index: k,
1415
+ start: I * k,
1416
+ end: I * (k + 1)
1417
+ })), w = t.current.scrollLeft + D, E = O.find(
1411
1418
  (g) => w >= g.start && w < g.end
1412
1419
  );
1413
- n.current = (D == null ? void 0 : D.index) || 0;
1420
+ n.current = (E == null ? void 0 : E.index) || 0;
1414
1421
  }
1415
1422
  function l() {
1416
1423
  s.stop();
1417
1424
  }
1418
- function d(x) {
1419
- const C = x.target;
1420
- C.scrollLeft === 0 ? (n.current = 0, r.current = "start", t && t("start")) : C.scrollLeft >= Et(C) ? (r.current = "end", t && t("end")) : r.current !== "idle" && (r.current = "idle", t && t("idle"));
1425
+ function d(I) {
1426
+ const D = I.target;
1427
+ D.scrollLeft === 0 ? (n.current = 0, r.current = "start", e && e("start")) : D.scrollLeft >= Ee(D) ? (r.current = "end", e && e("end")) : r.current !== "idle" && (r.current = "idle", e && e("idle"));
1421
1428
  }
1422
1429
  let u, _ = 0;
1423
1430
  function m() {
1424
- _ = e.current.scrollLeft, clearTimeout(u), u = setTimeout(function() {
1425
- e.current.scrollLeft === _ && c();
1431
+ _ = t.current.scrollLeft, clearTimeout(u), u = setTimeout(function() {
1432
+ t.current.scrollLeft === _ && c();
1426
1433
  }, 200);
1427
1434
  }
1428
- if (e.current)
1429
- return e.current.addEventListener("wheel", l, {
1435
+ if (t.current)
1436
+ return t.current.addEventListener("wheel", l, {
1430
1437
  passive: !0
1431
- }), e.current.addEventListener("scroll", d), e.current.addEventListener("scroll", m), () => {
1432
- e.current && (e.current.removeEventListener("scroll", m), e.current.removeEventListener("scroll", d), e.current.removeEventListener("wheel", l));
1438
+ }), t.current.addEventListener("scroll", d), t.current.addEventListener("scroll", m), () => {
1439
+ t.current && (t.current.removeEventListener("scroll", m), t.current.removeEventListener("scroll", d), t.current.removeEventListener("wheel", l));
1433
1440
  };
1434
- }, [e, t]), R(() => {
1435
- if (e.current) {
1441
+ }, [t, e]), B(() => {
1442
+ if (t.current) {
1436
1443
  const c = new ResizeObserver(() => {
1437
- o(n.current * et(e.current));
1444
+ o(n.current * re(t.current));
1438
1445
  });
1439
- return c.observe(e.current), () => {
1446
+ return c.observe(t.current), () => {
1440
1447
  c.disconnect();
1441
1448
  };
1442
1449
  }
@@ -1450,6 +1457,6 @@ function Ve({ container: e, onReach: t }) {
1450
1457
  };
1451
1458
  }
1452
1459
  export {
1453
- Me as useSpringCarousel,
1454
- Ve as useSpringScroll
1460
+ Vt as useSpringCarousel,
1461
+ Rt as useSpringScroll
1455
1462
  };