glide-react 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2043 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Dots: () => Dots,
34
+ Glide: () => Glide,
35
+ NextArrow: () => NextArrow,
36
+ PrevArrow: () => PrevArrow,
37
+ Track: () => Track,
38
+ calculateSlideWidth: () => calculateSlideWidth,
39
+ canGoNext: () => canGoNext,
40
+ canGoPrev: () => canGoPrev,
41
+ canUseDOM: () => canUseDOM,
42
+ clamp: () => clamp,
43
+ default: () => index_default,
44
+ getHeight: () => getHeight,
45
+ getOnDemandLazySlides: () => getOnDemandLazySlides,
46
+ getPostClones: () => getPostClones,
47
+ getPreClones: () => getPreClones,
48
+ getSlideClasses: () => getSlideClasses,
49
+ getSwipeDirection: () => getSwipeDirection,
50
+ getTotalSlides: () => getTotalSlides,
51
+ getTrackAnimateCSS: () => getTrackAnimateCSS,
52
+ getTrackCSS: () => getTrackCSS,
53
+ getTrackLeft: () => getTrackLeft,
54
+ getWidth: () => getWidth,
55
+ keyHandler: () => keyHandler,
56
+ lazyEndIndex: () => lazyEndIndex,
57
+ lazySlidesOnLeft: () => lazySlidesOnLeft,
58
+ lazySlidesOnRight: () => lazySlidesOnRight,
59
+ lazyStartIndex: () => lazyStartIndex,
60
+ safePreventDefault: () => safePreventDefault,
61
+ swipeEnd: () => swipeEnd,
62
+ swipeMove: () => swipeMove,
63
+ swipeStart: () => swipeStart,
64
+ useTrack: () => useTrack
65
+ });
66
+ module.exports = __toCommonJS(index_exports);
67
+ var import_react5 = __toESM(require("react"));
68
+
69
+ // src/types.ts
70
+ var defaultSettings = {
71
+ accessibility: true,
72
+ adaptiveHeight: false,
73
+ arrows: true,
74
+ autoplay: false,
75
+ autoplaySpeed: 3e3,
76
+ centerMode: false,
77
+ centerPadding: "50px",
78
+ className: "",
79
+ cssEase: "ease",
80
+ dots: false,
81
+ dotsClass: "glide-dots",
82
+ draggable: true,
83
+ easing: "linear",
84
+ edgeFriction: 0.35,
85
+ fade: false,
86
+ focusOnSelect: false,
87
+ infinite: true,
88
+ initialSlide: 0,
89
+ lazyLoad: null,
90
+ pauseOnDotsHover: false,
91
+ pauseOnFocus: false,
92
+ pauseOnHover: true,
93
+ responsive: null,
94
+ rows: 1,
95
+ rtl: false,
96
+ slide: "div",
97
+ slidesPerRow: 1,
98
+ slidesToScroll: 1,
99
+ slidesToShow: 1,
100
+ speed: 500,
101
+ swipe: true,
102
+ swipeToSlide: false,
103
+ touchMove: true,
104
+ touchThreshold: 5,
105
+ useCSS: true,
106
+ useTransform: true,
107
+ variableWidth: false,
108
+ vertical: false,
109
+ verticalSwiping: false,
110
+ waitForAnimate: true,
111
+ disabled: false
112
+ };
113
+
114
+ // src/components/Track.tsx
115
+ var import_react = require("react");
116
+
117
+ // src/utils/slideUtils.ts
118
+ var canUseDOM = () => !!(typeof window !== "undefined" && window.document && window.document.createElement);
119
+ var getWidth = (elem) => elem && elem.offsetWidth || 0;
120
+ var getHeight = (elem) => elem && elem.offsetHeight || 0;
121
+ function clamp(number, lowerBound, upperBound) {
122
+ return Math.max(lowerBound, Math.min(number, upperBound));
123
+ }
124
+ var getPreClones = (spec) => {
125
+ if (spec.disabled || !spec.infinite) {
126
+ return 0;
127
+ }
128
+ if (spec.variableWidth) {
129
+ return spec.slideCount || 0;
130
+ }
131
+ return (spec.slidesToShow || 1) + (spec.centerMode ? 1 : 0);
132
+ };
133
+ var getPostClones = (spec) => {
134
+ if (spec.disabled || !spec.infinite) {
135
+ return 0;
136
+ }
137
+ if (spec.variableWidth) {
138
+ return spec.slideCount || 0;
139
+ }
140
+ return (spec.slidesToShow || 1) + (spec.centerMode ? 1 : 0);
141
+ };
142
+ var getTotalSlides = (spec) => {
143
+ if (spec.slideCount === 1) {
144
+ return 1;
145
+ }
146
+ return getPreClones(spec) + (spec.slideCount || 0) + getPostClones(spec);
147
+ };
148
+ var canGoNext = (spec) => {
149
+ if (spec.infinite) {
150
+ return true;
151
+ }
152
+ const currentSlide = spec.currentSlide || 0;
153
+ const slideCount = spec.slideCount || 0;
154
+ const slidesToShow = spec.slidesToShow || 1;
155
+ if (spec.centerMode && currentSlide >= slideCount - 1) {
156
+ return false;
157
+ }
158
+ if (slideCount <= slidesToShow || currentSlide >= slideCount - slidesToShow) {
159
+ return false;
160
+ }
161
+ return true;
162
+ };
163
+ var canGoPrev = (spec) => {
164
+ if (spec.infinite) {
165
+ return true;
166
+ }
167
+ const currentSlide = spec.currentSlide || 0;
168
+ if (currentSlide <= 0) {
169
+ return false;
170
+ }
171
+ return true;
172
+ };
173
+ var getSwipeDirection = (touchObject, verticalSwiping = false) => {
174
+ const xDist = touchObject.startX - touchObject.curX;
175
+ const yDist = touchObject.startY - touchObject.curY;
176
+ const r = Math.atan2(yDist, xDist);
177
+ let swipeAngle = Math.round(r * 180 / Math.PI);
178
+ if (swipeAngle < 0) {
179
+ swipeAngle = 360 - Math.abs(swipeAngle);
180
+ }
181
+ if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
182
+ return "left";
183
+ }
184
+ if (swipeAngle >= 135 && swipeAngle <= 225) {
185
+ return "right";
186
+ }
187
+ if (verticalSwiping) {
188
+ if (swipeAngle >= 35 && swipeAngle <= 135) {
189
+ return "up";
190
+ }
191
+ return "down";
192
+ }
193
+ return "vertical";
194
+ };
195
+ var safePreventDefault = (event) => {
196
+ const passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
197
+ const reactEvent = event;
198
+ if (reactEvent._reactName && !passiveEvents.includes(reactEvent._reactName)) {
199
+ event.preventDefault();
200
+ } else if (!reactEvent._reactName) {
201
+ try {
202
+ event.preventDefault();
203
+ } catch {
204
+ }
205
+ }
206
+ };
207
+ var swipeStart = (e, swipe, draggable) => {
208
+ if (e.target.tagName === "IMG") {
209
+ safePreventDefault(e);
210
+ }
211
+ if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) {
212
+ return null;
213
+ }
214
+ const touches = "touches" in e ? e.touches : null;
215
+ return {
216
+ dragging: true,
217
+ touchObject: {
218
+ startX: touches ? touches[0].pageX : e.clientX,
219
+ startY: touches ? touches[0].pageY : e.clientY,
220
+ curX: touches ? touches[0].pageX : e.clientX,
221
+ curY: touches ? touches[0].pageY : e.clientY
222
+ }
223
+ };
224
+ };
225
+ var swipeMove = (e, spec) => {
226
+ const {
227
+ scrolling,
228
+ animating,
229
+ vertical,
230
+ swipeToSlide,
231
+ verticalSwiping,
232
+ rtl,
233
+ currentSlide,
234
+ edgeFriction,
235
+ edgeDragged,
236
+ onEdge,
237
+ swiped,
238
+ swiping,
239
+ slideCount,
240
+ slidesToScroll,
241
+ infinite,
242
+ touchObject,
243
+ swipeEvent,
244
+ listHeight,
245
+ listWidth
246
+ } = spec;
247
+ if (scrolling) return null;
248
+ if (animating) {
249
+ safePreventDefault(e);
250
+ return null;
251
+ }
252
+ if (vertical && swipeToSlide && verticalSwiping) {
253
+ safePreventDefault(e);
254
+ }
255
+ const touches = "touches" in e ? e.touches : null;
256
+ const newTouchObject = {
257
+ ...touchObject,
258
+ curX: touches ? touches[0].pageX : e.clientX,
259
+ curY: touches ? touches[0].pageY : e.clientY
260
+ };
261
+ newTouchObject.swipeLength = Math.round(
262
+ Math.sqrt(Math.pow(newTouchObject.curX - newTouchObject.startX, 2))
263
+ );
264
+ const verticalSwipeLength = Math.round(
265
+ Math.sqrt(Math.pow(newTouchObject.curY - newTouchObject.startY, 2))
266
+ );
267
+ if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
268
+ return { scrolling: true };
269
+ }
270
+ if (verticalSwiping) {
271
+ newTouchObject.swipeLength = verticalSwipeLength;
272
+ }
273
+ let positionOffset = (!rtl ? 1 : -1) * (newTouchObject.curX > newTouchObject.startX ? 1 : -1);
274
+ if (verticalSwiping) {
275
+ positionOffset = newTouchObject.curY > newTouchObject.startY ? 1 : -1;
276
+ }
277
+ const dotCount = Math.ceil(slideCount / slidesToScroll);
278
+ const swipeDirection = getSwipeDirection(newTouchObject, verticalSwiping);
279
+ let touchSwipeLength = newTouchObject.swipeLength;
280
+ const state = {};
281
+ if (!infinite) {
282
+ if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
283
+ touchSwipeLength = newTouchObject.swipeLength * edgeFriction;
284
+ if (edgeDragged === false && onEdge) {
285
+ onEdge(swipeDirection);
286
+ state.edgeDragged = true;
287
+ }
288
+ }
289
+ }
290
+ if (!swiped && swipeEvent) {
291
+ swipeEvent(swipeDirection);
292
+ state.swiped = true;
293
+ }
294
+ const curLeft = getTrackLeft({
295
+ ...spec,
296
+ slideIndex: currentSlide
297
+ });
298
+ let swipeLeft;
299
+ if (!vertical) {
300
+ if (!rtl) {
301
+ swipeLeft = curLeft + touchSwipeLength * positionOffset;
302
+ } else {
303
+ swipeLeft = curLeft - touchSwipeLength * positionOffset;
304
+ }
305
+ } else {
306
+ swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
307
+ }
308
+ if (verticalSwiping) {
309
+ swipeLeft = curLeft + touchSwipeLength * positionOffset;
310
+ }
311
+ const trackStyle = getTrackCSS({
312
+ ...spec,
313
+ left: swipeLeft
314
+ });
315
+ if (Math.abs(newTouchObject.curX - newTouchObject.startX) < Math.abs(newTouchObject.curY - newTouchObject.startY) * 0.8) {
316
+ return {
317
+ ...state,
318
+ touchObject: newTouchObject,
319
+ swipeLeft,
320
+ trackStyle
321
+ };
322
+ }
323
+ if (newTouchObject.swipeLength > 10) {
324
+ state.swiping = true;
325
+ safePreventDefault(e);
326
+ }
327
+ return {
328
+ ...state,
329
+ touchObject: newTouchObject,
330
+ swipeLeft,
331
+ trackStyle
332
+ };
333
+ };
334
+ var swipeEnd = (e, spec) => {
335
+ const {
336
+ dragging,
337
+ swipe,
338
+ touchObject,
339
+ listWidth,
340
+ touchThreshold,
341
+ verticalSwiping,
342
+ listHeight,
343
+ swipeToSlide,
344
+ scrolling,
345
+ onSwipe,
346
+ currentSlide,
347
+ infinite
348
+ } = spec;
349
+ const emptyTouchObject = { startX: 0, startY: 0, curX: 0, curY: 0 };
350
+ const state = {
351
+ dragging: false,
352
+ edgeDragged: false,
353
+ scrolling: false,
354
+ swiping: false,
355
+ swiped: false,
356
+ swipeLeft: null,
357
+ touchObject: emptyTouchObject
358
+ };
359
+ if (!dragging) {
360
+ if (swipe) safePreventDefault(e);
361
+ return state;
362
+ }
363
+ if (scrolling) {
364
+ return state;
365
+ }
366
+ if (!touchObject.swipeLength) {
367
+ return state;
368
+ }
369
+ const minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
370
+ const swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
371
+ if (touchObject.swipeLength > minSwipe) {
372
+ safePreventDefault(e);
373
+ if (onSwipe) {
374
+ onSwipe(swipeDirection);
375
+ }
376
+ let newSlide;
377
+ const activeSlide = infinite ? currentSlide : spec.targetSlide;
378
+ const slideCount = getSlideCount(spec);
379
+ switch (swipeDirection) {
380
+ case "left":
381
+ case "up":
382
+ newSlide = activeSlide + slideCount;
383
+ if (swipeToSlide) {
384
+ newSlide = checkNavigable(spec, newSlide);
385
+ }
386
+ state.triggerSlideHandler = newSlide;
387
+ state.currentDirection = 0;
388
+ break;
389
+ case "right":
390
+ case "down":
391
+ newSlide = activeSlide - slideCount;
392
+ if (swipeToSlide) {
393
+ newSlide = checkNavigable(spec, newSlide);
394
+ }
395
+ state.triggerSlideHandler = newSlide;
396
+ state.currentDirection = 1;
397
+ break;
398
+ default:
399
+ state.triggerSlideHandler = activeSlide;
400
+ }
401
+ } else {
402
+ const currentLeft = getTrackLeft({
403
+ ...spec,
404
+ slideIndex: currentSlide
405
+ });
406
+ state.trackStyle = getTrackAnimateCSS({
407
+ ...spec,
408
+ left: currentLeft
409
+ });
410
+ }
411
+ return state;
412
+ };
413
+ var getSlideCount = (spec) => {
414
+ if (spec.swipeToSlide) {
415
+ return 1;
416
+ }
417
+ return spec.slidesToScroll;
418
+ };
419
+ var getNavigableIndexes = (spec) => {
420
+ const max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
421
+ const breakpointStart = spec.infinite ? spec.slidesToShow * -1 : 0;
422
+ let counter = breakpointStart;
423
+ const indexes = [];
424
+ let breakpoint = breakpointStart;
425
+ while (breakpoint < max) {
426
+ indexes.push(breakpoint);
427
+ breakpoint = counter + spec.slidesToScroll;
428
+ counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
429
+ }
430
+ return indexes;
431
+ };
432
+ var checkNavigable = (spec, index) => {
433
+ const navigables = getNavigableIndexes(spec);
434
+ let prevNavigable = 0;
435
+ if (index > navigables[navigables.length - 1]) {
436
+ return navigables[navigables.length - 1];
437
+ }
438
+ for (const nav of navigables) {
439
+ if (index < nav) {
440
+ return prevNavigable;
441
+ }
442
+ prevNavigable = nav;
443
+ }
444
+ return index;
445
+ };
446
+ var getTrackLeft = (spec) => {
447
+ if (spec.disabled) {
448
+ return 0;
449
+ }
450
+ const {
451
+ slideIndex,
452
+ infinite,
453
+ centerMode,
454
+ slideCount,
455
+ slidesToShow,
456
+ slidesToScroll,
457
+ slideWidth,
458
+ slideHeight,
459
+ fade,
460
+ vertical
461
+ } = spec;
462
+ if (fade || slideCount === 1) {
463
+ return 0;
464
+ }
465
+ let slidesToOffset = 0;
466
+ if (infinite) {
467
+ slidesToOffset = -getPreClones(spec);
468
+ if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
469
+ slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
470
+ }
471
+ if (centerMode) {
472
+ slidesToOffset += Math.floor(slidesToShow / 2);
473
+ }
474
+ } else {
475
+ if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
476
+ slidesToOffset = slidesToShow - slideCount % slidesToScroll;
477
+ }
478
+ if (centerMode) {
479
+ slidesToOffset = Math.floor(slidesToShow / 2);
480
+ }
481
+ }
482
+ const slideOffset = slidesToOffset * slideWidth;
483
+ const verticalOffset = slidesToOffset * slideHeight;
484
+ let targetLeft;
485
+ if (!vertical) {
486
+ targetLeft = slideIndex * slideWidth * -1 + slideOffset;
487
+ } else {
488
+ targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
489
+ }
490
+ return targetLeft;
491
+ };
492
+ var getTrackCSS = (spec) => {
493
+ let trackWidth;
494
+ let trackHeight;
495
+ const totalSlides = getTotalSlides(spec);
496
+ if (!spec.vertical) {
497
+ trackWidth = totalSlides * spec.slideWidth;
498
+ } else {
499
+ const trackChildren = spec.disabled ? spec.slideCount : spec.slideCount + 2 * spec.slidesToShow;
500
+ trackHeight = trackChildren * (spec.slideHeight || 0);
501
+ }
502
+ let style = {
503
+ opacity: 1,
504
+ transition: "",
505
+ WebkitTransition: ""
506
+ };
507
+ if (spec.useTransform) {
508
+ const transform = !spec.vertical ? `translate3d(${spec.left}px, 0px, 0px)` : `translate3d(0px, ${spec.left}px, 0px)`;
509
+ const msTransform = !spec.vertical ? `translateX(${spec.left}px)` : `translateY(${spec.left}px)`;
510
+ style = {
511
+ ...style,
512
+ WebkitTransform: transform,
513
+ transform,
514
+ msTransform
515
+ };
516
+ } else {
517
+ if (spec.vertical) {
518
+ style.top = spec.left;
519
+ } else {
520
+ style.left = spec.left;
521
+ }
522
+ }
523
+ if (spec.fade) {
524
+ style = { opacity: 1 };
525
+ }
526
+ if (trackWidth) {
527
+ style.width = trackWidth;
528
+ }
529
+ if (trackHeight) {
530
+ style.height = trackHeight;
531
+ }
532
+ return style;
533
+ };
534
+ var getTrackAnimateCSS = (spec) => {
535
+ const style = getTrackCSS(spec);
536
+ if (spec.useTransform) {
537
+ style.WebkitTransition = `-webkit-transform ${spec.speed}ms ${spec.cssEase}`;
538
+ style.transition = `transform ${spec.speed}ms ${spec.cssEase}`;
539
+ } else {
540
+ if (spec.vertical) {
541
+ style.transition = `top ${spec.speed}ms ${spec.cssEase}`;
542
+ } else {
543
+ style.transition = `left ${spec.speed}ms ${spec.cssEase}`;
544
+ }
545
+ }
546
+ return style;
547
+ };
548
+ var calculateSlideWidth = (listWidth, slidesToShow, centerMode, centerPadding, vertical) => {
549
+ if (vertical) {
550
+ return listWidth;
551
+ }
552
+ let centerPaddingAdj = 0;
553
+ if (centerMode) {
554
+ const paddingValue = parseInt(centerPadding, 10) || 0;
555
+ centerPaddingAdj = paddingValue * 2;
556
+ if (centerPadding.endsWith("%")) {
557
+ centerPaddingAdj = listWidth * paddingValue * 2 / 100;
558
+ }
559
+ }
560
+ return Math.ceil((listWidth - centerPaddingAdj) / slidesToShow);
561
+ };
562
+ var keyHandler = (e, accessibility, rtl) => {
563
+ if (e.target.tagName.match(/TEXTAREA|INPUT|SELECT/) || !accessibility) {
564
+ return "";
565
+ }
566
+ if (e.keyCode === 37) {
567
+ return rtl ? "next" : "previous";
568
+ }
569
+ if (e.keyCode === 39) {
570
+ return rtl ? "previous" : "next";
571
+ }
572
+ return "";
573
+ };
574
+ var lazyStartIndex = (spec) => {
575
+ return spec.currentSlide - lazySlidesOnLeft(spec);
576
+ };
577
+ var lazyEndIndex = (spec) => {
578
+ return spec.currentSlide + lazySlidesOnRight(spec);
579
+ };
580
+ var lazySlidesOnLeft = (spec) => {
581
+ if (spec.centerMode) {
582
+ return Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding || "0", 10) > 0 ? 1 : 0);
583
+ }
584
+ return 0;
585
+ };
586
+ var lazySlidesOnRight = (spec) => {
587
+ if (spec.centerMode) {
588
+ return Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding || "0", 10) > 0 ? 1 : 0);
589
+ }
590
+ return spec.slidesToShow;
591
+ };
592
+ var getOnDemandLazySlides = (spec) => {
593
+ const onDemandSlides = [];
594
+ const startIndex = lazyStartIndex(spec);
595
+ const endIndex = lazyEndIndex(spec);
596
+ for (let slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
597
+ if (!spec.lazyLoadedList.includes(slideIndex)) {
598
+ onDemandSlides.push(slideIndex);
599
+ }
600
+ }
601
+ return onDemandSlides;
602
+ };
603
+ var getSlideClasses = (spec) => {
604
+ let index = spec.index;
605
+ if (spec.rtl) {
606
+ index = spec.slideCount - 1 - spec.index;
607
+ }
608
+ const glideCloned = index < 0 || index >= spec.slideCount;
609
+ let glideActive = false;
610
+ let glideCenter = false;
611
+ if (spec.centerMode) {
612
+ const centerOffset = Math.floor(spec.slidesToShow / 2);
613
+ glideCenter = (index - spec.currentSlide) % spec.slideCount === 0;
614
+ if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
615
+ glideActive = true;
616
+ }
617
+ } else {
618
+ glideActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
619
+ }
620
+ let focusedSlide = spec.targetSlide;
621
+ if (spec.targetSlide < 0) {
622
+ focusedSlide = spec.targetSlide + spec.slideCount;
623
+ } else if (spec.targetSlide >= spec.slideCount) {
624
+ focusedSlide = spec.targetSlide - spec.slideCount;
625
+ }
626
+ const glideCurrent = index === focusedSlide;
627
+ return {
628
+ "glide-slide": true,
629
+ "glide-active": glideActive,
630
+ "glide-center": glideCenter,
631
+ "glide-cloned": glideCloned,
632
+ "glide-current": glideCurrent
633
+ };
634
+ };
635
+
636
+ // src/components/Track.tsx
637
+ var import_jsx_runtime = require("react/jsx-runtime");
638
+ var getSlideStyle = (spec) => {
639
+ const style = {};
640
+ if (!spec.variableWidth) {
641
+ style.width = spec.slideWidth;
642
+ }
643
+ if (spec.fade) {
644
+ style.position = "relative";
645
+ if (spec.vertical) {
646
+ style.top = -spec.index * (spec.slideHeight || 0);
647
+ } else {
648
+ style.left = -spec.index * spec.slideWidth;
649
+ }
650
+ style.opacity = spec.currentSlide === spec.index ? 1 : 0;
651
+ style.zIndex = spec.currentSlide === spec.index ? 999 : 998;
652
+ if (spec.useCSS) {
653
+ style.transition = `opacity ${spec.speed}ms ${spec.cssEase}, visibility ${spec.speed}ms ${spec.cssEase}`;
654
+ }
655
+ }
656
+ return style;
657
+ };
658
+ var getKey = (child, fallbackKey) => {
659
+ if ((0, import_react.isValidElement)(child) && child.key !== null) {
660
+ return child.key;
661
+ }
662
+ return fallbackKey;
663
+ };
664
+ var classNames = (classes) => {
665
+ return Object.entries(classes).filter(([, value]) => value).map(([key]) => key).join(" ");
666
+ };
667
+ var Track = (0, import_react.forwardRef)(function Track2({
668
+ trackStyle,
669
+ slideWidth,
670
+ slideHeight,
671
+ slideCount,
672
+ currentSlide,
673
+ targetSlide,
674
+ slidesToShow,
675
+ slidesToScroll,
676
+ infinite,
677
+ centerMode,
678
+ centerPadding,
679
+ fade,
680
+ vertical,
681
+ variableWidth,
682
+ rtl,
683
+ disabled,
684
+ lazyLoad,
685
+ lazyLoadedList,
686
+ speed,
687
+ cssEase,
688
+ useCSS,
689
+ children,
690
+ onSlideClick,
691
+ focusOnSelect,
692
+ onMouseEnter,
693
+ onMouseOver,
694
+ onMouseLeave
695
+ }, ref) {
696
+ const spec = (0, import_react.useMemo)(
697
+ () => ({
698
+ slideCount,
699
+ slidesToShow,
700
+ slidesToScroll,
701
+ currentSlide,
702
+ targetSlide,
703
+ centerMode,
704
+ centerPadding,
705
+ infinite,
706
+ rtl,
707
+ fade,
708
+ vertical,
709
+ variableWidth,
710
+ disabled
711
+ }),
712
+ [
713
+ slideCount,
714
+ slidesToShow,
715
+ slidesToScroll,
716
+ currentSlide,
717
+ targetSlide,
718
+ centerMode,
719
+ centerPadding,
720
+ infinite,
721
+ rtl,
722
+ fade,
723
+ vertical,
724
+ variableWidth,
725
+ disabled
726
+ ]
727
+ );
728
+ const startIndex = (0, import_react.useMemo)(
729
+ () => lazyStartIndex({ currentSlide, centerMode, slidesToShow, centerPadding }),
730
+ [currentSlide, centerMode, slidesToShow, centerPadding]
731
+ );
732
+ const endIndex = (0, import_react.useMemo)(
733
+ () => lazyEndIndex({ currentSlide, centerMode, slidesToShow, centerPadding }),
734
+ [currentSlide, centerMode, slidesToShow, centerPadding]
735
+ );
736
+ const preCloneCount = (0, import_react.useMemo)(() => getPreClones(spec), [spec]);
737
+ const postCloneCount = (0, import_react.useMemo)(() => getPostClones(spec), [spec]);
738
+ const handleSlideClick = (0, import_react.useCallback)(
739
+ (index, originalOnClick) => (e) => {
740
+ if (originalOnClick) {
741
+ originalOnClick(e);
742
+ }
743
+ if (focusOnSelect && onSlideClick) {
744
+ onSlideClick(index);
745
+ }
746
+ },
747
+ [focusOnSelect, onSlideClick]
748
+ );
749
+ const slides = (0, import_react.useMemo)(() => {
750
+ const output = [];
751
+ const preCloneSlides = [];
752
+ const postCloneSlides = [];
753
+ const childrenArray = import_react.Children.toArray(children);
754
+ const childrenCount = childrenArray.length;
755
+ childrenArray.forEach((elem, index) => {
756
+ if (!(0, import_react.isValidElement)(elem)) return;
757
+ let child = elem;
758
+ if (lazyLoad) {
759
+ const shouldLoad = lazyLoadedList.includes(index);
760
+ if (!shouldLoad) {
761
+ child = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {});
762
+ }
763
+ }
764
+ const childStyle = getSlideStyle({
765
+ index,
766
+ slideWidth,
767
+ slideHeight,
768
+ fade,
769
+ vertical,
770
+ variableWidth,
771
+ currentSlide,
772
+ speed,
773
+ cssEase,
774
+ useCSS
775
+ });
776
+ const slideClasses = getSlideClasses({
777
+ index,
778
+ currentSlide,
779
+ slideCount,
780
+ slidesToShow,
781
+ centerMode,
782
+ targetSlide,
783
+ rtl
784
+ });
785
+ const existingClassName = elem.props.className || "";
786
+ const className = `${classNames(slideClasses)} ${existingClassName}`.trim();
787
+ const originalOnClick = elem.props.onClick;
788
+ output.push(
789
+ (0, import_react.cloneElement)(child, {
790
+ key: `original${getKey(child, index)}`,
791
+ "data-index": index,
792
+ className,
793
+ tabIndex: -1,
794
+ "aria-hidden": !slideClasses["glide-active"],
795
+ style: {
796
+ outline: "none",
797
+ ...elem.props.style,
798
+ ...childStyle
799
+ },
800
+ onClick: handleSlideClick(index, originalOnClick)
801
+ })
802
+ );
803
+ if (infinite && childrenCount > 1 && !fade && !disabled) {
804
+ const preCloneNo = childrenCount - index;
805
+ if (preCloneNo <= preCloneCount) {
806
+ const key = -preCloneNo;
807
+ let cloneChild = elem;
808
+ if (lazyLoad && key >= startIndex) {
809
+ cloneChild = elem;
810
+ } else if (lazyLoad) {
811
+ cloneChild = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {});
812
+ }
813
+ const cloneClasses = getSlideClasses({
814
+ index: key,
815
+ currentSlide,
816
+ slideCount,
817
+ slidesToShow,
818
+ centerMode,
819
+ targetSlide,
820
+ rtl
821
+ });
822
+ preCloneSlides.push(
823
+ (0, import_react.cloneElement)(cloneChild, {
824
+ key: `precloned${getKey(cloneChild, key)}`,
825
+ "data-index": key,
826
+ tabIndex: -1,
827
+ className: `${classNames(cloneClasses)} ${existingClassName}`.trim(),
828
+ "aria-hidden": !cloneClasses["glide-active"],
829
+ style: {
830
+ ...elem.props.style,
831
+ ...childStyle
832
+ },
833
+ onClick: handleSlideClick(index, originalOnClick)
834
+ })
835
+ );
836
+ }
837
+ if (index < postCloneCount) {
838
+ const key = childrenCount + index;
839
+ let cloneChild = elem;
840
+ if (lazyLoad && key < endIndex) {
841
+ cloneChild = elem;
842
+ } else if (lazyLoad) {
843
+ cloneChild = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {});
844
+ }
845
+ const cloneClasses = getSlideClasses({
846
+ index: key,
847
+ currentSlide,
848
+ slideCount,
849
+ slidesToShow,
850
+ centerMode,
851
+ targetSlide,
852
+ rtl
853
+ });
854
+ postCloneSlides.push(
855
+ (0, import_react.cloneElement)(cloneChild, {
856
+ key: `postcloned${getKey(cloneChild, key)}`,
857
+ "data-index": key,
858
+ tabIndex: -1,
859
+ className: `${classNames(cloneClasses)} ${existingClassName}`.trim(),
860
+ "aria-hidden": !cloneClasses["glide-active"],
861
+ style: {
862
+ ...elem.props.style,
863
+ ...childStyle
864
+ },
865
+ onClick: handleSlideClick(index, originalOnClick)
866
+ })
867
+ );
868
+ }
869
+ }
870
+ });
871
+ let result = preCloneSlides.concat(output, postCloneSlides);
872
+ if (rtl) {
873
+ result = result.reverse();
874
+ }
875
+ return result;
876
+ }, [
877
+ children,
878
+ slideWidth,
879
+ slideHeight,
880
+ slideCount,
881
+ currentSlide,
882
+ targetSlide,
883
+ slidesToShow,
884
+ slidesToScroll,
885
+ infinite,
886
+ centerMode,
887
+ centerPadding,
888
+ fade,
889
+ vertical,
890
+ variableWidth,
891
+ rtl,
892
+ disabled,
893
+ lazyLoad,
894
+ lazyLoadedList,
895
+ speed,
896
+ cssEase,
897
+ useCSS,
898
+ preCloneCount,
899
+ postCloneCount,
900
+ startIndex,
901
+ endIndex,
902
+ handleSlideClick
903
+ ]);
904
+ const baseTrackStyle = {
905
+ position: "relative",
906
+ display: fade ? "block" : "flex",
907
+ flexDirection: vertical ? "column" : "row",
908
+ ...trackStyle
909
+ };
910
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
911
+ "div",
912
+ {
913
+ ref,
914
+ className: "glide-track",
915
+ style: baseTrackStyle,
916
+ onMouseEnter,
917
+ onMouseOver,
918
+ onMouseLeave,
919
+ children: slides
920
+ }
921
+ );
922
+ });
923
+
924
+ // src/components/Arrows.tsx
925
+ var import_react2 = require("react");
926
+ var import_jsx_runtime2 = require("react/jsx-runtime");
927
+ var PrevArrowSVG = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
928
+ "svg",
929
+ {
930
+ className,
931
+ xmlns: "http://www.w3.org/2000/svg",
932
+ viewBox: "0 0 24 24",
933
+ fill: "none",
934
+ stroke: "currentColor",
935
+ strokeWidth: "2",
936
+ strokeLinecap: "round",
937
+ strokeLinejoin: "round",
938
+ style: { width: 20, height: 20 },
939
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "15 18 9 12 15 6" })
940
+ }
941
+ );
942
+ var NextArrowSVG = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
943
+ "svg",
944
+ {
945
+ className,
946
+ xmlns: "http://www.w3.org/2000/svg",
947
+ viewBox: "0 0 24 24",
948
+ fill: "none",
949
+ stroke: "currentColor",
950
+ strokeWidth: "2",
951
+ strokeLinecap: "round",
952
+ strokeLinejoin: "round",
953
+ style: { width: 20, height: 20 },
954
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "9 18 15 12 9 6" })
955
+ }
956
+ );
957
+ var baseArrowStyle = {
958
+ position: "absolute",
959
+ top: "50%",
960
+ transform: "translateY(-50%)",
961
+ zIndex: 10,
962
+ display: "flex",
963
+ alignItems: "center",
964
+ justifyContent: "center",
965
+ width: 40,
966
+ height: 40,
967
+ padding: 0,
968
+ border: "none",
969
+ borderRadius: "50%",
970
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
971
+ color: "white",
972
+ cursor: "pointer",
973
+ transition: "background-color 0.2s, opacity 0.2s"
974
+ };
975
+ var disabledArrowStyle = {
976
+ ...baseArrowStyle,
977
+ opacity: 0.3,
978
+ cursor: "not-allowed"
979
+ };
980
+ var PrevArrow = ({
981
+ currentSlide,
982
+ slideCount,
983
+ slidesToShow,
984
+ infinite,
985
+ centerMode,
986
+ onClick,
987
+ customArrow
988
+ }) => {
989
+ const canGo = canGoPrev({
990
+ currentSlide,
991
+ infinite
992
+ });
993
+ const handleClick = (e) => {
994
+ e.preventDefault();
995
+ if (canGo) {
996
+ onClick();
997
+ }
998
+ };
999
+ if (customArrow && (0, import_react2.isValidElement)(customArrow)) {
1000
+ const arrowProps = customArrow.props;
1001
+ return (0, import_react2.cloneElement)(customArrow, {
1002
+ onClick: handleClick,
1003
+ currentSlide,
1004
+ slideCount,
1005
+ className: `glide-arrow glide-prev ${!canGo ? "glide-disabled" : ""} ${arrowProps.className || ""}`.trim(),
1006
+ style: { ...arrowProps.style },
1007
+ "aria-disabled": !canGo
1008
+ });
1009
+ }
1010
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1011
+ "button",
1012
+ {
1013
+ type: "button",
1014
+ className: `glide-arrow glide-prev ${!canGo ? "glide-disabled" : ""}`,
1015
+ style: {
1016
+ ...canGo ? baseArrowStyle : disabledArrowStyle,
1017
+ left: 10
1018
+ },
1019
+ onClick: handleClick,
1020
+ "aria-label": "Previous slide",
1021
+ "aria-disabled": !canGo,
1022
+ disabled: !canGo,
1023
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PrevArrowSVG, {})
1024
+ }
1025
+ );
1026
+ };
1027
+ var NextArrow = ({
1028
+ currentSlide,
1029
+ slideCount,
1030
+ slidesToShow,
1031
+ infinite,
1032
+ centerMode,
1033
+ onClick,
1034
+ customArrow
1035
+ }) => {
1036
+ const canGo = canGoNext({
1037
+ currentSlide,
1038
+ slideCount,
1039
+ slidesToShow,
1040
+ infinite,
1041
+ centerMode
1042
+ });
1043
+ const handleClick = (e) => {
1044
+ e.preventDefault();
1045
+ if (canGo) {
1046
+ onClick();
1047
+ }
1048
+ };
1049
+ if (customArrow && (0, import_react2.isValidElement)(customArrow)) {
1050
+ const arrowProps = customArrow.props;
1051
+ return (0, import_react2.cloneElement)(customArrow, {
1052
+ onClick: handleClick,
1053
+ currentSlide,
1054
+ slideCount,
1055
+ className: `glide-arrow glide-next ${!canGo ? "glide-disabled" : ""} ${arrowProps.className || ""}`.trim(),
1056
+ style: { ...arrowProps.style },
1057
+ "aria-disabled": !canGo
1058
+ });
1059
+ }
1060
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1061
+ "button",
1062
+ {
1063
+ type: "button",
1064
+ className: `glide-arrow glide-next ${!canGo ? "glide-disabled" : ""}`,
1065
+ style: {
1066
+ ...canGo ? baseArrowStyle : disabledArrowStyle,
1067
+ right: 10
1068
+ },
1069
+ onClick: handleClick,
1070
+ "aria-label": "Next slide",
1071
+ "aria-disabled": !canGo,
1072
+ disabled: !canGo,
1073
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NextArrowSVG, {})
1074
+ }
1075
+ );
1076
+ };
1077
+
1078
+ // src/components/Dots.tsx
1079
+ var import_react3 = require("react");
1080
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1081
+ var defaultDotsContainerStyle = {
1082
+ display: "flex",
1083
+ justifyContent: "center",
1084
+ alignItems: "center",
1085
+ listStyle: "none",
1086
+ margin: "16px 0 0",
1087
+ padding: 0,
1088
+ gap: 8
1089
+ };
1090
+ var defaultDotButtonStyle = {
1091
+ width: 10,
1092
+ height: 10,
1093
+ padding: 0,
1094
+ border: "none",
1095
+ borderRadius: "50%",
1096
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
1097
+ cursor: "pointer",
1098
+ transition: "background-color 0.2s"
1099
+ };
1100
+ var activeDotButtonStyle = {
1101
+ ...defaultDotButtonStyle,
1102
+ backgroundColor: "rgba(0, 0, 0, 0.8)"
1103
+ };
1104
+ var Dots = ({
1105
+ slideCount,
1106
+ slidesToScroll,
1107
+ slidesToShow,
1108
+ currentSlide,
1109
+ infinite,
1110
+ onDotClick,
1111
+ customPaging,
1112
+ appendDots,
1113
+ dotsClass,
1114
+ onMouseEnter,
1115
+ onMouseLeave
1116
+ }) => {
1117
+ const dotCount = (0, import_react3.useMemo)(() => {
1118
+ if (infinite) {
1119
+ return Math.ceil(slideCount / slidesToScroll);
1120
+ }
1121
+ return Math.ceil((slideCount - slidesToShow) / slidesToScroll) + 1;
1122
+ }, [slideCount, slidesToScroll, slidesToShow, infinite]);
1123
+ const handleDotClick = (index) => (e) => {
1124
+ e.preventDefault();
1125
+ e.target.blur?.();
1126
+ onDotClick(index * slidesToScroll);
1127
+ };
1128
+ const dots = (0, import_react3.useMemo)(() => {
1129
+ return Array.from({ length: dotCount }).map((_, index) => {
1130
+ const isActive = index === Math.floor(currentSlide / slidesToScroll);
1131
+ const dotButton = customPaging ? customPaging(index) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1132
+ "button",
1133
+ {
1134
+ type: "button",
1135
+ style: isActive ? activeDotButtonStyle : defaultDotButtonStyle,
1136
+ "aria-label": `Go to slide ${index + 1}`
1137
+ }
1138
+ );
1139
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1140
+ "li",
1141
+ {
1142
+ className: isActive ? "glide-active" : "",
1143
+ style: { display: "inline-block" },
1144
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1145
+ "div",
1146
+ {
1147
+ onClick: handleDotClick(index),
1148
+ onKeyDown: (e) => {
1149
+ if (e.key === "Enter" || e.key === " ") {
1150
+ e.preventDefault();
1151
+ onDotClick(index * slidesToScroll);
1152
+ }
1153
+ },
1154
+ role: "button",
1155
+ tabIndex: 0,
1156
+ "aria-current": isActive ? "true" : void 0,
1157
+ children: dotButton
1158
+ }
1159
+ )
1160
+ },
1161
+ index
1162
+ );
1163
+ });
1164
+ }, [dotCount, currentSlide, slidesToScroll, customPaging, onDotClick]);
1165
+ const dotsContainer = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1166
+ "ul",
1167
+ {
1168
+ className: dotsClass,
1169
+ style: defaultDotsContainerStyle,
1170
+ onMouseEnter,
1171
+ onMouseLeave,
1172
+ children: dots
1173
+ }
1174
+ );
1175
+ if (appendDots) {
1176
+ return appendDots(dots);
1177
+ }
1178
+ return dotsContainer;
1179
+ };
1180
+
1181
+ // src/hooks/useTrack.ts
1182
+ var import_react4 = require("react");
1183
+ function useTrack(options) {
1184
+ const {
1185
+ currentSlide,
1186
+ slideCount,
1187
+ slidesToShow,
1188
+ slidesToScroll,
1189
+ infinite,
1190
+ centerMode,
1191
+ centerPadding,
1192
+ listWidth,
1193
+ listHeight,
1194
+ slideWidth: providedSlideWidth,
1195
+ slideHeight = 0,
1196
+ fade,
1197
+ vertical,
1198
+ variableWidth,
1199
+ useTransform,
1200
+ disabled,
1201
+ speed,
1202
+ cssEase,
1203
+ rtl,
1204
+ animating,
1205
+ swipeLeft
1206
+ } = options;
1207
+ const calculatedSlideWidth = (0, import_react4.useMemo)(() => {
1208
+ if (providedSlideWidth && providedSlideWidth > 0) {
1209
+ return providedSlideWidth;
1210
+ }
1211
+ if (listWidth <= 0) {
1212
+ return 0;
1213
+ }
1214
+ return calculateSlideWidth(listWidth, slidesToShow, centerMode, centerPadding, vertical);
1215
+ }, [providedSlideWidth, listWidth, slidesToShow, centerMode, centerPadding, vertical]);
1216
+ const preCloneCount = (0, import_react4.useMemo)(() => {
1217
+ return getPreClones({
1218
+ disabled,
1219
+ infinite,
1220
+ variableWidth,
1221
+ slideCount,
1222
+ slidesToShow,
1223
+ centerMode
1224
+ });
1225
+ }, [disabled, infinite, variableWidth, slideCount, slidesToShow, centerMode]);
1226
+ const postCloneCount = (0, import_react4.useMemo)(() => {
1227
+ return getPostClones({
1228
+ disabled,
1229
+ infinite,
1230
+ variableWidth,
1231
+ slideCount,
1232
+ slidesToShow,
1233
+ centerMode
1234
+ });
1235
+ }, [disabled, infinite, variableWidth, slideCount, slidesToShow, centerMode]);
1236
+ const totalSlides = (0, import_react4.useMemo)(() => {
1237
+ return getTotalSlides({
1238
+ slideCount,
1239
+ disabled,
1240
+ infinite,
1241
+ variableWidth,
1242
+ slidesToShow,
1243
+ centerMode
1244
+ });
1245
+ }, [slideCount, disabled, infinite, variableWidth, slidesToShow, centerMode]);
1246
+ const trackWidth = (0, import_react4.useMemo)(() => {
1247
+ if (vertical) {
1248
+ return listWidth;
1249
+ }
1250
+ return totalSlides * calculatedSlideWidth;
1251
+ }, [vertical, totalSlides, calculatedSlideWidth, listWidth]);
1252
+ const spec = (0, import_react4.useMemo)(
1253
+ () => ({
1254
+ slideIndex: currentSlide,
1255
+ infinite,
1256
+ centerMode,
1257
+ slideCount,
1258
+ slidesToShow,
1259
+ slidesToScroll,
1260
+ slideWidth: calculatedSlideWidth,
1261
+ slideHeight,
1262
+ fade,
1263
+ vertical,
1264
+ variableWidth,
1265
+ useTransform,
1266
+ disabled,
1267
+ listWidth,
1268
+ centerPadding
1269
+ }),
1270
+ [
1271
+ currentSlide,
1272
+ infinite,
1273
+ centerMode,
1274
+ slideCount,
1275
+ slidesToShow,
1276
+ slidesToScroll,
1277
+ calculatedSlideWidth,
1278
+ slideHeight,
1279
+ fade,
1280
+ vertical,
1281
+ variableWidth,
1282
+ useTransform,
1283
+ disabled,
1284
+ listWidth,
1285
+ centerPadding
1286
+ ]
1287
+ );
1288
+ const getTrackStyleForSlide = (0, import_react4.useCallback)(
1289
+ (slideIndex, animate = false) => {
1290
+ const left = getTrackLeft({
1291
+ ...spec,
1292
+ slideIndex
1293
+ });
1294
+ if (animate) {
1295
+ return getTrackAnimateCSS({
1296
+ ...spec,
1297
+ left,
1298
+ speed,
1299
+ cssEase
1300
+ });
1301
+ }
1302
+ return getTrackCSS({
1303
+ ...spec,
1304
+ left
1305
+ });
1306
+ },
1307
+ [spec, speed, cssEase]
1308
+ );
1309
+ const trackStyle = (0, import_react4.useMemo)(() => {
1310
+ if (swipeLeft !== null) {
1311
+ return getTrackCSS({
1312
+ ...spec,
1313
+ left: swipeLeft
1314
+ });
1315
+ }
1316
+ const left = getTrackLeft({
1317
+ ...spec,
1318
+ slideIndex: currentSlide
1319
+ });
1320
+ if (animating) {
1321
+ return getTrackAnimateCSS({
1322
+ ...spec,
1323
+ left,
1324
+ speed,
1325
+ cssEase
1326
+ });
1327
+ }
1328
+ return getTrackCSS({
1329
+ ...spec,
1330
+ left
1331
+ });
1332
+ }, [spec, currentSlide, animating, swipeLeft, speed, cssEase]);
1333
+ return {
1334
+ slideWidth: calculatedSlideWidth,
1335
+ trackStyle,
1336
+ preCloneCount,
1337
+ postCloneCount,
1338
+ totalSlides,
1339
+ getTrackStyleForSlide,
1340
+ trackWidth
1341
+ };
1342
+ }
1343
+
1344
+ // src/index.tsx
1345
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1346
+ var createInitialState = (props) => ({
1347
+ animating: false,
1348
+ autoplaying: props.autoplay ? "playing" : null,
1349
+ currentDirection: 0,
1350
+ currentLeft: null,
1351
+ currentSlide: props.initialSlide || 0,
1352
+ direction: 1,
1353
+ dragging: false,
1354
+ edgeDragged: false,
1355
+ initialized: false,
1356
+ lazyLoadedList: props.lazyLoad ? [props.initialSlide || 0] : [],
1357
+ listHeight: null,
1358
+ listWidth: null,
1359
+ scrolling: false,
1360
+ slideCount: 0,
1361
+ slideHeight: null,
1362
+ slideWidth: null,
1363
+ swipeLeft: null,
1364
+ swiped: false,
1365
+ swiping: false,
1366
+ touchObject: { startX: 0, startY: 0, curX: 0, curY: 0 },
1367
+ trackStyle: {},
1368
+ trackWidth: 0,
1369
+ targetSlide: props.initialSlide || 0
1370
+ });
1371
+ var glideReducer = (state, action) => {
1372
+ switch (action.type) {
1373
+ case "INIT":
1374
+ return { ...state, ...action.payload, initialized: true };
1375
+ case "SET_DIMENSIONS":
1376
+ return { ...state, ...action.payload };
1377
+ case "GO_TO_SLIDE":
1378
+ return {
1379
+ ...state,
1380
+ currentSlide: action.payload.slide,
1381
+ targetSlide: action.payload.slide,
1382
+ animating: action.payload.animated !== false
1383
+ };
1384
+ case "NEXT":
1385
+ case "PREV":
1386
+ return state;
1387
+ // Handled externally
1388
+ case "SET_TRACK_STYLE":
1389
+ return { ...state, trackStyle: action.payload };
1390
+ case "SWIPE_START":
1391
+ return {
1392
+ ...state,
1393
+ dragging: true,
1394
+ touchObject: action.payload
1395
+ };
1396
+ case "SWIPE_MOVE":
1397
+ return {
1398
+ ...state,
1399
+ touchObject: action.payload.touchObject,
1400
+ swipeLeft: action.payload.swipeLeft,
1401
+ trackStyle: action.payload.trackStyle,
1402
+ swiping: action.payload.swiping ?? state.swiping
1403
+ };
1404
+ case "SWIPE_END":
1405
+ return { ...state, ...action.payload };
1406
+ case "ANIMATION_END":
1407
+ return { ...state, animating: false };
1408
+ case "SET_AUTOPLAY":
1409
+ return { ...state, autoplaying: action.payload };
1410
+ case "UPDATE":
1411
+ return { ...state, ...action.payload };
1412
+ default:
1413
+ return state;
1414
+ }
1415
+ };
1416
+ var Glide = (0, import_react5.forwardRef)(function Glide2(props, ref) {
1417
+ const settings = {
1418
+ ...defaultSettings,
1419
+ ...props
1420
+ };
1421
+ const {
1422
+ accessibility,
1423
+ adaptiveHeight,
1424
+ arrows,
1425
+ autoplay,
1426
+ autoplaySpeed,
1427
+ centerMode,
1428
+ centerPadding,
1429
+ className,
1430
+ cssEase,
1431
+ dots,
1432
+ dotsClass,
1433
+ draggable,
1434
+ fade,
1435
+ focusOnSelect,
1436
+ infinite,
1437
+ initialSlide,
1438
+ lazyLoad,
1439
+ pauseOnDotsHover,
1440
+ pauseOnFocus,
1441
+ pauseOnHover,
1442
+ rtl,
1443
+ slidesToScroll,
1444
+ slidesToShow,
1445
+ speed,
1446
+ swipe,
1447
+ swipeToSlide,
1448
+ touchMove,
1449
+ touchThreshold,
1450
+ useCSS,
1451
+ useTransform,
1452
+ variableWidth,
1453
+ vertical,
1454
+ verticalSwiping,
1455
+ waitForAnimate,
1456
+ disabled,
1457
+ children,
1458
+ afterChange,
1459
+ beforeChange,
1460
+ appendDots,
1461
+ customPaging,
1462
+ nextArrow,
1463
+ prevArrow,
1464
+ onEdge,
1465
+ onInit,
1466
+ onReInit,
1467
+ onSwipe,
1468
+ swipeEvent
1469
+ } = settings;
1470
+ const listRef = (0, import_react5.useRef)(null);
1471
+ const trackRef = (0, import_react5.useRef)(null);
1472
+ const autoplayTimerRef = (0, import_react5.useRef)(null);
1473
+ const animationEndTimeoutRef = (0, import_react5.useRef)(null);
1474
+ const resizeObserverRef = (0, import_react5.useRef)(null);
1475
+ const [state, dispatch] = (0, import_react5.useReducer)(glideReducer, props, createInitialState);
1476
+ const {
1477
+ initialized,
1478
+ currentSlide,
1479
+ targetSlide,
1480
+ animating,
1481
+ dragging,
1482
+ swiping,
1483
+ swipeLeft,
1484
+ touchObject,
1485
+ listWidth,
1486
+ listHeight,
1487
+ slideWidth,
1488
+ slideHeight,
1489
+ lazyLoadedList,
1490
+ autoplaying,
1491
+ edgeDragged,
1492
+ swiped,
1493
+ scrolling
1494
+ } = state;
1495
+ const slideCount = import_react5.Children.count(children);
1496
+ const {
1497
+ slideWidth: calculatedSlideWidth,
1498
+ trackStyle,
1499
+ preCloneCount,
1500
+ postCloneCount,
1501
+ totalSlides,
1502
+ getTrackStyleForSlide,
1503
+ trackWidth
1504
+ } = useTrack({
1505
+ currentSlide,
1506
+ slideCount,
1507
+ slidesToShow,
1508
+ slidesToScroll,
1509
+ infinite,
1510
+ centerMode,
1511
+ centerPadding,
1512
+ listWidth: listWidth || 0,
1513
+ listHeight: listHeight || 0,
1514
+ slideWidth: slideWidth ?? void 0,
1515
+ slideHeight: slideHeight || 0,
1516
+ fade,
1517
+ vertical,
1518
+ variableWidth,
1519
+ useTransform,
1520
+ disabled,
1521
+ speed,
1522
+ cssEase,
1523
+ rtl,
1524
+ animating,
1525
+ swipeLeft
1526
+ });
1527
+ (0, import_react5.useEffect)(() => {
1528
+ if (!canUseDOM() || !listRef.current) return;
1529
+ const updateDimensions = () => {
1530
+ if (!listRef.current) return;
1531
+ const newListWidth = getWidth(listRef.current);
1532
+ const newListHeight = getHeight(listRef.current);
1533
+ const firstSlide = listRef.current.querySelector('[data-index="0"]');
1534
+ const newSlideHeight = firstSlide ? getHeight(firstSlide) : null;
1535
+ dispatch({
1536
+ type: "INIT",
1537
+ payload: {
1538
+ listWidth: newListWidth,
1539
+ listHeight: newListHeight,
1540
+ slideHeight: newSlideHeight,
1541
+ slideCount
1542
+ }
1543
+ });
1544
+ };
1545
+ updateDimensions();
1546
+ resizeObserverRef.current = new ResizeObserver(updateDimensions);
1547
+ resizeObserverRef.current.observe(listRef.current);
1548
+ onInit?.();
1549
+ return () => {
1550
+ resizeObserverRef.current?.disconnect();
1551
+ };
1552
+ }, [slideCount, onInit]);
1553
+ const autoplayIterator = (0, import_react5.useCallback)(() => {
1554
+ if (autoplaying !== "playing") return;
1555
+ const nextSlideIndex = currentSlide + slidesToScroll;
1556
+ goToSlide(nextSlideIndex);
1557
+ }, [autoplaying, currentSlide, slidesToScroll]);
1558
+ (0, import_react5.useEffect)(() => {
1559
+ if (!autoplay || !initialized) return;
1560
+ if (autoplaying === "playing") {
1561
+ autoplayTimerRef.current = setTimeout(autoplayIterator, autoplaySpeed);
1562
+ }
1563
+ return () => {
1564
+ if (autoplayTimerRef.current) {
1565
+ clearTimeout(autoplayTimerRef.current);
1566
+ }
1567
+ };
1568
+ }, [autoplay, autoplaying, initialized, autoplayIterator, autoplaySpeed]);
1569
+ (0, import_react5.useEffect)(() => {
1570
+ if (animating) {
1571
+ animationEndTimeoutRef.current = setTimeout(() => {
1572
+ dispatch({ type: "ANIMATION_END" });
1573
+ afterChange?.(currentSlide);
1574
+ }, speed);
1575
+ }
1576
+ return () => {
1577
+ if (animationEndTimeoutRef.current) {
1578
+ clearTimeout(animationEndTimeoutRef.current);
1579
+ }
1580
+ };
1581
+ }, [animating, speed, afterChange, currentSlide]);
1582
+ const goToSlide = (0, import_react5.useCallback)(
1583
+ (slideIndex, dontAnimate = false) => {
1584
+ if (waitForAnimate && animating) return;
1585
+ let targetIndex = slideIndex;
1586
+ if (infinite) {
1587
+ if (targetIndex < 0) {
1588
+ targetIndex = slideCount + targetIndex;
1589
+ } else if (targetIndex >= slideCount) {
1590
+ targetIndex = targetIndex - slideCount;
1591
+ }
1592
+ } else {
1593
+ targetIndex = clamp(targetIndex, 0, slideCount - slidesToShow);
1594
+ }
1595
+ beforeChange?.(currentSlide, targetIndex);
1596
+ if (lazyLoad) {
1597
+ const slidesToLoad = getOnDemandLazySlides({
1598
+ currentSlide: targetIndex,
1599
+ centerMode,
1600
+ slidesToShow,
1601
+ centerPadding,
1602
+ lazyLoadedList
1603
+ });
1604
+ if (slidesToLoad.length > 0) {
1605
+ dispatch({
1606
+ type: "UPDATE",
1607
+ payload: { lazyLoadedList: [...lazyLoadedList, ...slidesToLoad] }
1608
+ });
1609
+ }
1610
+ }
1611
+ dispatch({
1612
+ type: "GO_TO_SLIDE",
1613
+ payload: { slide: targetIndex, animated: !dontAnimate }
1614
+ });
1615
+ },
1616
+ [
1617
+ waitForAnimate,
1618
+ animating,
1619
+ infinite,
1620
+ slideCount,
1621
+ slidesToShow,
1622
+ beforeChange,
1623
+ currentSlide,
1624
+ lazyLoad,
1625
+ centerMode,
1626
+ centerPadding,
1627
+ lazyLoadedList
1628
+ ]
1629
+ );
1630
+ const next = (0, import_react5.useCallback)(() => {
1631
+ goToSlide(currentSlide + slidesToScroll);
1632
+ }, [currentSlide, slidesToScroll, goToSlide]);
1633
+ const prev = (0, import_react5.useCallback)(() => {
1634
+ goToSlide(currentSlide - slidesToScroll);
1635
+ }, [currentSlide, slidesToScroll, goToSlide]);
1636
+ const goTo = (0, import_react5.useCallback)(
1637
+ (index, dontAnimate = false) => {
1638
+ goToSlide(index, dontAnimate);
1639
+ },
1640
+ [goToSlide]
1641
+ );
1642
+ const pause = (0, import_react5.useCallback)(() => {
1643
+ dispatch({ type: "SET_AUTOPLAY", payload: "paused" });
1644
+ }, []);
1645
+ const play = (0, import_react5.useCallback)(() => {
1646
+ dispatch({ type: "SET_AUTOPLAY", payload: "playing" });
1647
+ }, []);
1648
+ (0, import_react5.useImperativeHandle)(
1649
+ ref,
1650
+ () => ({
1651
+ prev,
1652
+ next,
1653
+ goTo,
1654
+ pause,
1655
+ play,
1656
+ innerSlider: { state: { currentSlide } }
1657
+ }),
1658
+ [prev, next, goTo, pause, play, currentSlide]
1659
+ );
1660
+ const handleKeyDown = (0, import_react5.useCallback)(
1661
+ (e) => {
1662
+ const action = keyHandler(e, accessibility, rtl);
1663
+ if (action === "next") {
1664
+ next();
1665
+ } else if (action === "previous") {
1666
+ prev();
1667
+ }
1668
+ },
1669
+ [accessibility, rtl, next, prev]
1670
+ );
1671
+ const handleSwipeStart = (0, import_react5.useCallback)(
1672
+ (e) => {
1673
+ const result = swipeStart(e, swipe, draggable);
1674
+ if (result) {
1675
+ dispatch({ type: "SWIPE_START", payload: result.touchObject });
1676
+ }
1677
+ },
1678
+ [swipe, draggable]
1679
+ );
1680
+ const handleSwipeMove = (0, import_react5.useCallback)(
1681
+ (e) => {
1682
+ if (!dragging) return;
1683
+ const result = swipeMove(e, {
1684
+ scrolling,
1685
+ animating,
1686
+ vertical,
1687
+ swipeToSlide,
1688
+ verticalSwiping,
1689
+ rtl,
1690
+ currentSlide,
1691
+ edgeFriction: settings.edgeFriction,
1692
+ edgeDragged,
1693
+ onEdge,
1694
+ swiped,
1695
+ swiping,
1696
+ slideCount,
1697
+ slidesToScroll,
1698
+ infinite,
1699
+ touchObject,
1700
+ swipeEvent,
1701
+ listHeight: listHeight || 0,
1702
+ listWidth: listWidth || 0,
1703
+ slideWidth: calculatedSlideWidth,
1704
+ slideHeight: slideHeight || 0,
1705
+ centerMode,
1706
+ slidesToShow,
1707
+ fade,
1708
+ disabled,
1709
+ variableWidth,
1710
+ useTransform
1711
+ });
1712
+ if (result && "scrolling" in result && result.scrolling) {
1713
+ dispatch({ type: "UPDATE", payload: { scrolling: true } });
1714
+ } else if (result && "swipeLeft" in result) {
1715
+ dispatch({ type: "SWIPE_MOVE", payload: result });
1716
+ }
1717
+ },
1718
+ [
1719
+ dragging,
1720
+ scrolling,
1721
+ animating,
1722
+ vertical,
1723
+ swipeToSlide,
1724
+ verticalSwiping,
1725
+ rtl,
1726
+ currentSlide,
1727
+ settings.edgeFriction,
1728
+ edgeDragged,
1729
+ onEdge,
1730
+ swiped,
1731
+ swiping,
1732
+ slideCount,
1733
+ slidesToScroll,
1734
+ infinite,
1735
+ touchObject,
1736
+ swipeEvent,
1737
+ listHeight,
1738
+ listWidth,
1739
+ calculatedSlideWidth,
1740
+ slideHeight,
1741
+ centerMode,
1742
+ slidesToShow,
1743
+ fade,
1744
+ disabled,
1745
+ variableWidth,
1746
+ useTransform
1747
+ ]
1748
+ );
1749
+ const handleSwipeEnd = (0, import_react5.useCallback)(
1750
+ (e) => {
1751
+ const result = swipeEnd(e, {
1752
+ dragging,
1753
+ swipe,
1754
+ touchObject,
1755
+ listWidth: listWidth || 0,
1756
+ touchThreshold,
1757
+ verticalSwiping,
1758
+ listHeight: listHeight || 0,
1759
+ swipeToSlide,
1760
+ scrolling,
1761
+ onSwipe,
1762
+ targetSlide,
1763
+ currentSlide,
1764
+ infinite,
1765
+ slideCount,
1766
+ slidesToScroll,
1767
+ slidesToShow,
1768
+ slideWidth: calculatedSlideWidth,
1769
+ slideHeight: slideHeight || 0,
1770
+ centerMode,
1771
+ fade,
1772
+ disabled,
1773
+ variableWidth,
1774
+ useTransform,
1775
+ speed,
1776
+ cssEase,
1777
+ rtl,
1778
+ vertical
1779
+ });
1780
+ dispatch({
1781
+ type: "SWIPE_END",
1782
+ payload: {
1783
+ dragging: result.dragging,
1784
+ edgeDragged: result.edgeDragged,
1785
+ scrolling: result.scrolling,
1786
+ swiping: result.swiping,
1787
+ swiped: result.swiped,
1788
+ swipeLeft: result.swipeLeft,
1789
+ touchObject: result.touchObject
1790
+ }
1791
+ });
1792
+ if (result.triggerSlideHandler !== void 0) {
1793
+ goToSlide(result.triggerSlideHandler);
1794
+ } else if (result.trackStyle) {
1795
+ dispatch({ type: "SET_TRACK_STYLE", payload: result.trackStyle });
1796
+ }
1797
+ },
1798
+ [
1799
+ dragging,
1800
+ swipe,
1801
+ touchObject,
1802
+ listWidth,
1803
+ touchThreshold,
1804
+ verticalSwiping,
1805
+ listHeight,
1806
+ swipeToSlide,
1807
+ scrolling,
1808
+ onSwipe,
1809
+ targetSlide,
1810
+ currentSlide,
1811
+ infinite,
1812
+ slideCount,
1813
+ slidesToScroll,
1814
+ slidesToShow,
1815
+ calculatedSlideWidth,
1816
+ slideHeight,
1817
+ centerMode,
1818
+ fade,
1819
+ disabled,
1820
+ variableWidth,
1821
+ useTransform,
1822
+ speed,
1823
+ cssEase,
1824
+ rtl,
1825
+ vertical,
1826
+ goToSlide
1827
+ ]
1828
+ );
1829
+ const handleMouseEnter = (0, import_react5.useCallback)(() => {
1830
+ if (autoplay && pauseOnHover) {
1831
+ dispatch({ type: "SET_AUTOPLAY", payload: "hovered" });
1832
+ }
1833
+ }, [autoplay, pauseOnHover]);
1834
+ const handleMouseLeave = (0, import_react5.useCallback)(() => {
1835
+ if (autoplay && pauseOnHover && autoplaying === "hovered") {
1836
+ dispatch({ type: "SET_AUTOPLAY", payload: "playing" });
1837
+ }
1838
+ }, [autoplay, pauseOnHover, autoplaying]);
1839
+ const handleFocus = (0, import_react5.useCallback)(() => {
1840
+ if (autoplay && pauseOnFocus) {
1841
+ dispatch({ type: "SET_AUTOPLAY", payload: "focused" });
1842
+ }
1843
+ }, [autoplay, pauseOnFocus]);
1844
+ const handleBlur = (0, import_react5.useCallback)(() => {
1845
+ if (autoplay && pauseOnFocus && autoplaying === "focused") {
1846
+ dispatch({ type: "SET_AUTOPLAY", payload: "playing" });
1847
+ }
1848
+ }, [autoplay, pauseOnFocus, autoplaying]);
1849
+ const handleDotClick = (0, import_react5.useCallback)(
1850
+ (index) => {
1851
+ goToSlide(index);
1852
+ },
1853
+ [goToSlide]
1854
+ );
1855
+ const handleDotMouseEnter = (0, import_react5.useCallback)(() => {
1856
+ if (autoplay && pauseOnDotsHover) {
1857
+ dispatch({ type: "SET_AUTOPLAY", payload: "hovered" });
1858
+ }
1859
+ }, [autoplay, pauseOnDotsHover]);
1860
+ const handleDotMouseLeave = (0, import_react5.useCallback)(() => {
1861
+ if (autoplay && pauseOnDotsHover && autoplaying === "hovered") {
1862
+ dispatch({ type: "SET_AUTOPLAY", payload: "playing" });
1863
+ }
1864
+ }, [autoplay, pauseOnDotsHover, autoplaying]);
1865
+ const handleSlideClick = (0, import_react5.useCallback)(
1866
+ (index) => {
1867
+ if (focusOnSelect) {
1868
+ goToSlide(index);
1869
+ }
1870
+ },
1871
+ [focusOnSelect, goToSlide]
1872
+ );
1873
+ const sliderStyle = (0, import_react5.useMemo)(
1874
+ () => ({
1875
+ position: "relative",
1876
+ display: "block",
1877
+ boxSizing: "border-box",
1878
+ userSelect: "none",
1879
+ touchAction: vertical ? "pan-x" : "pan-y",
1880
+ WebkitTapHighlightColor: "transparent"
1881
+ }),
1882
+ [vertical]
1883
+ );
1884
+ const listStyle = (0, import_react5.useMemo)(
1885
+ () => ({
1886
+ position: "relative",
1887
+ display: "block",
1888
+ overflow: "hidden",
1889
+ margin: 0,
1890
+ padding: 0
1891
+ }),
1892
+ []
1893
+ );
1894
+ if (!initialized || !canUseDOM()) {
1895
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `glide-slider ${className}`.trim(), style: sliderStyle, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "glide-list", style: listStyle, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "glide-track", style: { display: "flex" }, children: import_react5.default.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1896
+ "div",
1897
+ {
1898
+ className: "glide-slide",
1899
+ style: {
1900
+ width: `${100 / slidesToShow}%`,
1901
+ flexShrink: 0
1902
+ },
1903
+ children: child
1904
+ },
1905
+ idx
1906
+ )) }) }) });
1907
+ }
1908
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1909
+ "div",
1910
+ {
1911
+ className: `glide-slider ${className} ${vertical ? "glide-vertical" : ""}`.trim(),
1912
+ style: sliderStyle,
1913
+ onKeyDown: handleKeyDown,
1914
+ tabIndex: accessibility ? 0 : void 0,
1915
+ onFocus: handleFocus,
1916
+ onBlur: handleBlur,
1917
+ children: [
1918
+ arrows && !disabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1919
+ PrevArrow,
1920
+ {
1921
+ currentSlide,
1922
+ slideCount,
1923
+ slidesToShow,
1924
+ infinite,
1925
+ centerMode,
1926
+ onClick: prev,
1927
+ customArrow: prevArrow
1928
+ }
1929
+ ),
1930
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1931
+ "div",
1932
+ {
1933
+ ref: listRef,
1934
+ className: "glide-list",
1935
+ style: listStyle,
1936
+ onMouseDown: touchMove ? handleSwipeStart : void 0,
1937
+ onMouseMove: touchMove && dragging ? handleSwipeMove : void 0,
1938
+ onMouseUp: touchMove ? handleSwipeEnd : void 0,
1939
+ onMouseLeave: touchMove && dragging ? handleSwipeEnd : handleMouseLeave,
1940
+ onMouseEnter: handleMouseEnter,
1941
+ onTouchStart: swipe ? handleSwipeStart : void 0,
1942
+ onTouchMove: swipe && dragging ? handleSwipeMove : void 0,
1943
+ onTouchEnd: swipe ? handleSwipeEnd : void 0,
1944
+ onTouchCancel: swipe && dragging ? handleSwipeEnd : void 0,
1945
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1946
+ Track,
1947
+ {
1948
+ ref: trackRef,
1949
+ trackStyle,
1950
+ slideWidth: calculatedSlideWidth,
1951
+ slideHeight: slideHeight || void 0,
1952
+ slideCount,
1953
+ currentSlide,
1954
+ targetSlide,
1955
+ slidesToShow,
1956
+ slidesToScroll,
1957
+ infinite,
1958
+ centerMode,
1959
+ centerPadding,
1960
+ fade,
1961
+ vertical,
1962
+ variableWidth,
1963
+ rtl,
1964
+ disabled,
1965
+ lazyLoad,
1966
+ lazyLoadedList,
1967
+ speed,
1968
+ cssEase,
1969
+ useCSS,
1970
+ focusOnSelect,
1971
+ onSlideClick: handleSlideClick,
1972
+ children
1973
+ }
1974
+ )
1975
+ }
1976
+ ),
1977
+ arrows && !disabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1978
+ NextArrow,
1979
+ {
1980
+ currentSlide,
1981
+ slideCount,
1982
+ slidesToShow,
1983
+ infinite,
1984
+ centerMode,
1985
+ onClick: next,
1986
+ customArrow: nextArrow
1987
+ }
1988
+ ),
1989
+ dots && !disabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1990
+ Dots,
1991
+ {
1992
+ slideCount,
1993
+ slidesToScroll,
1994
+ slidesToShow,
1995
+ currentSlide,
1996
+ infinite,
1997
+ onDotClick: handleDotClick,
1998
+ customPaging,
1999
+ appendDots,
2000
+ dotsClass,
2001
+ onMouseEnter: handleDotMouseEnter,
2002
+ onMouseLeave: handleDotMouseLeave
2003
+ }
2004
+ )
2005
+ ]
2006
+ }
2007
+ );
2008
+ });
2009
+ var index_default = Glide;
2010
+ // Annotate the CommonJS export names for ESM import in node:
2011
+ 0 && (module.exports = {
2012
+ Dots,
2013
+ Glide,
2014
+ NextArrow,
2015
+ PrevArrow,
2016
+ Track,
2017
+ calculateSlideWidth,
2018
+ canGoNext,
2019
+ canGoPrev,
2020
+ canUseDOM,
2021
+ clamp,
2022
+ getHeight,
2023
+ getOnDemandLazySlides,
2024
+ getPostClones,
2025
+ getPreClones,
2026
+ getSlideClasses,
2027
+ getSwipeDirection,
2028
+ getTotalSlides,
2029
+ getTrackAnimateCSS,
2030
+ getTrackCSS,
2031
+ getTrackLeft,
2032
+ getWidth,
2033
+ keyHandler,
2034
+ lazyEndIndex,
2035
+ lazySlidesOnLeft,
2036
+ lazySlidesOnRight,
2037
+ lazyStartIndex,
2038
+ safePreventDefault,
2039
+ swipeEnd,
2040
+ swipeMove,
2041
+ swipeStart,
2042
+ useTrack
2043
+ });