react-spring-carousel 3.0.0-beta-2.0.495 → 3.0.0-beta-2.0.5
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 +22 -22
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -263,10 +263,10 @@ class ee {
|
|
|
263
263
|
this.restrictToAxis && !r._blocked && this.restrictToAxis(m);
|
|
264
264
|
const E = r.offset, k = r._active && !r._blocked || r.active;
|
|
265
265
|
k && (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 [P, y] = r.offset, [[$,
|
|
267
|
-
r.overflow = [P < $ ? -1 : P >
|
|
268
|
-
const
|
|
269
|
-
if (r.offset = jt(r._bounds, r.offset,
|
|
266
|
+
const [P, y] = r.offset, [[$, N], [b, x]] = r._bounds;
|
|
267
|
+
r.overflow = [P < $ ? -1 : P > N ? 1 : 0, y < b ? -1 : y > x ? 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
|
+
const L = r._active ? n.rubberband || [0, 0] : [0, 0];
|
|
269
|
+
if (r.offset = jt(r._bounds, r.offset, L), r.delta = w.sub(r.offset, E), this.computeMovement(), k && (!r.last || o > te)) {
|
|
270
270
|
r.delta = w.sub(r.offset, E);
|
|
271
271
|
const O = r.delta.map(Math.abs);
|
|
272
272
|
w.addTo(r.distance, O), r.direction = r.delta.map(Math.sign), r._direction = r._delta.map(Math.sign), !r.first && o > 0 && (r.velocity = [O[0] / o, O[1] / o], r.timeDelta = o);
|
|
@@ -1004,7 +1004,7 @@ function Me({
|
|
|
1004
1004
|
initialActiveItem: v = 0,
|
|
1005
1005
|
slideType: m = "item"
|
|
1006
1006
|
}) {
|
|
1007
|
-
const [E, k] = Vt(!1), P = C(e), y = C(null), $ = C(null),
|
|
1007
|
+
const [E, k] = Vt(!1), P = C(e), y = C(null), $ = C(null), N = C(0), b = C(0), x = C(!r), L = C(!1), O = C(0), h = C(0), [Y, F] = Et(
|
|
1008
1008
|
() => ({
|
|
1009
1009
|
value: 0,
|
|
1010
1010
|
onChange({ value: i }) {
|
|
@@ -1039,7 +1039,7 @@ function Me({
|
|
|
1039
1039
|
return 1;
|
|
1040
1040
|
}
|
|
1041
1041
|
function H(i) {
|
|
1042
|
-
P.current && (
|
|
1042
|
+
P.current && (L.current || M({
|
|
1043
1043
|
type: "next",
|
|
1044
1044
|
toIndex: i,
|
|
1045
1045
|
actionType: "click"
|
|
@@ -1060,15 +1060,15 @@ function Me({
|
|
|
1060
1060
|
}) {
|
|
1061
1061
|
var at, ct;
|
|
1062
1062
|
const A = !f;
|
|
1063
|
-
x.current = !1,
|
|
1063
|
+
x.current = !1, L.current = !1;
|
|
1064
1064
|
let g = Y.value.get(), I = 0;
|
|
1065
1065
|
if (i === "next" && (h.current += 1), i === "prev" && (h.current === 0 ? h.current = t.length - 1 : h.current -= 1), _ !== void 0 && (h.current = _), i === "next") {
|
|
1066
1066
|
const K = q(
|
|
1067
1067
|
r ? b.current * (t.length * 2) : 0
|
|
1068
1068
|
);
|
|
1069
|
-
I = -(h.current * b.current), r && h.current === t.length && (h.current = 0, g = g + b.current * t.length, I = 0), !r && (Math.abs(I) >= K || h.current === t.length - 1) && (
|
|
1069
|
+
I = -(h.current * b.current), r && h.current === t.length && (h.current = 0, g = g + b.current * t.length, I = 0), !r && (Math.abs(I) >= K || h.current === t.length - 1) && (L.current = !0, I = -K);
|
|
1070
1070
|
}
|
|
1071
|
-
i === "prev" && (I = -(h.current * b.current), h.current === t.length - 1 && (g = g - t.length * b.current), !r && I >= 0 && (x.current = !0, I = 0)),
|
|
1071
|
+
i === "prev" && (I = -(h.current * b.current), h.current === t.length - 1 && (g = g - t.length * b.current), !r && I >= 0 && (x.current = !0, I = 0)), N.current = I, T === "resize" ? (I = -(h.current * b.current), U({
|
|
1072
1072
|
eventName: "onResize",
|
|
1073
1073
|
sliceActionType: T,
|
|
1074
1074
|
slideDirection: i,
|
|
@@ -1076,7 +1076,7 @@ function Me({
|
|
|
1076
1076
|
index: h.current,
|
|
1077
1077
|
id: ((at = t.at(h.current)) == null ? void 0 : at.id) ?? "",
|
|
1078
1078
|
startReached: x.current,
|
|
1079
|
-
endReached:
|
|
1079
|
+
endReached: L.current
|
|
1080
1080
|
}
|
|
1081
1081
|
})) : U({
|
|
1082
1082
|
eventName: "onSlideStartChange",
|
|
@@ -1086,7 +1086,7 @@ function Me({
|
|
|
1086
1086
|
index: h.current,
|
|
1087
1087
|
id: ((ct = t.at(h.current)) == null ? void 0 : ct.id) ?? "",
|
|
1088
1088
|
startReached: x.current,
|
|
1089
|
-
endReached:
|
|
1089
|
+
endReached: L.current
|
|
1090
1090
|
}
|
|
1091
1091
|
}), F.start({
|
|
1092
1092
|
immediate: A,
|
|
@@ -1106,7 +1106,7 @@ function Me({
|
|
|
1106
1106
|
index: h.current,
|
|
1107
1107
|
id: ((ut = t.at(h.current)) == null ? void 0 : ut.id) ?? "",
|
|
1108
1108
|
startReached: x.current,
|
|
1109
|
-
endReached:
|
|
1109
|
+
endReached: L.current
|
|
1110
1110
|
}
|
|
1111
1111
|
});
|
|
1112
1112
|
}
|
|
@@ -1154,7 +1154,7 @@ function Me({
|
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
1156
|
function f() {
|
|
1157
|
-
b.current = At(),
|
|
1157
|
+
b.current = At(), O.current = b.current / 4;
|
|
1158
1158
|
const { totalStartEndGutterCssVar: A } = it();
|
|
1159
1159
|
let g = 0;
|
|
1160
1160
|
r && (g = b.current * t.length), g -= b.current * i(c), g -= A / 2, y.current.style.setProperty(
|
|
@@ -1177,7 +1177,7 @@ function Me({
|
|
|
1177
1177
|
return P.current = !0, _(), window.addEventListener("resize", T), () => {
|
|
1178
1178
|
window.removeEventListener("resize", T);
|
|
1179
1179
|
};
|
|
1180
|
-
}, [e
|
|
1180
|
+
}, [e]), R(() => {
|
|
1181
1181
|
e && v !== h.current && M({
|
|
1182
1182
|
type: "next",
|
|
1183
1183
|
toIndex: v,
|
|
@@ -1187,7 +1187,7 @@ function Me({
|
|
|
1187
1187
|
}, [e, v]), R(() => {
|
|
1188
1188
|
E && u && u();
|
|
1189
1189
|
}, [E, u]);
|
|
1190
|
-
const ot = l,
|
|
1190
|
+
const ot = l, Lt = Ce(
|
|
1191
1191
|
(i) => {
|
|
1192
1192
|
if (!P.current)
|
|
1193
1193
|
return;
|
|
@@ -1209,7 +1209,7 @@ function Me({
|
|
|
1209
1209
|
actionType: "drag",
|
|
1210
1210
|
type: "next"
|
|
1211
1211
|
}), i.cancel()) : (F.start({
|
|
1212
|
-
value:
|
|
1212
|
+
value: N.current,
|
|
1213
1213
|
config: {
|
|
1214
1214
|
velocity: I
|
|
1215
1215
|
}
|
|
@@ -1230,7 +1230,7 @@ function Me({
|
|
|
1230
1230
|
from: () => [Y.value.get(), Y.value.get()]
|
|
1231
1231
|
}
|
|
1232
1232
|
);
|
|
1233
|
-
function
|
|
1233
|
+
function Nt(i) {
|
|
1234
1234
|
var f, _;
|
|
1235
1235
|
return typeof i == "number" ? h.current === i : ((f = t.find((T) => T.id === i)) == null ? void 0 : f.id) === ((_ = t[h.current]) == null ? void 0 : _.id);
|
|
1236
1236
|
}
|
|
@@ -1242,7 +1242,7 @@ function Me({
|
|
|
1242
1242
|
className: "ReactSpringCarouselContainer",
|
|
1243
1243
|
"data-part": "Container",
|
|
1244
1244
|
"data-part-internal": `${n}-Container`,
|
|
1245
|
-
...
|
|
1245
|
+
...Lt(),
|
|
1246
1246
|
children: [
|
|
1247
1247
|
/* @__PURE__ */ J(
|
|
1248
1248
|
"style",
|
|
@@ -1310,7 +1310,7 @@ function Me({
|
|
|
1310
1310
|
"data-part": "Track",
|
|
1311
1311
|
"data-part-internal": `${n}-Track`,
|
|
1312
1312
|
onScroll: () => {
|
|
1313
|
-
x.current = !1,
|
|
1313
|
+
x.current = !1, L.current = !1;
|
|
1314
1314
|
},
|
|
1315
1315
|
children: Pt.map((i, f) => /* @__PURE__ */ J(
|
|
1316
1316
|
"div",
|
|
@@ -1323,7 +1323,7 @@ function Me({
|
|
|
1323
1323
|
useListenToCustomEvent: st,
|
|
1324
1324
|
index: f,
|
|
1325
1325
|
isClonedItem: !!i.isClonedItem,
|
|
1326
|
-
isActiveItem:
|
|
1326
|
+
isActiveItem: Nt
|
|
1327
1327
|
}) : i.renderItem
|
|
1328
1328
|
},
|
|
1329
1329
|
`${i.id}-${f}`
|
|
@@ -1400,8 +1400,8 @@ function Ve({ container: e, onReach: t }) {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
return R(() => {
|
|
1402
1402
|
function c() {
|
|
1403
|
-
var
|
|
1404
|
-
const E = et(e.current), k = ((
|
|
1403
|
+
var N;
|
|
1404
|
+
const E = et(e.current), k = ((N = [...e.current.children].at(0)) == null ? void 0 : N.getBoundingClientRect().width) || 0, P = Array(e.current.childElementCount).fill(0).map((b, x) => ({
|
|
1405
1405
|
index: x,
|
|
1406
1406
|
start: E * x,
|
|
1407
1407
|
end: E * (x + 1)
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(N,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react/jsx-runtime"),require("@react-spring/web"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@react-spring/web","react"],M):(N=typeof globalThis<"u"?globalThis:N||self,M(N["react-spring-carousel"]={},N["react/jsx-runtime"],N["@react-spring/web"],N.React))})(this,function(N,M,ne,m){"use strict";function De(t,e,r){return Math.max(e,Math.min(t,r))}const w={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function se(t,e,r){return e===0||Math.abs(e)===1/0?Math.pow(t,r*5):t*e*r/(e+r*t)}function ie(t,e,r,n=.15){return n===0?De(t,e,r):t<e?-se(e-t,r-e,n)+e:t>r?+se(t-r,r-e,n)+r:t}function Pe(t,[e,r],[n,s]){const[[o,a],[c,l]]=t;return[ie(e,o,a,n),ie(r,c,l,s)]}function $e(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Oe(t){var e=$e(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,r){return e=Oe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oe(Object(r),!0).forEach(function(n){x(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const ae={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function ce(t){return t?t[0].toUpperCase()+t.slice(1):""}const Ae=["enter","leave"];function Ne(t=!1,e){return t&&!Ae.includes(e)}function Le(t,e="",r=!1){const n=ae[t],s=n&&n[e]||e;return"on"+ce(t)+ce(s)+(Ne(r,s)?"Capture":"")}const Me=["gotpointercapture","lostpointercapture"];function Ve(t){let e=t.substring(2).toLowerCase();const r=!!~e.indexOf("passive");r&&(e=e.replace("passive",""));const n=Me.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(n);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:r}}function je(t,e=""){const r=ae[t],n=r&&r[e]||e;return t+n}function K(t){return"touches"in t}function ue(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function Be(t){return Array.from(t.touches).filter(e=>{var r,n;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))})}function Re(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function le(t){return K(t)?Re(t)[0]:t}function Ue(t){return Be(t).map(e=>e.identifier)}function F(t){const e=le(t);return K(t)?e.identifier:e.pointerId}function fe(t){const e=le(t);return[e.clientX,e.clientY]}function Ke(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:r,altKey:n,metaKey:s,ctrlKey:o}=t;Object.assign(e,{shiftKey:r,altKey:n,metaKey:s,ctrlKey:o})}return e}function G(t,...e){return typeof t=="function"?t(...e):t}function Ge(){}function ze(...t){return t.length===0?Ge:t.length===1?t[0]:function(){let e;for(const r of t)e=r.apply(this,arguments)||e;return e}}function de(t,e){return Object.assign({},e,t||{})}const We=32;class Ye{constructor(e,r,n){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())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:r,ingKey:n,args:s}=this;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}start(e){const r=this.state,n=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=e.target,r.currentTarget=e.currentTarget,r.lastOffset=n.from?G(n.from,r):r.offset,r.offset=r.lastOffset,r.startTime=r.timeStamp=e.timeStamp)}computeValues(e){const r=this.state;r._values=e,r.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:r,config:n,shared:s}=this;r.args=this.args;let o=0;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,Ke(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){const O=r._delta.map(Math.abs);w.addTo(r._distance,O)}this.axisIntent&&this.axisIntent(e);const[a,c]=r._movement,[l,d]=n.threshold,{_step:u,values:y}=r;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(a)>=l&&y[0]),u[1]===!1&&(u[1]=Math.abs(c)>=d&&y[1])):(u[0]===!1&&(u[0]=Math.abs(a)>=l&&Math.sign(a)*l),u[1]===!1&&(u[1]=Math.abs(c)>=d&&Math.sign(c)*d)),r.intentional=u[0]!==!1||u[1]!==!1,!r.intentional)return;const g=[0,0];if(n.hasCustomTransform){const[O,h]=y;g[0]=u[0]!==!1?O-u[0]:0,g[1]=u[1]!==!1?h-u[1]:0}else g[0]=u[0]!==!1?a-u[0]:0,g[1]=u[1]!==!1?c-u[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(g);const T=r.offset,D=r._active&&!r._blocked||r.active;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=G(n.bounds,r)),this.setup&&this.setup()),r.movement=g,this.computeOffset()));const[P,b]=r.offset,[[$,V],[_,I]]=r._bounds;r.overflow=[P<$?-1:P>V?1:0,b<_?-1:b>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;const L=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=Pe(r._bounds,r.offset,L),r.delta=w.sub(r.offset,T),this.computeMovement(),D&&(!r.last||o>We)){r.delta=w.sub(r.offset,T);const O=r.delta.map(Math.abs);w.addTo(r.distance,O),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&o>0&&(r.velocity=[O[0]/o,O[1]/o],r.timeDelta=o)}}emit(){const e=this.state,r=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const s=this.handler(p(p(p({},r),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Fe([t,e],r){const n=Math.abs(t),s=Math.abs(e);if(n>s&&n>r)return"x";if(s>n&&s>r)return"y"}class He extends Ye{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=w.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=w.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const r=this.state,n=this.config;if(!r.axis&&e){const s=typeof n.axisThreshold=="object"?n.axisThreshold[ue(e)]:n.axisThreshold;r.axis=Fe(r._movement,s)}r._blocked=(n.lockDirection||!!n.axis)&&!r.axis||!!n.axis&&n.axis!==r.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const he=t=>t,pe=.15,H={enabled(t=!0){return t},eventOptions(t,e,r){return p(p({},r.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[pe,pe];case!1:return[0,0];default:return w.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return w.toVector(t)},transform(t,e,r){const n=t||r.shared.transform;if(this.hasCustomTransform=!!n,process.env.NODE_ENV==="development"){const s=n||he;return o=>{const a=s(o);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}}return n||he},threshold(t){return w.toVector(t,0)}};process.env.NODE_ENV==="development"&&Object.assign(H,{domTarget(t){if(t!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(t){if(t!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(t){if(t!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const Xe=0,R=p(p({},H),{},{axis(t,e,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(t=Xe){return t},bounds(t={}){if(typeof t=="function")return o=>R.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:r=1/0,top:n=-1/0,bottom:s=1/0}=t;return[[e,r],[n,s]]}}),me={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class qe extends He{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;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)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const r=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),s={left:r.left-n.left+e.offset[0],right:r.right-n.right+e.offset[0],top:r.top-n.top+e.offset[1],bottom:r.bottom-n.bottom+e.offset[1]};e._bounds=R.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const r=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(e.buttons):r.pointerButtons!==-1&&r.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);r.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=F(e),n._pointerActive=!0,this.computeValues(fe(e)),this.computeInitial(),r.preventScrollAxis&&ue(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):r.delay>0?(this.setupDelayTrigger(e),r.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const r=this.state;r._active=!0,r._preventScroll=!0,r._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const r=this.state,n=this.config;if(!r._pointerActive)return;const s=F(e);if(r._pointerId!==void 0&&s!==r._pointerId)return;const o=fe(e);if(document.pointerLockElement===e.target?r._delta=[e.movementX,e.movementY]:(r._delta=w.sub(o,r._values),this.computeValues(o)),w.addTo(r._movement,r._delta),this.compute(e),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){r._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{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.")}const r=this.state,n=this.config;if(!r._active||!r._pointerActive)return;const s=F(e);if(r._pointerId!==void 0&&s!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,a]=r._distance;if(r.tap=o<=n.tapsThreshold&&a<=n.tapsThreshold,r.tap&&n.filterTaps)r._force=!0;else{const[c,l]=r._delta,[d,u]=r._movement,[y,g]=n.swipe.velocity,[T,D]=n.swipe.distance,P=n.swipe.duration;if(r.elapsedTime<P){const b=Math.abs(c/r.timeDelta),$=Math.abs(l/r.timeDelta);b>y&&Math.abs(d)>T&&(r.swipe[0]=Math.sign(c)),$>g&&Math.abs(u)>D&&(r.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const r=this.config,n=r.device;if(process.env.NODE_ENV==="development")try{if(n==="pointer"&&r.preventScrollDelay===void 0){const s="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;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)}}catch{}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)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,Je(e);const r=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});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)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const r=me[e.key];if(r){const n=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=r(this.config.keyboardDisplacement,s),n._keyboardActive=!0,w.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in me&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const r=this.config.device;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),{capture:!0,passive:!1})}}function Je(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const U=typeof window<"u"&&window.document&&window.document.createElement;function ge(){return U&&"ontouchstart"in window}function Qe(){return ge()||U&&window.navigator.maxTouchPoints>1}function Ze(){return U&&"onpointerdown"in window}function et(){return U&&"exitPointerLock"in window.document}function tt(){try{return"constructor"in GestureEvent}catch{return!1}}const C={isBrowser:U,gesture:tt(),touch:ge(),touchscreen:Qe(),pointer:Ze(),pointerLock:et()},rt=250,nt=180,st=.5,it=50,ot=250,at=10,ve={mouse:0,touch:0,pen:8},ye=p(p({},R),{},{device(t,e,{pointer:{touch:r=!1,lock:n=!1,mouse:s=!1}={}}){return this.pointerLock=n&&C.pointerLock,C.touch&&r?"touch":this.pointerLock?"mouse":C.pointer&&!s?"pointer":C.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&t?rt:void 0,!(!C.touchscreen||r===!1))return t||(r!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:r=!0,buttons:n=1,keys:s=!0}={}}){return this.pointerButtons=n,this.keys=s,!this.pointerLock&&this.device==="pointer"&&r},threshold(t,e,{filterTaps:r=!1,tapsThreshold:n=3,axis:s=void 0}){const o=w.toVector(t,r?n:s?1:0);return this.filterTaps=r,this.tapsThreshold=n,o},swipe({velocity:t=st,distance:e=it,duration:r=ot}={}){return{velocity:this.transform(w.toVector(t)),distance:this.transform(w.toVector(e)),duration:r}},delay(t=0){switch(t){case!0:return nt;case!1:return 0;default:return t}},axisThreshold(t){return t?p(p({},ve),t):ve},keyboardDisplacement(t=at){return t}});process.env.NODE_ENV==="development"&&Object.assign(ye,{useTouch(t){if(t!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(t){if(t!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(t){if(t!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(t){if(t!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(t){if(t!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}}),p(p({},H),{},{device(t,e,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!C.touch&&C.gesture)return"gesture";if(C.touch&&n)return"touch";if(C.touchscreen){if(C.pointer)return"pointer";if(C.touch)return"touch"}},bounds(t,e,{scaleBounds:r={},angleBounds:n={}}){const s=a=>{const c=de(G(r,a),{min:-1/0,max:1/0});return[c.min,c.max]},o=a=>{const c=de(G(n,a),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof r!="function"&&typeof n!="function"?[s(),o()]:a=>[s(a),o(a)]},threshold(t,e,r){return this.lockDirection=r.axis==="lock",w.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}}),p(p({},R),{},{mouseOnly:(t=!0)=>t}),p(p({},R),{},{mouseOnly:(t=!0)=>t});const be=new Map,X=new Map;function ct(t){be.set(t.key,t.engine),X.set(t.key,t.resolver)}const ut={key:"drag",engine:qe,resolver:ye};function lt(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,o;for(o=0;o<n.length;o++)s=n[o],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function ft(t,e){if(t==null)return{};var r=lt(t,e),n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(s=0;s<o.length;s++)n=o[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}const dt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=C.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},ht=["target","eventOptions","window","enabled","transform"];function z(t={},e){const r={};for(const[n,s]of Object.entries(e))switch(typeof s){case"function":if(process.env.NODE_ENV==="development"){const o=s.call(r,t[n],n,t);Number.isNaN(o)||(r[n]=o)}else r[n]=s.call(r,t[n],n,t);break;case"object":r[n]=z(t[n],s);break;case"boolean":s&&(r[n]=t[n]);break}return r}function pt(t,e,r={}){const n=t,{target:s,eventOptions:o,window:a,enabled:c,transform:l}=n,d=ft(n,ht);if(r.shared=z({target:s,eventOptions:o,window:a,enabled:c,transform:l},dt),e){const u=X.get(e);r[e]=z(p({shared:r.shared},d),u)}else for(const u in d){const y=X.get(u);if(y)r[u]=z(p({shared:r.shared},d[u]),y);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(u)){if(u==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${u}\` was used. Please read the documentation for further information.`)}}return r}class _e{constructor(e,r){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=r}add(e,r,n,s,o){const a=this._listeners,c=je(r,n),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=p(p({},l),o);e.addEventListener(c,s,d);const u=()=>{e.removeEventListener(c,s,d),a.delete(u)};return a.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class mt{constructor(){x(this,"_timeouts",new Map)}add(e,r,n=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(r,n,...s))}remove(e){const r=this._timeouts.get(e);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class gt{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new _e(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),vt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(Ue(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,r){this.handlers=e,this.nativeHandlers=r}applyConfig(e,r){this.config=pt(e,r,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const r=this.config.shared,n={};let s;if(!(r.target&&(s=r.target(),!s))){if(r.enabled){for(const a of this.gestures){const c=this.config[a],l=we(n,c.eventOptions,!!s);if(c.enabled){const d=be.get(a);new d(this,e,a).bind(l)}}const o=we(n,r.eventOptions,!!s);for(const a in this.nativeHandlers)o(a,"",c=>this.nativeHandlers[a](p(p({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in n)n[o]=ze(...n[o]);if(!s)return n;for(const o in n){const{device:a,capture:c,passive:l}=Ve(o);this._targetEventStore.add(s,a,"",n[o],{capture:c,passive:l})}}}}function j(t,e){t.gestures.add(e),t.gestureEventStores[e]=new _e(t,e),t.gestureTimeoutStores[e]=new mt}function vt(t,e){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")}const we=(t,e,r)=>(n,s,o,a={},c=!1)=>{var l,d;const u=(l=a.capture)!==null&&l!==void 0?l:e.capture,y=(d=a.passive)!==null&&d!==void 0?d:e.passive;let g=c?n:Le(n,s,u);r&&y&&(g+="Passive"),t[g]=t[g]||[],t[g].push(o)};function yt(t,e={},r,n){const s=m.useMemo(()=>new gt(t),[]);if(s.applyHandlers(t,n),s.applyConfig(e,r),m.useEffect(s.effect.bind(s)),m.useEffect(()=>s.clean.bind(s),[]),e.target===void 0)return s.bind.bind(s)}function bt(t,e){return ct(ut),yt({drag:t},e||{},"drag")}const q="RSC::Event";function _t(){const t=m.useRef(null);function e(n){m.useEffect(()=>{t.current||(t.current=document.createElement("div"));function s(o){n(o.detail)}if(t.current)return t.current.addEventListener(q,s,!1),()=>{var o;(o=t.current)==null||o.removeEventListener(q,s,!1)}},[n])}function r(n){if(t.current){const s=new CustomEvent(q,{detail:n});t.current.dispatchEvent(s)}}return{useListenToCustomEvent:e,emitEvent:r}}function wt(t){let e=t.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"");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()}function Et({init:t=!0,items:e,withLoop:r=!1,id:n,gutter:s=[{breakpoint:0,gutter:0,startEndGutter:0}],itemsPerSlide:o=[{breakpoint:0,itemsPerSlide:1}],carouselAxis:a="x",startingPosition:c="start",enableGestures:l=!0,slideWhenDragThresholdIsReached:d=!0,onInit:u,initialActiveItem:y=0,slideType:g="item"}){const[T,D]=m.useState(!1),P=m.useRef(t),b=m.useRef(null),$=m.useRef(null),V=m.useRef(0),_=m.useRef(0),I=m.useRef(!r),L=m.useRef(!1),O=m.useRef(0),h=m.useRef(0),[Q,Z]=ne.useSpring(()=>({value:0,onChange({value:i}){$.current.style.transform=`translate3d(calc(${i.value}px + var(--${n}-offset-modifier)), 0px, 0px)`}}),[a]),xt=r?[...e.map(i=>({...i,id:`prev-repeated-item-${i.id}`,isClonedItem:!0})),...e,...e.map(i=>({...i,id:`next-repeated-item-${i.id}`,isClonedItem:!0}))]:e,{useListenToCustomEvent:Te,emitEvent:W}=_t();function It(){const{totalGutterCssVar:i}=Se();return i}function kt(){if(b.current){const f=window.getComputedStyle(b.current).getPropertyValue(`--${n}-items-per-slide`).trim();return Number(f)||1}return 1}function ee(i){P.current&&(L.current||B({type:"next",toIndex:i,actionType:"click"}))}function te(i){P.current&&(I.current||B({type:"prev",toIndex:i,actionType:"click"}))}function B({type:i,shouldAnimate:f=!0,toIndex:E,actionType:S}){var Ie,ke;const A=!f;I.current=!1,L.current=!1;let v=Q.value.get(),k=0;if(i==="next"&&(h.current+=1),i==="prev"&&(h.current===0?h.current=e.length-1:h.current-=1),E!==void 0&&(h.current=E),i==="next"){const Y=re(r?_.current*(e.length*2):0);k=-(h.current*_.current),r&&h.current===e.length&&(h.current=0,v=v+_.current*e.length,k=0),!r&&(Math.abs(k)>=Y||h.current===e.length-1)&&(L.current=!0,k=-Y)}i==="prev"&&(k=-(h.current*_.current),h.current===e.length-1&&(v=v-e.length*_.current),!r&&k>=0&&(I.current=!0,k=0)),V.current=k,S==="resize"?(k=-(h.current*_.current),W({eventName:"onResize",sliceActionType:S,slideDirection:i,currentItem:{index:h.current,id:((Ie=e.at(h.current))==null?void 0:Ie.id)??"",startReached:I.current,endReached:L.current}})):W({eventName:"onSlideStartChange",sliceActionType:S,slideDirection:i,nextItem:{index:h.current,id:((ke=e.at(h.current))==null?void 0:ke.id)??"",startReached:I.current,endReached:L.current}}),Z.start({immediate:A,from:{value:v},to:{value:k},onRest({finished:Y}){var Ce;Y&&W({eventName:"onSlideChangeComplete",sliceActionType:S,slideDirection:i,currentItem:{index:h.current,id:((Ce=e.at(h.current))==null?void 0:Ce.id)??"",startReached:I.current,endReached:L.current}})}})}function Ct(){const i=g==="item"?$.current.children[0]:b.current;let f=0;return f=i.getBoundingClientRect()[a==="x"?"width":"height"]+It(),f}function re(i){const f=b.current;return f[a==="x"?"scrollWidth":"scrollHeight"]-f.getBoundingClientRect()[a==="x"?"width":"height"]-i}function Se(){let i=0,f=0;if(b.current){const E=window.getComputedStyle(b.current),S=E.getPropertyValue(`--${n}-start-end-gutter`).trim();S.includes("px")&&(i=Number(S.replace("px","")));const A=E.getPropertyValue(`--${n}-gutter`).trim();A.includes("px")&&(f=Number(A.replace("px","")))}return{totalStartEndGutterCssVar:i,totalGutterCssVar:f}}m.useEffect(()=>{function i(A){const v=kt();switch(A){case"start":return 0;case"middle-start":return Math.floor((v-1)*.25);case"center":return Math.floor((v-1)*.5);case"middle-end":return Math.floor((v-1)*.75);case"end":return v-1;default:return 0}}function f(){_.current=Ct(),console.log(_.current),O.current=_.current/4;const{totalStartEndGutterCssVar:A}=Se();let v=0;r&&(v=_.current*e.length),v-=_.current*i(c),v-=A/2,b.current.style.setProperty(`--${n}-offset-modifier`,`${-v}px`)}function E(){b.current&&(f(),D(!0))}function S(){E(),B({type:"resize",toIndex:h.current,shouldAnimate:!1,actionType:"resize"})}if(t)return P.current=!0,E(),window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[t,r,n,a,s,c]),m.useEffect(()=>{t&&y!==h.current&&B({type:"next",toIndex:y,actionType:"resize",shouldAnimate:!1})},[t,y]),m.useEffect(()=>{T&&u&&u()},[T,u]);const xe=l,Dt=bt(i=>{if(!P.current)return;const f=i.dragging,E=i.offset[a==="x"?0:1],S=i.movement[a==="x"?0:1],A=S>O.current,v=S<-O.current,k=i.velocity;f&&(W({...i,eventName:"onDrag",slideActionType:"drag"}),Z.start({value:E,immediate:!0,config:{velocity:k}}),d&&(A||v)&&i.cancel()),i.last&&(A?(B({actionType:"drag",type:"prev"}),i.cancel()):v?(B({actionType:"drag",type:"next"}),i.cancel()):(Z.start({value:V.current,config:{velocity:k}}),i.cancel()))},{enabled:xe,axis:a,rubberband:!r,...r?{}:{bounds:()=>({right:0,left:-re(0),top:-re(0),bottom:0})},from:()=>[Q.value.get(),Q.value.get()]});function Pt(i){var f,E;return typeof i=="number"?h.current===i:((f=e.find(S=>S.id===i))==null?void 0:f.id)===((E=e[h.current])==null?void 0:E.id)}return{carouselFragment:M.jsxs("div",{ref:b,className:"ReactSpringCarouselContainer","data-part":"Container","data-part-internal":`${n}-Container`,...Dt(),children:[M.jsx("style",{dangerouslySetInnerHTML:{__html:wt(`
|
|
1
|
+
(function(L,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react/jsx-runtime"),require("@react-spring/web"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@react-spring/web","react"],M):(L=typeof globalThis<"u"?globalThis:L||self,M(L["react-spring-carousel"]={},L["react/jsx-runtime"],L["@react-spring/web"],L.React))})(this,function(L,M,ne,m){"use strict";function De(t,e,r){return Math.max(e,Math.min(t,r))}const _={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function se(t,e,r){return e===0||Math.abs(e)===1/0?Math.pow(t,r*5):t*e*r/(e+r*t)}function ie(t,e,r,n=.15){return n===0?De(t,e,r):t<e?-se(e-t,r-e,n)+e:t>r?+se(t-r,r-e,n)+r:t}function Pe(t,[e,r],[n,s]){const[[o,a],[c,l]]=t;return[ie(e,o,a,n),ie(r,c,l,s)]}function $e(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Oe(t){var e=$e(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,r){return e=Oe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oe(Object(r),!0).forEach(function(n){x(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const ae={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function ce(t){return t?t[0].toUpperCase()+t.slice(1):""}const Ae=["enter","leave"];function Le(t=!1,e){return t&&!Ae.includes(e)}function Ne(t,e="",r=!1){const n=ae[t],s=n&&n[e]||e;return"on"+ce(t)+ce(s)+(Le(r,s)?"Capture":"")}const Me=["gotpointercapture","lostpointercapture"];function Ve(t){let e=t.substring(2).toLowerCase();const r=!!~e.indexOf("passive");r&&(e=e.replace("passive",""));const n=Me.includes(e)?"capturecapture":"capture",s=!!~e.indexOf(n);return s&&(e=e.replace("capture","")),{device:e,capture:s,passive:r}}function je(t,e=""){const r=ae[t],n=r&&r[e]||e;return t+n}function K(t){return"touches"in t}function ue(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function Be(t){return Array.from(t.touches).filter(e=>{var r,n;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))})}function Re(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function le(t){return K(t)?Re(t)[0]:t}function Ue(t){return Be(t).map(e=>e.identifier)}function F(t){const e=le(t);return K(t)?e.identifier:e.pointerId}function fe(t){const e=le(t);return[e.clientX,e.clientY]}function Ke(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:r,altKey:n,metaKey:s,ctrlKey:o}=t;Object.assign(e,{shiftKey:r,altKey:n,metaKey:s,ctrlKey:o})}return e}function G(t,...e){return typeof t=="function"?t(...e):t}function Ge(){}function ze(...t){return t.length===0?Ge:t.length===1?t[0]:function(){let e;for(const r of t)e=r.apply(this,arguments)||e;return e}}function de(t,e){return Object.assign({},e,t||{})}const We=32;class Ye{constructor(e,r,n){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())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:r,ingKey:n,args:s}=this;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}start(e){const r=this.state,n=this.config;r._active||(this.reset(),this.computeInitial(),r._active=!0,r.target=e.target,r.currentTarget=e.currentTarget,r.lastOffset=n.from?G(n.from,r):r.offset,r.offset=r.lastOffset,r.startTime=r.timeStamp=e.timeStamp)}computeValues(e){const r=this.state;r._values=e,r.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:r,config:n,shared:s}=this;r.args=this.args;let o=0;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,Ke(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){const O=r._delta.map(Math.abs);_.addTo(r._distance,O)}this.axisIntent&&this.axisIntent(e);const[a,c]=r._movement,[l,d]=n.threshold,{_step:u,values:y}=r;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(a)>=l&&y[0]),u[1]===!1&&(u[1]=Math.abs(c)>=d&&y[1])):(u[0]===!1&&(u[0]=Math.abs(a)>=l&&Math.sign(a)*l),u[1]===!1&&(u[1]=Math.abs(c)>=d&&Math.sign(c)*d)),r.intentional=u[0]!==!1||u[1]!==!1,!r.intentional)return;const g=[0,0];if(n.hasCustomTransform){const[O,h]=y;g[0]=u[0]!==!1?O-u[0]:0,g[1]=u[1]!==!1?h-u[1]:0}else g[0]=u[0]!==!1?a-u[0]:0,g[1]=u[1]!==!1?c-u[1]:0;this.restrictToAxis&&!r._blocked&&this.restrictToAxis(g);const T=r.offset,D=r._active&&!r._blocked||r.active;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=G(n.bounds,r)),this.setup&&this.setup()),r.movement=g,this.computeOffset()));const[P,b]=r.offset,[[$,V],[w,I]]=r._bounds;r.overflow=[P<$?-1:P>V?1:0,b<w?-1:b>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;const N=r._active?n.rubberband||[0,0]:[0,0];if(r.offset=Pe(r._bounds,r.offset,N),r.delta=_.sub(r.offset,T),this.computeMovement(),D&&(!r.last||o>We)){r.delta=_.sub(r.offset,T);const O=r.delta.map(Math.abs);_.addTo(r.distance,O),r.direction=r.delta.map(Math.sign),r._direction=r._delta.map(Math.sign),!r.first&&o>0&&(r.velocity=[O[0]/o,O[1]/o],r.timeDelta=o)}}emit(){const e=this.state,r=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const s=this.handler(p(p(p({},r),e),{},{[this.aliasKey]:e.values}));s!==void 0&&(e.memo=s)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Fe([t,e],r){const n=Math.abs(t),s=Math.abs(e);if(n>s&&n>r)return"x";if(s>n&&s>r)return"y"}class He extends Ye{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=_.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=_.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const r=this.state,n=this.config;if(!r.axis&&e){const s=typeof n.axisThreshold=="object"?n.axisThreshold[ue(e)]:n.axisThreshold;r.axis=Fe(r._movement,s)}r._blocked=(n.lockDirection||!!n.axis)&&!r.axis||!!n.axis&&n.axis!==r.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const he=t=>t,pe=.15,H={enabled(t=!0){return t},eventOptions(t,e,r){return p(p({},r.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[pe,pe];case!1:return[0,0];default:return _.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return _.toVector(t)},transform(t,e,r){const n=t||r.shared.transform;if(this.hasCustomTransform=!!n,process.env.NODE_ENV==="development"){const s=n||he;return o=>{const a=s(o);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}}return n||he},threshold(t){return _.toVector(t,0)}};process.env.NODE_ENV==="development"&&Object.assign(H,{domTarget(t){if(t!==void 0)throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");return NaN},lockDirection(t){if(t!==void 0)throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");return NaN},initial(t){if(t!==void 0)throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");return NaN}});const Xe=0,R=p(p({},H),{},{axis(t,e,{axis:r}){if(this.lockDirection=r==="lock",!this.lockDirection)return r},axisThreshold(t=Xe){return t},bounds(t={}){if(typeof t=="function")return o=>R.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:r=1/0,top:n=-1/0,bottom:s=1/0}=t;return[[e,r],[n,s]]}}),me={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class qe extends He{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;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)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const r=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),s={left:r.left-n.left+e.offset[0],right:r.right-n.right+e.offset[0],top:r.top-n.top+e.offset[1],bottom:r.bottom-n.bottom+e.offset[1]};e._bounds=R.bounds(s)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const r=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(r.pointerButtons)?!r.pointerButtons.includes(e.buttons):r.pointerButtons!==-1&&r.pointerButtons!==e.buttons))return;const s=this.ctrl.setEventIds(e);r.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(s&&s.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=F(e),n._pointerActive=!0,this.computeValues(fe(e)),this.computeInitial(),r.preventScrollAxis&&ue(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):r.delay>0?(this.setupDelayTrigger(e),r.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const r=this.state;r._active=!0,r._preventScroll=!0,r._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const r=this.state,n=this.config;if(!r._pointerActive)return;const s=F(e);if(r._pointerId!==void 0&&s!==r._pointerId)return;const o=fe(e);if(document.pointerLockElement===e.target?r._delta=[e.movementX,e.movementY]:(r._delta=_.sub(o,r._values),this.computeValues(o)),_.addTo(r._movement,r._delta),this.compute(e),r._delayed&&r.intentional){this.timeoutStore.remove("dragDelay"),r.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!r._preventScroll)if(r.axis)if(r.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){r._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{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.")}const r=this.state,n=this.config;if(!r._active||!r._pointerActive)return;const s=F(e);if(r._pointerId!==void 0&&s!==r._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,a]=r._distance;if(r.tap=o<=n.tapsThreshold&&a<=n.tapsThreshold,r.tap&&n.filterTaps)r._force=!0;else{const[c,l]=r._delta,[d,u]=r._movement,[y,g]=n.swipe.velocity,[T,D]=n.swipe.distance,P=n.swipe.duration;if(r.elapsedTime<P){const b=Math.abs(c/r.timeDelta),$=Math.abs(l/r.timeDelta);b>y&&Math.abs(d)>T&&(r.swipe[0]=Math.sign(c)),$>g&&Math.abs(u)>D&&(r.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const r=this.config,n=r.device;if(process.env.NODE_ENV==="development")try{if(n==="pointer"&&r.preventScrollDelay===void 0){const s="uv"in e?e.sourceEvent.currentTarget:e.currentTarget;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)}}catch{}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)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,Je(e);const r=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});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)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const r=me[e.key];if(r){const n=this.state,s=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=r(this.config.keyboardDisplacement,s),n._keyboardActive=!0,_.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in me&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const r=this.config.device;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),{capture:!0,passive:!1})}}function Je(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const U=typeof window<"u"&&window.document&&window.document.createElement;function ge(){return U&&"ontouchstart"in window}function Qe(){return ge()||U&&window.navigator.maxTouchPoints>1}function Ze(){return U&&"onpointerdown"in window}function et(){return U&&"exitPointerLock"in window.document}function tt(){try{return"constructor"in GestureEvent}catch{return!1}}const C={isBrowser:U,gesture:tt(),touch:ge(),touchscreen:Qe(),pointer:Ze(),pointerLock:et()},rt=250,nt=180,st=.5,it=50,ot=250,at=10,ve={mouse:0,touch:0,pen:8},ye=p(p({},R),{},{device(t,e,{pointer:{touch:r=!1,lock:n=!1,mouse:s=!1}={}}){return this.pointerLock=n&&C.pointerLock,C.touch&&r?"touch":this.pointerLock?"mouse":C.pointer&&!s?"pointer":C.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:r}){if(this.preventScrollDelay=typeof r=="number"?r:r||r===void 0&&t?rt:void 0,!(!C.touchscreen||r===!1))return t||(r!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:r=!0,buttons:n=1,keys:s=!0}={}}){return this.pointerButtons=n,this.keys=s,!this.pointerLock&&this.device==="pointer"&&r},threshold(t,e,{filterTaps:r=!1,tapsThreshold:n=3,axis:s=void 0}){const o=_.toVector(t,r?n:s?1:0);return this.filterTaps=r,this.tapsThreshold=n,o},swipe({velocity:t=st,distance:e=it,duration:r=ot}={}){return{velocity:this.transform(_.toVector(t)),distance:this.transform(_.toVector(e)),duration:r}},delay(t=0){switch(t){case!0:return nt;case!1:return 0;default:return t}},axisThreshold(t){return t?p(p({},ve),t):ve},keyboardDisplacement(t=at){return t}});process.env.NODE_ENV==="development"&&Object.assign(ye,{useTouch(t){if(t!==void 0)throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");return NaN},experimental_preventWindowScrollY(t){if(t!==void 0)throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");return NaN},swipeVelocity(t){if(t!==void 0)throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");return NaN},swipeDistance(t){if(t!==void 0)throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");return NaN},swipeDuration(t){if(t!==void 0)throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");return NaN}}),p(p({},H),{},{device(t,e,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!C.touch&&C.gesture)return"gesture";if(C.touch&&n)return"touch";if(C.touchscreen){if(C.pointer)return"pointer";if(C.touch)return"touch"}},bounds(t,e,{scaleBounds:r={},angleBounds:n={}}){const s=a=>{const c=de(G(r,a),{min:-1/0,max:1/0});return[c.min,c.max]},o=a=>{const c=de(G(n,a),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof r!="function"&&typeof n!="function"?[s(),o()]:a=>[s(a),o(a)]},threshold(t,e,r){return this.lockDirection=r.axis==="lock",_.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}}),p(p({},R),{},{mouseOnly:(t=!0)=>t}),p(p({},R),{},{mouseOnly:(t=!0)=>t});const be=new Map,X=new Map;function ct(t){be.set(t.key,t.engine),X.set(t.key,t.resolver)}const ut={key:"drag",engine:qe,resolver:ye};function lt(t,e){if(t==null)return{};var r={},n=Object.keys(t),s,o;for(o=0;o<n.length;o++)s=n[o],!(e.indexOf(s)>=0)&&(r[s]=t[s]);return r}function ft(t,e){if(t==null)return{};var r=lt(t,e),n,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(s=0;s<o.length;s++)n=o[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}const dt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=C.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},ht=["target","eventOptions","window","enabled","transform"];function z(t={},e){const r={};for(const[n,s]of Object.entries(e))switch(typeof s){case"function":if(process.env.NODE_ENV==="development"){const o=s.call(r,t[n],n,t);Number.isNaN(o)||(r[n]=o)}else r[n]=s.call(r,t[n],n,t);break;case"object":r[n]=z(t[n],s);break;case"boolean":s&&(r[n]=t[n]);break}return r}function pt(t,e,r={}){const n=t,{target:s,eventOptions:o,window:a,enabled:c,transform:l}=n,d=ft(n,ht);if(r.shared=z({target:s,eventOptions:o,window:a,enabled:c,transform:l},dt),e){const u=X.get(e);r[e]=z(p({shared:r.shared},d),u)}else for(const u in d){const y=X.get(u);if(y)r[u]=z(p({shared:r.shared},d[u]),y);else if(process.env.NODE_ENV==="development"&&!["drag","pinch","scroll","wheel","move","hover"].includes(u)){if(u==="domTarget")throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");console.warn(`[@use-gesture]: Unknown config key \`${u}\` was used. Please read the documentation for further information.`)}}return r}class _e{constructor(e,r){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=r}add(e,r,n,s,o){const a=this._listeners,c=je(r,n),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=p(p({},l),o);e.addEventListener(c,s,d);const u=()=>{e.removeEventListener(c,s,d),a.delete(u)};return a.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class mt{constructor(){x(this,"_timeouts",new Map)}add(e,r,n=140,...s){this.remove(e),this._timeouts.set(e,window.setTimeout(r,n,...s))}remove(e){const r=this._timeouts.get(e);r&&window.clearTimeout(r)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}class gt{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new _e(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),vt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(Ue(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,r){this.handlers=e,this.nativeHandlers=r}applyConfig(e,r){this.config=pt(e,r,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const r=this.config.shared,n={};let s;if(!(r.target&&(s=r.target(),!s))){if(r.enabled){for(const a of this.gestures){const c=this.config[a],l=we(n,c.eventOptions,!!s);if(c.enabled){const d=be.get(a);new d(this,e,a).bind(l)}}const o=we(n,r.eventOptions,!!s);for(const a in this.nativeHandlers)o(a,"",c=>this.nativeHandlers[a](p(p({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in n)n[o]=ze(...n[o]);if(!s)return n;for(const o in n){const{device:a,capture:c,passive:l}=Ve(o);this._targetEventStore.add(s,a,"",n[o],{capture:c,passive:l})}}}}function j(t,e){t.gestures.add(e),t.gestureEventStores[e]=new _e(t,e),t.gestureTimeoutStores[e]=new mt}function vt(t,e){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")}const we=(t,e,r)=>(n,s,o,a={},c=!1)=>{var l,d;const u=(l=a.capture)!==null&&l!==void 0?l:e.capture,y=(d=a.passive)!==null&&d!==void 0?d:e.passive;let g=c?n:Ne(n,s,u);r&&y&&(g+="Passive"),t[g]=t[g]||[],t[g].push(o)};function yt(t,e={},r,n){const s=m.useMemo(()=>new gt(t),[]);if(s.applyHandlers(t,n),s.applyConfig(e,r),m.useEffect(s.effect.bind(s)),m.useEffect(()=>s.clean.bind(s),[]),e.target===void 0)return s.bind.bind(s)}function bt(t,e){return ct(ut),yt({drag:t},e||{},"drag")}const q="RSC::Event";function _t(){const t=m.useRef(null);function e(n){m.useEffect(()=>{t.current||(t.current=document.createElement("div"));function s(o){n(o.detail)}if(t.current)return t.current.addEventListener(q,s,!1),()=>{var o;(o=t.current)==null||o.removeEventListener(q,s,!1)}},[n])}function r(n){if(t.current){const s=new CustomEvent(q,{detail:n});t.current.dispatchEvent(s)}}return{useListenToCustomEvent:e,emitEvent:r}}function wt(t){let e=t.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm,"");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()}function Et({init:t=!0,items:e,withLoop:r=!1,id:n,gutter:s=[{breakpoint:0,gutter:0,startEndGutter:0}],itemsPerSlide:o=[{breakpoint:0,itemsPerSlide:1}],carouselAxis:a="x",startingPosition:c="start",enableGestures:l=!0,slideWhenDragThresholdIsReached:d=!0,onInit:u,initialActiveItem:y=0,slideType:g="item"}){const[T,D]=m.useState(!1),P=m.useRef(t),b=m.useRef(null),$=m.useRef(null),V=m.useRef(0),w=m.useRef(0),I=m.useRef(!r),N=m.useRef(!1),O=m.useRef(0),h=m.useRef(0),[Q,Z]=ne.useSpring(()=>({value:0,onChange({value:i}){$.current.style.transform=`translate3d(calc(${i.value}px + var(--${n}-offset-modifier)), 0px, 0px)`}}),[a]),xt=r?[...e.map(i=>({...i,id:`prev-repeated-item-${i.id}`,isClonedItem:!0})),...e,...e.map(i=>({...i,id:`next-repeated-item-${i.id}`,isClonedItem:!0}))]:e,{useListenToCustomEvent:Te,emitEvent:W}=_t();function It(){const{totalGutterCssVar:i}=Se();return i}function kt(){if(b.current){const f=window.getComputedStyle(b.current).getPropertyValue(`--${n}-items-per-slide`).trim();return Number(f)||1}return 1}function ee(i){P.current&&(N.current||B({type:"next",toIndex:i,actionType:"click"}))}function te(i){P.current&&(I.current||B({type:"prev",toIndex:i,actionType:"click"}))}function B({type:i,shouldAnimate:f=!0,toIndex:E,actionType:S}){var Ie,ke;const A=!f;I.current=!1,N.current=!1;let v=Q.value.get(),k=0;if(i==="next"&&(h.current+=1),i==="prev"&&(h.current===0?h.current=e.length-1:h.current-=1),E!==void 0&&(h.current=E),i==="next"){const Y=re(r?w.current*(e.length*2):0);k=-(h.current*w.current),r&&h.current===e.length&&(h.current=0,v=v+w.current*e.length,k=0),!r&&(Math.abs(k)>=Y||h.current===e.length-1)&&(N.current=!0,k=-Y)}i==="prev"&&(k=-(h.current*w.current),h.current===e.length-1&&(v=v-e.length*w.current),!r&&k>=0&&(I.current=!0,k=0)),V.current=k,S==="resize"?(k=-(h.current*w.current),W({eventName:"onResize",sliceActionType:S,slideDirection:i,currentItem:{index:h.current,id:((Ie=e.at(h.current))==null?void 0:Ie.id)??"",startReached:I.current,endReached:N.current}})):W({eventName:"onSlideStartChange",sliceActionType:S,slideDirection:i,nextItem:{index:h.current,id:((ke=e.at(h.current))==null?void 0:ke.id)??"",startReached:I.current,endReached:N.current}}),Z.start({immediate:A,from:{value:v},to:{value:k},onRest({finished:Y}){var Ce;Y&&W({eventName:"onSlideChangeComplete",sliceActionType:S,slideDirection:i,currentItem:{index:h.current,id:((Ce=e.at(h.current))==null?void 0:Ce.id)??"",startReached:I.current,endReached:N.current}})}})}function Ct(){const i=g==="item"?$.current.children[0]:b.current;let f=0;return f=i.getBoundingClientRect()[a==="x"?"width":"height"]+It(),f}function re(i){const f=b.current;return f[a==="x"?"scrollWidth":"scrollHeight"]-f.getBoundingClientRect()[a==="x"?"width":"height"]-i}function Se(){let i=0,f=0;if(b.current){const E=window.getComputedStyle(b.current),S=E.getPropertyValue(`--${n}-start-end-gutter`).trim();S.includes("px")&&(i=Number(S.replace("px","")));const A=E.getPropertyValue(`--${n}-gutter`).trim();A.includes("px")&&(f=Number(A.replace("px","")))}return{totalStartEndGutterCssVar:i,totalGutterCssVar:f}}m.useEffect(()=>{function i(A){const v=kt();switch(A){case"start":return 0;case"middle-start":return Math.floor((v-1)*.25);case"center":return Math.floor((v-1)*.5);case"middle-end":return Math.floor((v-1)*.75);case"end":return v-1;default:return 0}}function f(){w.current=Ct(),O.current=w.current/4;const{totalStartEndGutterCssVar:A}=Se();let v=0;r&&(v=w.current*e.length),v-=w.current*i(c),v-=A/2,b.current.style.setProperty(`--${n}-offset-modifier`,`${-v}px`)}function E(){b.current&&(f(),D(!0))}function S(){E(),B({type:"resize",toIndex:h.current,shouldAnimate:!1,actionType:"resize"})}if(t)return P.current=!0,E(),window.addEventListener("resize",S),()=>{window.removeEventListener("resize",S)}},[t]),m.useEffect(()=>{t&&y!==h.current&&B({type:"next",toIndex:y,actionType:"resize",shouldAnimate:!1})},[t,y]),m.useEffect(()=>{T&&u&&u()},[T,u]);const xe=l,Dt=bt(i=>{if(!P.current)return;const f=i.dragging,E=i.offset[a==="x"?0:1],S=i.movement[a==="x"?0:1],A=S>O.current,v=S<-O.current,k=i.velocity;f&&(W({...i,eventName:"onDrag",slideActionType:"drag"}),Z.start({value:E,immediate:!0,config:{velocity:k}}),d&&(A||v)&&i.cancel()),i.last&&(A?(B({actionType:"drag",type:"prev"}),i.cancel()):v?(B({actionType:"drag",type:"next"}),i.cancel()):(Z.start({value:V.current,config:{velocity:k}}),i.cancel()))},{enabled:xe,axis:a,rubberband:!r,...r?{}:{bounds:()=>({right:0,left:-re(0),top:-re(0),bottom:0})},from:()=>[Q.value.get(),Q.value.get()]});function Pt(i){var f,E;return typeof i=="number"?h.current===i:((f=e.find(S=>S.id===i))==null?void 0:f.id)===((E=e[h.current])==null?void 0:E.id)}return{carouselFragment:M.jsxs("div",{ref:b,className:"ReactSpringCarouselContainer","data-part":"Container","data-part-internal":`${n}-Container`,...Dt(),children:[M.jsx("style",{dangerouslySetInnerHTML:{__html:wt(`
|
|
2
2
|
[data-part-internal="${n}-Container"] {
|
|
3
3
|
display: flex;
|
|
4
4
|
width: 100%;
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
`).join(""):""}
|
|
47
|
-
`)}}),M.jsx("div",{ref:$,className:"ReactSpringCarouselTrack","data-part":"Track","data-part-internal":`${n}-Track`,onScroll:()=>{I.current=!1,
|
|
47
|
+
`)}}),M.jsx("div",{ref:$,className:"ReactSpringCarouselTrack","data-part":"Track","data-part-internal":`${n}-Track`,onScroll:()=>{I.current=!1,N.current=!1},children:xt.map((i,f)=>M.jsx("div",{className:"ReactSpringCarouselItem","data-part":"Item","data-part-internal":`${n}-Item`,"data-id":i.id,children:typeof i.renderItem=="function"?i.renderItem({useListenToCustomEvent:Te,index:f,isClonedItem:!!i.isClonedItem,isActiveItem:Pt}):i.renderItem},`${i.id}-${f}`))})]}),useListenToCustomEvent:Te,slideToNextItem:()=>ee(),slideToPrevItem:()=>te(),slideToItem:i=>{if(typeof i=="number"){if(!e[i]){console.warn(`The item you're trying to slide doesn't exist. index: ${i}`);return}i>h.current?ee(i):te(i)}if(typeof i=="string"){const f=e.findIndex(E=>E.id===i);if(f<0){console.warn(`The item you're trying to slide doesn't exist. id: ${i}`);return}f>h.current?ee(f):te(f)}}}}function Tt(t){let e=0;const r=getComputedStyle(t).getPropertyValue("gap");return r.includes("px")&&(e=Number(r.replace("px",""))),e}function Ee(t){return t.scrollWidth-t.clientWidth}function J(t){const e=t.children[0],r=Tt(t);return e.getBoundingClientRect().width+r}function St({container:t,onReach:e}){const r=m.useRef("start"),n=m.useRef(0),[,s]=ne.useSpring(()=>({x:0}));function o(c){s.start({from:{x:t.current.scrollLeft},to:{x:c},onChange({value:l}){t.current&&(t.current.scrollLeft=l.x)}})}function a(c){if(!t.current||c==="next"&&r.current==="end"||c==="prev"&&r.current==="start")return;let l=0;if(c==="next"&&(n.current+=1),c==="prev"&&(n.current-=1),l=n.current*J(t.current),c==="next"){const d=Ee(t.current);l>d&&(r.current="end",l=d,e&&e("end"))}c==="prev"&&l<=0&&(r.current="start",n.current=0,l=0,e&&e("start")),o(l)}return m.useEffect(()=>{function c(){var V;const T=J(t.current),D=((V=[...t.current.children].at(0))==null?void 0:V.getBoundingClientRect().width)||0,P=Array(t.current.childElementCount).fill(0).map((w,I)=>({index:I,start:T*I,end:T*(I+1)})),b=t.current.scrollLeft+D,$=P.find(w=>b>=w.start&&b<w.end);n.current=($==null?void 0:$.index)||0}function l(){s.stop()}function d(T){const D=T.target;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"))}let u,y=0;function g(){y=t.current.scrollLeft,clearTimeout(u),u=setTimeout(function(){t.current.scrollLeft===y&&c()},200)}if(t.current)return t.current.addEventListener("wheel",l,{passive:!0}),t.current.addEventListener("scroll",d),t.current.addEventListener("scroll",g),()=>{t.current&&(t.current.removeEventListener("scroll",g),t.current.removeEventListener("scroll",d),t.current.removeEventListener("wheel",l))}},[t,e]),m.useEffect(()=>{if(t.current){const c=new ResizeObserver(()=>{o(n.current*J(t.current))});return c.observe(t.current),()=>{c.disconnect()}}},[]),{scrollToNext(){a("next")},scrollToPrev(){a("prev")}}}L.useSpringCarousel=Et,L.useSpringScroll=St,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|