@preline/carousel 4.1.3 → 5.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/README.md ADDED
@@ -0,0 +1,390 @@
1
+ # Carousel
2
+
3
+ Build carousels and sliders with Carousel JavaScript plugin.
4
+
5
+ [![npm](https://img.shields.io/badge/npm-v4.2.0-blue)](https://www.npmjs.com/package/@preline/carousel) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Demo](https://img.shields.io/badge/demo-online-brightgreen)](https://preline.co/plugins/carousel.html)
6
+
7
+ ## Contents
8
+
9
+ - [Overview](#overview)
10
+ - [Installation](#installation)
11
+ - [Basic usage](#basic-usage)
12
+ - [Configuration Options](#configuration-options)
13
+ - [JavaScript API](#javascript-api)
14
+ - [Events](#events)
15
+ - [Common Patterns](#common-patterns)
16
+ - [License](#license)
17
+
18
+ ## Overview
19
+
20
+ The Carousel component provides a flexible, feature-rich slider for displaying multiple items in a scrollable container. It supports autoplay, infinite loop, drag gestures, responsive breakpoints, and multiple display modes.
21
+
22
+ **Key Features:**
23
+ - Multiple slides in a scrollable container
24
+ - Autoplay and infinite loop support
25
+ - Drag/swipe gestures for navigation
26
+ - Responsive breakpoints for different screen sizes
27
+ - Multiple display modes (default, snap, bounded)
28
+ - Programmatic control via JavaScript API
29
+ - Keyboard navigation support
30
+ - Customizable pagination dots
31
+
32
+ ## Installation
33
+
34
+ To get started, install Carousel plugin via npm, else you can skip this step if you are already using Preline UI as a package.
35
+
36
+ ```bash
37
+ npm i @preline/carousel
38
+ ```
39
+
40
+ ### CSS
41
+
42
+ Use [`@source`](https://tailwindcss.com/docs/functions-and-directives#source-directive) to register the plugin's JavaScript path for Tailwind CSS scanning, then [`@import`](https://tailwindcss.com/docs/functions-and-directives#import-directive) the plugin's CSS files into your Tailwind CSS file.
43
+
44
+ ```css
45
+ @import "tailwindcss";
46
+
47
+ /* @preline/carousel */
48
+ @source "../node_modules/@preline/carousel/*.js";
49
+ @import "./node_modules/@preline/carousel/variants.css";
50
+ @import "./node_modules/@preline/carousel/theme.css";
51
+ ```
52
+
53
+ ### JavaScript
54
+
55
+ Include the JavaScript that powers the interactive elements near the end of your `</body>` tag:
56
+
57
+ ```html
58
+ <script src="./node_modules/@preline/carousel/index.js"></script>
59
+ ```
60
+
61
+ ### Manual Initialization
62
+
63
+ Use the `non-auto` entry if you need manual initialization. In this mode, automatic initialization on page load is not included, so the component should be initialized explicitly.
64
+
65
+ ```html
66
+ <script type="module">
67
+ import HSCarousel from "@preline/carousel/non-auto.mjs";
68
+
69
+ new HSCarousel(document.querySelector("#carousel"));
70
+ </script>
71
+ ```
72
+
73
+ ### Via Bundler
74
+
75
+ When using a bundler (Vite, webpack, etc.), import the plugin directly as an ES module.
76
+
77
+ `@preline/carousel` is the auto-init entry: it scans the DOM and initializes matching elements automatically.
78
+
79
+ ```js
80
+ import "@preline/carousel";
81
+ ```
82
+
83
+ `@preline/carousel/non-auto` is the manual entry: use it when you want explicit control over when initialization happens, either via `autoInit()` or by creating a specific instance yourself.
84
+
85
+ ```js
86
+ import HSCarousel from "@preline/carousel/non-auto";
87
+
88
+ HSCarousel.autoInit();
89
+
90
+ // Or initialize a specific element manually
91
+ const el = document.querySelector("#carousel");
92
+ if (el) new HSCarousel(el);
93
+ ```
94
+
95
+ ### TypeScript
96
+
97
+ This package ships with TypeScript type definitions. No additional `@types/` package is needed.
98
+
99
+ ## Basic usage
100
+
101
+ The following example demonstrates the minimal HTML structure required for a carousel component. This is a base template without custom styling - you can apply your own CSS classes and styles as needed. The carousel displays three slides with previous/next navigation buttons.
102
+
103
+ ```html
104
+ <div data-hs-carousel='{
105
+ "loadingClasses": "opacity-0"
106
+ }' class="relative">
107
+ <div class="hs-carousel relative overflow-hidden w-full min-h-64">
108
+ <div class="hs-carousel-body absolute top-0 bottom-0 start-0 flex flex-nowrap transition-transform duration-700 opacity-0">
109
+ <div class="hs-carousel-slide">
110
+ 1
111
+ </div>
112
+ <div class="hs-carousel-slide">
113
+ 2
114
+ </div>
115
+ <div class="hs-carousel-slide">
116
+ 3
117
+ </div>
118
+ </div>
119
+ </div>
120
+
121
+ <button type="button" class="hs-carousel-prev">
122
+ <span aria-hidden="true">«</span>
123
+ <span class="sr-only">Previous</span>
124
+ </button>
125
+ <button type="button" class="hs-carousel-next">
126
+ <span class="sr-only">Next</span>
127
+ <span aria-hidden="true">»</span>
128
+ </button>
129
+ </div>
130
+ ```
131
+
132
+ **Structure Requirements:**
133
+ - `data-hs-carousel`: Required on the container element, contains configuration options
134
+ - `hs-carousel`: Required wrapper for slides collection, must contain `overflow-hidden` class
135
+ - `hs-carousel-body`: Required slides container
136
+ - `hs-carousel-slide`: Required for each slide element
137
+ - `hs-carousel-prev`: Optional previous slide button
138
+ - `hs-carousel-next`: Optional next slide button
139
+ - `hs-carousel-pagination`: Optional pagination container
140
+
141
+ **Initial State:**
142
+ - Carousel body typically starts with `opacity-0` which is removed after loading
143
+ - First slide is active by default (index 0)
144
+
145
+ ## Configuration Options
146
+
147
+ ### Data Options
148
+
149
+ Data options are specified in the `data-hs-carousel` attribute as a JSON object.
150
+
151
+ | Option | Type | Default | Description |
152
+ | --- | --- | --- | --- |
153
+ | `currentIndex` | number | `0` | Specifies the index of the current slide initially (from 0 to slides quantity). |
154
+ | `loadingClasses` | string | `"opacity-0"` | Specifies which classes should be removed after the carousel is loaded. CSS classes should be separated with space. |
155
+ | `dotsItemClasses` | string | - | Specifies which classes will be added to the point elements (which are generated automatically). CSS classes should be separated with space. |
156
+ | `isAutoHeight` | boolean | `false` | Sets the height of the carousel to the height of the current slide. |
157
+ | `isAutoPlay` | boolean | `false` | Enables autoplay. Slides advance automatically at the interval specified by `speed`. |
158
+ | `isInfiniteLoop` | boolean | `true` | Enables infinite loop. When reaching the last slide, it wraps to the first slide. |
159
+ | `isCentered` | boolean | `false` | Enables centered mode. This mode adds space on the sides to center the slides. |
160
+ | `isSnap` | boolean | `false` | Enables a mode in which you can scroll the contents of the slider using the scroll along the x-axis, while the active slider is centered relative to the slider. |
161
+ | `isScrollBlocked` | boolean | `false` | Prevents the user from scrolling the slider. Useful when you need to prevent scrolling while the carousel is active. |
162
+ | `isDraggable` | boolean | `false` | Adds the ability to change slides using dragging. Requires adding `hs-carousel:dragging:transition-none` class to the `hs-carousel-body`. Not working with `isSnap: true` option. |
163
+ | `isRTL` | boolean | `false` | Turns on RTL (right-to-left) mode. |
164
+ | `hasSnapSpacers` | boolean | `true` | Adds additional elements to create a constant centering effect. |
165
+ | `slidesQty` | object \| number | `1` | Allows to set the number of slides to display at a certain screen resolution if passed as an object (e.g., `{"xs": 1, "md": 2, "lg": 3}`). If passed as a number, the specified number of slides will be displayed for all screen resolutions. |
166
+ | `slideBy` | object \| number | `1` | Specifies how many slides to move when navigating through the carousel. Can be a number for all screen sizes or an object with breakpoint-specific values. |
167
+ | `speed` | number | `4000` | Autoplay animation speed in milliseconds. Available if `isAutoplay: true`. |
168
+ | `updateDelay` | number | `0` | Allows you to delay the update function when resizing a window. Suitable for a slider with images, for more accurate calculation of the size of the images. |
169
+ | `mode` | `"default"` \| `"snap"` \| `"bounded"` | `"default"` | Defines the carousel's behavior mode. `default` for standard sliding, `snap` for scroll-based navigation with snap points, and `bounded` for a fixed-width container with responsive slides. |
170
+ | `boundedOptions` | object | `null` | Configuration options for the bounded mode carousel. Includes `maxWidth` to set the maximum width of the carousel container, `slidesGap` to define spacing between slides, and `spacersWidth` to control the width of side spacers. When `spacersWidth` is set to `"auto"`, it automatically calculates equal spacing on both sides. |
171
+
172
+ **Example:**
173
+ ```html
174
+ <div data-hs-carousel='{
175
+ "isAutoPlay": true,
176
+ "speed": 3000,
177
+ "slidesQty": {"xs": 1, "md": 2, "lg": 3},
178
+ "isInfiniteLoop": true
179
+ }'>
180
+ <!-- Carousel content -->
181
+ </div>
182
+ ```
183
+
184
+ ### Required CSS Classes
185
+
186
+ These classes define the structure and must be present for the carousel to function.
187
+
188
+ | Class | Required On | Purpose |
189
+ | --- | --- | --- |
190
+ | `hs-carousel` | Wrapper container | A wrapper for a collection of slides. Must contain the `overflow-hidden` class for correct functionality. |
191
+ | `hs-carousel-body` | Slides container | Container for all slide elements. |
192
+ | `hs-carousel-slide` | Each slide element | Identifies an individual slide. |
193
+
194
+ ### Optional CSS Classes
195
+
196
+ | Class | Required On | Purpose |
197
+ | --- | --- | --- |
198
+ | `hs-carousel-prev` | Previous button | Previous slide navigation button. |
199
+ | `hs-carousel-next` | Next button | Next slide navigation button. |
200
+ | `hs-carousel-pagination` | Pagination container | Pagination container. If it doesn't contain nested elements, dots are generated automatically. If it contains elements with `hs-carousel-pagination-item` class, they will act as dots. |
201
+
202
+ ### Tailwind Modifiers
203
+
204
+ | Name | Description |
205
+ | --- | --- |
206
+ | `hs-carousel-active:*` | A modifier that allows you to set Tailwind classes when the active slide was shown. |
207
+ | `hs-carousel-disabled:*` | A modifier that allows you to set Tailwind classes for arrow buttons when they are `disabled`. |
208
+ | `hs-carousel:dragging:*` | A modifier that allows you to set Tailwind classes for `hs-carousel-body` when dragging. |
209
+
210
+ ## JavaScript API
211
+
212
+ The `HSCarousel` object is available in the global `window` object after the plugin is loaded.
213
+
214
+ ### Instance Methods
215
+
216
+ These methods are called on a carousel instance.
217
+
218
+ | Method | Parameters | Return Type | Description |
219
+ | --- | --- | --- | --- |
220
+ | `goToPrev()` | None | `void` | Navigates to the previous slide. |
221
+ | `goToNext()` | None | `void` | Navigates to the next slide. |
222
+ | `goTo(index)` | `index`: `number` | `void` | Navigates to the slide at the specified index. Index starts from 0. |
223
+ | `recalculateWidth()` | None | `void` | Recalculates the width of the carousel. Useful after dynamically adding or removing slides, or when window is resized. |
224
+ | `destroy()` | None | `void` | Destroys the carousel instance, removes all generated markup, classes, and event listeners. Use when removing carousel from DOM. |
225
+
226
+ ### Static Methods
227
+
228
+ These methods are called directly on the `HSCarousel` class.
229
+
230
+ | Method | Parameters | Return Type | Description |
231
+ | --- | --- | --- | --- |
232
+ | `HSCarousel.getInstance(target, isInstance)` | `target`: `HTMLElement \| string` (CSS selector)<br>`isInstance`: `boolean` (optional) | `HSCarousel \| { id: string \| number, element: HSCarousel } \| null` | Returns the carousel instance associated with the target. If `isInstance` is `true`, returns collection item object `{ id, element }` where `element` is the `HSCarousel` instance. If `isInstance` is `false` or omitted, returns the `HSCarousel` instance directly. Returns `null` if carousel instance is not found. |
233
+
234
+ ### Usage Examples
235
+
236
+ **Example 1: Using instance methods (public API)**
237
+ ```javascript
238
+ // Create a new carousel instance
239
+ const carousel = new HSCarousel(document.querySelector('#hs-carousel'));
240
+ const goToSecondBtn = document.querySelector('#hs-go-to-second-btn');
241
+
242
+ // Navigate to slide by index
243
+ goToSecondBtn.addEventListener('click', () => {
244
+ carousel.goTo(1); // Go to second slide (index 1)
245
+ });
246
+ ```
247
+
248
+ **Example 2: Getting instance and using methods (recommended pattern)**
249
+ ```javascript
250
+ // Get the carousel instance
251
+ const instance = HSCarousel.getInstance('#hs-carousel', true);
252
+
253
+ if (instance) {
254
+ const { element } = instance; // element is the HSCarousel instance
255
+ const goToSecondBtn = document.querySelector('#hs-go-to-second-btn');
256
+ const prevBtn = document.querySelector('#hs-prev-btn');
257
+ const nextBtn = document.querySelector('#hs-next-btn');
258
+
259
+ // Navigate to specific slide
260
+ goToSecondBtn.addEventListener('click', () => {
261
+ element.goTo(1);
262
+ });
263
+
264
+ // Navigate to previous slide
265
+ prevBtn.addEventListener('click', () => {
266
+ element.goToPrev();
267
+ });
268
+
269
+ // Navigate to next slide
270
+ nextBtn.addEventListener('click', () => {
271
+ element.goToNext();
272
+ });
273
+
274
+ // Recalculate width after dynamic changes
275
+ function updateCarousel() {
276
+ element.recalculateWidth();
277
+ }
278
+
279
+ // Clean up when removing from DOM
280
+ function removeCarousel() {
281
+ element.destroy();
282
+ }
283
+ }
284
+ ```
285
+
286
+ **Example 3: Destroying carousel instance**
287
+ ```javascript
288
+ const instance = HSCarousel.getInstance('#hs-carousel', true);
289
+
290
+ if (instance) {
291
+ const { element } = instance;
292
+ const removeBtn = document.querySelector('#hs-remove-btn');
293
+
294
+ removeBtn.addEventListener('click', () => {
295
+ // Clean up before removing from DOM
296
+ element.destroy();
297
+ // Now safe to remove the element
298
+ document.querySelector('#hs-carousel').remove();
299
+ });
300
+ }
301
+ ```
302
+
303
+ ## Events
304
+
305
+ Carousel instances emit events that can be listened to for slide lifecycle hooks.
306
+
307
+ | Event Name | When Fired | Callback Parameter | Description |
308
+ | --- | --- | --- | --- |
309
+ | `on:update` | After the active slide changes | `number` (zero-based index of the current slide) | Fires after navigating to the next or previous slide, or after `goTo()` is called. |
310
+
311
+ ### Event Usage Example
312
+
313
+ ```javascript
314
+ // Get carousel instance
315
+ const instance = HSCarousel.getInstance('#hs-carousel', true);
316
+
317
+ if (instance) {
318
+ const { element } = instance;
319
+
320
+ // Listen for slide changes
321
+ element.on('update', (currentIndex) => {
322
+ console.log('Active slide:', currentIndex);
323
+ // Update external indicators, counters, etc.
324
+ });
325
+ }
326
+ ```
327
+
328
+ ## Common Patterns
329
+
330
+ ### Pattern 1: Responsive Carousel
331
+
332
+ Display different number of slides at different breakpoints.
333
+
334
+ ```html
335
+ <div data-hs-carousel='{
336
+ "slidesQty": {"xs": 1, "sm": 2, "md": 3, "lg": 4}
337
+ }'>
338
+ <!-- Carousel content -->
339
+ </div>
340
+ ```
341
+
342
+ ### Pattern 2: Autoplay Carousel
343
+
344
+ Automatically advance slides at regular intervals.
345
+
346
+ ```html
347
+ <div data-hs-carousel='{
348
+ "isAutoPlay": true,
349
+ "speed": 5000,
350
+ "isInfiniteLoop": true
351
+ }'>
352
+ <!-- Carousel content -->
353
+ </div>
354
+ ```
355
+
356
+ ### Pattern 3: Programmatic Control
357
+
358
+ Control carousel from external buttons.
359
+
360
+ ```html
361
+ <div id="hs-carousel-first" data-hs-carousel>
362
+ <!-- Carousel content -->
363
+ </div>
364
+
365
+ <button id="hs-go-to-first">Go to First</button>
366
+ <button id="hs-go-to-last">Go to Last</button>
367
+
368
+ <script>
369
+ const instance = HSCarousel.getInstance('#hs-carousel-first', true);
370
+
371
+ if (instance) {
372
+ const { element } = instance;
373
+
374
+ document.querySelector('#hs-go-to-first').addEventListener('click', () => {
375
+ element.goTo(0);
376
+ });
377
+
378
+ document.querySelector('#hs-go-to-last').addEventListener('click', () => {
379
+ // Assuming 5 slides (indices 0-4)
380
+ element.goTo(4);
381
+ });
382
+ }
383
+ </script>
384
+ ```
385
+
386
+ ## License
387
+
388
+ Copyright (c) 2024 Htmlstream.
389
+
390
+ Licensed under the [MIT License](https://opensource.org/licenses/MIT).
package/index.d.ts CHANGED
@@ -5,21 +5,36 @@ export interface ICarouselOptions {
5
5
  currentIndex: number;
6
6
  loadingClasses?: string | string[];
7
7
  dotsItemClasses?: string;
8
- mode?: "default" | "scroll-nav";
9
8
  isAutoHeight?: boolean;
10
9
  isAutoPlay?: boolean;
11
10
  isCentered?: boolean;
12
11
  isDraggable?: boolean;
12
+ dragThreshold?: number;
13
13
  isInfiniteLoop?: boolean;
14
+ isItemCustomWidth?: boolean;
14
15
  isRTL?: boolean;
15
16
  isSnap?: boolean;
17
+ isScrollBlocked?: boolean;
16
18
  hasSnapSpacers?: boolean;
17
19
  slidesQty?: TCarouselOptionsSlidesQty | number;
20
+ slideBy?: TCarouselOptionsSlidesQty | number | null;
18
21
  speed?: number;
19
22
  updateDelay?: number;
23
+ mode?: "default" | "snap" | "bounded";
24
+ boundedOptions?: {
25
+ maxWidth?: [
26
+ number,
27
+ "px" | "rem"
28
+ ];
29
+ slidesGap?: [
30
+ number,
31
+ "px" | "rem"
32
+ ];
33
+ spacersWidth?: number | "auto";
34
+ };
20
35
  }
21
36
  export interface ICarousel {
22
- options?: ICarouselOptions;
37
+ options: ICarouselOptions;
23
38
  recalculateWidth(): void;
24
39
  goToPrev(): void;
25
40
  goToNext(): void;
@@ -48,6 +63,7 @@ declare class HSCarousel extends HSBasePlugin<ICarouselOptions> implements ICaro
48
63
  private readonly isAutoPlay;
49
64
  private readonly isCentered;
50
65
  private readonly isDraggable;
66
+ private readonly dragThreshold;
51
67
  private readonly isInfiniteLoop;
52
68
  private readonly isRTL;
53
69
  private readonly isSnap;
@@ -73,6 +89,7 @@ declare class HSCarousel extends HSBasePlugin<ICarouselOptions> implements ICaro
73
89
  private isScrolling;
74
90
  private isDragging;
75
91
  private dragStartX;
92
+ private dragStartTime;
76
93
  private initialTranslateX;
77
94
  private readonly touchX;
78
95
  private readonly touchY;
@@ -134,6 +151,7 @@ declare class HSCarousel extends HSBasePlugin<ICarouselOptions> implements ICaro
134
151
  private setTimer;
135
152
  private resetTimer;
136
153
  private detectDirection;
154
+ private getTargetTranslateX;
137
155
  private calculateTransform;
138
156
  private setTransform;
139
157
  private setTranslate;
package/index.js CHANGED
@@ -1,24 +1,24 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(self,(()=>(()=>{"use strict";var t={292:function(t,e){
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var i in s)("object"==typeof exports?exports:t)[i]=s[i]}}(self,()=>(()=>{"use strict";var t={8223(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BREAKPOINTS=e.COMBO_BOX_ACCESSIBILITY_KEY_SET=e.SELECT_ACCESSIBILITY_KEY_SET=e.TABS_ACCESSIBILITY_KEY_SET=e.OVERLAY_ACCESSIBILITY_KEY_SET=e.DROPDOWN_ACCESSIBILITY_KEY_SET=e.POSITIONS=void 0,e.POSITIONS={auto:"auto","auto-start":"auto-start","auto-end":"auto-end",top:"top","top-left":"top-start","top-right":"top-end",bottom:"bottom","bottom-left":"bottom-start","bottom-right":"bottom-end",right:"right","right-start":"right-start","right-end":"right-end",left:"left","left-start":"left-start","left-end":"left-end"},e.DROPDOWN_ACCESSIBILITY_KEY_SET=["Escape","ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Home","End","Enter"],e.OVERLAY_ACCESSIBILITY_KEY_SET=["Escape","Tab"],e.TABS_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End"],e.SELECT_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End","Escape","Enter","Space","Tab"],e.COMBO_BOX_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End","Escape","Enter"],e.BREAKPOINTS={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536}},2961(t,e){
2
2
  /*
3
- * @version: 4.1.3
3
+ * HSBasePlugin
4
+ * @version: 5.0.0
4
5
  * @author: Preline Labs Ltd.
5
6
  * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
6
7
  * Copyright 2024 Preline Labs Ltd.
7
8
  */
8
- Object.defineProperty(e,"__esModule",{value:!0}),e.stringToBoolean=e.menuSearchHistory=e.isScrollable=e.isParentOrElementHidden=e.isJson=e.isIpadOS=e.isIOS=e.isFormElement=e.isFocused=e.isEnoughSpace=e.isDirectChild=e.htmlToElement=e.getZIndex=e.getHighestZIndex=e.getClassPropertyAlt=e.getClassProperty=e.dispatch=e.debounce=e.classToClassList=e.afterTransition=void 0;e.stringToBoolean=t=>"true"===t;e.getClassProperty=(t,e,s="")=>(window.getComputedStyle(t).getPropertyValue(e)||s).replace(" ","");e.getClassPropertyAlt=(t,e,s="")=>{let i="";return t.classList.forEach((t=>{t.includes(e)&&(i=t)})),i.match(/:(.*)]/)?i.match(/:(.*)]/)[1]:s};const s=t=>window.getComputedStyle(t).getPropertyValue("z-index");e.getZIndex=s;e.getHighestZIndex=t=>{let e=Number.NEGATIVE_INFINITY;return t.forEach((t=>{let i=s(t);"auto"!==i&&(i=parseInt(i,10),i>e&&(e=i))})),e};e.isDirectChild=(t,e)=>{const s=t.children;for(let t=0;t<s.length;t++)if(s[t]===e)return!0;return!1};e.isEnoughSpace=(t,e,s="auto",i=10,n=null)=>{const r=e.getBoundingClientRect(),o=n?n.getBoundingClientRect():null,l=window.innerHeight,h=o?r.top-o.top:r.top,a=(n?o.bottom:l)-r.bottom,d=t.clientHeight+i;return"bottom"===s?a>=d:"top"===s?h>=d:h>=d||a>=d};e.isFocused=t=>document.activeElement===t;e.isFormElement=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement;e.isIOS=()=>!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);e.isIpadOS=()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);e.isJson=t=>{if("string"!=typeof t)return!1;const e=t.trim()[0],s=t.trim().slice(-1);if("{"===e&&"}"===s||"["===e&&"]"===s)try{return JSON.parse(t),!0}catch(t){return!1}return!1};const i=t=>{if(!t)return!1;return"none"===window.getComputedStyle(t).display||i(t.parentElement)};e.isParentOrElementHidden=i;e.isScrollable=t=>{const e=window.getComputedStyle(t),s=e.overflowY,i=e.overflowX,n=("scroll"===s||"auto"===s)&&t.scrollHeight>t.clientHeight,r=("scroll"===i||"auto"===i)&&t.scrollWidth>t.clientWidth;return n||r};e.debounce=(t,e=200)=>{let s;return(...i)=>{clearTimeout(s),s=setTimeout((()=>{t.apply(this,i)}),e)}};e.dispatch=(t,e,s=null)=>{const i=new CustomEvent(t,{detail:{payload:s},bubbles:!0,cancelable:!0,composed:!1});e.dispatchEvent(i)};e.afterTransition=(t,e)=>{const s=()=>{e(),t.removeEventListener("transitionend",s,!0)},i=window.getComputedStyle(t),n=i.getPropertyValue("transition-duration");"none"!==i.getPropertyValue("transition-property")&&parseFloat(n)>0?t.addEventListener("transitionend",s,!0):e()};e.htmlToElement=t=>{const e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild};e.classToClassList=(t,e,s=" ",i="add")=>{t.split(s).forEach((t=>{t.trim()&&("add"===i?e.classList.add(t):e.classList.remove(t))}))};const n={historyIndex:-1,addHistory(t){this.historyIndex=t},existsInHistory(t){return t>this.historyIndex},clearHistory(){this.historyIndex=-1}};e.menuSearchHistory=n},2961:(t,e)=>{
9
+ Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(t,e,s){this.el=t,this.options=e,this.events=s,this.el=t,this.options=e,this.events={}}createCollection(t,e){var s,i;let n=t;if(!Array.isArray(n)&&"undefined"!=typeof window){const t=null===(s=this.constructor)||void 0===s?void 0:s.name,e="string"==typeof t&&t.startsWith("HS")?`$hs${t.slice(2)}Collection`:null;e&&(Array.isArray(window[e])||(window[e]=[]),n=window[e])}Array.isArray(n)&&n.push({id:(null===(i=null==e?void 0:e.el)||void 0===i?void 0:i.id)||n.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}},2069(t,e,s){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=i(s(4701));window.addEventListener("load",()=>{n.default.autoInit()}),"undefined"!=typeof window&&(window.HSCarousel=n.default)},4701(t,e,s){
9
10
  /*
10
- * HSBasePlugin
11
- * @version: 4.1.3
11
+ * HSCarousel
12
+ * @version: 5.0.0
12
13
  * @author: Preline Labs Ltd.
13
14
  * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
14
15
  * Copyright 2024 Preline Labs Ltd.
15
16
  */
16
- Object.defineProperty(e,"__esModule",{value:!0});e.default=class{constructor(t,e,s){this.el=t,this.options=e,this.events=s,this.el=t,this.options=e,this.events={}}createCollection(t,e){var s,i;let n=t;if(!Array.isArray(n)&&"undefined"!=typeof window){const t=null===(s=this.constructor)||void 0===s?void 0:s.name,e="string"==typeof t&&t.startsWith("HS")?`$hs${t.slice(2)}Collection`:null;e&&(Array.isArray(window[e])||(window[e]=[]),n=window[e])}Array.isArray(n)&&n.push({id:(null===(i=null==e?void 0:e.el)||void 0===i?void 0:i.id)||n.length+1,element:e})}fireEvent(t,e=null){if(this.events.hasOwnProperty(t))return this.events[t](e)}on(t,e){this.events[t]=e}}},4701:function(t,e,s){
17
+ var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=s(292),r=i(s(2961)),o=s(8223);class l extends r.default{constructor(t,e){var s,i,n,r,o;super(t,e);const l=t.getAttribute("data-hs-carousel"),h=l?JSON.parse(l):{},a=Object.assign(Object.assign({},h),e);this.currentIndex=a.currentIndex||0,this.loadingClasses=a.loadingClasses?`${a.loadingClasses}`.split(","):null,this.dotsItemClasses=a.dotsItemClasses?a.dotsItemClasses:null,this.isAutoHeight=void 0!==a.isAutoHeight&&a.isAutoHeight,this.isAutoPlay=void 0!==a.isAutoPlay&&a.isAutoPlay,this.isCentered=void 0!==a.isCentered&&a.isCentered,this.isDraggable=void 0!==a.isDraggable&&a.isDraggable,this.dragThreshold="number"==typeof a.dragThreshold?a.dragThreshold:.2,this.isInfiniteLoop=void 0!==a.isInfiniteLoop&&a.isInfiniteLoop,this.isRTL=void 0!==a.isRTL&&a.isRTL,this.isSnap=void 0!==a.isSnap&&a.isSnap,this.hasSnapSpacers=void 0===a.hasSnapSpacers||a.hasSnapSpacers,this.speed=a.speed||4e3,this.updateDelay=a.updateDelay||0,this.slidesQty=a.slidesQty||1,this.loadingClassesRemove=(null===(s=this.loadingClasses)||void 0===s?void 0:s[0])?this.loadingClasses[0].split(" "):"opacity-0",this.loadingClassesAdd=(null===(i=this.loadingClasses)||void 0===i?void 0:i[1])?this.loadingClasses[1].split(" "):"",this.afterLoadingClassesAdd=(null===(n=this.loadingClasses)||void 0===n?void 0:n[2])?this.loadingClasses[2].split(" "):"",this.container=this.el.querySelector(".hs-carousel")||null,this.inner=this.el.querySelector(".hs-carousel-body")||null,this.slides=this.el.querySelectorAll(".hs-carousel-slide")||[],this.prev=this.el.querySelector(".hs-carousel-prev")||null,this.next=this.el.querySelector(".hs-carousel-next")||null,this.dots=this.el.querySelector(".hs-carousel-pagination")||null,this.info=this.el.querySelector(".hs-carousel-info")||null,this.infoTotal=(null===(r=null==this?void 0:this.info)||void 0===r?void 0:r.querySelector(".hs-carousel-info-total"))||null,this.infoCurrent=(null===(o=null==this?void 0:this.info)||void 0===o?void 0:o.querySelector(".hs-carousel-info-current"))||null,this.sliderWidth=this.el.getBoundingClientRect().width,this.isDragging=!1,this.dragStartX=null,this.dragStartTime=null,this.initialTranslateX=null,this.touchX={start:0,end:0},this.touchY={start:0,end:0},this.resizeContainer=document.querySelector("body"),this.resizeContainerWidth=0,this.init()}setIsSnap(){const t=this.container.getBoundingClientRect(),e=t.left+t.width/2;let s=null,i=null,n=1/0;Array.from(this.inner.children).forEach(t=>{const i=t.getBoundingClientRect(),r=this.inner.getBoundingClientRect(),o=i.left+i.width/2-r.left,l=Math.abs(e-(r.left+o));l<n&&(n=l,s=t)}),s&&(i=Array.from(this.slides).findIndex(t=>t===s)),this.setIndex(i),this.dots&&this.setCurrentDot()}prevClick(){this.goToPrev(),this.isAutoPlay&&(this.resetTimer(),this.setTimer())}nextClick(){this.goToNext(),this.isAutoPlay&&(this.resetTimer(),this.setTimer())}containerScroll(){clearTimeout(this.isScrolling),this.isScrolling=setTimeout(()=>{this.setIsSnap()},100)}elementTouchStart(t){this.touchX.start=t.changedTouches[0].screenX,this.touchY.start=t.changedTouches[0].screenY}elementTouchEnd(t){this.touchX.end=t.changedTouches[0].screenX,this.touchY.end=t.changedTouches[0].screenY,this.detectDirection()}innerMouseDown(t){this.handleDragStart(t)}innerTouchStart(t){this.handleDragStart(t)}documentMouseMove(t){this.handleDragMove(t)}documentTouchMove(t){this.handleDragMove(t)}documentMouseUp(){this.handleDragEnd()}documentTouchEnd(){this.handleDragEnd()}dotClick(t){this.goTo(t),this.isAutoPlay&&(this.resetTimer(),this.setTimer())}init(){this.createCollection(window.$hsCarouselCollection,this),this.inner&&(this.calculateWidth(),this.isDraggable&&!this.isSnap&&this.initDragHandling()),this.prev&&(this.onPrevClickListener=()=>this.prevClick(),this.prev.addEventListener("click",this.onPrevClickListener)),this.next&&(this.onNextClickListener=()=>this.nextClick(),this.next.addEventListener("click",this.onNextClickListener)),this.dots&&this.initDots(),this.info&&this.buildInfo(),this.slides.length&&(this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass(),this.isAutoPlay&&this.autoPlay()),setTimeout(()=>{this.isSnap&&this.setIsSnap(),this.loadingClassesRemove&&("string"==typeof this.loadingClassesRemove?this.inner.classList.remove(this.loadingClassesRemove):this.inner.classList.remove(...this.loadingClassesRemove)),this.loadingClassesAdd&&("string"==typeof this.loadingClassesAdd?this.inner.classList.add(this.loadingClassesAdd):this.inner.classList.add(...this.loadingClassesAdd)),this.inner&&this.afterLoadingClassesAdd&&setTimeout(()=>{"string"==typeof this.afterLoadingClassesAdd?this.inner.classList.add(this.afterLoadingClassesAdd):this.inner.classList.add(...this.afterLoadingClassesAdd)})},400),this.isSnap&&(this.onContainerScrollListener=()=>this.containerScroll(),this.container.addEventListener("scroll",this.onContainerScrollListener)),this.el.classList.add("init"),this.isSnap||this.isDraggable||(this.onElementTouchStartListener=t=>this.elementTouchStart(t),this.onElementTouchEndListener=t=>this.elementTouchEnd(t),this.el.addEventListener("touchstart",this.onElementTouchStartListener),this.el.addEventListener("touchend",this.onElementTouchEndListener)),this.observeResize()}initDragHandling(){const t=this.inner;this.onInnerMouseDownListener=t=>this.innerMouseDown(t),this.onInnerTouchStartListener=t=>this.innerTouchStart(t),this.onDocumentMouseMoveListener=t=>this.documentMouseMove(t),this.onDocumentTouchMoveListener=t=>this.documentTouchMove(t),this.onDocumentMouseUpListener=()=>this.documentMouseUp(),this.onDocumentTouchEndListener=()=>this.documentTouchEnd(),t&&(t.addEventListener("mousedown",this.onInnerMouseDownListener),t.addEventListener("touchstart",this.onInnerTouchStartListener,{passive:!0}),document.addEventListener("mousemove",this.onDocumentMouseMoveListener),document.addEventListener("touchmove",this.onDocumentTouchMoveListener,{passive:!1}),document.addEventListener("mouseup",this.onDocumentMouseUpListener),document.addEventListener("touchend",this.onDocumentTouchEndListener))}getTranslateXValue(){var t;const e=window.getComputedStyle(this.inner).transform;if("none"!==e){const s=null===(t=e.match(/matrix.*\((.+)\)/))||void 0===t?void 0:t[1].split(", ");if(s){let t=parseFloat(6===s.length?s[4]:s[12]);return this.isRTL&&(t=-t),isNaN(t)||0===t?0:-t}}return 0}removeClickEventWhileDragging(t){t.preventDefault()}handleDragStart(t){t.preventDefault(),this.isDragging=!0,this.dragStartX=this.getEventX(t),this.dragStartTime=Date.now(),this.initialTranslateX=this.isRTL?this.getTranslateXValue():-this.getTranslateXValue(),this.inner.classList.add("dragging")}handleDragMove(t){if(!this.isDragging)return;this.inner.querySelectorAll("a:not(.prevented-click)").forEach(t=>{t.classList.add("prevented-click"),t.addEventListener("click",this.removeClickEventWhileDragging)});let e=this.getEventX(t)-this.dragStartX;this.isRTL&&(e=-e);const s=this.initialTranslateX+e;this.setTranslate((()=>{let t=this.sliderWidth*this.slides.length/this.getCurrentSlidesQty()-this.sliderWidth;const e=this.sliderWidth,i=(e-e/this.getCurrentSlidesQty())/2,n=this.isCentered?i:0;this.isCentered&&(t+=i);const r=-t;return this.isRTL?s<n?n:s>t?r:-s:s>n?n:s<-t?r:s})())}handleDragEnd(){if(!this.isDragging)return;this.isDragging=!1;const t=this.sliderWidth/this.getCurrentSlidesQty(),e=this.getTranslateXValue()-this.getTargetTranslateX(this.currentIndex),s=this.dragStartTime?Date.now()-this.dragStartTime:1/0,i=t*this.dragThreshold,n=s<=250&&Math.abs(e)>=20;let r=this.currentIndex;e>i||n&&e>0?r=this.currentIndex+1:(e<-i||n&&e<0)&&(r=this.currentIndex-1);const o=this.isCentered?this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.slides.length-this.getCurrentSlidesQty();r=Math.max(0,Math.min(r,o)),this.inner.classList.remove("dragging"),setTimeout(()=>{this.calculateTransform(r),this.dots&&this.setCurrentDot(),this.dragStartX=null,this.dragStartTime=null,this.initialTranslateX=null,this.inner.querySelectorAll("a.prevented-click").forEach(t=>{t.classList.remove("prevented-click"),t.removeEventListener("click",this.removeClickEventWhileDragging)})})}getEventX(t){return t instanceof MouseEvent?t.clientX:t.touches[0].clientX}getCurrentSlidesQty(){if("object"==typeof this.slidesQty){const t=document.body.clientWidth;let e=0;return Object.keys(this.slidesQty).forEach(s=>{t>=(typeof s+1=="number"?this.slidesQty[s]:o.BREAKPOINTS[s])&&(e=this.slidesQty[s])}),e}return this.slidesQty}buildSnapSpacers(){const t=this.inner.querySelector(".hs-snap-before"),e=this.inner.querySelector(".hs-snap-after");t&&t.remove(),e&&e.remove();const s=this.sliderWidth,i=s/2-s/this.getCurrentSlidesQty()/2,r=(0,n.htmlToElement)(`<div class="hs-snap-before" style="height: 100%; width: ${i}px"></div>`),o=(0,n.htmlToElement)(`<div class="hs-snap-after" style="height: 100%; width: ${i}px"></div>`);this.inner.prepend(r),this.inner.appendChild(o)}initDots(){this.el.querySelectorAll(".hs-carousel-pagination-item").length?this.setDots():this.buildDots(),this.dots&&this.setCurrentDot()}buildDots(){this.dots.innerHTML="";const t=!this.isCentered&&this.slidesQty?this.slides.length-(this.getCurrentSlidesQty()-1):this.slides.length;for(let e=0;e<t;e++){const t=this.buildSingleDot(e);this.dots.append(t)}}setDots(){this.dotsItems=this.dots.querySelectorAll(".hs-carousel-pagination-item"),this.dotsItems.forEach((t,e)=>{const s=t.getAttribute("data-carousel-pagination-item-target");this.singleDotEvents(t,s?+s:e)})}goToCurrentDot(){const t=this.dots,e=t.getBoundingClientRect(),s=t.scrollLeft,i=t.scrollTop,n=t.clientWidth,r=t.clientHeight,o=this.dotsItems[this.currentIndex],l=o.getBoundingClientRect(),h=l.left-e.left+s,a=h+o.clientWidth,d=l.top-e.top+i,c=d+o.clientHeight;let u=s,g=i;(h<s||a>s+n)&&(u=a-n),(d<i||c>i+r)&&(g=c-r),t.scrollTo({left:u,top:g,behavior:"smooth"})}buildInfo(){this.infoTotal&&this.setInfoTotal(),this.infoCurrent&&this.setInfoCurrent()}setInfoTotal(){this.infoTotal.innerText=`${this.slides.length}`}setInfoCurrent(){this.infoCurrent.innerText=`${this.currentIndex+1}`}buildSingleDot(t){const e=(0,n.htmlToElement)("<span></span>");return this.dotsItemClasses&&(0,n.classToClassList)(this.dotsItemClasses,e),this.singleDotEvents(e,t),e}singleDotEvents(t,e){this.onDotClickListener=()=>this.dotClick(e),t.addEventListener("click",this.onDotClickListener)}observeResize(){new ResizeObserver((0,n.debounce)(t=>{for(let e of t){const t=e.contentRect.width;t!==this.resizeContainerWidth&&(this.recalculateWidth(),this.dots&&this.initDots(),this.addCurrentClass(),this.resizeContainerWidth=t)}},this.updateDelay)).observe(this.resizeContainer)}calculateWidth(){this.isSnap||(this.inner.style.width=this.sliderWidth*this.slides.length/this.getCurrentSlidesQty()+"px"),this.slides.forEach(t=>{t.style.width=this.sliderWidth/this.getCurrentSlidesQty()+"px"}),this.calculateTransform()}addCurrentClass(){if(this.isSnap){const t=Math.floor(this.getCurrentSlidesQty()/2);for(let e=0;e<this.slides.length;e++){const s=this.slides[e];e<=this.currentIndex+t&&e>=this.currentIndex-t?s.classList.add("active"):s.classList.remove("active")}}else{const t=this.isCentered?this.currentIndex+this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.currentIndex+this.getCurrentSlidesQty();this.slides.forEach((e,s)=>{s>=this.currentIndex&&s<t?e.classList.add("active"):e.classList.remove("active")})}}setCurrentDot(){const t=(t,e)=>{let s=!1;const i=Math.floor(this.getCurrentSlidesQty()/2);s=this.isSnap&&!this.hasSnapSpacers?e===(this.getCurrentSlidesQty()%2==0?this.currentIndex-i+1:this.currentIndex-i):e===this.currentIndex,s?t.classList.add("active"):t.classList.remove("active")};this.dotsItems?this.dotsItems.forEach((e,s)=>t(e,s)):this.dots.querySelectorAll(":scope > *").forEach((e,s)=>t(e,s))}setElementToDisabled(t){t.classList.add("disabled"),"BUTTON"!==t.tagName&&"INPUT"!==t.tagName||t.setAttribute("disabled","disabled")}unsetElementToDisabled(t){t.classList.remove("disabled"),"BUTTON"!==t.tagName&&"INPUT"!==t.tagName||t.removeAttribute("disabled")}addDisabledClass(){if(!this.prev||!this.next)return!1;const t=getComputedStyle(this.inner).getPropertyValue("gap"),e=Math.floor(this.getCurrentSlidesQty()/2);let s=0,i=0,n=!1,r=!1;this.isSnap?(s=this.currentIndex,i=this.hasSnapSpacers?this.slides.length-1:this.slides.length-e-1,n=this.hasSnapSpacers?0===s:this.getCurrentSlidesQty()%2==0?s-e<0:s-e===0,r=s>=i&&this.container.scrollLeft+this.container.clientWidth+(parseFloat(t)||0)>=this.container.scrollWidth):(s=this.currentIndex,i=this.isCentered?this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.slides.length-this.getCurrentSlidesQty(),n=0===s,r=s>=i),n?(this.unsetElementToDisabled(this.next),this.setElementToDisabled(this.prev)):r?(this.unsetElementToDisabled(this.prev),this.setElementToDisabled(this.next)):(this.unsetElementToDisabled(this.prev),this.unsetElementToDisabled(this.next))}autoPlay(){this.setTimer()}setTimer(){this.timer=setInterval(()=>{this.currentIndex===this.slides.length-1?this.goTo(0):this.goToNext()},this.speed)}resetTimer(){clearInterval(this.timer)}detectDirection(){const t=this.touchX.end-this.touchX.start,e=this.touchY.end-this.touchY.start,s=Math.abs(t),i=Math.abs(e);if(s<30||s<i)return;const n=this.isRTL?t>0:t<0;this.isInfiniteLoop?n?this.goToNext():this.goToPrev():(n&&this.currentIndex<this.slides.length-this.getCurrentSlidesQty()&&this.goToNext(),!n&&this.currentIndex>0&&this.goToPrev())}getTargetTranslateX(t){const e=this.sliderWidth,s=e/this.getCurrentSlidesQty();let i=t*s;if(this.isCentered&&!this.isSnap){const n=(e-s)/2;if(0===t)i=-n;else if(t>=this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1)){i=this.slides.length*s-e+n}else i=t*s-n}return i}calculateTransform(t){void 0!==t&&(this.currentIndex=t);const e=this.sliderWidth,s=e/this.getCurrentSlidesQty(),i=this.getTargetTranslateX(this.currentIndex);this.isSnap&&!this.isCentered&&this.container.scrollLeft<e&&this.container.scrollLeft+s/2>e&&(this.container.scrollLeft=this.container.scrollWidth),this.isSnap||this.setTransform(i),this.isAutoHeight&&(this.inner.style.height=`${this.slides[this.currentIndex].clientHeight}px`),this.dotsItems&&this.goToCurrentDot(),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass(),this.isSnap&&this.hasSnapSpacers&&this.buildSnapSpacers(),this.infoCurrent&&this.setInfoCurrent()}setTransform(t){this.slides.length>this.getCurrentSlidesQty()?this.inner.style.transform=this.isRTL?`translate(${t}px, 0px)`:`translate(${-t}px, 0px)`:this.inner.style.transform="translate(0px, 0px)"}setTranslate(t){this.inner.style.transform=this.isRTL?`translate(${-t}px, 0px)`:`translate(${t}px, 0px)`}setIndex(t){this.currentIndex=t,this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}recalculateWidth(){this.sliderWidth=this.inner.parentElement.getBoundingClientRect().width,this.calculateWidth(),this.sliderWidth!==this.inner.parentElement.getBoundingClientRect().width&&this.recalculateWidth()}goToPrev(){const t=this.isCentered?this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.slides.length-this.getCurrentSlidesQty();if(this.currentIndex>0?this.currentIndex--:this.currentIndex=t,this.fireEvent("update",this.currentIndex),this.isSnap){const t=this.sliderWidth/this.getCurrentSlidesQty();this.container.scrollBy({left:Math.max(-this.container.scrollLeft,-t),behavior:"smooth"}),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}else this.calculateTransform();this.dots&&this.setCurrentDot()}goToNext(){const t=this.isCentered?this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.slides.length-this.getCurrentSlidesQty();if(this.currentIndex<t?this.currentIndex++:this.currentIndex=0,this.fireEvent("update",this.currentIndex),this.isSnap){const t=this.sliderWidth/this.getCurrentSlidesQty(),e=this.container.scrollWidth-this.container.clientWidth;this.container.scrollBy({left:Math.min(t,e-this.container.scrollLeft),behavior:"smooth"}),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}else this.calculateTransform();this.dots&&this.setCurrentDot()}goTo(t){const e=this.currentIndex;if(this.currentIndex=t,this.fireEvent("update",this.currentIndex),this.isSnap){const t=this.sliderWidth/this.getCurrentSlidesQty(),s=e>this.currentIndex?e-this.currentIndex:this.currentIndex-e,i=e>this.currentIndex?-t*s:t*s;this.container.scrollBy({left:i,behavior:"smooth"}),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}else this.calculateTransform();this.dots&&this.setCurrentDot()}destroy(){var t,e;if(this.loadingClassesAdd&&("string"==typeof this.loadingClassesAdd?this.inner.classList.remove(this.loadingClassesAdd):this.inner.classList.remove(...this.loadingClassesAdd)),this.inner&&this.afterLoadingClassesAdd&&setTimeout(()=>{"string"==typeof this.afterLoadingClassesAdd?this.inner.classList.remove(this.afterLoadingClassesAdd):this.inner.classList.remove(...this.afterLoadingClassesAdd)}),this.el.classList.remove("init"),this.inner.classList.remove("dragging"),this.slides.forEach(t=>t.classList.remove("active")),(null===(t=null==this?void 0:this.dotsItems)||void 0===t?void 0:t.length)&&this.dotsItems.forEach(t=>t.classList.remove("active")),this.prev.classList.remove("disabled"),this.next.classList.remove("disabled"),this.inner.style.width="",this.slides.forEach(t=>t.style.width=""),this.isSnap||(this.inner.style.transform=""),this.isAutoHeight&&(this.inner.style.height=""),this.prev.removeEventListener("click",this.onPrevClickListener),this.next.removeEventListener("click",this.onNextClickListener),this.container.removeEventListener("scroll",this.onContainerScrollListener),this.el.removeEventListener("touchstart",this.onElementTouchStartListener),this.el.removeEventListener("touchend",this.onElementTouchEndListener),this.inner.removeEventListener("mousedown",this.onInnerMouseDownListener),this.inner.removeEventListener("touchstart",this.onInnerTouchStartListener),document.removeEventListener("mousemove",this.onDocumentMouseMoveListener),document.removeEventListener("touchmove",this.onDocumentTouchMoveListener),document.removeEventListener("mouseup",this.onDocumentMouseUpListener),document.removeEventListener("touchend",this.onDocumentTouchEndListener),this.inner.querySelectorAll("a:not(.prevented-click)").forEach(t=>{t.classList.remove("prevented-click"),t.removeEventListener("click",this.removeClickEventWhileDragging)}),(null===(e=null==this?void 0:this.dotsItems)||void 0===e?void 0:e.length)||this.dots.querySelectorAll(":scope > *").length){((null==this?void 0:this.dotsItems)||this.dots.querySelectorAll(":scope > *")).forEach(t=>t.removeEventListener("click",this.onDotClickListener)),this.dots.innerHTML=null}this.isSnap&&this.hasSnapSpacers&&(this.inner.querySelector(".hs-snap-before").remove(),this.inner.querySelector(".hs-snap-after").remove()),this.dotsItems=null,this.isDragging=!1,this.dragStartX=null,this.dragStartTime=null,this.initialTranslateX=null,window.$hsCarouselCollection=window.$hsCarouselCollection.filter(({element:t})=>t.el!==this.el)}static getInstance(t,e){const s=window.$hsCarouselCollection.find(e=>e.element.el===("string"==typeof t?document.querySelector(t):t));return s?e?s:s.element:null}static autoInit(){window.$hsCarouselCollection||(window.$hsCarouselCollection=[]),window.$hsCarouselCollection&&(window.$hsCarouselCollection=window.$hsCarouselCollection.filter(({element:t})=>document.contains(t.el))),document.querySelectorAll("[data-hs-carousel]:not(.--prevent-on-load-init)").forEach(t=>{window.$hsCarouselCollection.find(e=>{var s;return(null===(s=null==e?void 0:e.element)||void 0===s?void 0:s.el)===t})||new l(t)})}}e.default=l},292(t,e){
17
18
  /*
18
- * HSCarousel
19
- * @version: 4.1.3
19
+ * @version: 5.0.0
20
20
  * @author: Preline Labs Ltd.
21
21
  * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)
22
22
  * Copyright 2024 Preline Labs Ltd.
23
23
  */
24
- var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=s(292),r=i(s(2961)),o=s(8223);class l extends r.default{constructor(t,e){var s,i,n,r,o;super(t,e);const l=t.getAttribute("data-hs-carousel"),h=l?JSON.parse(l):{},a=Object.assign(Object.assign({},h),e);this.currentIndex=a.currentIndex||0,this.loadingClasses=a.loadingClasses?`${a.loadingClasses}`.split(","):null,this.dotsItemClasses=a.dotsItemClasses?a.dotsItemClasses:null,this.isAutoHeight=void 0!==a.isAutoHeight&&a.isAutoHeight,this.isAutoPlay=void 0!==a.isAutoPlay&&a.isAutoPlay,this.isCentered=void 0!==a.isCentered&&a.isCentered,this.isDraggable=void 0!==a.isDraggable&&a.isDraggable,this.isInfiniteLoop=void 0!==a.isInfiniteLoop&&a.isInfiniteLoop,this.isRTL=void 0!==a.isRTL&&a.isRTL,this.isSnap=void 0!==a.isSnap&&a.isSnap,this.hasSnapSpacers=void 0===a.hasSnapSpacers||a.hasSnapSpacers,this.speed=a.speed||4e3,this.updateDelay=a.updateDelay||0,this.slidesQty=a.slidesQty||1,this.loadingClassesRemove=(null===(s=this.loadingClasses)||void 0===s?void 0:s[0])?this.loadingClasses[0].split(" "):"opacity-0",this.loadingClassesAdd=(null===(i=this.loadingClasses)||void 0===i?void 0:i[1])?this.loadingClasses[1].split(" "):"",this.afterLoadingClassesAdd=(null===(n=this.loadingClasses)||void 0===n?void 0:n[2])?this.loadingClasses[2].split(" "):"",this.container=this.el.querySelector(".hs-carousel")||null,this.inner=this.el.querySelector(".hs-carousel-body")||null,this.slides=this.el.querySelectorAll(".hs-carousel-slide")||[],this.prev=this.el.querySelector(".hs-carousel-prev")||null,this.next=this.el.querySelector(".hs-carousel-next")||null,this.dots=this.el.querySelector(".hs-carousel-pagination")||null,this.info=this.el.querySelector(".hs-carousel-info")||null,this.infoTotal=(null===(r=null==this?void 0:this.info)||void 0===r?void 0:r.querySelector(".hs-carousel-info-total"))||null,this.infoCurrent=(null===(o=null==this?void 0:this.info)||void 0===o?void 0:o.querySelector(".hs-carousel-info-current"))||null,this.sliderWidth=this.el.getBoundingClientRect().width,this.isDragging=!1,this.dragStartX=null,this.initialTranslateX=null,this.touchX={start:0,end:0},this.touchY={start:0,end:0},this.resizeContainer=document.querySelector("body"),this.resizeContainerWidth=0,this.init()}setIsSnap(){const t=this.container.getBoundingClientRect(),e=t.left+t.width/2;let s=null,i=null,n=1/0;Array.from(this.inner.children).forEach((t=>{const i=t.getBoundingClientRect(),r=this.inner.getBoundingClientRect(),o=i.left+i.width/2-r.left,l=Math.abs(e-(r.left+o));l<n&&(n=l,s=t)})),s&&(i=Array.from(this.slides).findIndex((t=>t===s))),this.setIndex(i),this.dots&&this.setCurrentDot()}prevClick(){this.goToPrev(),this.isAutoPlay&&(this.resetTimer(),this.setTimer())}nextClick(){this.goToNext(),this.isAutoPlay&&(this.resetTimer(),this.setTimer())}containerScroll(){clearTimeout(this.isScrolling),this.isScrolling=setTimeout((()=>{this.setIsSnap()}),100)}elementTouchStart(t){this.touchX.start=t.changedTouches[0].screenX,this.touchY.start=t.changedTouches[0].screenY}elementTouchEnd(t){this.touchX.end=t.changedTouches[0].screenX,this.touchY.end=t.changedTouches[0].screenY,this.detectDirection()}innerMouseDown(t){this.handleDragStart(t)}innerTouchStart(t){this.handleDragStart(t)}documentMouseMove(t){this.handleDragMove(t)}documentTouchMove(t){this.handleDragMove(t)}documentMouseUp(){this.handleDragEnd()}documentTouchEnd(){this.handleDragEnd()}dotClick(t){this.goTo(t),this.isAutoPlay&&(this.resetTimer(),this.setTimer())}init(){this.createCollection(window.$hsCarouselCollection,this),this.inner&&(this.calculateWidth(),this.isDraggable&&!this.isSnap&&this.initDragHandling()),this.prev&&(this.onPrevClickListener=()=>this.prevClick(),this.prev.addEventListener("click",this.onPrevClickListener)),this.next&&(this.onNextClickListener=()=>this.nextClick(),this.next.addEventListener("click",this.onNextClickListener)),this.dots&&this.initDots(),this.info&&this.buildInfo(),this.slides.length&&(this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass(),this.isAutoPlay&&this.autoPlay()),setTimeout((()=>{this.isSnap&&this.setIsSnap(),this.loadingClassesRemove&&("string"==typeof this.loadingClassesRemove?this.inner.classList.remove(this.loadingClassesRemove):this.inner.classList.remove(...this.loadingClassesRemove)),this.loadingClassesAdd&&("string"==typeof this.loadingClassesAdd?this.inner.classList.add(this.loadingClassesAdd):this.inner.classList.add(...this.loadingClassesAdd)),this.inner&&this.afterLoadingClassesAdd&&setTimeout((()=>{"string"==typeof this.afterLoadingClassesAdd?this.inner.classList.add(this.afterLoadingClassesAdd):this.inner.classList.add(...this.afterLoadingClassesAdd)}))}),400),this.isSnap&&(this.onContainerScrollListener=()=>this.containerScroll(),this.container.addEventListener("scroll",this.onContainerScrollListener)),this.el.classList.add("init"),this.isSnap||(this.onElementTouchStartListener=t=>this.elementTouchStart(t),this.onElementTouchEndListener=t=>this.elementTouchEnd(t),this.el.addEventListener("touchstart",this.onElementTouchStartListener),this.el.addEventListener("touchend",this.onElementTouchEndListener)),this.observeResize()}initDragHandling(){const t=this.inner;this.onInnerMouseDownListener=t=>this.innerMouseDown(t),this.onInnerTouchStartListener=t=>this.innerTouchStart(t),this.onDocumentMouseMoveListener=t=>this.documentMouseMove(t),this.onDocumentTouchMoveListener=t=>this.documentTouchMove(t),this.onDocumentMouseUpListener=()=>this.documentMouseUp(),this.onDocumentTouchEndListener=()=>this.documentTouchEnd(),t&&(t.addEventListener("mousedown",this.onInnerMouseDownListener),t.addEventListener("touchstart",this.onInnerTouchStartListener,{passive:!0}),document.addEventListener("mousemove",this.onDocumentMouseMoveListener),document.addEventListener("touchmove",this.onDocumentTouchMoveListener,{passive:!1}),document.addEventListener("mouseup",this.onDocumentMouseUpListener),document.addEventListener("touchend",this.onDocumentTouchEndListener))}getTranslateXValue(){var t;const e=window.getComputedStyle(this.inner).transform;if("none"!==e){const s=null===(t=e.match(/matrix.*\((.+)\)/))||void 0===t?void 0:t[1].split(", ");if(s){let t=parseFloat(6===s.length?s[4]:s[12]);return this.isRTL&&(t=-t),isNaN(t)||0===t?0:-t}}return 0}removeClickEventWhileDragging(t){t.preventDefault()}handleDragStart(t){t.preventDefault(),this.isDragging=!0,this.dragStartX=this.getEventX(t),this.initialTranslateX=this.isRTL?this.getTranslateXValue():-this.getTranslateXValue(),this.inner.classList.add("dragging")}handleDragMove(t){if(!this.isDragging)return;this.inner.querySelectorAll("a:not(.prevented-click)").forEach((t=>{t.classList.add("prevented-click"),t.addEventListener("click",this.removeClickEventWhileDragging)}));let e=this.getEventX(t)-this.dragStartX;this.isRTL&&(e=-e);const s=this.initialTranslateX+e;this.setTranslate((()=>{let t=this.sliderWidth*this.slides.length/this.getCurrentSlidesQty()-this.sliderWidth;const e=this.sliderWidth,i=(e-e/this.getCurrentSlidesQty())/2,n=this.isCentered?i:0;this.isCentered&&(t+=i);const r=-t;return this.isRTL?s<n?n:s>t?r:-s:s>n?n:s<-t?r:s})())}handleDragEnd(){if(!this.isDragging)return;this.isDragging=!1;const t=this.sliderWidth/this.getCurrentSlidesQty(),e=this.getTranslateXValue();let s=Math.round(e/t);this.isRTL&&(s=Math.round(e/t)),this.inner.classList.remove("dragging"),setTimeout((()=>{this.calculateTransform(s),this.dots&&this.setCurrentDot(),this.dragStartX=null,this.initialTranslateX=null,this.inner.querySelectorAll("a.prevented-click").forEach((t=>{t.classList.remove("prevented-click"),t.removeEventListener("click",this.removeClickEventWhileDragging)}))}))}getEventX(t){return t instanceof MouseEvent?t.clientX:t.touches[0].clientX}getCurrentSlidesQty(){if("object"==typeof this.slidesQty){const t=document.body.clientWidth;let e=0;return Object.keys(this.slidesQty).forEach((s=>{t>=(typeof s+1=="number"?this.slidesQty[s]:o.BREAKPOINTS[s])&&(e=this.slidesQty[s])})),e}return this.slidesQty}buildSnapSpacers(){const t=this.inner.querySelector(".hs-snap-before"),e=this.inner.querySelector(".hs-snap-after");t&&t.remove(),e&&e.remove();const s=this.sliderWidth,i=s/2-s/this.getCurrentSlidesQty()/2,r=(0,n.htmlToElement)(`<div class="hs-snap-before" style="height: 100%; width: ${i}px"></div>`),o=(0,n.htmlToElement)(`<div class="hs-snap-after" style="height: 100%; width: ${i}px"></div>`);this.inner.prepend(r),this.inner.appendChild(o)}initDots(){this.el.querySelectorAll(".hs-carousel-pagination-item").length?this.setDots():this.buildDots(),this.dots&&this.setCurrentDot()}buildDots(){this.dots.innerHTML="";const t=!this.isCentered&&this.slidesQty?this.slides.length-(this.getCurrentSlidesQty()-1):this.slides.length;for(let e=0;e<t;e++){const t=this.buildSingleDot(e);this.dots.append(t)}}setDots(){this.dotsItems=this.dots.querySelectorAll(".hs-carousel-pagination-item"),this.dotsItems.forEach(((t,e)=>{const s=t.getAttribute("data-carousel-pagination-item-target");this.singleDotEvents(t,s?+s:e)}))}goToCurrentDot(){const t=this.dots,e=t.getBoundingClientRect(),s=t.scrollLeft,i=t.scrollTop,n=t.clientWidth,r=t.clientHeight,o=this.dotsItems[this.currentIndex],l=o.getBoundingClientRect(),h=l.left-e.left+s,a=h+o.clientWidth,d=l.top-e.top+i,c=d+o.clientHeight;let u=s,g=i;(h<s||a>s+n)&&(u=a-n),(d<i||c>i+r)&&(g=c-r),t.scrollTo({left:u,top:g,behavior:"smooth"})}buildInfo(){this.infoTotal&&this.setInfoTotal(),this.infoCurrent&&this.setInfoCurrent()}setInfoTotal(){this.infoTotal.innerText=`${this.slides.length}`}setInfoCurrent(){this.infoCurrent.innerText=`${this.currentIndex+1}`}buildSingleDot(t){const e=(0,n.htmlToElement)("<span></span>");return this.dotsItemClasses&&(0,n.classToClassList)(this.dotsItemClasses,e),this.singleDotEvents(e,t),e}singleDotEvents(t,e){this.onDotClickListener=()=>this.dotClick(e),t.addEventListener("click",this.onDotClickListener)}observeResize(){new ResizeObserver((0,n.debounce)((t=>{for(let e of t){const t=e.contentRect.width;t!==this.resizeContainerWidth&&(this.recalculateWidth(),this.dots&&this.initDots(),this.addCurrentClass(),this.resizeContainerWidth=t)}}),this.updateDelay)).observe(this.resizeContainer)}calculateWidth(){this.isSnap||(this.inner.style.width=this.sliderWidth*this.slides.length/this.getCurrentSlidesQty()+"px"),this.slides.forEach((t=>{t.style.width=this.sliderWidth/this.getCurrentSlidesQty()+"px"})),this.calculateTransform()}addCurrentClass(){if(this.isSnap){const t=Math.floor(this.getCurrentSlidesQty()/2);for(let e=0;e<this.slides.length;e++){const s=this.slides[e];e<=this.currentIndex+t&&e>=this.currentIndex-t?s.classList.add("active"):s.classList.remove("active")}}else{const t=this.isCentered?this.currentIndex+this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.currentIndex+this.getCurrentSlidesQty();this.slides.forEach(((e,s)=>{s>=this.currentIndex&&s<t?e.classList.add("active"):e.classList.remove("active")}))}}setCurrentDot(){const t=(t,e)=>{let s=!1;const i=Math.floor(this.getCurrentSlidesQty()/2);s=this.isSnap&&!this.hasSnapSpacers?e===(this.getCurrentSlidesQty()%2==0?this.currentIndex-i+1:this.currentIndex-i):e===this.currentIndex,s?t.classList.add("active"):t.classList.remove("active")};this.dotsItems?this.dotsItems.forEach(((e,s)=>t(e,s))):this.dots.querySelectorAll(":scope > *").forEach(((e,s)=>t(e,s)))}setElementToDisabled(t){t.classList.add("disabled"),"BUTTON"!==t.tagName&&"INPUT"!==t.tagName||t.setAttribute("disabled","disabled")}unsetElementToDisabled(t){t.classList.remove("disabled"),"BUTTON"!==t.tagName&&"INPUT"!==t.tagName||t.removeAttribute("disabled")}addDisabledClass(){if(!this.prev||!this.next)return!1;const t=getComputedStyle(this.inner).getPropertyValue("gap"),e=Math.floor(this.getCurrentSlidesQty()/2);let s=0,i=0,n=!1,r=!1;this.isSnap?(s=this.currentIndex,i=this.hasSnapSpacers?this.slides.length-1:this.slides.length-e-1,n=this.hasSnapSpacers?0===s:this.getCurrentSlidesQty()%2==0?s-e<0:s-e==0,r=s>=i&&this.container.scrollLeft+this.container.clientWidth+(parseFloat(t)||0)>=this.container.scrollWidth):(s=this.currentIndex,i=this.isCentered?this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.slides.length-this.getCurrentSlidesQty(),n=0===s,r=s>=i),n?(this.unsetElementToDisabled(this.next),this.setElementToDisabled(this.prev)):r?(this.unsetElementToDisabled(this.prev),this.setElementToDisabled(this.next)):(this.unsetElementToDisabled(this.prev),this.unsetElementToDisabled(this.next))}autoPlay(){this.setTimer()}setTimer(){this.timer=setInterval((()=>{this.currentIndex===this.slides.length-1?this.goTo(0):this.goToNext()}),this.speed)}resetTimer(){clearInterval(this.timer)}detectDirection(){const t=this.touchX.end-this.touchX.start,e=this.touchY.end-this.touchY.start,s=Math.abs(t),i=Math.abs(e);if(s<30||s<i)return;const n=this.isRTL?t>0:t<0;this.isInfiniteLoop?n?this.goToNext():this.goToPrev():(n&&this.currentIndex<this.slides.length-this.getCurrentSlidesQty()&&this.goToNext(),!n&&this.currentIndex>0&&this.goToPrev())}calculateTransform(t){void 0!==t&&(this.currentIndex=t);const e=this.sliderWidth,s=e/this.getCurrentSlidesQty();let i=this.currentIndex*s;if(this.isSnap&&!this.isCentered&&this.container.scrollLeft<e&&this.container.scrollLeft+s/2>e&&(this.container.scrollLeft=this.container.scrollWidth),this.isCentered&&!this.isSnap){const t=(e-s)/2;if(0===this.currentIndex)i=-t;else if(this.currentIndex>=this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1)){i=this.slides.length*s-e+t}else i=this.currentIndex*s-t}this.isSnap||this.setTransform(i),this.isAutoHeight&&(this.inner.style.height=`${this.slides[this.currentIndex].clientHeight}px`),this.dotsItems&&this.goToCurrentDot(),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass(),this.isSnap&&this.hasSnapSpacers&&this.buildSnapSpacers(),this.infoCurrent&&this.setInfoCurrent()}setTransform(t){this.slides.length>this.getCurrentSlidesQty()?this.inner.style.transform=this.isRTL?`translate(${t}px, 0px)`:`translate(${-t}px, 0px)`:this.inner.style.transform="translate(0px, 0px)"}setTranslate(t){this.inner.style.transform=this.isRTL?`translate(${-t}px, 0px)`:`translate(${t}px, 0px)`}setIndex(t){this.currentIndex=t,this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}recalculateWidth(){this.sliderWidth=this.inner.parentElement.getBoundingClientRect().width,this.calculateWidth(),this.sliderWidth!==this.inner.parentElement.getBoundingClientRect().width&&this.recalculateWidth()}goToPrev(){if(this.currentIndex>0?this.currentIndex--:this.currentIndex=this.slides.length-this.getCurrentSlidesQty(),this.fireEvent("update",this.currentIndex),this.isSnap){const t=this.sliderWidth/this.getCurrentSlidesQty();this.container.scrollBy({left:Math.max(-this.container.scrollLeft,-t),behavior:"smooth"}),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}else this.calculateTransform();this.dots&&this.setCurrentDot()}goToNext(){const t=this.isCentered?this.slides.length-this.getCurrentSlidesQty()+(this.getCurrentSlidesQty()-1):this.slides.length-this.getCurrentSlidesQty();if(this.currentIndex<t?this.currentIndex++:this.currentIndex=0,this.fireEvent("update",this.currentIndex),this.isSnap){const t=this.sliderWidth/this.getCurrentSlidesQty(),e=this.container.scrollWidth-this.container.clientWidth;this.container.scrollBy({left:Math.min(t,e-this.container.scrollLeft),behavior:"smooth"}),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}else this.calculateTransform();this.dots&&this.setCurrentDot()}goTo(t){const e=this.currentIndex;if(this.currentIndex=t,this.fireEvent("update",this.currentIndex),this.isSnap){const t=this.sliderWidth/this.getCurrentSlidesQty(),s=e>this.currentIndex?e-this.currentIndex:this.currentIndex-e,i=e>this.currentIndex?-t*s:t*s;this.container.scrollBy({left:i,behavior:"smooth"}),this.addCurrentClass(),this.isInfiniteLoop||this.addDisabledClass()}else this.calculateTransform();this.dots&&this.setCurrentDot()}destroy(){var t,e;if(this.loadingClassesAdd&&("string"==typeof this.loadingClassesAdd?this.inner.classList.remove(this.loadingClassesAdd):this.inner.classList.remove(...this.loadingClassesAdd)),this.inner&&this.afterLoadingClassesAdd&&setTimeout((()=>{"string"==typeof this.afterLoadingClassesAdd?this.inner.classList.remove(this.afterLoadingClassesAdd):this.inner.classList.remove(...this.afterLoadingClassesAdd)})),this.el.classList.remove("init"),this.inner.classList.remove("dragging"),this.slides.forEach((t=>t.classList.remove("active"))),(null===(t=null==this?void 0:this.dotsItems)||void 0===t?void 0:t.length)&&this.dotsItems.forEach((t=>t.classList.remove("active"))),this.prev.classList.remove("disabled"),this.next.classList.remove("disabled"),this.inner.style.width="",this.slides.forEach((t=>t.style.width="")),this.isSnap||(this.inner.style.transform=""),this.isAutoHeight&&(this.inner.style.height=""),this.prev.removeEventListener("click",this.onPrevClickListener),this.next.removeEventListener("click",this.onNextClickListener),this.container.removeEventListener("scroll",this.onContainerScrollListener),this.el.removeEventListener("touchstart",this.onElementTouchStartListener),this.el.removeEventListener("touchend",this.onElementTouchEndListener),this.inner.removeEventListener("mousedown",this.onInnerMouseDownListener),this.inner.removeEventListener("touchstart",this.onInnerTouchStartListener),document.removeEventListener("mousemove",this.onDocumentMouseMoveListener),document.removeEventListener("touchmove",this.onDocumentTouchMoveListener),document.removeEventListener("mouseup",this.onDocumentMouseUpListener),document.removeEventListener("touchend",this.onDocumentTouchEndListener),this.inner.querySelectorAll("a:not(.prevented-click)").forEach((t=>{t.classList.remove("prevented-click"),t.removeEventListener("click",this.removeClickEventWhileDragging)})),(null===(e=null==this?void 0:this.dotsItems)||void 0===e?void 0:e.length)||this.dots.querySelectorAll(":scope > *").length){((null==this?void 0:this.dotsItems)||this.dots.querySelectorAll(":scope > *")).forEach((t=>t.removeEventListener("click",this.onDotClickListener))),this.dots.innerHTML=null}this.isSnap&&this.hasSnapSpacers&&(this.inner.querySelector(".hs-snap-before").remove(),this.inner.querySelector(".hs-snap-after").remove()),this.dotsItems=null,this.isDragging=!1,this.dragStartX=null,this.initialTranslateX=null,window.$hsCarouselCollection=window.$hsCarouselCollection.filter((({element:t})=>t.el!==this.el))}static getInstance(t,e){const s=window.$hsCarouselCollection.find((e=>e.element.el===("string"==typeof t?document.querySelector(t):t)));return s?e?s:s.element:null}static autoInit(){window.$hsCarouselCollection||(window.$hsCarouselCollection=[]),window.$hsCarouselCollection&&(window.$hsCarouselCollection=window.$hsCarouselCollection.filter((({element:t})=>document.contains(t.el)))),document.querySelectorAll("[data-hs-carousel]:not(.--prevent-on-load-init)").forEach((t=>{window.$hsCarouselCollection.find((e=>{var s;return(null===(s=null==e?void 0:e.element)||void 0===s?void 0:s.el)===t}))||new l(t)}))}}e.default=l},8223:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BREAKPOINTS=e.COMBO_BOX_ACCESSIBILITY_KEY_SET=e.SELECT_ACCESSIBILITY_KEY_SET=e.TABS_ACCESSIBILITY_KEY_SET=e.OVERLAY_ACCESSIBILITY_KEY_SET=e.DROPDOWN_ACCESSIBILITY_KEY_SET=e.POSITIONS=void 0,e.POSITIONS={auto:"auto","auto-start":"auto-start","auto-end":"auto-end",top:"top","top-left":"top-start","top-right":"top-end",bottom:"bottom","bottom-left":"bottom-start","bottom-right":"bottom-end",right:"right","right-start":"right-start","right-end":"right-end",left:"left","left-start":"left-start","left-end":"left-end"},e.DROPDOWN_ACCESSIBILITY_KEY_SET=["Escape","ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Home","End","Enter"],e.OVERLAY_ACCESSIBILITY_KEY_SET=["Escape","Tab"],e.TABS_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End"],e.SELECT_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End","Escape","Enter","Space","Tab"],e.COMBO_BOX_ACCESSIBILITY_KEY_SET=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End","Escape","Enter"],e.BREAKPOINTS={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536}}},e={};var s=function s(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,s),r.exports}(4701);return s})()));
24
+ Object.defineProperty(e,"__esModule",{value:!0}),e.stringToBoolean=e.menuSearchHistory=e.isScrollable=e.isParentOrElementHidden=e.isJson=e.isIpadOS=e.isIOS=e.isFormElement=e.isFocused=e.isEnoughSpace=e.isDirectChild=e.htmlToElement=e.getZIndex=e.getHighestZIndex=e.getClassPropertyAlt=e.getClassProperty=e.dispatch=e.debounce=e.classToClassList=e.afterTransition=void 0;e.stringToBoolean=t=>"true"===t;e.getClassProperty=(t,e,s="")=>(window.getComputedStyle(t).getPropertyValue(e)||s).replace(" ","");e.getClassPropertyAlt=(t,e,s="")=>{let i="";return t.classList.forEach(t=>{t.includes(e)&&(i=t)}),i.match(/:(.*)]/)?i.match(/:(.*)]/)[1]:s};const s=t=>window.getComputedStyle(t).getPropertyValue("z-index");e.getZIndex=s;e.getHighestZIndex=t=>{let e=Number.NEGATIVE_INFINITY;return t.forEach(t=>{let i=s(t);"auto"!==i&&(i=parseInt(i,10),i>e&&(e=i))}),e};e.isDirectChild=(t,e)=>{const s=t.children;for(let t=0;t<s.length;t++)if(s[t]===e)return!0;return!1};e.isEnoughSpace=(t,e,s="auto",i=10,n=null)=>{const r=e.getBoundingClientRect(),o=n?n.getBoundingClientRect():null,l=window.innerHeight,h=o?r.top-o.top:r.top,a=(n?o.bottom:l)-r.bottom,d=t.clientHeight+i;return"bottom"===s?a>=d:"top"===s?h>=d:h>=d||a>=d};e.isFocused=t=>document.activeElement===t;e.isFormElement=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement;e.isIOS=()=>!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);e.isIpadOS=()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform);e.isJson=t=>{if("string"!=typeof t)return!1;const e=t.trim()[0],s=t.trim().slice(-1);if("{"===e&&"}"===s||"["===e&&"]"===s)try{return JSON.parse(t),!0}catch(t){return!1}return!1};const i=t=>{if(!t)return!1;return"none"===window.getComputedStyle(t).display||i(t.parentElement)};e.isParentOrElementHidden=i;e.isScrollable=t=>{const e=window.getComputedStyle(t),s=e.overflowY,i=e.overflowX,n=("scroll"===s||"auto"===s)&&t.scrollHeight>t.clientHeight,r=("scroll"===i||"auto"===i)&&t.scrollWidth>t.clientWidth;return n||r};e.debounce=(t,e=200)=>{let s;return(...i)=>{clearTimeout(s),s=setTimeout(()=>{t.apply(this,i)},e)}};e.dispatch=(t,e,s=null)=>{const i=new CustomEvent(t,{detail:{payload:s},bubbles:!0,cancelable:!0,composed:!1});e.dispatchEvent(i)};e.afterTransition=(t,e)=>{const s=()=>{e(),t.removeEventListener("transitionend",s,!0)},i=window.getComputedStyle(t),n=i.getPropertyValue("transition-duration");"none"!==i.getPropertyValue("transition-property")&&parseFloat(n)>0?t.addEventListener("transitionend",s,!0):e()};e.htmlToElement=t=>{const e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild};e.classToClassList=(t,e,s=" ",i="add")=>{t.split(s).forEach(t=>{t.trim()&&("add"===i?e.classList.add(t):e.classList.remove(t))})};const n={historyIndex:-1,addHistory(t){this.historyIndex=t},existsInHistory(t){return t>this.historyIndex},clearHistory(){this.historyIndex=-1}};e.menuSearchHistory=n}},e={};var s=function s(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,s),r.exports}(2069);return s})());