@lanaco/lnc-react-ui
Version:
React component library
498 lines (497 loc) • 31.4 kB
JavaScript
import { c as j, g as dt } from "./_commonjsHelpers-BkfeUUK-.js";
import A from "react";
var U = {}, z = {}, m = {}, F = {};
(function(o) {
function i(a, n, l) {
var u = n.slidesToShow, h = n.currentSlide;
return l.length > 2 * u ? a + 2 * u : h >= l.length ? l.length + a : a;
}
function t(a, n) {
if (n.length > 2 * a) {
for (var l = {}, u = n.length - 2 * a, h = n.length - u, c = u, d = 0; d < h; d++) l[d] = c, c++;
var p = n.length + h, f = p + n.slice(0, 2 * a).length, g = 0;
for (d = p; d <= f; d++) l[d] = g, g++;
var w = p, b = 0;
for (d = h; d < w; d++) l[d] = b, b++;
return l;
}
l = {};
var C = 3 * n.length, S = 0;
for (d = 0; d < C; d++) l[d] = S, ++S === n.length && (S = 0);
return l;
}
function e(a, n) {
return n.length < a ? n : n.length > 2 * a ? n.slice(n.length - 2 * a, n.length).concat(n, n.slice(0, 2 * a)) : n.concat(n, n);
}
function r(a, n) {
return n.length > 2 * a ? 2 * a : n.length;
}
function s(a, n, l) {
var u, h = a.currentSlide, c = a.slidesToShow, d = a.itemWidth, p = a.totalItems, f = 0, g = 0, w = h === 0, b = n.length - (n.length - 2 * c);
return n.length < c ? (g = f = 0, w = u = !1) : n.length > 2 * c ? ((u = h >= b + n.length) && (g = -d * (f = h - n.length)), w && (g = -d * (f = b + (n.length - 2 * c)))) : ((u = h >= 2 * n.length) && (g = -d * (f = h - n.length)), w && (g = l.showDots ? -d * (f = n.length) : -d * (f = p / 3))), { isReachingTheEnd: u, isReachingTheStart: w, nextSlide: f, nextPosition: g };
}
Object.defineProperty(o, "__esModule", { value: !0 }), o.getOriginalCounterPart = i, o.getOriginalIndexLookupTableByClones = t, o.getClones = e, o.getInitialSlideInInfiniteMode = r, o.checkClonesPosition = s;
})(F);
var O = {};
Object.defineProperty(O, "__esModule", { value: !0 });
var et = !1;
function ct(o, i, t, e) {
var r = 0, s = e || t;
return i && s && (!et && process.env.NODE_ENV !== "production" && o[s].paritialVisibilityGutter && (et = !0, console.warn("You appear to be using paritialVisibilityGutter instead of partialVisibilityGutter which will be moved to partialVisibilityGutter in the future completely")), r = o[s].partialVisibilityGutter || o[s].paritialVisibilityGutter), r;
}
function pt(o, i) {
var t;
return i[o] && (t = (100 / i[o].items).toFixed(1)), t;
}
function ft(o, i, t) {
return Math.round(t / (i + (o.centerMode ? 1 : 0)));
}
O.getPartialVisibilityGutter = ct, O.getWidthFromDeviceType = pt, O.getItemClientSideWidth = ft;
var y = {};
Object.defineProperty(y, "__esModule", { value: !0 });
var Y = O;
function K(o) {
var i = o.slidesToShow;
return o.totalItems < i;
}
function mt(o, i) {
var t, e = o.domLoaded, r = o.slidesToShow, s = o.containerWidth, a = o.itemWidth, n = i.deviceType, l = i.responsive, u = i.ssr, h = i.partialVisbile, c = i.partialVisible, d = !!(e && r && s && a);
u && n && !d && (t = Y.getWidthFromDeviceType(n, l));
var p = !!(u && n && !d && t);
return { shouldRenderOnSSR: p, flexBisis: t, domFullyLoaded: d, partialVisibilityGutter: Y.getPartialVisibilityGutter(l, h || c, n, o.deviceType), shouldRenderAtAll: p || d };
}
function vt(o, i) {
var t = i.currentSlide, e = i.slidesToShow;
return t <= o && o < t + e;
}
function nt(o, i, t) {
var e = t || o.transform;
return !i.infinite && o.currentSlide === 0 || K(o) ? e : e + o.itemWidth / 2;
}
function gt(o) {
return !(0 < o.currentSlide);
}
function st(o) {
var i = o.currentSlide, t = o.totalItems;
return !(i + o.slidesToShow < t);
}
function at(o, i, t, e) {
i === void 0 && (i = 0);
var r = o.currentSlide, s = o.slidesToShow, a = st(o), n = !t.infinite && a, l = e || o.transform;
if (K(o)) return l;
var u = l + r * i;
return n ? u + (o.containerWidth - (o.itemWidth - i) * s) : u;
}
function lt(o, i) {
return o.rtl ? -1 * i : i;
}
function St(o, i, t) {
var e = i.partialVisbile, r = i.partialVisible, s = i.responsive, a = i.deviceType, n = i.centerMode, l = t || o.transform, u = Y.getPartialVisibilityGutter(s, e || r, a, o.deviceType);
return lt(i, r || e ? at(o, u, i, t) : n ? nt(o, i, t) : l);
}
function yt(o, i) {
var t = o.domLoaded, e = o.slidesToShow, r = o.containerWidth, s = o.itemWidth, a = i.deviceType, n = i.responsive, l = i.slidesToSlide || 1, u = !!(t && e && r && s);
return i.ssr && i.deviceType && !u && Object.keys(n).forEach(function(h) {
var c = n[h].slidesToSlide;
a === h && c && (l = c);
}), u && Object.keys(n).forEach(function(h) {
var c = n[h], d = c.breakpoint, p = c.slidesToSlide, f = d.max, g = d.min;
p && window.innerWidth >= g && window.innerWidth <= f && (l = p);
}), l;
}
y.notEnoughChildren = K, y.getInitialState = mt, y.getIfSlideIsVisbile = vt, y.getTransformForCenterMode = nt, y.isInLeftEnd = gt, y.isInRightEnd = st, y.getTransformForPartialVsibile = at, y.parsePosition = lt, y.getTransform = St, y.getSlidesToSlide = yt;
var q = {};
Object.defineProperty(q, "__esModule", { value: !0 });
var Tt = function(o, i, t) {
var e;
return function() {
var r = arguments;
e || (o.apply(this, r), e = !0, typeof t == "function" && t(!0), setTimeout(function() {
e = !1, typeof t == "function" && t(!1);
}, i));
};
};
q.default = Tt;
var ut = {};
(function(o) {
function i(t, e) {
var r = e.partialVisbile, s = e.partialVisible, a = e.centerMode, n = e.ssr, l = e.responsive;
if ((r || s) && a) throw new Error("center mode can not be used at the same time with partialVisible");
if (!l) throw n ? new Error("ssr mode need to be used in conjunction with responsive prop") : new Error("Responsive prop is needed for deciding the amount of items to show on the screen");
if (l && typeof l != "object") throw new Error("responsive prop must be an object");
}
Object.defineProperty(o, "__esModule", { value: !0 }), o.default = i;
})(ut);
var J = {};
Object.defineProperty(J, "__esModule", { value: !0 });
var wt = y;
function bt(o, i, t) {
t === void 0 && (t = 0);
var e, r, s = o.slidesToShow, a = o.currentSlide, n = o.itemWidth, l = o.totalItems, u = wt.getSlidesToSlide(o, i), h = a + 1 + t + s + (0 < t ? 0 : u);
return r = h <= l ? -n * (e = a + t + (0 < t ? 0 : u)) : l < h && a !== l - s ? -n * (e = l - s) : e = void 0, { nextSlides: e, nextPosition: r };
}
J.populateNextSlides = bt;
var Q = {};
Object.defineProperty(Q, "__esModule", { value: !0 });
var Ct = A, It = y, Mt = y;
function Et(o, i, t) {
t === void 0 && (t = 0);
var e, r, s = o.currentSlide, a = o.itemWidth, n = o.slidesToShow, l = i.children, u = i.showDots, h = i.infinite, c = It.getSlidesToSlide(o, i), d = s - t - (0 < t ? 0 : c), p = (Ct.Children.toArray(l).length - n) % c;
return r = 0 <= d ? (e = d, u && !h && 0 < p && Mt.isInRightEnd(o) && (e = s - p), -a * e) : e = d < 0 && s !== 0 ? 0 : void 0, { nextSlides: e, nextPosition: r };
}
Q.populatePreviousSlides = Et;
var ht = {};
(function(o) {
function i(t, e, r, s, a, n) {
var l, u, h = t.itemWidth, c = t.slidesToShow, d = t.totalItems, p = t.currentSlide, f = e.infinite, g = !1, w = Math.round((r - s) / h), b = Math.round((s - r) / h), C = r < a;
if (a < r && w <= c) {
l = "right";
var S = Math.abs(-h * (d - c)), M = n - (s - a), I = p === d - c;
(Math.abs(M) <= S || I && f) && (u = M, g = !0);
}
return C && b <= c && (l = "left", ((M = n + (a - s)) <= 0 || p === 0 && f) && (g = !0, u = M)), { direction: l, nextPosition: u, canContinue: g };
}
Object.defineProperty(o, "__esModule", { value: !0 }), o.populateSlidesOnMouseTouchMove = i;
})(ht);
Object.defineProperty(m, "__esModule", { value: !0 });
var x = F;
m.getOriginalCounterPart = x.getOriginalCounterPart, m.getClones = x.getClones, m.checkClonesPosition = x.checkClonesPosition, m.getInitialSlideInInfiniteMode = x.getInitialSlideInInfiniteMode;
var $ = O;
m.getWidthFromDeviceType = $.getWidthFromDeviceType, m.getPartialVisibilityGutter = $.getPartialVisibilityGutter, m.getItemClientSideWidth = $.getItemClientSideWidth;
var P = y;
m.getInitialState = P.getInitialState, m.getIfSlideIsVisbile = P.getIfSlideIsVisbile, m.getTransformForCenterMode = P.getTransformForCenterMode, m.getTransformForPartialVsibile = P.getTransformForPartialVsibile, m.isInLeftEnd = P.isInLeftEnd, m.isInRightEnd = P.isInRightEnd, m.notEnoughChildren = P.notEnoughChildren, m.getSlidesToSlide = P.getSlidesToSlide;
var Pt = q;
m.throttle = Pt.default;
var Rt = ut;
m.throwError = Rt.default;
var _t = J;
m.populateNextSlides = _t.populateNextSlides;
var Ot = Q;
m.populatePreviousSlides = Ot.populatePreviousSlides;
var At = ht;
m.populateSlidesOnMouseTouchMove = At.populateSlidesOnMouseTouchMove;
var B = {}, Wt = j && j.__extends || /* @__PURE__ */ function() {
var o = function(i, t) {
return (o = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
e.__proto__ = r;
} || function(e, r) {
for (var s in r) r.hasOwnProperty(s) && (e[s] = r[s]);
})(i, t);
};
return function(i, t) {
function e() {
this.constructor = i;
}
o(i, t), i.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
};
}();
Object.defineProperty(B, "__esModule", { value: !0 });
var Dt = A;
function Lt(o) {
return "clientY" in o;
}
B.isMouseMoveEvent = Lt;
var xt = function(o) {
function i() {
return o !== null && o.apply(this, arguments) || this;
}
return Wt(i, o), i;
}(Dt.Component);
B.default = xt;
var Z = {}, H = {};
Object.defineProperty(H, "__esModule", { value: !0 });
var Vt = F, kt = y;
function jt(o, i, t, e) {
var r = {}, s = kt.getSlidesToSlide(i, t);
return Array(o).fill(0).forEach(function(a, n) {
var l = Vt.getOriginalCounterPart(n, i, e);
if (n === 0) r[0] = l;
else {
var u = r[n - 1] + s;
r[n] = u;
}
}), r;
}
H.getLookupTableForNextSlides = jt;
Object.defineProperty(Z, "__esModule", { value: !0 });
var D = A, Gt = F, Ft = H, it = y, Bt = function(o) {
var i = o.props, t = o.state, e = o.goToSlide, r = o.getState, s = i.showDots, a = i.customDot, n = i.dotListClass, l = i.infinite, u = i.children;
if (!s || it.notEnoughChildren(t)) return null;
var h, c = t.currentSlide, d = t.slidesToShow, p = it.getSlidesToSlide(t, i), f = D.Children.toArray(u);
h = l ? Math.ceil(f.length / p) : Math.ceil((f.length - d) / p) + 1;
var g = Ft.getLookupTableForNextSlides(h, t, i, f), w = Gt.getOriginalIndexLookupTableByClones(d, f), b = w[c];
return D.createElement("ul", { className: "react-multi-carousel-dot-list " + n }, Array(h).fill(0).map(function(C, S) {
var M, I;
if (l) {
I = g[S];
var _ = w[I];
M = b === _ || _ <= b && b < _ + p;
} else {
var W = f.length - d, L = S * p;
M = (I = W < L ? W : L) === c || I < c && c < I + p && c < f.length - d;
}
return a ? D.cloneElement(a, { index: S, active: M, key: S, onClick: function() {
return e(I);
}, carouselState: r() }) : D.createElement("li", { "data-index": S, key: S, className: "react-multi-carousel-dot " + (M ? "react-multi-carousel-dot--active" : "") }, D.createElement("button", { "aria-label": "Go to slide " + (S + 1), onClick: function() {
return e(I);
} }));
}));
};
Z.default = Bt;
var N = {};
Object.defineProperty(N, "__esModule", { value: !0 });
var G = A, Nt = function(o) {
var i = o.customLeftArrow, t = o.getState, e = o.previous, r = o.disabled, s = o.rtl;
if (i) return G.cloneElement(i, { onClick: function() {
return e();
}, carouselState: t(), disabled: r, rtl: s });
var a = s ? "rtl" : "";
return G.createElement("button", { "aria-label": "Go to previous slide", className: "react-multiple-carousel__arrow react-multiple-carousel__arrow--left " + a, onClick: function() {
return e();
}, type: "button", disabled: r });
};
N.LeftArrow = Nt;
var $t = function(o) {
var i = o.customRightArrow, t = o.getState, e = o.next, r = o.disabled, s = o.rtl;
if (i) return G.cloneElement(i, { onClick: function() {
return e();
}, carouselState: t(), disabled: r, rtl: s });
var a = s ? "rtl" : "";
return G.createElement("button", { "aria-label": "Go to next slide", className: "react-multiple-carousel__arrow react-multiple-carousel__arrow--right " + a, onClick: function() {
return e();
}, type: "button", disabled: r });
};
N.RightArrow = $t;
var tt = {};
Object.defineProperty(tt, "__esModule", { value: !0 });
var V = A, X = m, Xt = function(o) {
var i = o.props, t = o.state, e = o.goToSlide, r = o.clones, s = o.notEnoughChildren, a = t.itemWidth, n = i.children, l = i.infinite, u = i.itemClass, h = i.itemAriaLabel, c = i.partialVisbile, d = i.partialVisible, p = X.getInitialState(t, i), f = p.flexBisis, g = p.shouldRenderOnSSR, w = p.domFullyLoaded, b = p.partialVisibilityGutter;
return p.shouldRenderAtAll ? (c && console.warn('WARNING: Please correct props name: "partialVisible" as old typo will be removed in future versions!'), V.createElement(V.Fragment, null, (l ? r : V.Children.toArray(n)).map(function(C, S) {
return V.createElement("li", { key: S, "data-index": S, onClick: function() {
i.focusOnSelect && e(S);
}, "aria-hidden": X.getIfSlideIsVisbile(S, t) ? "false" : "true", "aria-label": h || (C.props.ariaLabel ? C.props.ariaLabel : null), style: { flex: g ? "1 0 " + f + "%" : "auto", position: "relative", width: w ? ((c || d) && b && !s ? a - b : a) + "px" : "auto" }, className: "react-multi-carousel-item " + (X.getIfSlideIsVisbile(S, t) ? "react-multi-carousel-item--active" : "") + " " + u }, C);
}))) : null;
};
tt.default = Xt;
var Yt = j && j.__extends || /* @__PURE__ */ function() {
var o = function(i, t) {
return (o = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
e.__proto__ = r;
} || function(e, r) {
for (var s in r) r.hasOwnProperty(s) && (e[s] = r[s]);
})(i, t);
};
return function(i, t) {
function e() {
this.constructor = i;
}
o(i, t), i.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
};
}();
Object.defineProperty(z, "__esModule", { value: !0 });
var T = A, v = m, R = B, Ut = Z, ot = N, zt = tt, k = y, E = 400, rt = "transform 400ms ease-in-out", Kt = function(o) {
function i(t) {
var e = o.call(this, t) || this;
return e.containerRef = T.createRef(), e.listRef = T.createRef(), e.state = { itemWidth: 0, slidesToShow: 0, currentSlide: 0, totalItems: T.Children.count(t.children), deviceType: "", domLoaded: !1, transform: 0, containerWidth: 0 }, e.onResize = e.onResize.bind(e), e.handleDown = e.handleDown.bind(e), e.handleMove = e.handleMove.bind(e), e.handleOut = e.handleOut.bind(e), e.onKeyUp = e.onKeyUp.bind(e), e.handleEnter = e.handleEnter.bind(e), e.setIsInThrottle = e.setIsInThrottle.bind(e), e.next = v.throttle(e.next.bind(e), t.transitionDuration || E, e.setIsInThrottle), e.previous = v.throttle(e.previous.bind(e), t.transitionDuration || E, e.setIsInThrottle), e.goToSlide = v.throttle(e.goToSlide.bind(e), t.transitionDuration || E, e.setIsInThrottle), e.onMove = !1, e.initialX = 0, e.lastX = 0, e.isAnimationAllowed = !1, e.direction = "", e.initialY = 0, e.isInThrottle = !1, e.transformPlaceHolder = 0, e;
}
return Yt(i, o), i.prototype.resetTotalItems = function() {
var t = this, e = T.Children.count(this.props.children), r = v.notEnoughChildren(this.state) ? 0 : Math.max(0, Math.min(this.state.currentSlide, e));
this.setState({ totalItems: e, currentSlide: r }, function() {
t.setContainerAndItemWidth(t.state.slidesToShow, !0);
});
}, i.prototype.setIsInThrottle = function(t) {
t === void 0 && (t = !1), this.isInThrottle = t;
}, i.prototype.setTransformDirectly = function(t, e) {
var r = this.props.additionalTransfrom;
this.transformPlaceHolder = t;
var s = k.getTransform(this.state, this.props, this.transformPlaceHolder);
this.listRef && this.listRef.current && (this.setAnimationDirectly(e), this.listRef.current.style.transform = "translate3d(" + (s + r) + "px,0,0)");
}, i.prototype.setAnimationDirectly = function(t) {
this.listRef && this.listRef.current && (this.listRef.current.style.transition = t ? this.props.customTransition || rt : "none");
}, i.prototype.componentDidMount = function() {
this.setState({ domLoaded: !0 }), this.setItemsToShow(), window.addEventListener("resize", this.onResize), this.onResize(!0), this.props.keyBoardControl && window.addEventListener("keyup", this.onKeyUp), this.props.autoPlay && (this.autoPlay = setInterval(this.next, this.props.autoPlaySpeed));
}, i.prototype.setClones = function(t, e, r, s) {
var a = this;
s === void 0 && (s = !1), this.isAnimationAllowed = !1;
var n = T.Children.toArray(this.props.children), l = v.getInitialSlideInInfiniteMode(t || this.state.slidesToShow, n), u = v.getClones(this.state.slidesToShow, n), h = n.length < this.state.slidesToShow ? 0 : this.state.currentSlide;
this.setState({ totalItems: u.length, currentSlide: r && !s ? h : l }, function() {
a.correctItemsPosition(e || a.state.itemWidth);
});
}, i.prototype.setItemsToShow = function(t, e) {
var r = this, s = this.props.responsive;
Object.keys(s).forEach(function(a) {
var n = s[a], l = n.breakpoint, u = n.items, h = l.max, c = l.min, d = [window.innerWidth];
window.screen && window.screen.width && d.push(window.screen.width);
var p = Math.min.apply(Math, d);
c <= p && p <= h && (r.setState({ slidesToShow: u, deviceType: a }), r.setContainerAndItemWidth(u, t, e));
});
}, i.prototype.setContainerAndItemWidth = function(t, e, r) {
var s = this;
if (this.containerRef && this.containerRef.current) {
var a = this.containerRef.current.offsetWidth, n = v.getItemClientSideWidth(this.props, t, a);
this.setState({ containerWidth: a, itemWidth: n }, function() {
s.props.infinite && s.setClones(t, n, e, r);
}), e && this.correctItemsPosition(n);
}
}, i.prototype.correctItemsPosition = function(t, e, r) {
e && (this.isAnimationAllowed = !0), !e && this.isAnimationAllowed && (this.isAnimationAllowed = !1);
var s = this.state.totalItems < this.state.slidesToShow ? 0 : -t * this.state.currentSlide;
r && this.setTransformDirectly(s, !0), this.setState({ transform: s });
}, i.prototype.onResize = function(t) {
var e;
e = !!this.props.infinite && (typeof t != "boolean" || !t), this.setItemsToShow(e);
}, i.prototype.componentDidUpdate = function(t, e) {
var r = this, s = t.keyBoardControl, a = t.autoPlay, n = t.children, l = e.containerWidth, u = e.domLoaded, h = e.currentSlide;
if (this.containerRef && this.containerRef.current && this.containerRef.current.offsetWidth !== l && (this.itemsToShowTimeout && clearTimeout(this.itemsToShowTimeout), this.itemsToShowTimeout = setTimeout(function() {
r.setItemsToShow(!0);
}, this.props.transitionDuration || E)), s && !this.props.keyBoardControl && window.removeEventListener("keyup", this.onKeyUp), !s && this.props.keyBoardControl && window.addEventListener("keyup", this.onKeyUp), a && !this.props.autoPlay && this.autoPlay && (clearInterval(this.autoPlay), this.autoPlay = void 0), a || !this.props.autoPlay || this.autoPlay || (this.autoPlay = setInterval(this.next, this.props.autoPlaySpeed)), n.length !== this.props.children.length ? i.clonesTimeout = setTimeout(function() {
r.props.infinite ? r.setClones(r.state.slidesToShow, r.state.itemWidth, !0, !0) : r.resetTotalItems();
}, this.props.transitionDuration || E) : this.props.infinite && this.state.currentSlide !== h && this.correctClonesPosition({ domLoaded: u }), this.transformPlaceHolder !== this.state.transform && (this.transformPlaceHolder = this.state.transform), this.props.autoPlay && this.props.rewind && !this.props.infinite && v.isInRightEnd(this.state)) {
var c = this.props.transitionDuration || E;
i.isInThrottleTimeout = setTimeout(function() {
r.setIsInThrottle(!1), r.resetAutoplayInterval(), r.goToSlide(0, void 0, !!r.props.rewindWithAnimation);
}, c + this.props.autoPlaySpeed);
}
}, i.prototype.correctClonesPosition = function(t) {
var e = this, r = t.domLoaded, s = T.Children.toArray(this.props.children), a = v.checkClonesPosition(this.state, s, this.props), n = a.isReachingTheEnd, l = a.isReachingTheStart, u = a.nextSlide, h = a.nextPosition;
this.state.domLoaded && r && (n || l) && (this.isAnimationAllowed = !1, i.transformTimeout = setTimeout(function() {
e.setState({ transform: h, currentSlide: u });
}, this.props.transitionDuration || E));
}, i.prototype.next = function(t) {
var e = this;
t === void 0 && (t = 0);
var r = this.props, s = r.afterChange, a = r.beforeChange;
if (!v.notEnoughChildren(this.state)) {
var n = v.populateNextSlides(this.state, this.props, t), l = n.nextSlides, u = n.nextPosition, h = this.state.currentSlide;
l !== void 0 && u !== void 0 && (typeof a == "function" && a(l, this.getState()), this.isAnimationAllowed = !0, this.props.shouldResetAutoplay && this.resetAutoplayInterval(), this.setState({ transform: u, currentSlide: l }, function() {
typeof s == "function" && (i.afterChangeTimeout = setTimeout(function() {
s(h, e.getState());
}, e.props.transitionDuration || E));
}));
}
}, i.prototype.previous = function(t) {
var e = this;
t === void 0 && (t = 0);
var r = this.props, s = r.afterChange, a = r.beforeChange;
if (!v.notEnoughChildren(this.state)) {
var n = v.populatePreviousSlides(this.state, this.props, t), l = n.nextSlides, u = n.nextPosition;
if (l !== void 0 && u !== void 0) {
var h = this.state.currentSlide;
typeof a == "function" && a(l, this.getState()), this.isAnimationAllowed = !0, this.props.shouldResetAutoplay && this.resetAutoplayInterval(), this.setState({ transform: u, currentSlide: l }, function() {
typeof s == "function" && (i.afterChangeTimeout2 = setTimeout(function() {
s(h, e.getState());
}, e.props.transitionDuration || E));
});
}
}
}, i.prototype.resetAutoplayInterval = function() {
this.props.autoPlay && (clearInterval(this.autoPlay), this.autoPlay = setInterval(this.next, this.props.autoPlaySpeed));
}, i.prototype.componentWillUnmount = function() {
window.removeEventListener("resize", this.onResize), this.props.keyBoardControl && window.removeEventListener("keyup", this.onKeyUp), this.props.autoPlay && this.autoPlay && (clearInterval(this.autoPlay), this.autoPlay = void 0), this.itemsToShowTimeout && clearTimeout(this.itemsToShowTimeout), i.clonesTimeout && clearTimeout(i.clonesTimeout), i.isInThrottleTimeout && clearTimeout(i.isInThrottleTimeout), i.transformTimeout && clearTimeout(i.transformTimeout), i.afterChangeTimeout && clearTimeout(i.afterChangeTimeout), i.afterChangeTimeout2 && clearTimeout(i.afterChangeTimeout2), i.afterChangeTimeout3 && clearTimeout(i.afterChangeTimeout3);
}, i.prototype.resetMoveStatus = function() {
this.onMove = !1, this.initialX = 0, this.lastX = 0, this.direction = "", this.initialY = 0;
}, i.prototype.getCords = function(t) {
var e = t.clientX, r = t.clientY;
return { clientX: k.parsePosition(this.props, e), clientY: k.parsePosition(this.props, r) };
}, i.prototype.handleDown = function(t) {
if (!(!R.isMouseMoveEvent(t) && !this.props.swipeable || R.isMouseMoveEvent(t) && !this.props.draggable || this.isInThrottle)) {
var e = this.getCords(R.isMouseMoveEvent(t) ? t : t.touches[0]), r = e.clientX, s = e.clientY;
this.onMove = !0, this.initialX = r, this.initialY = s, this.lastX = r, this.isAnimationAllowed = !1;
}
}, i.prototype.handleMove = function(t) {
if (!(!R.isMouseMoveEvent(t) && !this.props.swipeable || R.isMouseMoveEvent(t) && !this.props.draggable || v.notEnoughChildren(this.state))) {
var e = this.getCords(R.isMouseMoveEvent(t) ? t : t.touches[0]), r = e.clientX, s = e.clientY, a = this.initialX - r, n = this.initialY - s;
if (this.onMove) {
if (!(Math.abs(a) > Math.abs(n))) return;
var l = v.populateSlidesOnMouseTouchMove(this.state, this.props, this.initialX, this.lastX, r, this.transformPlaceHolder), u = l.direction, h = l.nextPosition, c = l.canContinue;
u && (this.direction = u, c && h !== void 0 && this.setTransformDirectly(h)), this.lastX = r;
}
}
}, i.prototype.handleOut = function(t) {
this.props.autoPlay && !this.autoPlay && (this.autoPlay = setInterval(this.next, this.props.autoPlaySpeed));
var e = t.type === "touchend" && !this.props.swipeable, r = (t.type === "mouseleave" || t.type === "mouseup") && !this.props.draggable;
if (!e && !r && this.onMove) {
if (this.setAnimationDirectly(!0), this.direction === "right") if (this.initialX - this.lastX >= this.props.minimumTouchDrag) {
var s = Math.round((this.initialX - this.lastX) / this.state.itemWidth);
this.next(s);
} else this.correctItemsPosition(this.state.itemWidth, !0, !0);
this.direction === "left" && (this.lastX - this.initialX > this.props.minimumTouchDrag ? (s = Math.round((this.lastX - this.initialX) / this.state.itemWidth), this.previous(s)) : this.correctItemsPosition(this.state.itemWidth, !0, !0)), this.resetMoveStatus();
}
}, i.prototype.isInViewport = function(t) {
var e = t.getBoundingClientRect(), r = e.top, s = r === void 0 ? 0 : r, a = e.left, n = a === void 0 ? 0 : a, l = e.bottom, u = l === void 0 ? 0 : l, h = e.right, c = h === void 0 ? 0 : h;
return 0 <= s && 0 <= n && u <= (window.innerHeight || document.documentElement.clientHeight) && c <= (window.innerWidth || document.documentElement.clientWidth);
}, i.prototype.isChildOfCarousel = function(t) {
return !!(t instanceof Element && this.listRef && this.listRef.current) && this.listRef.current.contains(t);
}, i.prototype.onKeyUp = function(t) {
var e = t.target;
switch (t.keyCode) {
case 37:
if (this.isChildOfCarousel(e)) return this.previous();
break;
case 39:
if (this.isChildOfCarousel(e)) return this.next();
break;
case 9:
if (this.isChildOfCarousel(e) && e instanceof HTMLInputElement && this.isInViewport(e)) return this.next();
}
}, i.prototype.handleEnter = function(t) {
R.isMouseMoveEvent(t) && this.autoPlay && this.props.autoPlay && this.props.pauseOnHover && (clearInterval(this.autoPlay), this.autoPlay = void 0);
}, i.prototype.goToSlide = function(t, e, r) {
var s = this;
if (r === void 0 && (r = !0), !this.isInThrottle) {
var a = this.state.itemWidth, n = this.props, l = n.afterChange, u = n.beforeChange, h = this.state.currentSlide;
typeof u != "function" || e && (typeof e != "object" || e.skipBeforeChange) || u(t, this.getState()), this.isAnimationAllowed = r, this.props.shouldResetAutoplay && this.resetAutoplayInterval(), this.setState({ currentSlide: t, transform: -a * t }, function() {
s.props.infinite && s.correctClonesPosition({ domLoaded: !0 }), typeof l != "function" || e && (typeof e != "object" || e.skipAfterChange) || (i.afterChangeTimeout3 = setTimeout(function() {
l(h, s.getState());
}, s.props.transitionDuration || E));
});
}
}, i.prototype.getState = function() {
return this.state;
}, i.prototype.renderLeftArrow = function(t) {
var e = this, r = this.props, s = r.customLeftArrow, a = r.rtl;
return T.createElement(ot.LeftArrow, { customLeftArrow: s, getState: function() {
return e.getState();
}, previous: this.previous, disabled: t, rtl: a });
}, i.prototype.renderRightArrow = function(t) {
var e = this, r = this.props, s = r.customRightArrow, a = r.rtl;
return T.createElement(ot.RightArrow, { customRightArrow: s, getState: function() {
return e.getState();
}, next: this.next, disabled: t, rtl: a });
}, i.prototype.renderButtonGroups = function() {
var t = this, e = this.props.customButtonGroup;
return e ? T.cloneElement(e, { previous: function() {
return t.previous();
}, next: function() {
return t.next();
}, goToSlide: function(r, s) {
return t.goToSlide(r, s);
}, carouselState: this.getState() }) : null;
}, i.prototype.renderDotsList = function() {
var t = this;
return T.createElement(Ut.default, { state: this.state, props: this.props, goToSlide: this.goToSlide, getState: function() {
return t.getState();
} });
}, i.prototype.renderCarouselItems = function() {
var t = [];
if (this.props.infinite) {
var e = T.Children.toArray(this.props.children);
t = v.getClones(this.state.slidesToShow, e);
}
return T.createElement(zt.default, { clones: t, goToSlide: this.goToSlide, state: this.state, notEnoughChildren: v.notEnoughChildren(this.state), props: this.props });
}, i.prototype.render = function() {
var t = this.props, e = t.deviceType, r = t.arrows, s = t.renderArrowsWhenDisabled, a = t.removeArrowOnDeviceType, n = t.infinite, l = t.containerClass, u = t.sliderClass, h = t.customTransition, c = t.additionalTransfrom, d = t.renderDotsOutside, p = t.renderButtonGroupOutside, f = t.className, g = t.rtl;
process.env.NODE_ENV !== "production" && v.throwError(this.state, this.props);
var w = v.getInitialState(this.state, this.props), b = w.shouldRenderOnSSR, C = w.shouldRenderAtAll, S = v.isInLeftEnd(this.state), M = v.isInRightEnd(this.state), I = r && !(a && (e && -1 < a.indexOf(e) || this.state.deviceType && -1 < a.indexOf(this.state.deviceType))) && !v.notEnoughChildren(this.state) && C, _ = !n && S, W = !n && M, L = k.getTransform(this.state, this.props);
return T.createElement(T.Fragment, null, T.createElement("div", { className: "react-multi-carousel-list " + l + " " + f, dir: g ? "rtl" : "ltr", ref: this.containerRef }, T.createElement("ul", { ref: this.listRef, className: "react-multi-carousel-track " + u, style: { transition: this.isAnimationAllowed ? h || rt : "none", overflow: b ? "hidden" : "unset", transform: "translate3d(" + (L + c) + "px,0,0)" }, onMouseMove: this.handleMove, onMouseDown: this.handleDown, onMouseUp: this.handleOut, onMouseEnter: this.handleEnter, onMouseLeave: this.handleOut, onTouchStart: this.handleDown, onTouchMove: this.handleMove, onTouchEnd: this.handleOut }, this.renderCarouselItems()), I && (!_ || s) && this.renderLeftArrow(_), I && (!W || s) && this.renderRightArrow(W), C && !p && this.renderButtonGroups(), C && !d && this.renderDotsList()), C && d && this.renderDotsList(), C && p && this.renderButtonGroups());
}, i.defaultProps = { slidesToSlide: 1, infinite: !1, draggable: !0, swipeable: !0, arrows: !0, renderArrowsWhenDisabled: !1, containerClass: "", sliderClass: "", itemClass: "", keyBoardControl: !0, autoPlaySpeed: 3e3, showDots: !1, renderDotsOutside: !1, renderButtonGroupOutside: !1, minimumTouchDrag: 80, className: "", dotListClass: "", focusOnSelect: !1, centerMode: !1, additionalTransfrom: 0, pauseOnHover: !0, shouldResetAutoplay: !0, rewind: !1, rtl: !1, rewindWithAnimation: !1 }, i;
}(T.Component);
z.default = Kt;
Object.defineProperty(U, "__esModule", { value: !0 });
var qt = z;
U.default = qt.default;
var Jt = U;
const Ht = /* @__PURE__ */ dt(Jt);
export {
Ht as C
};