Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

embla-carousel

Package Overview
Dependencies
Maintainers
1
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

embla-carousel - npm Package Compare versions

Comparing version 6.0.2 to 6.1.0

2

components/Axis.d.ts

@@ -11,3 +11,3 @@ import { DirectionOptionType } from './Direction';

};
export declare function Axis(axis: AxisOptionType, contentDirection: DirectionOptionType): AxisType;
export declare function Axis(axis: AxisOptionType, direction: DirectionOptionType): AxisType;
export {};
export declare type DirectionOptionType = 'ltr' | 'rtl';
export declare type DirectionType = {
applyTo: (n: number) => number;
apply: (n: number) => number;
};
export declare function Direction(direction: DirectionOptionType): DirectionType;
import { AxisOptionType, AxisType } from './Axis';
import { PxToPercentType } from './PxToPercent';
import { Vector1DType } from './Vector1d';
export declare type PointerEventType = TouchEvent | MouseEvent;
export declare type DragTrackerType = {
pointerDown: (evt: Event) => number;
pointerMove: (evt: Event) => number;
pointerUp: () => number;
readPoint: (evt: any, axis: AxisOptionType) => Vector1DType;
isTouchEvent: (evt: PointerEventType) => evt is TouchEvent;
pointerDown: (evt: PointerEventType) => number;
pointerMove: (evt: PointerEventType) => number;
pointerUp: (evt: PointerEventType) => number;
readPoint: (evt: PointerEventType, evtAxis?: AxisOptionType) => number;
};
export declare function DragTracker(axis: AxisType, pxToPercent: PxToPercentType): DragTrackerType;

@@ -45,3 +45,5 @@ import { AnimationType } from './Animation';

slideIndexes: number[];
containerRect: DOMRect;
slideRects: DOMRect[];
};
export declare function Engine(root: HTMLElement, container: HTMLElement, slides: HTMLElement[], options: OptionsType, events: EventEmitterType): Engine;

@@ -1,2 +0,2 @@

declare type EventHandlerType = EventListener | EventListenerObject | null;
declare type EventHandlerType = (evt: any) => void;
declare type EventOptionsType = boolean | AddEventListenerOptions | undefined;

@@ -3,0 +3,0 @@ export declare type EventStoreType = {

@@ -1,2 +0,3 @@

declare type SlideBoundType = {
import { LimitType } from './Limit';
export declare type SlideBoundType = {
start: number;

@@ -7,6 +8,5 @@ end: number;

export declare type SlidesInViewType = {
check: (location: number) => number[];
findSlideBounds: (offset: number, threshold?: number) => SlideBoundType[];
check: (location: number, bounds?: SlideBoundType[]) => number[];
findSlideBounds: (offsets?: number[], threshold?: number) => SlideBoundType[];
};
export declare function SlidesInView(viewSize: number, contentSize: number, slideSizes: number[], snaps: number[], loop: boolean, inViewThreshold: number): SlidesInViewType;
export {};
export declare function SlidesInView(viewSize: number, contentSize: number, slideSizes: number[], snaps: number[], limit: LimitType, loop: boolean, inViewThreshold: number): SlidesInViewType;
export declare function map(value: number, iStart: number, iStop: number, oStart: number, oStop: number): number;
export declare function mathAbs(n: number): number;
export declare function mathSign(n: number): number;

@@ -7,5 +8,5 @@ export declare function deltaAbs(valueB: number, valueA: number): number;

export declare function debounce(callback: () => void, time: number): () => void;
export declare function groupArray<GenericType>(array: GenericType[], size: number): GenericType[][];
export declare function arrayGroup<GenericType>(array: GenericType[], size: number): GenericType[][];
export declare function arrayKeys<GenericType>(array: GenericType[]): number[];
export declare function arrayLast<GenericType>(array: GenericType[]): GenericType;
export declare function lastIndex<GenericType>(array: GenericType[]): number;
export declare function arrayLastIndex<GenericType>(array: GenericType[]): number;

@@ -61,3 +61,3 @@ function Alignment(align, viewSize) {

function Axis(axis, contentDirection) {
function Axis(axis, direction) {
var scroll = axis === 'y' ? 'y' : 'x';

@@ -76,3 +76,3 @@ var cross = axis === 'y' ? 'x' : 'y';

if (scroll === 'y') return 'top';
return contentDirection === 'rtl' ? 'right' : 'left';
return direction === 'rtl' ? 'right' : 'left';
}

@@ -82,3 +82,3 @@

if (scroll === 'y') return 'bottom';
return contentDirection === 'rtl' ? 'left' : 'right';
return direction === 'rtl' ? 'left' : 'right';
}

@@ -96,4 +96,54 @@

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathAbs(n) {
return Math.abs(n);
}
function mathSign(n) {
return !n ? 0 : n / mathAbs(n);
}
function deltaAbs(valueB, valueA) {
return mathAbs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
var diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
return mathAbs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function arrayGroup(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[arrayLastIndex(array)];
}
function arrayLastIndex(array) {
return Math.max(0, array.length - 1);
}
function Limit(min, max) {
var length = Math.abs(min - max);
var length = mathAbs(min - max);

@@ -123,6 +173,6 @@ function reachedMin(n) {

var self = {
constrain: constrain,
length: length,
max: max,
min: min,
constrain: constrain,
reachedAny: reachedAny,

@@ -145,3 +195,3 @@ reachedMax: reachedMax,

function withinLimit(n) {
return !loop ? constrain(n) : Math.abs((loopEnd + n) % loopEnd);
return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
}

@@ -180,3 +230,3 @@

function applyTo(n) {
function apply(n) {
return n * sign;

@@ -186,3 +236,3 @@ }

var self = {
applyTo: applyTo
apply: apply
};

@@ -274,55 +324,5 @@ return self;

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathSign(n) {
return !n ? 0 : n / Math.abs(n);
}
function deltaAbs(valueB, valueA) {
return Math.abs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (Math.abs(valueB) <= Math.abs(valueA)) return 0;
var diff = deltaAbs(Math.abs(valueB), Math.abs(valueA));
return Math.abs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function groupArray(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[lastIndex(array)];
}
function lastIndex(array) {
return Math.max(0, array.length - 1);
}
function DragHandler(axis, direction, rootNode, target, dragFree, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps) {
var scrollAxis = axis.scroll,
crossAxis = axis.cross;
var crossAxis = axis.cross;
var focusNodes = ['INPUT', 'SELECT', 'TEXTAREA'];
var startScroll = Vector1D(0);
var startCross = Vector1D(0);
var dragStartPoint = Vector1D(0);

@@ -332,8 +332,8 @@ var activationEvents = EventStore();

var snapForceBoost = {
mouse: 2.5,
touch: 3.5
mouse: 300,
touch: 400
};
var freeForceBoost = {
mouse: 5,
touch: 7
mouse: 500,
touch: 600
};

@@ -343,2 +343,4 @@ var baseSpeed = dragFree ? 5 : 16;

var dragThreshold = 20;
var startScroll = 0;
var startCross = 0;
var pointerIsDown = false;

@@ -383,4 +385,4 @@ var preventScroll = false;

var baseForce = scrollTarget.byDistance(force, !dragFree).distance;
if (dragFree || Math.abs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.6;
if (dragFree || mathAbs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.4;
if (skipSnaps && targetChanged) return baseForce * 0.5;

@@ -403,4 +405,4 @@ return scrollTarget.byIndex(next.get(), 0).distance;

addInteractionEvents();
startScroll.set(dragTracker.readPoint(evt, scrollAxis));
startCross.set(dragTracker.readPoint(evt, crossAxis));
startScroll = dragTracker.readPoint(evt);
startCross = dragTracker.readPoint(evt, crossAxis);
events.emit('pointerDown');

@@ -413,9 +415,9 @@ if (clearPreventClick) preventClick = false;

if (!preventScroll && !isMouse) {
if (!evt.cancelable) return up();
var moveScroll = dragTracker.readPoint(evt, scrollAxis).get();
var moveCross = dragTracker.readPoint(evt, crossAxis).get();
var diffScroll = deltaAbs(moveScroll, startScroll.get());
var diffCross = deltaAbs(moveCross, startCross.get());
if (!evt.cancelable) return up(evt);
var lastScroll = dragTracker.readPoint(evt);
var lastCross = dragTracker.readPoint(evt, crossAxis);
var diffScroll = deltaAbs(lastScroll, startScroll);
var diffCross = deltaAbs(lastCross, startCross);
preventScroll = diffScroll > diffCross;
if (!preventScroll && !preventClick) return up();
if (!preventScroll && !preventClick) return up(evt);
}

@@ -426,15 +428,15 @@

animation.start();
target.add(direction.applyTo(diff));
target.add(direction.apply(diff));
evt.preventDefault();
}
function up() {
function up(evt) {
var currentLocation = scrollTarget.byDistance(0, false);
var targetChanged = currentLocation.index !== index.get();
var rawForce = dragTracker.pointerUp() * forceBoost();
var force = allowedForce(direction.applyTo(rawForce), targetChanged);
var rawForce = dragTracker.pointerUp(evt) * forceBoost();
var force = allowedForce(direction.apply(rawForce), targetChanged);
var forceFactor = factorAbs(rawForce, force);
var isMoving = deltaAbs(target.get(), dragStartPoint.get()) >= 0.5;
var isVigorous = targetChanged && forceFactor > 0.75;
var isBelowThreshold = Math.abs(rawForce) < dragThreshold;
var isBelowThreshold = mathAbs(rawForce) < dragThreshold;
var speed = isVigorous ? 10 : baseSpeed;

@@ -474,63 +476,45 @@ var mass = isVigorous ? baseMass + 2.5 * forceFactor : baseMass;

function DragTracker(axis, pxToPercent) {
var scrollAxis = axis.scroll;
var coords = {
x: 'clientX',
y: 'clientY'
};
var startDrag = Vector1D(0);
var diffDrag = Vector1D(0);
var lastDrag = Vector1D(0);
var pointValue = Vector1D(0);
var trackInterval = 10;
var trackLength = 5;
var trackTime = 100;
var trackPoints = [];
var lastMoveTime = new Date().getTime();
var isMouse = false;
var logInterval = 170;
var startEvent;
var lastEvent;
function readPoint(evt, type) {
isMouse = !evt.touches;
var c = coords[type];
var value = isMouse ? evt[c] : evt.touches[0][c];
return pointValue.set(value);
function isTouchEvent(evt) {
return typeof TouchEvent !== 'undefined' && evt instanceof TouchEvent;
}
function readTime(evt) {
return evt.timeStamp;
}
function readPoint(evt, evtAxis) {
var property = evtAxis || axis.scroll;
var coord = "client" + (property === 'x' ? 'X' : 'Y');
return (isTouchEvent(evt) ? evt.touches[0] : evt)[coord];
}
function pointerDown(evt) {
var point = readPoint(evt, scrollAxis);
startDrag.set(point);
lastDrag.set(point);
return pxToPercent.measure(startDrag.get());
startEvent = evt;
lastEvent = evt;
return pxToPercent.measure(readPoint(evt));
}
function pointerMove(evt) {
var point = readPoint(evt, scrollAxis);
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
if (diffTime >= trackInterval) {
if (diffTime >= trackTime) trackPoints = [];
trackPoints.push(point.get());
lastMoveTime = nowTime;
}
diffDrag.set(point).subtract(lastDrag);
lastDrag.set(point);
return pxToPercent.measure(diffDrag.get());
var diff = readPoint(evt) - readPoint(lastEvent);
var expired = readTime(evt) - readTime(startEvent) > logInterval;
lastEvent = evt;
if (expired) startEvent = evt;
return pxToPercent.measure(diff);
}
function pointerUp() {
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
var currentPoint = lastDrag.get();
var force = trackPoints.slice(-trackLength).map(function (trackPoint) {
return currentPoint - trackPoint;
}).sort(function (p1, p2) {
return Math.abs(p1) < Math.abs(p2) ? 1 : -1;
})[0];
lastDrag.set(diffTime > trackTime || !force ? 0 : force);
trackPoints = [];
return pxToPercent.measure(lastDrag.get());
function pointerUp(evt) {
var diffDrag = readPoint(lastEvent) - readPoint(startEvent);
var diffTime = readTime(evt) - readTime(startEvent);
var expired = readTime(evt) - readTime(lastEvent) > logInterval;
var force = diffDrag / diffTime;
var isFlick = diffTime && !expired && mathAbs(force) > 0.1;
return isFlick ? pxToPercent.measure(force) : 0;
}
var self = {
isTouchEvent: isTouchEvent,
pointerDown: pointerDown,

@@ -632,2 +616,4 @@ pointerMove: pointerMove,

var pullBackThreshold = 10;
var edgeOffsetTolerance = 50;
var maxFriction = 0.85;
var disabled = false;

@@ -644,7 +630,9 @@

if (!shouldConstrain()) return;
var friction = pointerDown ? 0.7 : 0.45;
var edge = limit.reachedMin(location.get()) ? 'min' : 'max';
var diffToEdge = mathAbs(limit[edge] - location.get());
var diffToTarget = target.get() - location.get();
var friction = Math.min(diffToEdge / edgeOffsetTolerance, maxFriction);
target.subtract(diffToTarget * friction);
if (!pointerDown && Math.abs(diffToTarget) < pullBackThreshold) {
if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
target.set(limit.constrain(target.get()));

@@ -763,5 +751,5 @@ scrollBody.useSpeed(10).useMass(3);

function measureSizes() {
return groupArray(slideRects, slidesToScroll).map(function (rects) {
return arrayGroup(slideRects, slidesToScroll).map(function (rects) {
return arrayLast(rects)[endEdge] - rects[0][startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -773,3 +761,3 @@

}).map(pxToPercent.measure).map(function (snap) {
return -Math.abs(snap);
return -mathAbs(snap);
});

@@ -779,3 +767,3 @@ }

function measureAligned() {
var groupedSnaps = groupArray(snaps, slidesToScroll).map(function (g) {
var groupedSnaps = arrayGroup(snaps, slidesToScroll).map(function (g) {
return g[0];

@@ -802,3 +790,3 @@ });

function minDistance(d1, d2) {
return Math.abs(d1) < Math.abs(d2) ? d1 : d2;
return mathAbs(d1) < mathAbs(d2) ? d1 : d2;
}

@@ -818,3 +806,3 @@

}).sort(function (d1, d2) {
return Math.abs(d1.diff) - Math.abs(d2.diff);
return mathAbs(d1.diff) - mathAbs(d2.diff);
});

@@ -835,3 +823,3 @@ var index = ascDiffsToSnaps[0].index;

var shortest = minDistance(t1, direction === 1 ? t2 : t3);
return Math.abs(shortest) * direction;
return mathAbs(shortest) * direction;
}

@@ -932,3 +920,3 @@

var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
var slideBounds = slidesInView.findSlideBounds([offset]);
return indexes.map(function (index) {

@@ -942,3 +930,3 @@ var initial = isStartEdge ? 0 : -contentSize;

var getTarget = function getTarget() {
var getTarget = function () {
return scrollLocation.get() > point ? initial : altered;

@@ -1008,23 +996,30 @@ };

function SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold) {
var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, offset) {
return a.concat(findSlideBounds(offset, threshold));
}, []);
function SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold) {
var removeOffset = limit.removeOffset,
constrain = limit.constrain;
var cachedThreshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var cachedOffsets = loop ? [0, contentSize, -contentSize] : [0];
var cachedBounds = findSlideBounds(cachedOffsets, cachedThreshold);
function findSlideBounds(offset, threshold) {
function findSlideBounds(offsets, threshold) {
var slideOffsets = offsets || cachedOffsets;
var slideThreshold = threshold || 0;
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
return s * slideThreshold;
});
return snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return slideOffsets.reduce(function (list, offset) {
var bounds = snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return list.concat(bounds);
}, []);
}
function check(location) {
function check(location, bounds) {
var limitedLocation = loop ? removeOffset(location) : constrain(location);
var slideBounds = bounds || cachedBounds;
return slideBounds.reduce(function (list, slideBound) {

@@ -1035,3 +1030,3 @@ var index = slideBound.index,

var inList = list.indexOf(index) !== -1;
var inView = start < location && end > location;
var inView = start < limitedLocation && end > limitedLocation;
return !inList && inView ? list.concat([index]) : list;

@@ -1058,3 +1053,3 @@ }, []);

return slideRects.map(function (rect, index, rects) {
var isLast = index === lastIndex(rects);
var isLast = index === arrayLastIndex(rects);
var style = window.getComputedStyle(arrayLast(slides));

@@ -1064,3 +1059,3 @@ var endGap = parseFloat(style.getPropertyValue("margin-" + endEdge));

return rects[index + 1][startEdge] - rect[startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -1076,4 +1071,4 @@

function Translate(axis, direction, container) {
var translate = axis.scroll === 'x' ? x : y;
var containerStyle = container.style;
var translate = axis.scroll === 'x' ? x : y;
var disabled = false;

@@ -1091,3 +1086,3 @@

if (disabled) return;
containerStyle.transform = translate(direction.applyTo(target.get()));
containerStyle.transform = translate(direction.apply(target.get()));
}

@@ -1149,7 +1144,7 @@

var index = Counter(lastIndex(scrollSnaps), startIndex, loop);
var index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
var indexPrevious = index.clone();
var slideIndexes = arrayKeys(slides); // Draw
var update = function update() {
var update = function () {
if (!loop) engine.scrollBounds.constrain(engine.dragHandler.pointerDown());

@@ -1185,3 +1180,3 @@ engine.scrollBody.seek(target).update();

var scrollTo = ScrollTo(animation, index, indexPrevious, scrollTarget, target, events);
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold); // DragHandler
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold); // DragHandler

@@ -1191,2 +1186,4 @@ var dragHandler = DragHandler(axis, direction, root, target, dragFree, DragTracker(axis, pxToPercent), location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps); // Slider

var engine = {
containerRect: containerRect,
slideRects: slideRects,
animation: animation,

@@ -1193,0 +1190,0 @@ axis: axis,

@@ -63,3 +63,3 @@ 'use strict';

function Axis(axis, contentDirection) {
function Axis(axis, direction) {
var scroll = axis === 'y' ? 'y' : 'x';

@@ -78,3 +78,3 @@ var cross = axis === 'y' ? 'x' : 'y';

if (scroll === 'y') return 'top';
return contentDirection === 'rtl' ? 'right' : 'left';
return direction === 'rtl' ? 'right' : 'left';
}

@@ -84,3 +84,3 @@

if (scroll === 'y') return 'bottom';
return contentDirection === 'rtl' ? 'left' : 'right';
return direction === 'rtl' ? 'left' : 'right';
}

@@ -98,4 +98,54 @@

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathAbs(n) {
return Math.abs(n);
}
function mathSign(n) {
return !n ? 0 : n / mathAbs(n);
}
function deltaAbs(valueB, valueA) {
return mathAbs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
var diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
return mathAbs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function arrayGroup(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[arrayLastIndex(array)];
}
function arrayLastIndex(array) {
return Math.max(0, array.length - 1);
}
function Limit(min, max) {
var length = Math.abs(min - max);
var length = mathAbs(min - max);

@@ -125,6 +175,6 @@ function reachedMin(n) {

var self = {
constrain: constrain,
length: length,
max: max,
min: min,
constrain: constrain,
reachedAny: reachedAny,

@@ -147,3 +197,3 @@ reachedMax: reachedMax,

function withinLimit(n) {
return !loop ? constrain(n) : Math.abs((loopEnd + n) % loopEnd);
return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
}

@@ -182,3 +232,3 @@

function applyTo(n) {
function apply(n) {
return n * sign;

@@ -188,3 +238,3 @@ }

var self = {
applyTo: applyTo
apply: apply
};

@@ -276,55 +326,5 @@ return self;

function map(value, iStart, iStop, oStart, oStop) {
return oStart + (oStop - oStart) * ((value - iStart) / (iStop - iStart));
}
function mathSign(n) {
return !n ? 0 : n / Math.abs(n);
}
function deltaAbs(valueB, valueA) {
return Math.abs(valueB - valueA);
}
function factorAbs(valueB, valueA) {
if (valueB === 0 || valueA === 0) return 0;
if (Math.abs(valueB) <= Math.abs(valueA)) return 0;
var diff = deltaAbs(Math.abs(valueB), Math.abs(valueA));
return Math.abs(diff / valueB);
}
function roundToDecimals(decimalPoints) {
var pow = Math.pow(10, decimalPoints);
return function (n) {
return Math.round(n * pow) / pow;
};
}
function debounce(callback, time) {
var timeout = 0;
return function () {
window.clearTimeout(timeout);
timeout = window.setTimeout(callback, time) || 0;
};
}
function groupArray(array, size) {
var groups = [];
for (var i = 0; i < array.length; i += size) {
groups.push(array.slice(i, i + size));
}
return groups;
}
function arrayKeys(array) {
return Object.keys(array).map(Number);
}
function arrayLast(array) {
return array[lastIndex(array)];
}
function lastIndex(array) {
return Math.max(0, array.length - 1);
}
function DragHandler(axis, direction, rootNode, target, dragFree, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps) {
var scrollAxis = axis.scroll,
crossAxis = axis.cross;
var crossAxis = axis.cross;
var focusNodes = ['INPUT', 'SELECT', 'TEXTAREA'];
var startScroll = Vector1D(0);
var startCross = Vector1D(0);
var dragStartPoint = Vector1D(0);

@@ -334,8 +334,8 @@ var activationEvents = EventStore();

var snapForceBoost = {
mouse: 2.5,
touch: 3.5
mouse: 300,
touch: 400
};
var freeForceBoost = {
mouse: 5,
touch: 7
mouse: 500,
touch: 600
};

@@ -345,2 +345,4 @@ var baseSpeed = dragFree ? 5 : 16;

var dragThreshold = 20;
var startScroll = 0;
var startCross = 0;
var pointerIsDown = false;

@@ -385,4 +387,4 @@ var preventScroll = false;

var baseForce = scrollTarget.byDistance(force, !dragFree).distance;
if (dragFree || Math.abs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.6;
if (dragFree || mathAbs(force) < dragThreshold) return baseForce;
if (!loop && isEdge) return baseForce * 0.4;
if (skipSnaps && targetChanged) return baseForce * 0.5;

@@ -405,4 +407,4 @@ return scrollTarget.byIndex(next.get(), 0).distance;

addInteractionEvents();
startScroll.set(dragTracker.readPoint(evt, scrollAxis));
startCross.set(dragTracker.readPoint(evt, crossAxis));
startScroll = dragTracker.readPoint(evt);
startCross = dragTracker.readPoint(evt, crossAxis);
events.emit('pointerDown');

@@ -415,9 +417,9 @@ if (clearPreventClick) preventClick = false;

if (!preventScroll && !isMouse) {
if (!evt.cancelable) return up();
var moveScroll = dragTracker.readPoint(evt, scrollAxis).get();
var moveCross = dragTracker.readPoint(evt, crossAxis).get();
var diffScroll = deltaAbs(moveScroll, startScroll.get());
var diffCross = deltaAbs(moveCross, startCross.get());
if (!evt.cancelable) return up(evt);
var lastScroll = dragTracker.readPoint(evt);
var lastCross = dragTracker.readPoint(evt, crossAxis);
var diffScroll = deltaAbs(lastScroll, startScroll);
var diffCross = deltaAbs(lastCross, startCross);
preventScroll = diffScroll > diffCross;
if (!preventScroll && !preventClick) return up();
if (!preventScroll && !preventClick) return up(evt);
}

@@ -428,15 +430,15 @@

animation.start();
target.add(direction.applyTo(diff));
target.add(direction.apply(diff));
evt.preventDefault();
}
function up() {
function up(evt) {
var currentLocation = scrollTarget.byDistance(0, false);
var targetChanged = currentLocation.index !== index.get();
var rawForce = dragTracker.pointerUp() * forceBoost();
var force = allowedForce(direction.applyTo(rawForce), targetChanged);
var rawForce = dragTracker.pointerUp(evt) * forceBoost();
var force = allowedForce(direction.apply(rawForce), targetChanged);
var forceFactor = factorAbs(rawForce, force);
var isMoving = deltaAbs(target.get(), dragStartPoint.get()) >= 0.5;
var isVigorous = targetChanged && forceFactor > 0.75;
var isBelowThreshold = Math.abs(rawForce) < dragThreshold;
var isBelowThreshold = mathAbs(rawForce) < dragThreshold;
var speed = isVigorous ? 10 : baseSpeed;

@@ -476,63 +478,45 @@ var mass = isVigorous ? baseMass + 2.5 * forceFactor : baseMass;

function DragTracker(axis, pxToPercent) {
var scrollAxis = axis.scroll;
var coords = {
x: 'clientX',
y: 'clientY'
};
var startDrag = Vector1D(0);
var diffDrag = Vector1D(0);
var lastDrag = Vector1D(0);
var pointValue = Vector1D(0);
var trackInterval = 10;
var trackLength = 5;
var trackTime = 100;
var trackPoints = [];
var lastMoveTime = new Date().getTime();
var isMouse = false;
var logInterval = 170;
var startEvent;
var lastEvent;
function readPoint(evt, type) {
isMouse = !evt.touches;
var c = coords[type];
var value = isMouse ? evt[c] : evt.touches[0][c];
return pointValue.set(value);
function isTouchEvent(evt) {
return typeof TouchEvent !== 'undefined' && evt instanceof TouchEvent;
}
function readTime(evt) {
return evt.timeStamp;
}
function readPoint(evt, evtAxis) {
var property = evtAxis || axis.scroll;
var coord = "client" + (property === 'x' ? 'X' : 'Y');
return (isTouchEvent(evt) ? evt.touches[0] : evt)[coord];
}
function pointerDown(evt) {
var point = readPoint(evt, scrollAxis);
startDrag.set(point);
lastDrag.set(point);
return pxToPercent.measure(startDrag.get());
startEvent = evt;
lastEvent = evt;
return pxToPercent.measure(readPoint(evt));
}
function pointerMove(evt) {
var point = readPoint(evt, scrollAxis);
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
if (diffTime >= trackInterval) {
if (diffTime >= trackTime) trackPoints = [];
trackPoints.push(point.get());
lastMoveTime = nowTime;
}
diffDrag.set(point).subtract(lastDrag);
lastDrag.set(point);
return pxToPercent.measure(diffDrag.get());
var diff = readPoint(evt) - readPoint(lastEvent);
var expired = readTime(evt) - readTime(startEvent) > logInterval;
lastEvent = evt;
if (expired) startEvent = evt;
return pxToPercent.measure(diff);
}
function pointerUp() {
var nowTime = new Date().getTime();
var diffTime = nowTime - lastMoveTime;
var currentPoint = lastDrag.get();
var force = trackPoints.slice(-trackLength).map(function (trackPoint) {
return currentPoint - trackPoint;
}).sort(function (p1, p2) {
return Math.abs(p1) < Math.abs(p2) ? 1 : -1;
})[0];
lastDrag.set(diffTime > trackTime || !force ? 0 : force);
trackPoints = [];
return pxToPercent.measure(lastDrag.get());
function pointerUp(evt) {
var diffDrag = readPoint(lastEvent) - readPoint(startEvent);
var diffTime = readTime(evt) - readTime(startEvent);
var expired = readTime(evt) - readTime(lastEvent) > logInterval;
var force = diffDrag / diffTime;
var isFlick = diffTime && !expired && mathAbs(force) > 0.1;
return isFlick ? pxToPercent.measure(force) : 0;
}
var self = {
isTouchEvent: isTouchEvent,
pointerDown: pointerDown,

@@ -634,2 +618,4 @@ pointerMove: pointerMove,

var pullBackThreshold = 10;
var edgeOffsetTolerance = 50;
var maxFriction = 0.85;
var disabled = false;

@@ -646,7 +632,9 @@

if (!shouldConstrain()) return;
var friction = pointerDown ? 0.7 : 0.45;
var edge = limit.reachedMin(location.get()) ? 'min' : 'max';
var diffToEdge = mathAbs(limit[edge] - location.get());
var diffToTarget = target.get() - location.get();
var friction = Math.min(diffToEdge / edgeOffsetTolerance, maxFriction);
target.subtract(diffToTarget * friction);
if (!pointerDown && Math.abs(diffToTarget) < pullBackThreshold) {
if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
target.set(limit.constrain(target.get()));

@@ -765,5 +753,5 @@ scrollBody.useSpeed(10).useMass(3);

function measureSizes() {
return groupArray(slideRects, slidesToScroll).map(function (rects) {
return arrayGroup(slideRects, slidesToScroll).map(function (rects) {
return arrayLast(rects)[endEdge] - rects[0][startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -775,3 +763,3 @@

}).map(pxToPercent.measure).map(function (snap) {
return -Math.abs(snap);
return -mathAbs(snap);
});

@@ -781,3 +769,3 @@ }

function measureAligned() {
var groupedSnaps = groupArray(snaps, slidesToScroll).map(function (g) {
var groupedSnaps = arrayGroup(snaps, slidesToScroll).map(function (g) {
return g[0];

@@ -804,3 +792,3 @@ });

function minDistance(d1, d2) {
return Math.abs(d1) < Math.abs(d2) ? d1 : d2;
return mathAbs(d1) < mathAbs(d2) ? d1 : d2;
}

@@ -820,3 +808,3 @@

}).sort(function (d1, d2) {
return Math.abs(d1.diff) - Math.abs(d2.diff);
return mathAbs(d1.diff) - mathAbs(d2.diff);
});

@@ -837,3 +825,3 @@ var index = ascDiffsToSnaps[0].index;

var shortest = minDistance(t1, direction === 1 ? t2 : t3);
return Math.abs(shortest) * direction;
return mathAbs(shortest) * direction;
}

@@ -934,3 +922,3 @@

var offset = isStartEdge ? -contentSize : contentSize;
var slideBounds = slidesInView.findSlideBounds(offset);
var slideBounds = slidesInView.findSlideBounds([offset]);
return indexes.map(function (index) {

@@ -944,3 +932,3 @@ var initial = isStartEdge ? 0 : -contentSize;

var getTarget = function getTarget() {
var getTarget = function () {
return scrollLocation.get() > point ? initial : altered;

@@ -1010,23 +998,30 @@ };

function SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold) {
var threshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var offsets = loop ? [0, contentSize, -contentSize] : [0];
var slideBounds = offsets.reduce(function (a, offset) {
return a.concat(findSlideBounds(offset, threshold));
}, []);
function SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold) {
var removeOffset = limit.removeOffset,
constrain = limit.constrain;
var cachedThreshold = Math.min(Math.max(inViewThreshold, 0.01), 0.99);
var cachedOffsets = loop ? [0, contentSize, -contentSize] : [0];
var cachedBounds = findSlideBounds(cachedOffsets, cachedThreshold);
function findSlideBounds(offset, threshold) {
function findSlideBounds(offsets, threshold) {
var slideOffsets = offsets || cachedOffsets;
var slideThreshold = threshold || 0;
var thresholds = slideSizes.map(function (s) {
return s * (threshold || 0);
return s * slideThreshold;
});
return snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return slideOffsets.reduce(function (list, offset) {
var bounds = snaps.map(function (snap, index) {
return {
start: snap - slideSizes[index] + thresholds[index] + offset,
end: snap + viewSize - thresholds[index] + offset,
index: index
};
});
return list.concat(bounds);
}, []);
}
function check(location) {
function check(location, bounds) {
var limitedLocation = loop ? removeOffset(location) : constrain(location);
var slideBounds = bounds || cachedBounds;
return slideBounds.reduce(function (list, slideBound) {

@@ -1037,3 +1032,3 @@ var index = slideBound.index,

var inList = list.indexOf(index) !== -1;
var inView = start < location && end > location;
var inView = start < limitedLocation && end > limitedLocation;
return !inList && inView ? list.concat([index]) : list;

@@ -1060,3 +1055,3 @@ }, []);

return slideRects.map(function (rect, index, rects) {
var isLast = index === lastIndex(rects);
var isLast = index === arrayLastIndex(rects);
var style = window.getComputedStyle(arrayLast(slides));

@@ -1066,3 +1061,3 @@ var endGap = parseFloat(style.getPropertyValue("margin-" + endEdge));

return rects[index + 1][startEdge] - rect[startEdge];
}).map(pxToPercent.measure).map(Math.abs);
}).map(pxToPercent.measure).map(mathAbs);
}

@@ -1078,4 +1073,4 @@

function Translate(axis, direction, container) {
var translate = axis.scroll === 'x' ? x : y;
var containerStyle = container.style;
var translate = axis.scroll === 'x' ? x : y;
var disabled = false;

@@ -1093,3 +1088,3 @@

if (disabled) return;
containerStyle.transform = translate(direction.applyTo(target.get()));
containerStyle.transform = translate(direction.apply(target.get()));
}

@@ -1151,7 +1146,7 @@

var index = Counter(lastIndex(scrollSnaps), startIndex, loop);
var index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
var indexPrevious = index.clone();
var slideIndexes = arrayKeys(slides); // Draw
var update = function update() {
var update = function () {
if (!loop) engine.scrollBounds.constrain(engine.dragHandler.pointerDown());

@@ -1187,3 +1182,3 @@ engine.scrollBody.seek(target).update();

var scrollTo = ScrollTo(animation, index, indexPrevious, scrollTarget, target, events);
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, loop, inViewThreshold); // DragHandler
var slidesInView = SlidesInView(viewSize, contentSize, slideSizes, snaps, limit, loop, inViewThreshold); // DragHandler

@@ -1193,2 +1188,4 @@ var dragHandler = DragHandler(axis, direction, root, target, dragFree, DragTracker(axis, pxToPercent), location, animation, scrollTo, scrollBody, scrollTarget, index, events, loop, skipSnaps); // Slider

var engine = {
containerRect: containerRect,
slideRects: slideRects,
animation: animation,

@@ -1195,0 +1192,0 @@ axis: axis,

@@ -1,1 +0,1 @@

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarousel=e()}(this,(function(){"use strict";function n(n,e){var t={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return e-n}return{measure:function(r){return"number"==typeof n?e*Number(n):t[n](r)}}}function e(n,e){var t=Math.abs(n-e);function r(e){return e<n}function o(n){return n>e}function i(n){return r(n)||o(n)}return{constrain:function(t){return i(t)?r(t)?n:e:t},length:t,max:e,min:n,reachedAny:i,reachedMax:o,reachedMin:r,removeOffset:function(n){return t?n-t*Math.ceil((n-e)/t):n}}}function t(n,r,o){var i=e(0,n),u=i.min,a=i.constrain,c=n+1,s=d(r);function d(n){return o?Math.abs((c+n)%c):a(n)}function f(){return s}function l(n){return s=d(n),p}var p={add:function(n){return l(f()+n)},clone:function(){return t(n,f(),o)},get:f,set:l,min:u,max:n};return p}function r(){var n=[];var e={add:function(t,r,o,i){return void 0===i&&(i=!1),t.addEventListener(r,o,i),n.push((function(){return t.removeEventListener(r,o,i)})),e},removeAll:function(){return n=n.filter((function(n){return n()})),e}};return e}function o(n){var e=n;function t(n){return e/=n,o}function r(n){return"number"==typeof n?n:n.get()}var o={add:function(n){return e+=r(n),o},divide:t,get:function(){return e},multiply:function(n){return e*=n,o},normalize:function(){return 0!==e&&t(e),o},set:function(n){return e=r(n),o},subtract:function(n){return e-=r(n),o}};return o}function i(n){return n?n/Math.abs(n):0}function u(n,e){return Math.abs(n-e)}function a(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function c(n){return Object.keys(n).map(Number)}function s(n){return n[d(n)]}function d(n){return Math.max(0,n.length-1)}function f(n,e,t,a,c,s,d,f,l,p,m,g,v,h,x){var b=n.scroll,y=n.cross,M=["INPUT","SELECT","TEXTAREA"],S=o(0),w=o(0),T=o(0),E=r(),A=r(),P={mouse:2.5,touch:3.5},B={mouse:5,touch:7},D=c?5:16,I=!1,O=!1,z=!1,L=!1;function k(n){if(!(L="mousedown"===n.type)||0===n.button){var e,r,o=u(a.get(),d.get())>=2,i=L||!o,c=(e=n.target,r=e.nodeName||"",!(M.indexOf(r)>-1)),f=o||L&&c;I=!0,s.pointerDown(n),T.set(a),a.set(d),p.useBaseMass().useSpeed(80),function(){var n=L?document:t;A.add(n,"touchmove",N).add(n,"touchend",C).add(n,"mousemove",N).add(n,"mouseup",C)}(),S.set(s.readPoint(n,b)),w.set(s.readPoint(n,y)),v.emit("pointerDown"),i&&(z=!1),f&&n.preventDefault()}}function N(n){if(!O&&!L){if(!n.cancelable)return C();var t=s.readPoint(n,b).get(),r=s.readPoint(n,y).get(),o=u(t,S.get()),i=u(r,w.get());if(!(O=o>i)&&!z)return C()}var c=s.pointerMove(n);!z&&c&&(z=!0),f.start(),a.add(e.applyTo(c)),n.preventDefault()}function C(){var n=m.byDistance(0,!1).index!==g.get(),t=s.pointerUp()*(c?B:P)[L?"mouse":"touch"],r=function(n,e){var t=g.clone().add(-1*i(n)),r=t.get()===g.min||t.get()===g.max,o=m.byDistance(n,!c).distance;return c||Math.abs(n)<20?o:!h&&r?.6*o:x&&e?.5*o:m.byIndex(t.get(),0).distance}(e.applyTo(t),n),o=function(n,e){if(0===n||0===e)return 0;if(Math.abs(n)<=Math.abs(e))return 0;var t=u(Math.abs(n),Math.abs(e));return Math.abs(t/n)}(t,r),d=u(a.get(),T.get())>=.5,f=n&&o>.75,b=Math.abs(t)<20,y=f?10:D,M=f?1+2.5*o:1;d&&!L&&(z=!0),O=!1,I=!1,A.removeAll(),p.useSpeed(b?9:y).useMass(M),l.distance(r,!c),L=!1,v.emit("pointerUp")}function j(n){z&&n.preventDefault()}return{addActivationEvents:function(){var n=t;E.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",k).add(n,"mousedown",k).add(n,"touchcancel",C).add(n,"contextmenu",C).add(n,"click",j)},clickAllowed:function(){return!z},pointerDown:function(){return I},removeAllEvents:function(){E.removeAll(),A.removeAll()}}}function l(n,e,t){var r,u,a=(r=2,u=Math.pow(10,r),function(n){return Math.round(n*u)/u}),c=o(0),s=o(0),d=o(0),f=0,l=e,p=t;function m(n){return l=n,v}function g(n){return p=n,v}var v={direction:function(){return f},seek:function(e){d.set(e).subtract(n);var t,r,o,u,a=(t=d.get(),(o=0)+(t-(r=0))/(100-r)*(l-o));return f=i(d.get()),d.normalize().multiply(a).subtract(c),(u=d).divide(p),s.add(u),v},settle:function(e){var t=e.get()-n.get(),r=!a(t);return r&&n.set(e),r},update:function(){c.add(s),n.add(c),s.multiply(0)},useBaseMass:function(){return g(t)},useBaseSpeed:function(){return m(e)},useMass:g,useSpeed:m};return v}function p(n,e,t,r){var o=!1;return{constrain:function(i){if(!o&&n.reachedAny(t.get())&&n.reachedAny(e.get())){var u=i?.7:.45,a=t.get()-e.get();t.subtract(a*u),!i&&Math.abs(a)<10&&(t.set(n.constrain(t.get())),r.useSpeed(10).useMass(3))}},toggleActive:function(n){o=!n}}}function m(n,t,r,o,i){var u=e(-t+n,r[0]),a=o.map(u.constrain);return{snapsContained:function(){if(t<=n)return[u.max];if("keepSnaps"===i)return a;var r=function(){var n=a[0],t=s(a),r=a.lastIndexOf(n),o=a.indexOf(t)+1;return e(r,o)}(),o=r.min,c=r.max;return a.slice(o,c)}()}}function g(n,t,r,o,i){var u=e(r.min+t.measure(.1),r.max+t.measure(.1)),a=u.reachedMin,c=u.reachedMax;return{loop:function(e){if(function(n){return 1===n?c(o.get()):-1===n&&a(o.get())}(e)){var t=n*(-1*e);i.forEach((function(n){return n.add(t)}))}}}}function v(n){var e=n.max,t=n.length;return{get:function(n){return(n-e)/-t}}}function h(n,e,t,r,o,i){var u,c,d=n.startEdge,f=n.endEdge,l=o.map((function(n){return r[d]-n[d]})).map(t.measure).map((function(n){return-Math.abs(n)})),p=(u=a(l,i).map((function(n){return n[0]})),c=a(o,i).map((function(n){return s(n)[f]-n[0][d]})).map(t.measure).map(Math.abs).map(e.measure),u.map((function(n,e){return n+c[e]})));return{snaps:l,snapsAligned:p}}function x(n,e,t,r,o){var i=r.reachedAny,u=r.removeOffset,a=r.constrain;function c(n,e){return Math.abs(n)<Math.abs(e)?n:e}function s(e,r){var o=e,i=e+t,u=e-t;if(!n)return o;if(!r)return c(c(o,i),u);var a=c(o,1===r?i:u);return Math.abs(a)*r}return{byDistance:function(t,r){var c=o.get()+t,d=function(t){var r=n?u(t):a(t);return{index:e.map((function(n){return n-r})).map((function(n){return s(n,0)})).map((function(n,e){return{diff:n,index:e}})).sort((function(n,e){return Math.abs(n.diff)-Math.abs(e.diff)}))[0].index,distance:r}}(c),f=d.index,l=d.distance,p=!n&&i(c);return!r||p?{index:f,distance:t}:{index:f,distance:t+s(e[f]-l,0)}},byIndex:function(n,t){return{index:n,distance:s(e[n]-o.get(),t)}},shortcut:s}}function b(n,e,t,r,o,i,u,a){var s,d=c(r),f=c(r).reverse(),l=(s=o[0]-1,g(m(f,s),"end")).concat(function(){var n=e-o[0]-1;return g(m(d,n),"start")}());function p(n,e){return n.reduce((function(n,e){return n-r[e]}),e)}function m(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function g(n,e){var r="start"===e,o=r?-t:t,a=i.findSlideBounds(o);return n.map((function(n){var e=r?0:-t,o=r?t:0,i=a.filter((function(e){return e.index===n}))[0][r?"end":"start"];return{point:i,getTarget:function(){return u.get()>i?e:o},index:n,location:-1}}))}return{canLoop:function(){return l.every((function(n){var t=n.index;return p(d.filter((function(n){return n!==t})),e)<=0}))},clear:function(){l.forEach((function(e){var t=e.index;a[t].style[n.startEdge]=""}))},loop:function(){l.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(a[o].style[n.startEdge]=i+"%",e.location=i)}))},loopPoints:l}}function y(n,e,t){var r=t.style,o="x"===n.scroll?function(n){return"translate3d("+n+"%,0px,0px)"}:function(n){return"translate3d(0px,"+n+"%,0px)"},i=!1;return{clear:function(){r.transform=""},to:function(n){i||(r.transform=o(e.applyTo(n.get())))},toggleActive:function(n){i=!n}}}function M(i,u,a,M,S){var w,T=M.align,E=M.axis,A=M.direction,P=M.startIndex,B=M.inViewThreshold,D=M.loop,I=M.speed,O=M.dragFree,z=M.slidesToScroll,L=M.skipSnaps,k=M.containScroll,N=u.getBoundingClientRect(),C=a.map((function(n){return n.getBoundingClientRect()})),j=function(n){var e="rtl"===n?-1:1;return{applyTo:function(n){return n*e}}}(A),V=function(n,e){var t="y"===n?"y":"x";return{scroll:t,cross:"y"===n?"x":"y",startEdge:"y"===t?"top":"rtl"===e?"right":"left",endEdge:"y"===t?"bottom":"rtl"===e?"left":"right",measureSize:function(n){var e=n.width,r=n.height;return"x"===t?e:r}}}(E,A),H=(w=V.measureSize(N),{measure:function(n){return 0===w?0:n/w*100},totalPercent:100}),F=H.totalPercent,R=n(T,F),U=function(n,e,t,r,o){var i=n.measureSize,u=n.startEdge,a=n.endEdge,c=r.map(i);return{slideSizes:c.map(e.measure),slideSizesWithGaps:r.map((function(n,e,r){var i=e===d(r),f=window.getComputedStyle(s(t)),l=parseFloat(f.getPropertyValue("margin-"+a));return i?c[e]+(o?l:0):r[e+1][u]-n[u]})).map(e.measure).map(Math.abs)}}(V,H,a,C,D),G=U.slideSizes,W=U.slideSizesWithGaps,X=h(V,R,H,N,C,z),q=X.snaps,J=X.snapsAligned,Y=-s(q)+s(W),K=m(F,Y,q,J,k).snapsContained,Q=!D&&""!==k?K:J,Z=function(n,t,r){var o,i;return{limit:(o=t[0],i=s(t),e(r?o-n:i,o))}}(Y,Q,D).limit,$=t(d(Q),P,D),_=$.clone(),nn=c(a),en=function(n){var e=0;function t(n,t){return function(){n===!!e&&t()}}function r(){e=window.requestAnimationFrame(n)}return{proceed:t(!0,r),start:t(!1,r),stop:t(!0,(function(){window.cancelAnimationFrame(e),e=0}))}}((function(){D||dn.scrollBounds.constrain(dn.dragHandler.pointerDown()),dn.scrollBody.seek(on).update();var n=dn.scrollBody.settle(on);n&&!dn.dragHandler.pointerDown()&&(dn.animation.stop(),S.emit("settle")),n||S.emit("scroll"),D&&(dn.scrollLooper.loop(dn.scrollBody.direction()),dn.slideLooper.loop()),dn.translate.to(rn),dn.animation.proceed()})),tn=Q[$.get()],rn=o(tn),on=o(tn),un=l(rn,I,1),an=x(D,Q,Y,Z,on),cn=function(n,e,t,r,o,i){function u(r){var u=r.distance,a=r.index!==e.get();u&&(n.start(),o.add(u)),a&&(t.set(e.get()),e.set(r.index),i.emit("select"))}return{distance:function(n,e){u(r.byDistance(n,e))},index:function(n,t){var o=e.clone().set(n);u(r.byIndex(o.get(),t))}}}(en,$,_,an,on,S),sn=function(n,e,t,r,o,i){var u=Math.min(Math.max(i,.01),.99),a=(o?[0,e,-e]:[0]).reduce((function(n,e){return n.concat(c(e,u))}),[]);function c(e,o){var i=t.map((function(n){return n*(o||0)}));return r.map((function(r,o){return{start:r-t[o]+i[o]+e,end:r+n-i[o]+e,index:o}}))}return{check:function(n){return a.reduce((function(e,t){var r=t.index,o=t.start,i=t.end;return-1===e.indexOf(r)&&o<n&&i>n?e.concat([r]):e}),[])},findSlideBounds:c}}(F,Y,G,q,D,B),dn={animation:en,axis:V,direction:j,dragHandler:f(V,j,i,on,O,function(n,e){var t=n.scroll,r={x:"clientX",y:"clientY"},i=o(0),u=o(0),a=o(0),c=o(0),s=[],d=(new Date).getTime(),f=!1;function l(n,e){f=!n.touches;var t=r[e],o=f?n[t]:n.touches[0][t];return c.set(o)}return{pointerDown:function(n){var r=l(n,t);return i.set(r),a.set(r),e.measure(i.get())},pointerMove:function(n){var r=l(n,t),o=(new Date).getTime(),i=o-d;return i>=10&&(i>=100&&(s=[]),s.push(r.get()),d=o),u.set(r).subtract(a),a.set(r),e.measure(u.get())},pointerUp:function(){var n=(new Date).getTime()-d,t=a.get(),r=s.slice(-5).map((function(n){return t-n})).sort((function(n,e){return Math.abs(n)<Math.abs(e)?1:-1}))[0];return a.set(n>100||!r?0:r),s=[],e.measure(a.get())},readPoint:l}}(V,H),rn,en,cn,un,an,$,S,D,L),eventStore:r(),pxToPercent:H,index:$,indexPrevious:_,limit:Z,location:rn,options:M,scrollBody:un,scrollBounds:p(Z,rn,on,un),scrollLooper:g(Y,H,Z,rn,[rn,on]),scrollProgress:v(Z),scrollSnaps:Q,scrollTarget:an,scrollTo:cn,slideLooper:b(V,F,Y,W,Q,sn,rn,a),slidesInView:sn,slideIndexes:nn,target:on,translate:y(V,j,u)};return dn}var S={align:"center",axis:"x",containScroll:"",direction:"ltr",dragFree:!1,draggable:!0,inViewThreshold:0,loop:!1,skipSnaps:!1,slidesToScroll:1,speed:10,startIndex:0};return function(n,e,t){var r,o,i,u,a,c,s,d,f,l=function(){var n={};function e(e){return n[e]||[]}var t={emit:function(n){return e(n).forEach((function(e){return e(n)})),t},off:function(r,o){return n[r]=e(r).filter((function(n){return n!==o})),t},on:function(r,o){return n[r]=e(r).concat([o]),t}};return t}(),p=(r=function(){if(h){var n=u.axis.measureSize(s.getBoundingClientRect());y!==n&&E(),l.emit("resize")}},o=500,i=0,function(){window.clearTimeout(i),i=window.setTimeout(r,o)||0}),m=E,g=l.on,v=l.off,h=!1,x=Object.assign({},S),b=Object.assign({},x),y=0;function w(){var e,t="container"in n&&n.container,r="slides"in n&&n.slides;s="root"in n?n.root:n,d=t||s.children[0],f=r||[].slice.call(d.children),e=getComputedStyle(s,":before").content,a={get:function(){try{return JSON.parse(e.slice(1,-1).replace(/\\/g,""))}catch(n){}return{}}}}function T(n,e){if(w(),x=Object.assign({},x,n),b=Object.assign({},x,a.get()),c=Object.assign([],e),(u=M(s,d,f,b,l)).eventStore.add(window,"resize",p),u.translate.to(u.location),y=u.axis.measureSize(s.getBoundingClientRect()),c.forEach((function(n){return n.init(I)})),b.loop){if(!u.slideLooper.canLoop())return A(),T({loop:!1},e);u.slideLooper.loop()}b.draggable&&d.offsetParent&&f.length&&u.dragHandler.addActivationEvents(),h||(setTimeout((function(){return l.emit("init")}),0),h=!0)}function E(n,e){if(h){var t=D(),r=Object.assign({startIndex:t},n);A(),T(r,e||c),l.emit("reInit")}}function A(){u.dragHandler.removeAllEvents(),u.animation.stop(),u.eventStore.removeAll(),u.translate.clear(),u.slideLooper.clear(),c.forEach((function(n){return n.destroy()}))}function P(n){var e=u[n?"target":"location"].get(),t=b.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function B(n,e,t){u.scrollBody.useBaseMass().useSpeed(e?100:b.speed),h&&u.scrollTo.index(n,t||0)}function D(){return u.index.get()}var I={canScrollNext:function(){return u.index.clone().add(1).get()!==D()},canScrollPrev:function(){return u.index.clone().add(-1).get()!==D()},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return d},internalEngine:function(){return u},destroy:function(){h&&(A(),h=!1,l.emit("destroy"))},off:v,on:g,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:m,rootNode:function(){return s},scrollNext:function(n){B(u.index.clone().add(1).get(),!0===n,-1)},scrollPrev:function(n){B(u.index.clone().add(-1).get(),!0===n,1)},scrollProgress:function(){return u.scrollProgress.get(u.location.get())},scrollSnapList:function(){return u.scrollSnaps.map(u.scrollProgress.get)},scrollTo:B,selectedScrollSnap:D,slideNodes:function(){return f},slidesInView:P,slidesNotInView:function(n){var e=P(n);return u.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}};return T(e,t),I}}));
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n="undefined"!=typeof globalThis?globalThis:n||self).EmblaCarousel=e()}(this,(function(){"use strict";function n(n,e){var t={start:function(){return 0},center:function(n){return r(n)/2},end:r};function r(n){return e-n}return{measure:function(r){return"number"==typeof n?e*Number(n):t[n](r)}}}function e(n){return Math.abs(n)}function t(n){return n?n/e(n):0}function r(n,t){return e(n-t)}function o(n,e){for(var t=[],r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function i(n){return Object.keys(n).map(Number)}function u(n){return n[c(n)]}function c(n){return Math.max(0,n.length-1)}function a(n,t){var r=e(n-t);function o(e){return e<n}function i(n){return n>t}function u(n){return o(n)||i(n)}return{length:r,max:t,min:n,constrain:function(e){return u(e)?o(e)?n:t:e},reachedAny:u,reachedMax:i,reachedMin:o,removeOffset:function(n){return r?n-r*Math.ceil((n-t)/r):n}}}function s(n,t,r){var o=a(0,n),i=o.min,u=o.constrain,c=n+1,d=f(t);function f(n){return r?e((c+n)%c):u(n)}function l(){return d}function p(n){return d=f(n),m}var m={add:function(n){return p(l()+n)},clone:function(){return s(n,l(),r)},get:l,set:p,min:i,max:n};return m}function d(){var n=[];var e={add:function(t,r,o,i){return void 0===i&&(i=!1),t.addEventListener(r,o,i),n.push((function(){return t.removeEventListener(r,o,i)})),e},removeAll:function(){return n=n.filter((function(n){return n()})),e}};return e}function f(n){var e=n;function t(n){return e/=n,o}function r(n){return"number"==typeof n?n:n.get()}var o={add:function(n){return e+=r(n),o},divide:t,get:function(){return e},multiply:function(n){return e*=n,o},normalize:function(){return 0!==e&&t(e),o},set:function(n){return e=r(n),o},subtract:function(n){return e-=r(n),o}};return o}function l(n,o,i,u,c,a,s,l,p,m,v,g,x,h,y){var S=n.cross,b=["INPUT","SELECT","TEXTAREA"],w=f(0),E=d(),A=d(),T={mouse:300,touch:400},M={mouse:500,touch:600},P=c?5:16,B=0,O=0,I=!1,z=!1,D=!1,L=!1;function k(n){if(!(L="mousedown"===n.type)||0===n.button){var e,t,o=r(u.get(),s.get())>=2,c=L||!o,d=(e=n.target,t=e.nodeName||"",!(b.indexOf(t)>-1)),f=o||L&&d;I=!0,a.pointerDown(n),w.set(u),u.set(s),m.useBaseMass().useSpeed(80),function(){var n=L?document:i;A.add(n,"touchmove",N).add(n,"touchend",C).add(n,"mousemove",N).add(n,"mouseup",C)}(),B=a.readPoint(n),O=a.readPoint(n,S),x.emit("pointerDown"),c&&(D=!1),f&&n.preventDefault()}}function N(n){if(!z&&!L){if(!n.cancelable)return C(n);var e=a.readPoint(n),t=a.readPoint(n,S),i=r(e,B),c=r(t,O);if(!(z=i>c)&&!D)return C(n)}var s=a.pointerMove(n);!D&&s&&(D=!0),l.start(),u.add(o.apply(s)),n.preventDefault()}function C(n){var i=v.byDistance(0,!1).index!==g.get(),s=a.pointerUp(n)*(c?M:T)[L?"mouse":"touch"],d=function(n,r){var o=g.clone().add(-1*t(n)),i=o.get()===g.min||o.get()===g.max,u=v.byDistance(n,!c).distance;return c||e(n)<20?u:!h&&i?.4*u:y&&r?.5*u:v.byIndex(o.get(),0).distance}(o.apply(s),i),f=function(n,t){if(0===n||0===t)return 0;if(e(n)<=e(t))return 0;var o=r(e(n),e(t));return e(o/n)}(s,d),l=r(u.get(),w.get())>=.5,S=i&&f>.75,b=e(s)<20,E=S?10:P,B=S?1+2.5*f:1;l&&!L&&(D=!0),z=!1,I=!1,A.removeAll(),m.useSpeed(b?9:E).useMass(B),p.distance(d,!c),L=!1,x.emit("pointerUp")}function j(n){D&&n.preventDefault()}return{addActivationEvents:function(){var n=i;E.add(n,"touchmove",(function(){})).add(n,"touchend",(function(){})).add(n,"touchstart",k).add(n,"mousedown",k).add(n,"touchcancel",C).add(n,"contextmenu",C).add(n,"click",j)},clickAllowed:function(){return!D},pointerDown:function(){return I},removeAllEvents:function(){E.removeAll(),A.removeAll()}}}function p(n,e,r){var o,i,u=(o=2,i=Math.pow(10,o),function(n){return Math.round(n*i)/i}),c=f(0),a=f(0),s=f(0),d=0,l=e,p=r;function m(n){return l=n,g}function v(n){return p=n,g}var g={direction:function(){return d},seek:function(e){s.set(e).subtract(n);var r,o,i,u,f=(r=s.get(),(i=0)+(r-(o=0))/(100-o)*(l-i));return d=t(s.get()),s.normalize().multiply(f).subtract(c),(u=s).divide(p),a.add(u),g},settle:function(e){var t=e.get()-n.get(),r=!u(t);return r&&n.set(e),r},update:function(){c.add(a),n.add(c),a.multiply(0)},useBaseMass:function(){return v(r)},useBaseSpeed:function(){return m(e)},useMass:v,useSpeed:m};return g}function m(n,t,r,o){var i=!1;return{constrain:function(u){if(!i&&n.reachedAny(r.get())&&n.reachedAny(t.get())){var c=n.reachedMin(t.get())?"min":"max",a=e(n[c]-t.get()),s=r.get()-t.get(),d=Math.min(a/50,.85);r.subtract(s*d),!u&&e(s)<10&&(r.set(n.constrain(r.get())),o.useSpeed(10).useMass(3))}},toggleActive:function(n){i=!n}}}function v(n,e,t,r,o){var i=a(-e+n,t[0]),c=r.map(i.constrain);return{snapsContained:function(){if(e<=n)return[i.max];if("keepSnaps"===o)return c;var t=function(){var n=c[0],e=u(c),t=c.lastIndexOf(n),r=c.indexOf(e)+1;return a(t,r)}(),r=t.min,s=t.max;return c.slice(r,s)}()}}function g(n,e,t,r,o){var i=a(t.min+e.measure(.1),t.max+e.measure(.1)),u=i.reachedMin,c=i.reachedMax;return{loop:function(e){if(function(n){return 1===n?c(r.get()):-1===n&&u(r.get())}(e)){var t=n*(-1*e);o.forEach((function(n){return n.add(t)}))}}}}function x(n){var e=n.max,t=n.length;return{get:function(n){return(n-e)/-t}}}function h(n,t,r,i,c,a){var s,d,f=n.startEdge,l=n.endEdge,p=c.map((function(n){return i[f]-n[f]})).map(r.measure).map((function(n){return-e(n)})),m=(s=o(p,a).map((function(n){return n[0]})),d=o(c,a).map((function(n){return u(n)[l]-n[0][f]})).map(r.measure).map(e).map(t.measure),s.map((function(n,e){return n+d[e]})));return{snaps:p,snapsAligned:m}}function y(n,t,r,o,i){var u=o.reachedAny,c=o.removeOffset,a=o.constrain;function s(n,t){return e(n)<e(t)?n:t}function d(t,o){var i=t,u=t+r,c=t-r;return n?o?e(s(i,1===o?u:c))*o:s(s(i,u),c):i}return{byDistance:function(r,o){var s=i.get()+r,f=function(r){var o=n?c(r):a(r);return{index:t.map((function(n){return n-o})).map((function(n){return d(n,0)})).map((function(n,e){return{diff:n,index:e}})).sort((function(n,t){return e(n.diff)-e(t.diff)}))[0].index,distance:o}}(s),l=f.index,p=f.distance,m=!n&&u(s);return!o||m?{index:l,distance:r}:{index:l,distance:r+d(t[l]-p,0)}},byIndex:function(n,e){return{index:n,distance:d(t[n]-i.get(),e)}},shortcut:d}}function S(n,e,t,r,o,u,c,a){var s,d=i(r),f=i(r).reverse(),l=(s=o[0]-1,v(m(f,s),"end")).concat(function(){var n=e-o[0]-1;return v(m(d,n),"start")}());function p(n,e){return n.reduce((function(n,e){return n-r[e]}),e)}function m(n,e){return n.reduce((function(n,t){return p(n,e)>0?n.concat([t]):n}),[])}function v(n,e){var r="start"===e,o=r?-t:t,i=u.findSlideBounds([o]);return n.map((function(n){var e=r?0:-t,o=r?t:0,u=i.filter((function(e){return e.index===n}))[0][r?"end":"start"];return{point:u,getTarget:function(){return c.get()>u?e:o},index:n,location:-1}}))}return{canLoop:function(){return l.every((function(n){var t=n.index;return p(d.filter((function(n){return n!==t})),e)<=0}))},clear:function(){l.forEach((function(e){var t=e.index;a[t].style[n.startEdge]=""}))},loop:function(){l.forEach((function(e){var t=e.getTarget,r=e.location,o=e.index,i=t();i!==r&&(a[o].style[n.startEdge]=i+"%",e.location=i)}))},loopPoints:l}}function b(n,e,t){var r="x"===n.scroll?function(n){return"translate3d("+n+"%,0px,0px)"}:function(n){return"translate3d(0px,"+n+"%,0px)"},o=t.style,i=!1;return{clear:function(){o.transform=""},to:function(n){i||(o.transform=r(e.apply(n.get())))},toggleActive:function(n){i=!n}}}function w(t,r,o,w,E){var A,T=w.align,M=w.axis,P=w.direction,B=w.startIndex,O=w.inViewThreshold,I=w.loop,z=w.speed,D=w.dragFree,L=w.slidesToScroll,k=w.skipSnaps,N=w.containScroll,C=r.getBoundingClientRect(),j=o.map((function(n){return n.getBoundingClientRect()})),R=function(n){var e="rtl"===n?-1:1;return{apply:function(n){return n*e}}}(P),V=function(n,e){var t="y"===n?"y":"x";return{scroll:t,cross:"y"===n?"x":"y",startEdge:"y"===t?"top":"rtl"===e?"right":"left",endEdge:"y"===t?"bottom":"rtl"===e?"left":"right",measureSize:function(n){var e=n.width,r=n.height;return"x"===t?e:r}}}(M,P),H=(A=V.measureSize(C),{measure:function(n){return 0===A?0:n/A*100},totalPercent:100}),F=H.totalPercent,U=n(T,F),G=function(n,t,r,o,i){var a=n.measureSize,s=n.startEdge,d=n.endEdge,f=o.map(a);return{slideSizes:f.map(t.measure),slideSizesWithGaps:o.map((function(n,e,t){var o=e===c(t),a=window.getComputedStyle(u(r)),l=parseFloat(a.getPropertyValue("margin-"+d));return o?f[e]+(i?l:0):t[e+1][s]-n[s]})).map(t.measure).map(e)}}(V,H,o,j,I),W=G.slideSizes,X=G.slideSizesWithGaps,q=h(V,U,H,C,j,L),J=q.snaps,Y=q.snapsAligned,K=-u(J)+u(X),Q=v(F,K,J,Y,N).snapsContained,Z=!I&&""!==N?Q:Y,$=function(n,e,t){var r,o;return{limit:(r=e[0],o=u(e),a(t?r-n:o,r))}}(K,Z,I).limit,_=s(c(Z),B,I),nn=_.clone(),en=i(o),tn=function(n){var e=0;function t(n,t){return function(){n===!!e&&t()}}function r(){e=window.requestAnimationFrame(n)}return{proceed:t(!0,r),start:t(!1,r),stop:t(!0,(function(){window.cancelAnimationFrame(e),e=0}))}}((function(){I||fn.scrollBounds.constrain(fn.dragHandler.pointerDown()),fn.scrollBody.seek(un).update();var n=fn.scrollBody.settle(un);n&&!fn.dragHandler.pointerDown()&&(fn.animation.stop(),E.emit("settle")),n||E.emit("scroll"),I&&(fn.scrollLooper.loop(fn.scrollBody.direction()),fn.slideLooper.loop()),fn.translate.to(on),fn.animation.proceed()})),rn=Z[_.get()],on=f(rn),un=f(rn),cn=p(on,z,1),an=y(I,Z,K,$,un),sn=function(n,e,t,r,o,i){function u(r){var u=r.distance,c=r.index!==e.get();u&&(n.start(),o.add(u)),c&&(t.set(e.get()),e.set(r.index),i.emit("select"))}return{distance:function(n,e){u(r.byDistance(n,e))},index:function(n,t){var o=e.clone().set(n);u(r.byIndex(o.get(),t))}}}(tn,_,nn,an,un,E),dn=function(n,e,t,r,o,i,u){var c=o.removeOffset,a=o.constrain,s=Math.min(Math.max(u,.01),.99),d=i?[0,e,-e]:[0],f=l(d,s);function l(e,o){var i=e||d,u=o||0,c=t.map((function(n){return n*u}));return i.reduce((function(e,o){var i=r.map((function(e,r){return{start:e-t[r]+c[r]+o,end:e+n-c[r]+o,index:r}}));return e.concat(i)}),[])}return{check:function(n,e){var t=i?c(n):a(n);return(e||f).reduce((function(n,e){var r=e.index,o=e.start,i=e.end;return-1===n.indexOf(r)&&o<t&&i>t?n.concat([r]):n}),[])},findSlideBounds:l}}(F,K,W,J,$,I,O),fn={containerRect:C,slideRects:j,animation:tn,axis:V,direction:R,dragHandler:l(V,R,t,un,D,function(n,t){var r,o;function i(n){return"undefined"!=typeof TouchEvent&&n instanceof TouchEvent}function u(n){return n.timeStamp}function c(e,t){var r="client"+("x"===(t||n.scroll)?"X":"Y");return(i(e)?e.touches[0]:e)[r]}return{isTouchEvent:i,pointerDown:function(n){return r=n,o=n,t.measure(c(n))},pointerMove:function(n){var e=c(n)-c(o),i=u(n)-u(r)>170;return o=n,i&&(r=n),t.measure(e)},pointerUp:function(n){var i=c(o)-c(r),a=u(n)-u(r),s=u(n)-u(o)>170,d=i/a;return a&&!s&&e(d)>.1?t.measure(d):0},readPoint:c}}(V,H),on,tn,sn,cn,an,_,E,I,k),eventStore:d(),pxToPercent:H,index:_,indexPrevious:nn,limit:$,location:on,options:w,scrollBody:cn,scrollBounds:m($,on,un,cn),scrollLooper:g(K,H,$,on,[on,un]),scrollProgress:x($),scrollSnaps:Z,scrollTarget:an,scrollTo:sn,slideLooper:S(V,F,K,X,Z,dn,on,o),slidesInView:dn,slideIndexes:en,target:un,translate:b(V,R,r)};return fn}var E={align:"center",axis:"x",containScroll:"",direction:"ltr",dragFree:!1,draggable:!0,inViewThreshold:0,loop:!1,skipSnaps:!1,slidesToScroll:1,speed:10,startIndex:0};return function(n,e,t){var r,o,i,u,c,a,s,d,f,l=function(){var n={};function e(e){return n[e]||[]}var t={emit:function(n){return e(n).forEach((function(e){return e(n)})),t},off:function(r,o){return n[r]=e(r).filter((function(n){return n!==o})),t},on:function(r,o){return n[r]=e(r).concat([o]),t}};return t}(),p=(r=function(){if(x){var n=u.axis.measureSize(s.getBoundingClientRect());S!==n&&T(),l.emit("resize")}},o=500,i=0,function(){window.clearTimeout(i),i=window.setTimeout(r,o)||0}),m=T,v=l.on,g=l.off,x=!1,h=Object.assign({},E),y=Object.assign({},h),S=0;function b(){var e,t="container"in n&&n.container,r="slides"in n&&n.slides;s="root"in n?n.root:n,d=t||s.children[0],f=r||[].slice.call(d.children),e=getComputedStyle(s,":before").content,c={get:function(){try{return JSON.parse(e.slice(1,-1).replace(/\\/g,""))}catch(n){}return{}}}}function A(n,e){if(b(),h=Object.assign({},h,n),y=Object.assign({},h,c.get()),a=Object.assign([],e),(u=w(s,d,f,y,l)).eventStore.add(window,"resize",p),u.translate.to(u.location),S=u.axis.measureSize(s.getBoundingClientRect()),a.forEach((function(n){return n.init(I)})),y.loop){if(!u.slideLooper.canLoop())return M(),A({loop:!1},e);u.slideLooper.loop()}y.draggable&&d.offsetParent&&f.length&&u.dragHandler.addActivationEvents(),x||(setTimeout((function(){return l.emit("init")}),0),x=!0)}function T(n,e){if(x){var t=O(),r=Object.assign({startIndex:t},n);M(),A(r,e||a),l.emit("reInit")}}function M(){u.dragHandler.removeAllEvents(),u.animation.stop(),u.eventStore.removeAll(),u.translate.clear(),u.slideLooper.clear(),a.forEach((function(n){return n.destroy()}))}function P(n){var e=u[n?"target":"location"].get(),t=y.loop?"removeOffset":"constrain";return u.slidesInView.check(u.limit[t](e))}function B(n,e,t){u.scrollBody.useBaseMass().useSpeed(e?100:y.speed),x&&u.scrollTo.index(n,t||0)}function O(){return u.index.get()}var I={canScrollNext:function(){return u.index.clone().add(1).get()!==O()},canScrollPrev:function(){return u.index.clone().add(-1).get()!==O()},clickAllowed:function(){return u.dragHandler.clickAllowed()},containerNode:function(){return d},internalEngine:function(){return u},destroy:function(){x&&(M(),x=!1,l.emit("destroy"))},off:g,on:v,previousScrollSnap:function(){return u.indexPrevious.get()},reInit:m,rootNode:function(){return s},scrollNext:function(n){B(u.index.clone().add(1).get(),!0===n,-1)},scrollPrev:function(n){B(u.index.clone().add(-1).get(),!0===n,1)},scrollProgress:function(){return u.scrollProgress.get(u.location.get())},scrollSnapList:function(){return u.scrollSnaps.map(u.scrollProgress.get)},scrollTo:B,selectedScrollSnap:O,slideNodes:function(){return f},slidesInView:P,slidesNotInView:function(n){var e=P(n);return u.slideIndexes.filter((function(n){return-1===e.indexOf(n)}))}};return A(e,t),I}}));
{
"name": "embla-carousel",
"version": "6.0.2",
"version": "6.1.0",
"author": "David Cetinkaya",

@@ -44,7 +44,2 @@ "description": "A lightweight carousel library with fluid motion and great swipe precision",

"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.22",

@@ -59,4 +54,2 @@ "@typescript-eslint/eslint-plugin": "^4.22.0",

"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.5",

@@ -63,0 +56,0 @@ "typescript": "^4.2.4"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc