{"version":3,"file":"index.js","sources":["../../../node_modules/vanilla-lazyload/dist/lazyload.esm.js","../../../node_modules/preline/src/utils/index.ts","../../../node_modules/preline/src/plugins/base-plugin/index.ts","../../../node_modules/preline/src/plugins/copy-markup/index.ts","../../../node_modules/preline/src/plugins/accordion/index.ts","../../../node_modules/preline/src/plugins/carousel/index.ts","../../../node_modules/preline/src/plugins/collapse/index.ts","../../../node_modules/preline/src/constants.ts","../../../node_modules/preline/src/plugins/combobox/index.ts","../../../node_modules/@popperjs/core/lib/enums.js","../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../node_modules/@popperjs/core/lib/utils/math.js","../../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../../node_modules/@popperjs/core/lib/utils/within.js","../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../../node_modules/@popperjs/core/lib/utils/debounce.js","../../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../../node_modules/@popperjs/core/lib/createPopper.js","../../../node_modules/@popperjs/core/lib/popper.js","../../../node_modules/preline/src/plugins/dropdown/index.ts","../../../node_modules/preline/src/plugins/input-number/index.ts","../../../node_modules/preline/src/plugins/overlay/index.ts","../../../node_modules/preline/src/plugins/pin-input/index.ts","../../../node_modules/preline/src/plugins/remove-element/index.ts","../../../node_modules/preline/src/plugins/scrollspy/index.ts","../../../node_modules/preline/src/plugins/select/index.ts","../../../node_modules/preline/src/plugins/stepper/index.ts","../../../node_modules/preline/src/plugins/strong-password/index.ts","../../../node_modules/preline/src/plugins/tabs/index.ts","../../../node_modules/preline/src/plugins/theme-switch/index.ts","../../../node_modules/preline/src/plugins/toggle-count/index.ts","../../../node_modules/preline/src/plugins/toggle-password/index.ts","../../../node_modules/preline/src/plugins/tooltip/index.ts","../../../node_modules/preline/src/plugins/datatable/index.ts","../../../node_modules/preline/src/plugins/file-upload/index.ts","../../../node_modules/preline/src/spa/index.ts","../../../node_modules/preline/src/static/index.ts","../../../node_modules/preline/src/index.ts","../../../node_modules/@preline/select/index.js","../../../src/ts/FormDataWithToken.ts","../../../src/ts/formatters.ts","../../../src/ts/SearchRates.ts","../../../src/ts/SimpleValidate.ts","../../../src/ts/handle-trade-values.ts","../../../src/ts/handle-mobile-nav.ts","../../../src/ts/handle-scroll-spy.ts","../../../src/ts/handle-scroll-to.ts","../../../src/ts/handle-show-hide-car-make-model.ts","../../../src/ts/handle-show-more.ts","../../../node_modules/swiper/shared/ssr-window.esm.mjs","../../../node_modules/swiper/shared/utils.mjs","../../../node_modules/swiper/shared/swiper-core.mjs","../../../node_modules/swiper/shared/create-element-if-not-defined.mjs","../../../node_modules/swiper/modules/navigation.mjs","../../../node_modules/swiper/shared/classes-to-selector.mjs","../../../node_modules/swiper/modules/pagination.mjs","../../../node_modules/swiper/modules/thumbs.mjs","../../../src/ts/Cars4SalePage.ts","../../../src/ts/handle-toggle-car-favourite.ts","../../../src/ts/handle-submit-loan.ts","../../../src/ts/handle-detail-swipers.ts","../../../src/ts/handle-filters.ts","../../../src/ts/standard-lead-submission.ts","../../../src/ts/InputMask.ts","../../../src/ts/RangeSlider.ts","../../../src/ts/toggle.ts","../../../src/ts/SimpleWizard.ts","../../../src/ts/SimpleModal.ts","../../../src/ts/sync-text.ts","../../../src/ts/check-credit.ts","../../../src/js/htmx.min.js","../../../src/main.ts"],"sourcesContent":["const runningOnBrowser = typeof window !== \"undefined\";\n\nconst isBot =\n (runningOnBrowser && !(\"onscroll\" in window)) ||\n (typeof navigator !== \"undefined\" && /(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent));\n\nconst supportsIntersectionObserver = runningOnBrowser && \"IntersectionObserver\" in window;\n\nconst supportsClassList = runningOnBrowser && \"classList\" in document.createElement(\"p\");\n\nconst isHiDpi = runningOnBrowser && window.devicePixelRatio > 1;\n\nconst defaultSettings = {\n elements_selector: \".lazy\",\n container: isBot || runningOnBrowser ? document : null,\n threshold: 300,\n thresholds: null,\n data_src: \"src\",\n data_srcset: \"srcset\",\n data_sizes: \"sizes\",\n data_bg: \"bg\",\n data_bg_hidpi: \"bg-hidpi\",\n data_bg_multi: \"bg-multi\",\n data_bg_multi_hidpi: \"bg-multi-hidpi\",\n data_bg_set: \"bg-set\",\n data_poster: \"poster\",\n class_applied: \"applied\",\n class_loading: \"loading\",\n class_loaded: \"loaded\",\n class_error: \"error\",\n class_entered: \"entered\",\n class_exited: \"exited\",\n unobserve_completed: true,\n unobserve_entered: false,\n cancel_on_exit: true,\n callback_enter: null,\n callback_exit: null,\n callback_applied: null,\n callback_loading: null,\n callback_loaded: null,\n callback_error: null,\n callback_finish: null,\n callback_cancel: null,\n use_native: false,\n restore_on_error: false\n};\n\nconst getExtendedSettings = (customSettings) => {\n return Object.assign({}, defaultSettings, customSettings);\n};\n\n/* Creates instance and notifies it through the window element */\nconst createInstance = function(classObj, options) {\n let event;\n const eventString = \"LazyLoad::Initialized\";\n const instance = new classObj(options);\n try {\n // Works in modern browsers\n event = new CustomEvent(eventString, { detail: { instance } });\n } catch (err) {\n // Works in Internet Explorer (all versions)\n event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(eventString, false, false, { instance });\n }\n window.dispatchEvent(event);\n};\n\n/* Auto initialization of one or more instances of LazyLoad, depending on the\n options passed in (plain object or an array) */\nconst autoInitialize = (classObj, options) => {\n if (!options) {\n return;\n }\n if (!options.length) {\n // Plain object\n createInstance(classObj, options);\n } else {\n // Array of objects\n for (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {\n createInstance(classObj, optionsItem);\n }\n }\n};\n\nconst SRC = \"src\";\nconst SRCSET = \"srcset\";\nconst SIZES = \"sizes\";\nconst POSTER = \"poster\";\nconst ORIGINALS = \"llOriginalAttrs\";\nconst DATA = \"data\";\n\nconst statusLoading = \"loading\";\nconst statusLoaded = \"loaded\";\nconst statusApplied = \"applied\";\nconst statusEntered = \"entered\";\nconst statusError = \"error\";\nconst statusNative = \"native\";\n\nconst dataPrefix = \"data-\";\nconst statusDataName = \"ll-status\";\n\nconst getData = (element, attribute) => {\n return element.getAttribute(dataPrefix + attribute);\n};\n\nconst setData = (element, attribute, value) => {\n const attrName = dataPrefix + attribute;\n if (value === null) {\n element.removeAttribute(attrName);\n return;\n }\n element.setAttribute(attrName, value);\n};\n\nconst getStatus = (element) => getData(element, statusDataName);\nconst setStatus = (element, status) => setData(element, statusDataName, status);\nconst resetStatus = (element) => setStatus(element, null);\n\nconst hasEmptyStatus = (element) => getStatus(element) === null;\nconst hasStatusLoading = (element) => getStatus(element) === statusLoading;\nconst hasStatusError = (element) => getStatus(element) === statusError;\nconst hasStatusNative = (element) => getStatus(element) === statusNative;\n\nconst statusesAfterLoading = [statusLoading, statusLoaded, statusApplied, statusError];\nconst hadStartedLoading = (element) => statusesAfterLoading.indexOf(getStatus(element)) >= 0;\n\nconst safeCallback = (callback, arg1, arg2, arg3) => {\n if (!callback || typeof callback !== 'function') {\n return;\n } \n if (arg3 !== undefined) {\n callback(arg1, arg2, arg3);\n return;\n }\n if (arg2 !== undefined) {\n callback(arg1, arg2);\n return;\n }\n callback(arg1);\n};\n\nconst addClass = (element, className) => {\n if (supportsClassList) {\n element.classList.add(className);\n return;\n }\n element.className += (element.className ? \" \" : \"\") + className;\n};\n\nconst removeClass = (element, className) => {\n if (supportsClassList) {\n element.classList.remove(className);\n return;\n }\n element.className = element.className.replace(new RegExp(\"(^|\\\\s+)\" + className + \"(\\\\s+|$)\"), \" \").replace(/^\\s+/, \"\").replace(/\\s+$/, \"\");\n};\n\nconst addTempImage = (element) => {\n element.llTempImage = document.createElement(\"IMG\");\n};\n\nconst deleteTempImage = (element) => {\n delete element.llTempImage;\n};\n\nconst getTempImage = (element) => element.llTempImage;\n\nconst unobserve = (element, instance) => {\n if (!instance) return;\n const observer = instance._observer;\n if (!observer) return;\n observer.unobserve(element);\n};\n\nconst resetObserver = (observer) => {\n observer.disconnect();\n};\n\nconst unobserveEntered = (element, settings, instance) => {\n if (settings.unobserve_entered) unobserve(element, instance);\n};\n\nconst updateLoadingCount = (instance, delta) => {\n if (!instance) return;\n instance.loadingCount += delta;\n};\n\nconst decreaseToLoadCount = (instance) => {\n if (!instance) return;\n instance.toLoadCount -= 1;\n};\n\nconst setToLoadCount = (instance, value) => {\n if (!instance) return;\n instance.toLoadCount = value;\n};\n\nconst isSomethingLoading = (instance) => instance.loadingCount > 0;\n\nconst haveElementsToLoad = (instance) => instance.toLoadCount > 0;\n\nconst getSourceTags = (parentTag) => {\n let sourceTags = [];\n for (let i = 0, childTag; (childTag = parentTag.children[i]); i += 1) {\n if (childTag.tagName === \"SOURCE\") {\n sourceTags.push(childTag);\n }\n }\n return sourceTags;\n};\n\nconst forEachPictureSource = (element, fn) => {\n const parent = element.parentNode;\n if (!parent || parent.tagName !== \"PICTURE\") {\n return;\n }\n let sourceTags = getSourceTags(parent);\n sourceTags.forEach(fn);\n};\n\nconst forEachVideoSource = (element, fn) => {\n let sourceTags = getSourceTags(element);\n sourceTags.forEach(fn);\n};\n\nconst attrsSrc = [SRC];\nconst attrsSrcPoster = [SRC, POSTER];\nconst attrsSrcSrcsetSizes = [SRC, SRCSET, SIZES];\nconst attrsData = [DATA];\n\nconst hasOriginalAttrs = (element) => !!element[ORIGINALS];\nconst getOriginalAttrs = (element) => element[ORIGINALS];\nconst deleteOriginalAttrs = (element) => delete element[ORIGINALS];\n\n// ## SAVE ##\n\nconst setOriginalsObject = (element, attributes) => {\n if (hasOriginalAttrs(element)) {\n return;\n }\n const originals = {};\n attributes.forEach((attribute) => {\n originals[attribute] = element.getAttribute(attribute);\n });\n element[ORIGINALS] = originals;\n};\n\nconst saveOriginalBackgroundStyle = (element) => {\n if (hasOriginalAttrs(element)) {\n return;\n }\n element[ORIGINALS] = { backgroundImage: element.style.backgroundImage };\n};\n\n// ## RESTORE ##\n\nconst setOrResetAttribute = (element, attrName, value) => {\n if (!value) {\n element.removeAttribute(attrName);\n return;\n }\n element.setAttribute(attrName, value);\n};\n\nconst restoreOriginalAttrs = (element, attributes) => {\n if (!hasOriginalAttrs(element)) {\n return;\n }\n const originals = getOriginalAttrs(element);\n attributes.forEach((attribute) => {\n setOrResetAttribute(element, attribute, originals[attribute]);\n });\n};\n\nconst restoreOriginalBgImage = (element) => {\n if (!hasOriginalAttrs(element)) {\n return;\n }\n const originals = getOriginalAttrs(element);\n element.style.backgroundImage = originals.backgroundImage;\n};\n\nconst manageApplied = (element, settings, instance) => {\n addClass(element, settings.class_applied);\n setStatus(element, statusApplied);\n // Instance is not provided when loading is called from static class\n if (!instance) return;\n if (settings.unobserve_completed) {\n // Unobserve now because we can't do it on load\n unobserve(element, settings);\n }\n safeCallback(settings.callback_applied, element, instance);\n};\n\nconst manageLoading = (element, settings, instance) => {\n addClass(element, settings.class_loading);\n setStatus(element, statusLoading);\n // Instance is not provided when loading is called from static class\n if (!instance) return;\n updateLoadingCount(instance, +1);\n safeCallback(settings.callback_loading, element, instance);\n};\n\nconst setAttributeIfValue = (element, attrName, value) => {\n if (!value) {\n return;\n }\n element.setAttribute(attrName, value);\n};\n\nconst setImageAttributes = (element, settings) => {\n setAttributeIfValue(element, SIZES, getData(element, settings.data_sizes));\n setAttributeIfValue(element, SRCSET, getData(element, settings.data_srcset));\n setAttributeIfValue(element, SRC, getData(element, settings.data_src));\n};\n\nconst setSourcesImg = (imgEl, settings) => {\n forEachPictureSource(imgEl, (sourceTag) => {\n setOriginalsObject(sourceTag, attrsSrcSrcsetSizes);\n setImageAttributes(sourceTag, settings);\n });\n setOriginalsObject(imgEl, attrsSrcSrcsetSizes);\n setImageAttributes(imgEl, settings);\n};\n\nconst setSourcesIframe = (iframe, settings) => {\n setOriginalsObject(iframe, attrsSrc);\n setAttributeIfValue(iframe, SRC, getData(iframe, settings.data_src));\n};\n\nconst setSourcesVideo = (videoEl, settings) => {\n forEachVideoSource(videoEl, (sourceEl) => {\n setOriginalsObject(sourceEl, attrsSrc);\n setAttributeIfValue(sourceEl, SRC, getData(sourceEl, settings.data_src));\n });\n setOriginalsObject(videoEl, attrsSrcPoster);\n\n setAttributeIfValue(videoEl, POSTER, getData(videoEl, settings.data_poster));\n setAttributeIfValue(videoEl, SRC, getData(videoEl, settings.data_src));\n videoEl.load();\n};\n\nconst setSourcesObject = (object, settings) => {\n setOriginalsObject(object, attrsData);\n setAttributeIfValue(object, DATA, getData(object, settings.data_src));\n};\n\nconst setBackground = (element, settings, instance) => {\n const bg1xValue = getData(element, settings.data_bg);\n const bgHiDpiValue = getData(element, settings.data_bg_hidpi);\n const bgDataValue = isHiDpi && bgHiDpiValue ? bgHiDpiValue : bg1xValue;\n if (!bgDataValue) return;\n element.style.backgroundImage = `url(\"${bgDataValue}\")`;\n getTempImage(element).setAttribute(SRC, bgDataValue);\n manageLoading(element, settings, instance);\n};\n\n// NOTE: THE TEMP IMAGE TRICK CANNOT BE DONE WITH data-multi-bg\n// BECAUSE INSIDE ITS VALUES MUST BE WRAPPED WITH URL() AND ONE OF THEM\n// COULD BE A GRADIENT BACKGROUND IMAGE\nconst setMultiBackground = (element, settings, instance) => {\n const bg1xValue = getData(element, settings.data_bg_multi);\n const bgHiDpiValue = getData(element, settings.data_bg_multi_hidpi);\n const bgDataValue = isHiDpi && bgHiDpiValue ? bgHiDpiValue : bg1xValue;\n if (!bgDataValue) {\n return;\n }\n element.style.backgroundImage = bgDataValue;\n manageApplied(element, settings, instance);\n};\n\nconst setImgsetBackground = (element, settings, instance) => {\n const bgImgSetDataValue = getData(element, settings.data_bg_set);\n if (!bgImgSetDataValue) {\n return;\n }\n const imgSetValues = bgImgSetDataValue.split(\"|\");\n let bgImageValues = imgSetValues.map((value) => `image-set(${value})`);\n element.style.backgroundImage = bgImageValues.join();\n // Temporary fix for Chromeium with the -webkit- prefix\n if (element.style.backgroundImage === \"\") {\n bgImageValues = imgSetValues.map((value) => `-webkit-image-set(${value})`);\n element.style.backgroundImage = bgImageValues.join();\n }\n manageApplied(element, settings, instance);\n};\n\nconst setSourcesFunctions = {\n IMG: setSourcesImg,\n IFRAME: setSourcesIframe,\n VIDEO: setSourcesVideo,\n OBJECT: setSourcesObject\n};\n\nconst setSourcesNative = (element, settings) => {\n const setSourcesFunction = setSourcesFunctions[element.tagName];\n if (!setSourcesFunction) {\n return;\n }\n setSourcesFunction(element, settings);\n};\n\nconst setSources = (element, settings, instance) => {\n const setSourcesFunction = setSourcesFunctions[element.tagName];\n if (!setSourcesFunction) {\n return;\n }\n setSourcesFunction(element, settings);\n manageLoading(element, settings, instance);\n};\n\nconst elementsWithLoadEvent = [\"IMG\", \"IFRAME\", \"VIDEO\", \"OBJECT\"];\nconst hasLoadEvent = (element) => elementsWithLoadEvent.indexOf(element.tagName) > -1;\n\nconst checkFinish = (settings, instance) => {\n if (instance && !isSomethingLoading(instance) && !haveElementsToLoad(instance)) {\n safeCallback(settings.callback_finish, instance);\n }\n};\n\nconst addEventListener = (element, eventName, handler) => {\n element.addEventListener(eventName, handler);\n element.llEvLisnrs[eventName] = handler;\n};\n\nconst removeEventListener = (element, eventName, handler) => {\n element.removeEventListener(eventName, handler);\n};\n\nconst hasEventListeners = (element) => {\n return !!element.llEvLisnrs;\n};\n\nconst addEventListeners = (element, loadHandler, errorHandler) => {\n if (!hasEventListeners(element)) element.llEvLisnrs = {};\n const loadEventName = element.tagName === \"VIDEO\" ? \"loadeddata\" : \"load\";\n addEventListener(element, loadEventName, loadHandler);\n addEventListener(element, \"error\", errorHandler);\n};\n\nconst removeEventListeners = (element) => {\n if (!hasEventListeners(element)) {\n return;\n }\n const eventListeners = element.llEvLisnrs;\n for (let eventName in eventListeners) {\n const handler = eventListeners[eventName];\n removeEventListener(element, eventName, handler);\n }\n delete element.llEvLisnrs;\n};\n\nconst doneHandler = (element, settings, instance) => {\n deleteTempImage(element);\n updateLoadingCount(instance, -1);\n decreaseToLoadCount(instance);\n removeClass(element, settings.class_loading);\n if (settings.unobserve_completed) {\n unobserve(element, instance);\n }\n};\n\nconst loadHandler = (event, element, settings, instance) => {\n const goingNative = hasStatusNative(element);\n doneHandler(element, settings, instance);\n addClass(element, settings.class_loaded);\n setStatus(element, statusLoaded);\n safeCallback(settings.callback_loaded, element, instance);\n if (!goingNative) checkFinish(settings, instance);\n};\n\nconst errorHandler = (event, element, settings, instance) => {\n const goingNative = hasStatusNative(element);\n doneHandler(element, settings, instance);\n addClass(element, settings.class_error);\n setStatus(element, statusError);\n safeCallback(settings.callback_error, element, instance);\n if (settings.restore_on_error) restoreOriginalAttrs(element, attrsSrcSrcsetSizes);\n if (!goingNative) checkFinish(settings, instance);\n};\n\nconst addOneShotEventListeners = (element, settings, instance) => {\n const elementToListenTo = getTempImage(element) || element;\n if (hasEventListeners(elementToListenTo)) {\n // This happens when loading is retried twice\n return;\n }\n const _loadHandler = (event) => {\n loadHandler(event, element, settings, instance);\n removeEventListeners(elementToListenTo);\n };\n const _errorHandler = (event) => {\n errorHandler(event, element, settings, instance);\n removeEventListeners(elementToListenTo);\n };\n addEventListeners(elementToListenTo, _loadHandler, _errorHandler);\n};\n\nconst loadBackground = (element, settings, instance) => {\n addTempImage(element);\n addOneShotEventListeners(element, settings, instance);\n saveOriginalBackgroundStyle(element);\n setBackground(element, settings, instance);\n setMultiBackground(element, settings, instance);\n setImgsetBackground(element, settings, instance);\n};\n\nconst loadRegular = (element, settings, instance) => {\n addOneShotEventListeners(element, settings, instance);\n setSources(element, settings, instance);\n};\n\nconst load = (element, settings, instance) => {\n if (hasLoadEvent(element)) {\n loadRegular(element, settings, instance);\n } else {\n loadBackground(element, settings, instance);\n }\n};\n\nconst loadNative = (element, settings, instance) => {\n element.setAttribute(\"loading\", \"lazy\");\n addOneShotEventListeners(element, settings, instance);\n setSourcesNative(element, settings);\n setStatus(element, statusNative);\n};\n\nconst removeImageAttributes = (element) => {\n element.removeAttribute(SRC);\n element.removeAttribute(SRCSET);\n element.removeAttribute(SIZES);\n};\n\nconst resetSourcesImg = (element) => {\n forEachPictureSource(element, (sourceTag) => {\n removeImageAttributes(sourceTag);\n });\n removeImageAttributes(element);\n};\n\nconst restoreImg = (imgEl) => {\n forEachPictureSource(imgEl, (sourceEl) => {\n restoreOriginalAttrs(sourceEl, attrsSrcSrcsetSizes);\n });\n restoreOriginalAttrs(imgEl, attrsSrcSrcsetSizes);\n};\n\nconst restoreVideo = (videoEl) => {\n forEachVideoSource(videoEl, (sourceEl) => {\n restoreOriginalAttrs(sourceEl, attrsSrc);\n });\n restoreOriginalAttrs(videoEl, attrsSrcPoster);\n videoEl.load();\n};\n\nconst restoreIframe = (iframeEl) => {\n restoreOriginalAttrs(iframeEl, attrsSrc);\n};\n\nconst restoreObject = (objectEl) => {\n restoreOriginalAttrs(objectEl, attrsData);\n};\n\nconst restoreFunctions = {\n IMG: restoreImg,\n IFRAME: restoreIframe,\n VIDEO: restoreVideo,\n OBJECT: restoreObject\n};\n\nconst restoreAttributes = (element) => {\n const restoreFunction = restoreFunctions[element.tagName];\n if (!restoreFunction) {\n restoreOriginalBgImage(element);\n return;\n }\n restoreFunction(element);\n};\n\nconst resetClasses = (element, settings) => {\n if (hasEmptyStatus(element) || hasStatusNative(element)) {\n return;\n }\n removeClass(element, settings.class_entered);\n removeClass(element, settings.class_exited);\n removeClass(element, settings.class_applied);\n removeClass(element, settings.class_loading);\n removeClass(element, settings.class_loaded);\n removeClass(element, settings.class_error);\n};\n\nconst restore = (element, settings) => {\n restoreAttributes(element);\n resetClasses(element, settings);\n resetStatus(element);\n deleteOriginalAttrs(element);\n};\n\nconst cancelLoading = (element, entry, settings, instance) => {\n if (!settings.cancel_on_exit) return;\n if (!hasStatusLoading(element)) return;\n if (element.tagName !== \"IMG\") return; //Works only on images\n removeEventListeners(element);\n resetSourcesImg(element);\n restoreImg(element);\n removeClass(element, settings.class_loading);\n updateLoadingCount(instance, -1);\n resetStatus(element);\n safeCallback(settings.callback_cancel, element, entry, instance);\n};\n\nconst onEnter = (element, entry, settings, instance) => {\n const dontLoad = hadStartedLoading(element); /* Save status\n before setting it, to prevent loading it again. Fixes #526. */\n setStatus(element, statusEntered);\n addClass(element, settings.class_entered);\n removeClass(element, settings.class_exited);\n unobserveEntered(element, settings, instance);\n safeCallback(settings.callback_enter, element, entry, instance);\n if (dontLoad) return;\n load(element, settings, instance);\n};\n\nconst onExit = (element, entry, settings, instance) => {\n if (hasEmptyStatus(element)) return; //Ignore the first pass, at landing\n addClass(element, settings.class_exited);\n cancelLoading(element, entry, settings, instance);\n safeCallback(settings.callback_exit, element, entry, instance);\n};\n\nconst tagsWithNativeLazy = [\"IMG\", \"IFRAME\", \"VIDEO\"];\n\nconst shouldUseNative = (settings) =>\n settings.use_native && \"loading\" in HTMLImageElement.prototype;\n\nconst loadAllNative = (elements, settings, instance) => {\n elements.forEach((element) => {\n if (tagsWithNativeLazy.indexOf(element.tagName) === -1) {\n return;\n }\n loadNative(element, settings, instance);\n });\n setToLoadCount(instance, 0);\n};\n\nconst isIntersecting = (entry) => entry.isIntersecting || entry.intersectionRatio > 0;\n\nconst getObserverSettings = (settings) => ({\n root: settings.container === document ? null : settings.container,\n rootMargin: settings.thresholds || settings.threshold + \"px\"\n});\n\nconst intersectionHandler = (entries, settings, instance) => {\n entries.forEach((entry) =>\n isIntersecting(entry)\n ? onEnter(entry.target, entry, settings, instance)\n : onExit(entry.target, entry, settings, instance)\n );\n};\n\nconst observeElements = (observer, elements) => {\n elements.forEach((element) => {\n observer.observe(element);\n });\n};\n\nconst updateObserver = (observer, elementsToObserve) => {\n resetObserver(observer);\n observeElements(observer, elementsToObserve);\n};\n\nconst setObserver = (settings, instance) => {\n if (!supportsIntersectionObserver || shouldUseNative(settings)) {\n return;\n }\n instance._observer = new IntersectionObserver((entries) => {\n intersectionHandler(entries, settings, instance);\n }, getObserverSettings(settings));\n};\n\nconst toArray = (nodeSet) => Array.prototype.slice.call(nodeSet);\n\nconst queryElements = (settings) =>\n settings.container.querySelectorAll(settings.elements_selector);\n\nconst excludeManagedElements = (elements) => toArray(elements).filter(hasEmptyStatus);\n\nconst hasError = (element) => hasStatusError(element);\nconst filterErrorElements = (elements) => toArray(elements).filter(hasError);\n\nconst getElementsToLoad = (elements, settings) =>\n excludeManagedElements(elements || queryElements(settings));\n\nconst retryLazyLoad = (settings, instance) => {\n const errorElements = filterErrorElements(queryElements(settings));\n errorElements.forEach((element) => {\n removeClass(element, settings.class_error);\n resetStatus(element);\n });\n instance.update();\n};\n\nconst setOnlineCheck = (settings, instance) => {\n if (!runningOnBrowser) {\n return;\n }\n instance._onlineHandler = () => {\n retryLazyLoad(settings, instance);\n };\n window.addEventListener(\"online\", instance._onlineHandler);\n};\n\nconst resetOnlineCheck = (instance) => {\n if (!runningOnBrowser) {\n return;\n }\n window.removeEventListener(\"online\", instance._onlineHandler);\n};\n\nconst LazyLoad = function(customSettings, elements) {\n const settings = getExtendedSettings(customSettings);\n this._settings = settings;\n this.loadingCount = 0;\n setObserver(settings, this);\n setOnlineCheck(settings, this);\n this.update(elements);\n};\n\nLazyLoad.prototype = {\n update: function(givenNodeset) {\n const settings = this._settings;\n const elementsToLoad = getElementsToLoad(givenNodeset, settings);\n setToLoadCount(this, elementsToLoad.length);\n\n if (isBot || !supportsIntersectionObserver) {\n this.loadAll(elementsToLoad);\n return;\n }\n if (shouldUseNative(settings)) {\n loadAllNative(elementsToLoad, settings, this);\n return;\n }\n\n updateObserver(this._observer, elementsToLoad);\n },\n\n destroy: function() {\n // Observer\n if (this._observer) {\n this._observer.disconnect();\n }\n // Clean handlers\n resetOnlineCheck(this);\n // Clean custom attributes on elements\n queryElements(this._settings).forEach((element) => {\n deleteOriginalAttrs(element);\n });\n // Delete all internal props\n delete this._observer;\n delete this._settings;\n delete this._onlineHandler;\n delete this.loadingCount;\n delete this.toLoadCount;\n },\n\n loadAll: function(elements) {\n const settings = this._settings;\n const elementsToLoad = getElementsToLoad(elements, settings);\n elementsToLoad.forEach((element) => {\n unobserve(element, this);\n load(element, settings, this);\n });\n },\n\n restoreAll: function() {\n const settings = this._settings;\n queryElements(settings).forEach((element) => {\n restore(element, settings);\n });\n }\n};\n\nLazyLoad.load = (element, customSettings) => {\n const settings = getExtendedSettings(customSettings);\n load(element, settings);\n};\n\nLazyLoad.resetStatus = (element) => {\n resetStatus(element);\n};\n\n// Automatic instances creation if required (useful for async script loading)\nif (runningOnBrowser) {\n autoInitialize(LazyLoad, window.lazyLoadOptions);\n}\n\nexport { LazyLoad as default };\n","const stringToBoolean = (string: string): boolean => {\n\treturn string === 'true' ? true : false;\n};\n\nconst getClassProperty = (el: HTMLElement, prop: string, val = '') => {\n\treturn (window.getComputedStyle(el).getPropertyValue(prop) || val).replace(\n\t\t' ',\n\t\t'',\n\t);\n};\n\nconst getClassPropertyAlt = (\n\tel: HTMLElement,\n\tprop?: string,\n\tval: string = '',\n) => {\n\tlet targetClass = '';\n\n\tel.classList.forEach((c) => {\n\t\tif (c.includes(prop)) {\n\t\t\ttargetClass = c;\n\t\t}\n\t});\n\n\treturn targetClass.match(/:(.*)]/) ? targetClass.match(/:(.*)]/)[1] : val;\n};\n\nconst getZIndex = (el: HTMLElement) => {\n\tconst computedStyle = window.getComputedStyle(el);\n\tconst zIndex = computedStyle.getPropertyValue('z-index');\n\n\treturn zIndex;\n};\n\nfunction getHighestZIndex(arr: HTMLElement[]) {\n\tlet highestZIndex = Number.NEGATIVE_INFINITY;\n\n\tarr.forEach((el) => {\n\t\tlet zIndex: string | number = getZIndex(el);\n\n\t\tif (zIndex !== 'auto') {\n\t\t\tzIndex = parseInt(zIndex, 10);\n\n\t\t\tif (zIndex > highestZIndex) highestZIndex = zIndex;\n\t\t}\n\t});\n\n\treturn highestZIndex;\n}\n\nconst isIOS = () => {\n\tif (/iPad|iPhone|iPod/.test(navigator.platform)) {\n\t\treturn true;\n\t} else {\n\t\treturn (\n\t\t\tnavigator.maxTouchPoints &&\n\t\t\tnavigator.maxTouchPoints > 2 &&\n\t\t\t/MacIntel/.test(navigator.platform)\n\t\t);\n\t}\n};\n\nconst isIpadOS = () => {\n\treturn (\n\t\tnavigator.maxTouchPoints &&\n\t\tnavigator.maxTouchPoints > 2 &&\n\t\t/MacIntel/.test(navigator.platform)\n\t);\n};\n\nconst isEnoughSpace = (\n\tel: HTMLElement,\n\ttoggle: HTMLElement,\n\tpreferredPosition: 'top' | 'bottom' | 'auto' = 'auto',\n\tspace = 10,\n\twrapper: HTMLElement | null = null,\n) => {\n\tconst referenceRect = toggle.getBoundingClientRect();\n\tconst wrapperRect = wrapper ? wrapper.getBoundingClientRect() : null;\n\tconst viewportHeight = window.innerHeight;\n\tconst spaceAbove = wrapperRect\n\t\t? referenceRect.top - wrapperRect.top\n\t\t: referenceRect.top;\n\tconst spaceBelow =\n\t\t(wrapper ? wrapperRect.bottom : viewportHeight) - referenceRect.bottom;\n\tconst minimumSpaceRequired = el.clientHeight + space;\n\n\tif (preferredPosition === 'bottom') {\n\t\treturn spaceBelow >= minimumSpaceRequired;\n\t} else if (preferredPosition === 'top') {\n\t\treturn spaceAbove >= minimumSpaceRequired;\n\t} else {\n\t\treturn (\n\t\t\tspaceAbove >= minimumSpaceRequired || spaceBelow >= minimumSpaceRequired\n\t\t);\n\t}\n};\n\nconst isFormElement = (target: HTMLElement) => {\n\treturn (\n\t\ttarget instanceof HTMLInputElement ||\n\t\ttarget instanceof HTMLTextAreaElement ||\n\t\ttarget instanceof HTMLSelectElement\n\t);\n};\n\nconst isParentOrElementHidden = (element: any): any => {\n\tif (!element) return false;\n\n\tconst computedStyle = window.getComputedStyle(element);\n\n\tif (computedStyle.display === 'none') return true;\n\n\treturn isParentOrElementHidden(element.parentElement);\n};\n\nconst debounce = (func: Function, timeout = 200) => {\n\tlet timer: any;\n\n\treturn (...args: any[]) => {\n\t\tclearTimeout(timer);\n\n\t\ttimer = setTimeout(() => {\n\t\t\tfunc.apply(this, args);\n\t\t}, timeout);\n\t};\n};\n\nconst dispatch = (evt: string, element: any, payload: any = null) => {\n\tconst event = new CustomEvent(evt, {\n\t\tdetail: { payload },\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tcomposed: false,\n\t});\n\n\telement.dispatchEvent(event);\n};\n\nconst afterTransition = (el: HTMLElement, callback: Function) => {\n\tconst handleEvent = () => {\n\t\tcallback();\n\n\t\tel.removeEventListener('transitionend', handleEvent, true);\n\t};\n\n\tconst computedStyle = window.getComputedStyle(el);\n\tconst transitionDuration = computedStyle.getPropertyValue(\n\t\t'transition-duration',\n\t);\n\tconst transitionProperty = computedStyle.getPropertyValue(\n\t\t'transition-property',\n\t);\n\tconst hasTransition =\n\t\ttransitionProperty !== 'none' && parseFloat(transitionDuration) > 0;\n\n\tif (hasTransition) el.addEventListener('transitionend', handleEvent, true);\n\telse callback();\n};\n\nconst htmlToElement = (html: string): HTMLElement => {\n\tconst template = document.createElement('template');\n\thtml = html.trim();\n\ttemplate.innerHTML = html;\n\n\treturn template.content.firstChild as HTMLElement;\n};\n\nconst classToClassList = (\n\tclasses: string,\n\ttarget: HTMLElement,\n\tsplitter = ' ',\n\taction: 'add' | 'remove' = 'add',\n) => {\n\tconst classesToArray = classes.split(splitter);\n\tclassesToArray.forEach((cl) =>\n\t\taction === 'add' ? target.classList.add(cl) : target.classList.remove(cl),\n\t);\n};\n\nconst menuSearchHistory = {\n\thistoryIndex: -1,\n\n\taddHistory(index: number) {\n\t\tthis.historyIndex = index;\n\t},\n\n\texistsInHistory(index: number) {\n\t\treturn index > this.historyIndex;\n\t},\n\n\tclearHistory() {\n\t\tthis.historyIndex = -1;\n\t},\n};\n\nexport {\n\tstringToBoolean,\n\tgetClassProperty,\n\tgetClassPropertyAlt,\n\tgetZIndex,\n\tgetHighestZIndex,\n\tisIOS,\n\tisIpadOS,\n\tisEnoughSpace,\n\tisParentOrElementHidden,\n\tisFormElement,\n\tdebounce,\n\tdispatch,\n\tafterTransition,\n\thtmlToElement,\n\tclassToClassList,\n\tmenuSearchHistory,\n};\n","/*\n * HSBasePlugin\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { IBasePlugin } from './interfaces';\n\nexport default class HSBasePlugin\n\timplements IBasePlugin\n{\n\tconstructor(\n\t\tpublic el: E,\n\t\tpublic options: O,\n\t\tpublic events?: any,\n\t) {\n\t\tthis.el = el;\n\t\tthis.options = options;\n\t\tthis.events = {};\n\t}\n\n\tpublic createCollection(collection: any[], element: any) {\n\t\tcollection.push({\n\t\t\tid: element?.el?.id || collection.length + 1,\n\t\t\telement,\n\t\t});\n\t}\n\n\tpublic fireEvent(evt: string, payload: any = null) {\n\t\tif (this.events.hasOwnProperty(evt)) return this.events[evt](payload);\n\t}\n\n\tpublic on(evt: string, cb: Function) {\n\t\tthis.events[evt] = cb;\n\t}\n}\n","/*\n * HSCopyMarkup\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch } from '../../utils';\n\nimport { ICopyMarkupOptions, ICopyMarkup } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSCopyMarkup\n\textends HSBasePlugin\n\timplements ICopyMarkup\n{\n\tprivate readonly targetSelector: string | null;\n\tprivate readonly wrapperSelector: string | null;\n\tprivate readonly limit: number | null;\n\n\tprivate target: HTMLElement | null;\n\tprivate wrapper: HTMLElement | null;\n\tprivate items: HTMLElement[] | null;\n\n\tconstructor(el: HTMLElement, options?: ICopyMarkupOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-copy-markup');\n\t\tconst dataOptions: ICopyMarkupOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.targetSelector = concatOptions?.targetSelector || null;\n\t\tthis.wrapperSelector = concatOptions?.wrapperSelector || null;\n\t\tthis.limit = concatOptions?.limit || null;\n\t\tthis.items = [];\n\n\t\tif (this.targetSelector) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsCopyMarkupCollection, this);\n\n\t\tthis.setTarget();\n\t\tthis.setWrapper();\n\t\tthis.addPredefinedItems();\n\t\tthis.el.addEventListener('click', () => this.copy());\n\t}\n\n\tprivate copy() {\n\t\tif (this.limit && this.items.length >= this.limit) return false;\n\n\t\tif (this.el.hasAttribute('disabled')) this.el.setAttribute('disabled', '');\n\n\t\tconst copiedElement = this.target.cloneNode(true) as HTMLElement;\n\n\t\tthis.addToItems(copiedElement);\n\n\t\tif (this.limit && this.items.length >= this.limit)\n\t\t\tthis.el.setAttribute('disabled', 'disabled');\n\n\t\tthis.fireEvent('copy', copiedElement);\n\t\tdispatch('copy.hs.copyMarkup', copiedElement, copiedElement);\n\t}\n\n\tprivate addPredefinedItems() {\n\t\tArray.from(this.wrapper.children)\n\t\t\t.filter(\n\t\t\t\t(el: HTMLElement) => !el.classList.contains('[--ignore-for-count]'),\n\t\t\t)\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tthis.addToItems(el);\n\t\t\t});\n\t}\n\n\tprivate setTarget() {\n\t\tconst target: HTMLElement =\n\t\t\ttypeof this.targetSelector === 'string'\n\t\t\t\t? (document\n\t\t\t\t\t\t.querySelector(this.targetSelector)\n\t\t\t\t\t\t.cloneNode(true) as HTMLElement)\n\t\t\t\t: ((this.targetSelector as HTMLElement).cloneNode(true) as HTMLElement);\n\n\t\ttarget.removeAttribute('id');\n\n\t\tthis.target = target;\n\t}\n\n\tprivate setWrapper() {\n\t\tthis.wrapper =\n\t\t\ttypeof this.wrapperSelector === 'string'\n\t\t\t\t? document.querySelector(this.wrapperSelector)\n\t\t\t\t: this.wrapperSelector;\n\t}\n\n\tprivate addToItems(item: HTMLElement) {\n\t\tconst deleteItemButton = item.querySelector(\n\t\t\t'[data-hs-copy-markup-delete-item]',\n\t\t);\n\n\t\tif (this.wrapper) this.wrapper.append(item);\n\t\telse this.el.before(item);\n\n\t\tif (deleteItemButton)\n\t\t\tdeleteItemButton.addEventListener('click', () => this.delete(item));\n\n\t\tthis.items.push(item);\n\t}\n\n\t// Public methods\n\tpublic delete(target: HTMLElement) {\n\t\tconst index = this.items.indexOf(target);\n\n\t\tif (index !== -1) this.items.splice(index, 1);\n\n\t\ttarget.remove();\n\n\t\tthis.fireEvent('delete', target);\n\t\tdispatch('delete.hs.copyMarkup', target, target);\n\t}\n\n\t// Static method\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsCopyMarkupCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsCopyMarkupCollection) window.$hsCopyMarkupCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-copy-markup]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsCopyMarkupCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst data = el.getAttribute('data-hs-copy-markup');\n\t\t\t\t\tconst options: ICopyMarkupOptions = data ? JSON.parse(data) : {};\n\n\t\t\t\t\tnew HSCopyMarkup(el, options);\n\t\t\t\t}\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSCopyMarkup: Function;\n\t\t$hsCopyMarkupCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSCopyMarkup.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Copy markup collection:', window.$hsCopyMarkupCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSCopyMarkup = HSCopyMarkup;\n}\n\nexport default HSCopyMarkup;\n","/*\n * HSAccordion\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch, afterTransition } from '../../utils';\n\nimport {\n\tIAccordionOptions,\n\tIAccordion,\n\tIAccordionTreeView,\n\tIAccordionTreeViewStaticOptions,\n} from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSAccordion\n\textends HSBasePlugin\n\timplements IAccordion\n{\n\tprivate readonly toggle: HTMLElement | null;\n\tpublic content: HTMLElement | null;\n\tprivate readonly group: HTMLElement | null;\n\tprivate readonly isAlwaysOpened: boolean;\n\n\tstatic selectable: IAccordionTreeView[];\n\n\tconstructor(el: HTMLElement, options?: IAccordionOptions, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tthis.toggle = this.el.querySelector('.hs-accordion-toggle') || null;\n\t\tthis.content = this.el.querySelector('.hs-accordion-content') || null;\n\t\tthis.group = this.el.closest('.hs-accordion-group') || null;\n\t\tthis.isAlwaysOpened =\n\t\t\tthis.group.hasAttribute('data-hs-accordion-always-open') || false;\n\n\t\tif (this.toggle && this.content) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsAccordionCollection, this);\n\n\t\tthis.toggle.addEventListener('click', (evt: Event) => {\n\t\t\tevt.stopPropagation();\n\n\t\t\tif (this.el.classList.contains('active')) {\n\t\t\t\tthis.hide();\n\t\t\t} else {\n\t\t\t\tthis.show();\n\t\t\t}\n\t\t});\n\t}\n\n\t// Public methods\n\tpublic show() {\n\t\tif (\n\t\t\tthis.group &&\n\t\t\t!this.isAlwaysOpened &&\n\t\t\tthis.group.querySelector(':scope > .hs-accordion.active') &&\n\t\t\tthis.group.querySelector(':scope > .hs-accordion.active') !== this.el\n\t\t) {\n\t\t\tconst currentlyOpened = window.$hsAccordionCollection.find(\n\t\t\t\t(el) =>\n\t\t\t\t\tel.element.el ===\n\t\t\t\t\tthis.group.querySelector(':scope > .hs-accordion.active'),\n\t\t\t);\n\n\t\t\tcurrentlyOpened.element.hide();\n\t\t}\n\n\t\tif (this.el.classList.contains('active')) return false;\n\n\t\tthis.el.classList.add('active');\n\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'true';\n\n\t\tthis.content.style.display = 'block';\n\t\tthis.content.style.height = '0';\n\t\tsetTimeout(() => {\n\t\t\tthis.content.style.height = `${this.content.scrollHeight}px`;\n\t\t});\n\n\t\tafterTransition(this.content, () => {\n\t\t\tthis.content.style.display = 'block';\n\t\t\tthis.content.style.height = '';\n\n\t\t\tthis.fireEvent('open', this.el);\n\t\t\tdispatch('open.hs.accordion', this.el, this.el);\n\t\t});\n\t}\n\n\tpublic hide() {\n\t\tif (!this.el.classList.contains('active')) return false;\n\n\t\tthis.el.classList.remove('active');\n\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'false';\n\n\t\tthis.content.style.height = `${this.content.scrollHeight}px`;\n\t\tsetTimeout(() => {\n\t\t\tthis.content.style.height = '0';\n\t\t});\n\n\t\tafterTransition(this.content, () => {\n\t\t\tthis.content.style.display = '';\n\t\t\tthis.content.style.height = '0';\n\n\t\t\tthis.fireEvent('close', this.el);\n\t\t\tdispatch('close.hs.accordion', this.el, this.el);\n\t\t});\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsAccordionCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic show(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsAccordionCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\telInCollection.element.content.style.display !== 'block'\n\t\t)\n\t\t\telInCollection.element.show();\n\t}\n\n\tstatic hide(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsAccordionCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\telInCollection.element.content.style.display === 'block'\n\t\t)\n\t\t\telInCollection.element.hide();\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsAccordionCollection) window.$hsAccordionCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('.hs-accordion:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsAccordionCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSAccordion(el);\n\t\t\t});\n\t}\n\n\tstatic treeView() {\n\t\tif (!document.querySelectorAll('.hs-accordion-treeview-root').length)\n\t\t\treturn false;\n\n\t\tthis.selectable = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('.hs-accordion-treeview-root')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tconst data = el?.getAttribute('data-hs-accordion-options');\n\t\t\t\tconst options: IAccordionTreeViewStaticOptions = data\n\t\t\t\t\t? JSON.parse(data)\n\t\t\t\t\t: {};\n\n\t\t\t\tthis.selectable.push({\n\t\t\t\t\tel,\n\t\t\t\t\toptions: { ...options },\n\t\t\t\t});\n\t\t\t});\n\n\t\tif (this.selectable.length)\n\t\t\tthis.selectable.forEach((item) => {\n\t\t\t\tconst { el } = item;\n\n\t\t\t\tel.querySelectorAll('.hs-accordion-selectable').forEach(\n\t\t\t\t\t(_el: HTMLElement) => {\n\t\t\t\t\t\t_el.addEventListener('click', (evt: Event) => {\n\t\t\t\t\t\t\tevt.stopPropagation();\n\n\t\t\t\t\t\t\tthis.toggleSelected(item, _el);\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t}\n\n\tstatic toggleSelected(root: IAccordionTreeView, item: HTMLElement) {\n\t\tif (item.classList.contains('selected')) item.classList.remove('selected');\n\t\telse {\n\t\t\troot.el\n\t\t\t\t.querySelectorAll('.hs-accordion-selectable')\n\t\t\t\t.forEach((el: HTMLElement) => el.classList.remove('selected'));\n\t\t\titem.classList.add('selected');\n\t\t}\n\t}\n\n\t// Backward compatibility\n\tstatic on(evt: string, target: HTMLElement, cb: Function) {\n\t\tconst elInCollection = window.$hsAccordionCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.events[evt] = cb;\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSAccordion: Function;\n\t\t$hsAccordionCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSAccordion.autoInit();\n\n\tif (document.querySelectorAll('.hs-accordion-treeview-root').length)\n\t\tHSAccordion.treeView();\n\n\t// Uncomment for debug\n\t// console.log('Accordion collection:', window.$hsAccordionCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSAccordion = HSAccordion;\n}\n\nexport default HSAccordion;\n","/*\n * HSCarousel\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { ICarousel, ICarouselOptions } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSCarousel extends HSBasePlugin implements ICarousel {\n\tprivate readonly inner: HTMLElement | null;\n\tprivate readonly slides: NodeListOf | undefined[];\n\tprivate readonly prev: HTMLElement | null;\n\tprivate readonly next: HTMLElement | null;\n\tprivate readonly dots: NodeListOf | null;\n\tprivate sliderWidth: number;\n\tprivate currentIndex: number;\n\tprivate readonly loadingClasses: string | string[];\n\tprivate readonly loadingClassesRemove: string | string[];\n\tprivate readonly loadingClassesAdd: string | string[];\n\tprivate readonly afterLoadingClassesAdd: string | string[];\n\tprivate readonly isAutoPlay: boolean;\n\tprivate readonly isRTL: boolean;\n\tprivate readonly speed: number;\n\tprivate readonly isInfiniteLoop: boolean;\n\tprivate timer: any;\n\n\t// Touch events' help variables\n\tprivate readonly touchX: {\n\t\tstart: number;\n\t\tend: number;\n\t};\n\n\tconstructor(el: HTMLElement, options?: ICarouselOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-carousel');\n\t\tconst dataOptions: ICarouselOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.currentIndex = concatOptions.currentIndex || 0;\n\t\tthis.loadingClasses = concatOptions.loadingClasses\n\t\t\t? `${concatOptions.loadingClasses}`.split(',')\n\t\t\t: null;\n\t\tthis.loadingClassesRemove = this.loadingClasses?.[0]\n\t\t\t? this.loadingClasses[0].split(' ')\n\t\t\t: 'opacity-0';\n\t\tthis.loadingClassesAdd = this.loadingClasses?.[1]\n\t\t\t? this.loadingClasses[1].split(' ')\n\t\t\t: '';\n\t\tthis.afterLoadingClassesAdd = this.loadingClasses?.[2]\n\t\t\t? this.loadingClasses[2].split(' ')\n\t\t\t: '';\n\t\tthis.isAutoPlay =\n\t\t\ttypeof concatOptions.isAutoPlay !== 'undefined'\n\t\t\t\t? concatOptions.isAutoPlay\n\t\t\t\t: false;\n\t\tthis.speed = concatOptions.speed || 4000;\n\t\tthis.isInfiniteLoop =\n\t\t\ttypeof concatOptions.isInfiniteLoop !== 'undefined'\n\t\t\t\t? concatOptions.isInfiniteLoop\n\t\t\t\t: true;\n\t\tthis.isRTL =\n\t\t\ttypeof concatOptions.isRTL !== 'undefined' ? concatOptions.isRTL : false;\n\t\tthis.inner = this.el.querySelector('.hs-carousel-body') || null;\n\t\tthis.slides = this.el.querySelectorAll('.hs-carousel-slide') || [];\n\t\tthis.prev = this.el.querySelector('.hs-carousel-prev') || null;\n\t\tthis.next = this.el.querySelector('.hs-carousel-next') || null;\n\t\tthis.dots = this.el.querySelectorAll('.hs-carousel-pagination > *') || null;\n\t\tthis.sliderWidth = this.inner.parentElement.clientWidth;\n\n\t\t// Touch events' help variables\n\t\tthis.touchX = {\n\t\t\tstart: 0,\n\t\t\tend: 0,\n\t\t};\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsCarouselCollection, this);\n\n\t\tif (this.inner) {\n\t\t\tthis.calculateWidth();\n\t\t\tif (this.loadingClassesRemove) {\n\t\t\t\tif (typeof this.loadingClassesRemove === 'string')\n\t\t\t\t\tthis.inner.classList.remove(this.loadingClassesRemove);\n\t\t\t\telse this.inner.classList.remove(...this.loadingClassesRemove);\n\t\t\t}\n\t\t\tif (this.loadingClassesAdd) {\n\t\t\t\tif (typeof this.loadingClassesAdd === 'string')\n\t\t\t\t\tthis.inner.classList.add(this.loadingClassesAdd);\n\t\t\t\telse this.inner.classList.add(...this.loadingClassesAdd);\n\t\t\t}\n\t\t}\n\t\tif (this.prev)\n\t\t\tthis.prev.addEventListener('click', () => {\n\t\t\t\tthis.goToPrev();\n\t\t\t\tif (this.isAutoPlay) {\n\t\t\t\t\tthis.resetTimer();\n\t\t\t\t\tthis.setTimer();\n\t\t\t\t}\n\t\t\t});\n\t\tif (this.next)\n\t\t\tthis.next.addEventListener('click', () => {\n\t\t\t\tthis.goToNext();\n\t\t\t\tif (this.isAutoPlay) {\n\t\t\t\t\tthis.resetTimer();\n\t\t\t\t\tthis.setTimer();\n\t\t\t\t}\n\t\t\t});\n\t\tif (this.dots) {\n\t\t\tthis.dots.forEach((el, i) =>\n\t\t\t\tel.addEventListener('click', () => {\n\t\t\t\t\tthis.goTo(i);\n\t\t\t\t\tif (this.isAutoPlay) {\n\t\t\t\t\t\tthis.resetTimer();\n\t\t\t\t\t\tthis.setTimer();\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tif (this.slides.length) {\n\t\t\tthis.addCurrentClass();\n\t\t\tif (!this.isInfiniteLoop) this.addDisabledClass();\n\t\t\tif (this.isAutoPlay) this.autoPlay();\n\t\t}\n\t\tif (this.inner && this.afterLoadingClassesAdd) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tif (typeof this.afterLoadingClassesAdd === 'string')\n\t\t\t\t\tthis.inner.classList.add(this.afterLoadingClassesAdd);\n\t\t\t\telse this.inner.classList.add(...this.afterLoadingClassesAdd);\n\t\t\t});\n\t\t}\n\n\t\tthis.el.classList.add('init');\n\n\t\tthis.el.addEventListener('touchstart', (evt) => {\n\t\t\tthis.touchX.start = evt.changedTouches[0].screenX;\n\t\t});\n\n\t\tthis.el.addEventListener('touchend', (evt) => {\n\t\t\tthis.touchX.end = evt.changedTouches[0].screenX;\n\n\t\t\tthis.detectDirection();\n\t\t});\n\n\t\tthis.observeResize();\n\t}\n\n\tprivate observeResize() {\n\t\tconst resizeObserver = new ResizeObserver(() => this.recalculateWidth());\n\n\t\tresizeObserver.observe(document.querySelector('body'));\n\t}\n\n\tprivate calculateWidth() {\n\t\t// Set slider width\n\t\tthis.inner.style.width = `${this.sliderWidth * this.slides.length}px`;\n\t\tthis.inner.style.transform = this.calculateTransform();\n\n\t\t// Set width to each slide\n\t\tthis.slides.forEach((el) => {\n\t\t\tel.style.width = `${this.sliderWidth}px`;\n\t\t});\n\t}\n\n\tprivate addCurrentClass() {\n\t\tthis.slides.forEach((el, i) => {\n\t\t\tif (i === this.currentIndex) {\n\t\t\t\tel.classList.add('active');\n\t\t\t} else {\n\t\t\t\tel.classList.remove('active');\n\t\t\t}\n\t\t});\n\n\t\tif (this.dots) {\n\t\t\tthis.dots.forEach((el, i) => {\n\t\t\t\tif (i === this.currentIndex) {\n\t\t\t\t\tel.classList.add('active');\n\t\t\t\t} else {\n\t\t\t\t\tel.classList.remove('active');\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate addDisabledClass() {\n\t\tif (!this.prev || !this.next) return false;\n\n\t\tif (this.currentIndex === 0) {\n\t\t\tthis.next.classList.remove('disabled');\n\t\t\tthis.prev.classList.add('disabled');\n\t\t} else if (this.currentIndex === this.slides.length - 1) {\n\t\t\tthis.prev.classList.remove('disabled');\n\t\t\tthis.next.classList.add('disabled');\n\t\t} else {\n\t\t\tthis.prev.classList.remove('disabled');\n\t\t\tthis.next.classList.remove('disabled');\n\t\t}\n\t}\n\n\tprivate autoPlay() {\n\t\tthis.setTimer();\n\t}\n\n\tprivate setTimer() {\n\t\tthis.timer = setInterval(() => {\n\t\t\tif (this.currentIndex === this.slides.length - 1) this.goTo(0);\n\t\t\telse this.goToNext();\n\t\t}, this.speed);\n\t}\n\n\tprivate resetTimer() {\n\t\tclearInterval(this.timer);\n\t}\n\n\tprivate detectDirection() {\n\t\tconst { start, end } = this.touchX;\n\n\t\tif (end < start) this.goToNext();\n\t\tif (end > start) this.goToPrev();\n\t}\n\n\t// Public methods\n\tpublic recalculateWidth() {\n\t\tthis.sliderWidth = this.inner.parentElement.clientWidth;\n\n\t\tthis.calculateWidth();\n\t}\n\n\tprivate calculateTransform(): string {\n\t\tlet value = this.currentIndex * this.sliderWidth;\n\t\treturn this.isRTL\n\t\t\t? `translate(${value}px, 0px)`\n\t\t\t: `translate(-${value}px, 0px)`;\n\t}\n\n\tpublic goToPrev() {\n\t\tif (this.currentIndex === 0 && this.isInfiniteLoop) {\n\t\t\tthis.currentIndex = this.slides.length - 1;\n\t\t\tthis.inner.style.transform = this.calculateTransform();\n\n\t\t\tthis.addCurrentClass();\n\t\t} else if (this.currentIndex !== 0) {\n\t\t\tthis.currentIndex -= 1;\n\t\t\tthis.inner.style.transform = this.calculateTransform();\n\n\t\t\tthis.addCurrentClass();\n\t\t\tthis.addDisabledClass();\n\t\t}\n\t}\n\n\tpublic goToNext() {\n\t\tif (this.currentIndex === this.slides.length - 1 && this.isInfiniteLoop) {\n\t\t\tthis.currentIndex = 0;\n\t\t\tthis.inner.style.transform = this.calculateTransform();\n\n\t\t\tthis.addCurrentClass();\n\t\t} else if (this.currentIndex < this.slides.length - 1) {\n\t\t\tthis.currentIndex += 1;\n\t\t\tthis.inner.style.transform = this.calculateTransform();\n\n\t\t\tthis.addCurrentClass();\n\t\t\tthis.addDisabledClass();\n\t\t}\n\t}\n\n\tpublic goTo(i: number) {\n\t\tthis.currentIndex = i;\n\t\tthis.inner.style.transform = this.calculateTransform();\n\n\t\tthis.addCurrentClass();\n\t\tif (!this.isInfiniteLoop) this.addDisabledClass();\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsCarouselCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsCarouselCollection) window.$hsCarouselCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-carousel]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsCarouselCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSCarousel(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSCarousel: Function;\n\t\t$hsCarouselCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSCarousel.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Carousel collection:', window.$hsCarouselCollection);\n});\n\nwindow.addEventListener('resize', () => {\n\tif (!window.$hsCarouselCollection) return false;\n\n\twindow.$hsCarouselCollection.forEach((el) => {\n\t\tel.element.recalculateWidth();\n\t});\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSCarousel = HSCarousel;\n}\n\nexport default HSCarousel;\n","/*\n * HSCollapse\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch, afterTransition } from '../../utils';\n\nimport { ICollapse } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSCollapse extends HSBasePlugin<{}> implements ICollapse {\n\tprivate readonly contentId: string | null;\n\tpublic content: HTMLElement | null;\n\tprivate animationInProcess: boolean;\n\n\tconstructor(el: HTMLElement, options?: {}, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tthis.contentId = this.el.dataset.hsCollapse;\n\t\tthis.content = document.querySelector(this.contentId);\n\t\tthis.animationInProcess = false;\n\n\t\tif (this.content) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsCollapseCollection, this);\n\n\t\tif (this?.el?.ariaExpanded) {\n\t\t\tif (this.el.classList.contains('open')) this.el.ariaExpanded = 'true';\n\t\t\telse this.el.ariaExpanded = 'false';\n\t\t}\n\n\t\tthis.el.addEventListener('click', () => {\n\t\t\tif (this.content.classList.contains('open')) {\n\t\t\t\tthis.hide();\n\t\t\t} else {\n\t\t\t\tthis.show();\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate hideAllMegaMenuItems() {\n\t\tthis.content\n\t\t\t.querySelectorAll('.hs-mega-menu-content.block')\n\t\t\t.forEach((el) => {\n\t\t\t\tel.classList.remove('block');\n\t\t\t\tel.classList.add('hidden');\n\t\t\t});\n\t}\n\n\t// Public methods\n\tpublic show() {\n\t\tif (this.animationInProcess || this.el.classList.contains('open'))\n\t\t\treturn false;\n\n\t\tthis.animationInProcess = true;\n\n\t\tthis.el.classList.add('open');\n\t\tif (this?.el?.ariaExpanded) this.el.ariaExpanded = 'true';\n\t\tthis.content.classList.add('open');\n\t\tthis.content.classList.remove('hidden');\n\n\t\tthis.content.style.height = '0';\n\t\tsetTimeout(() => {\n\t\t\tthis.content.style.height = `${this.content.scrollHeight}px`;\n\n\t\t\tthis.fireEvent('beforeOpen', this.el);\n\t\t\tdispatch('beforeOpen.hs.collapse', this.el, this.el);\n\t\t});\n\n\t\tafterTransition(this.content, () => {\n\t\t\tthis.content.style.height = '';\n\n\t\t\tthis.fireEvent('open', this.el);\n\t\t\tdispatch('open.hs.collapse', this.el, this.el);\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\t}\n\n\tpublic hide() {\n\t\tif (this.animationInProcess || !this.el.classList.contains('open'))\n\t\t\treturn false;\n\n\t\tthis.animationInProcess = true;\n\n\t\tthis.el.classList.remove('open');\n\t\tif (this?.el?.ariaExpanded) this.el.ariaExpanded = 'false';\n\n\t\tthis.content.style.height = `${this.content.scrollHeight}px`;\n\t\tsetTimeout(() => {\n\t\t\tthis.content.style.height = '0';\n\t\t});\n\n\t\tthis.content.classList.remove('open');\n\n\t\tafterTransition(this.content, () => {\n\t\t\tthis.content.classList.add('hidden');\n\t\t\tthis.content.style.height = '';\n\n\t\t\tthis.fireEvent('hide', this.el);\n\t\t\tdispatch('hide.hs.collapse', this.el, this.el);\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\n\t\tif (this.content.querySelectorAll('.hs-mega-menu-content.block').length) {\n\t\t\tthis.hideAllMegaMenuItems();\n\t\t}\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement, isInstance = false) {\n\t\tconst elInCollection = window.$hsCollapseCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsCollapseCollection) window.$hsCollapseCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('.hs-collapse-toggle:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsCollapseCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSCollapse(el);\n\t\t\t});\n\t}\n\n\tstatic show(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsCollapseCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\telInCollection.element.content.classList.contains('hidden')\n\t\t)\n\t\t\telInCollection.element.show();\n\t}\n\n\tstatic hide(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsCollapseCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\t!elInCollection.element.content.classList.contains('hidden')\n\t\t)\n\t\t\telInCollection.element.hide();\n\t}\n\n\t// Backward compatibility\n\tstatic on(evt: string, target: HTMLElement, cb: Function) {\n\t\tconst elInCollection = window.$hsCollapseCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.events[evt] = cb;\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSCollapse: Function;\n\t\t$hsCollapseCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSCollapse.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Collapse collection:', window.$hsCollapseCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSCollapse = HSCollapse;\n}\n\nexport default HSCollapse;\n","export const POSITIONS: any = {\n\tauto: 'auto',\n\t'auto-start': 'auto-start',\n\t'auto-end': 'auto-end',\n\ttop: 'top',\n\t'top-left': 'top-start',\n\t'top-right': 'top-end',\n\tbottom: 'bottom',\n\t'bottom-left': 'bottom-start',\n\t'bottom-right': 'bottom-end',\n\tright: 'right',\n\t'right-start': 'right-start',\n\t'right-end': 'right-end',\n\tleft: 'left',\n\t'left-start': 'left-start',\n\t'left-end': 'left-end',\n};\n\nexport const DROPDOWN_ACCESSIBILITY_KEY_SET = [\n\t'Escape',\n\t'ArrowUp',\n\t'ArrowDown',\n\t'Home',\n\t'End',\n\t'Enter',\n];\n\nexport const OVERLAY_ACCESSIBILITY_KEY_SET = ['Escape', 'Tab'];\n\nexport const TABS_ACCESSIBILITY_KEY_SET = [\n\t'ArrowUp',\n\t'ArrowLeft',\n\t'ArrowDown',\n\t'ArrowRight',\n\t'Home',\n\t'End',\n];\n\nexport const SELECT_ACCESSIBILITY_KEY_SET = [\n\t'ArrowUp',\n\t'ArrowLeft',\n\t'ArrowDown',\n\t'ArrowRight',\n\t'Home',\n\t'End',\n\t'Escape',\n\t'Enter',\n\t'Tab',\n];\n\nexport const COMBO_BOX_ACCESSIBILITY_KEY_SET = [\n\t'ArrowUp',\n\t'ArrowLeft',\n\t'ArrowDown',\n\t'ArrowRight',\n\t'Home',\n\t'End',\n\t'Escape',\n\t'Enter',\n];\n\nexport const BREAKPOINTS: any = {\n\tsm: 640,\n\tmd: 768,\n\tlg: 1024,\n\txl: 1280,\n\t'2xl': 1536,\n};\n","/*\n * HSComboBox\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport {\n\tisEnoughSpace,\n\tdebounce,\n\tdispatch,\n\tafterTransition,\n\thtmlToElement,\n\tisParentOrElementHidden,\n} from '../../utils';\n\nimport { IComboBox, IComboBoxOptions, IComboBoxItemAttr } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nimport { COMBO_BOX_ACCESSIBILITY_KEY_SET } from '../../constants';\n\nclass HSComboBox extends HSBasePlugin implements IComboBox {\n\tgap: number;\n\tviewport: string | HTMLElement | null;\n\tpreventVisibility: boolean;\n\tapiUrl: string | null;\n\tapiDataPart: string | null;\n\tapiQuery: string | null;\n\tapiSearchQuery: string | null;\n\tapiHeaders: {};\n\tapiGroupField: string | null;\n\toutputItemTemplate: string | null;\n\toutputEmptyTemplate: string | null;\n\toutputLoaderTemplate: string | null;\n\tgroupingType: 'default' | 'tabs' | null;\n\tgroupingTitleTemplate: string | null;\n\ttabsWrapperTemplate: string | null;\n\tpreventSelection: boolean;\n\tpreventAutoPosition: boolean;\n\tisOpenOnFocus: boolean;\n\n\tprivate readonly input: HTMLInputElement | null;\n\tprivate readonly output: HTMLElement | null;\n\tprivate readonly itemsWrapper: HTMLElement | null;\n\tprivate items: HTMLElement[] | [];\n\tprivate tabs: HTMLElement[] | [];\n\tprivate readonly toggle: HTMLElement | null;\n\tprivate readonly toggleClose: HTMLElement | null;\n\tprivate readonly toggleOpen: HTMLElement | null;\n\tprivate outputPlaceholder: HTMLElement | null;\n\tprivate outputLoader: HTMLElement | null;\n\n\tprivate value: string | null;\n\tprivate selected: string | null;\n\tprivate groups: any[] | null;\n\tprivate selectedGroup: string | null;\n\n\tisOpened: boolean;\n\tisCurrent: boolean;\n\tprivate animationInProcess: boolean;\n\n\tconstructor(el: HTMLElement, options?: IComboBoxOptions, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\t// Data parameters\n\t\tconst data = el.getAttribute('data-hs-combo-box');\n\t\tconst dataOptions: IComboBoxOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.gap = 5;\n\t\tthis.viewport =\n\t\t\t(typeof concatOptions?.viewport === 'string'\n\t\t\t\t? (document.querySelector(concatOptions?.viewport) as HTMLElement)\n\t\t\t\t: concatOptions?.viewport) ?? null;\n\t\tthis.preventVisibility = concatOptions?.preventVisibility ?? false;\n\t\tthis.apiUrl = concatOptions?.apiUrl ?? null;\n\t\tthis.apiDataPart = concatOptions?.apiDataPart ?? null;\n\t\tthis.apiQuery = concatOptions?.apiQuery ?? null;\n\t\tthis.apiSearchQuery = concatOptions?.apiSearchQuery ?? null;\n\t\tthis.apiHeaders = concatOptions?.apiHeaders ?? {};\n\t\tthis.apiGroupField = concatOptions?.apiGroupField ?? null;\n\t\tthis.outputItemTemplate =\n\t\t\tconcatOptions?.outputItemTemplate ??\n\t\t\t`
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
`;\n\t\tthis.outputEmptyTemplate =\n\t\t\tconcatOptions?.outputEmptyTemplate ??\n\t\t\t`
Nothing found...
`;\n\t\tthis.outputLoaderTemplate =\n\t\t\tconcatOptions?.outputLoaderTemplate ??\n\t\t\t`
\n\t\t\t\t
\n\t\t\t\t\tLoading...\n\t\t\t\t
\n\t\t\t
`;\n\t\tthis.groupingType = concatOptions?.groupingType ?? null;\n\t\tthis.groupingTitleTemplate =\n\t\t\tconcatOptions?.groupingTitleTemplate ??\n\t\t\t(this.groupingType === 'default'\n\t\t\t\t? `
`\n\t\t\t\t: ``);\n\t\tthis.tabsWrapperTemplate =\n\t\t\tconcatOptions?.tabsWrapperTemplate ??\n\t\t\t`
`;\n\t\tthis.preventSelection = concatOptions?.preventSelection ?? false;\n\t\tthis.preventAutoPosition = concatOptions?.preventAutoPosition ?? false;\n\t\tthis.isOpenOnFocus = concatOptions?.isOpenOnFocus ?? false;\n\n\t\t// Internal parameters\n\t\tthis.input = this.el.querySelector('[data-hs-combo-box-input]') ?? null;\n\t\tthis.output = this.el.querySelector('[data-hs-combo-box-output]') ?? null;\n\t\tthis.itemsWrapper =\n\t\t\tthis.el.querySelector('[data-hs-combo-box-output-items-wrapper]') ?? null;\n\t\tthis.items =\n\t\t\tArray.from(this.el.querySelectorAll('[data-hs-combo-box-output-item]')) ??\n\t\t\t[];\n\t\tthis.tabs = [];\n\t\tthis.toggle = this.el.querySelector('[data-hs-combo-box-toggle]') ?? null;\n\t\tthis.toggleClose =\n\t\t\tthis.el.querySelector('[data-hs-combo-box-close]') ?? null;\n\t\tthis.toggleOpen = this.el.querySelector('[data-hs-combo-box-open]') ?? null;\n\t\tthis.outputPlaceholder = null;\n\n\t\tthis.selected = this.value =\n\t\t\t(this.el.querySelector('[data-hs-combo-box-input]') as HTMLInputElement)\n\t\t\t\t.value ?? '';\n\t\tthis.isOpened = false;\n\t\tthis.isCurrent = false;\n\t\tthis.animationInProcess = false;\n\t\tthis.selectedGroup = 'all';\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsComboBoxCollection, this);\n\n\t\tthis.build();\n\t}\n\n\tprivate build() {\n\t\tthis.buildInput();\n\t\tif (this.groupingType) this.setGroups();\n\t\tthis.buildItems();\n\t\tif (this.preventVisibility) {\n\t\t\t// TODO:: test the plugin while the line below is commented.\n\t\t\t// this.isOpened = true;\n\n\t\t\tif (!this.preventAutoPosition) this.recalculateDirection();\n\t\t}\n\t\tif (this.toggle) this.buildToggle();\n\t\tif (this.toggleClose) this.buildToggleClose();\n\t\tif (this.toggleOpen) this.buildToggleOpen();\n\t}\n\n\tprivate setResultAndRender(value = '') {\n\t\t// TODO:: test the plugin with below code added.\n\t\tlet _value = this.preventVisibility ? this.input.value : value;\n\n\t\tthis.setResults(_value);\n\n\t\tif (this.apiSearchQuery) this.itemsFromJson();\n\t}\n\n\tprivate buildInput() {\n\t\tif (this.isOpenOnFocus) {\n\t\t\tthis.input.addEventListener('focus', () => {\n\t\t\t\tif (!this.isOpened) {\n\t\t\t\t\tthis.setResultAndRender();\n\t\t\t\t\tthis.open();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tthis.input.addEventListener(\n\t\t\t'input',\n\t\t\tdebounce((evt: InputEvent) => {\n\t\t\t\tthis.setResultAndRender((evt.target as HTMLInputElement).value);\n\t\t\t\tif (this.input.value !== '') this.el.classList.add('has-value');\n\t\t\t\telse this.el.classList.remove('has-value');\n\t\t\t\tif (!this.isOpened) this.open();\n\t\t\t}),\n\t\t);\n\t}\n\n\tprivate buildItems() {\n\t\tthis.output.role = 'listbox';\n\t\tthis.output.tabIndex = -1;\n\t\tthis.output.ariaOrientation = 'vertical';\n\n\t\tif (this.apiUrl) this.itemsFromJson();\n\t\telse {\n\t\t\tif (this.itemsWrapper) this.itemsWrapper.innerHTML = '';\n\t\t\telse this.output.innerHTML = '';\n\t\t\tthis.itemsFromHtml();\n\t\t}\n\t}\n\n\tprivate setResults(val: string) {\n\t\tthis.value = val;\n\n\t\tthis.resultItems();\n\n\t\tif (this.hasVisibleItems()) this.destroyOutputPlaceholder();\n\t\telse this.buildOutputPlaceholder();\n\t}\n\n\tprivate isItemExists(obj: never): boolean {\n\t\treturn this.items.some((el: HTMLElement) => {\n\t\t\tconst groupField =\n\t\t\t\tel.getAttribute('data-hs-combo-box-output-item-group-field') ?? null;\n\t\t\tconst params =\n\t\t\t\tJSON.parse(el.getAttribute('data-hs-combo-box-output-item')) ?? null;\n\t\t\tlet group = null;\n\n\t\t\tif (groupField && params?.group?.name) group = obj[groupField];\n\n\t\t\treturn Array.from(\n\t\t\t\tel.querySelectorAll('[data-hs-combo-box-search-text]'),\n\t\t\t).some((elI: HTMLElement) => {\n\t\t\t\tconst equality =\n\t\t\t\t\tparams?.group?.name && group\n\t\t\t\t\t\t? group === params.group.name &&\n\t\t\t\t\t\t\telI.getAttribute('data-hs-combo-box-search-text') ===\n\t\t\t\t\t\t\t\tobj[elI.getAttribute('data-hs-combo-box-output-item-field')]\n\t\t\t\t\t\t: elI.getAttribute('data-hs-combo-box-search-text') ===\n\t\t\t\t\t\t\tobj[elI.getAttribute('data-hs-combo-box-output-item-field')];\n\n\t\t\t\treturn equality;\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate isTextExists(el: HTMLElement, val: string[]): boolean {\n\t\tconst lowerCased = val.map((v) => v.toLowerCase());\n\n\t\treturn Array.from(\n\t\t\tel.querySelectorAll('[data-hs-combo-box-search-text]'),\n\t\t).some((elI: HTMLElement) =>\n\t\t\tlowerCased.includes(\n\t\t\t\telI.getAttribute('data-hs-combo-box-search-text').toLowerCase(),\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate isTextExistsAny(el: HTMLElement, val: string): boolean {\n\t\treturn Array.from(\n\t\t\tel.querySelectorAll('[data-hs-combo-box-search-text]'),\n\t\t).some((elI: HTMLElement) =>\n\t\t\telI\n\t\t\t\t.getAttribute('data-hs-combo-box-search-text')\n\t\t\t\t.toLowerCase()\n\t\t\t\t.includes(val.toLowerCase()),\n\t\t);\n\t}\n\n\tprivate valuesBySelector(el: HTMLElement) {\n\t\treturn Array.from(\n\t\t\tel.querySelectorAll('[data-hs-combo-box-search-text]'),\n\t\t).reduce(\n\t\t\t(acc: any, cur: HTMLElement) => [\n\t\t\t\t...acc,\n\t\t\t\tcur.getAttribute('data-hs-combo-box-search-text'),\n\t\t\t],\n\t\t\t[],\n\t\t);\n\t}\n\n\tprivate buildOutputLoader() {\n\t\tif (this.outputLoader) return false;\n\n\t\tthis.outputLoader = htmlToElement(this.outputLoaderTemplate);\n\t\tif (this.items.length || this.outputPlaceholder) {\n\t\t\tthis.outputLoader.style.position = 'absolute';\n\t\t\tthis.outputLoader.style.top = '0';\n\t\t\tthis.outputLoader.style.bottom = '0';\n\t\t\tthis.outputLoader.style.left = '0';\n\t\t\tthis.outputLoader.style.right = '0';\n\t\t\tthis.outputLoader.style.zIndex = '2';\n\t\t} else {\n\t\t\tthis.outputLoader.style.position = '';\n\t\t\tthis.outputLoader.style.top = '';\n\t\t\tthis.outputLoader.style.bottom = '';\n\t\t\tthis.outputLoader.style.left = '';\n\t\t\tthis.outputLoader.style.right = '';\n\t\t\tthis.outputLoader.style.zIndex = '';\n\t\t\tthis.outputLoader.style.height = '30px';\n\t\t}\n\n\t\tthis.output.append(this.outputLoader);\n\t}\n\n\tprivate destroyOutputLoader() {\n\t\tif (this.outputLoader) this.outputLoader.remove();\n\n\t\tthis.outputLoader = null;\n\t}\n\n\tprivate async itemsFromJson() {\n\t\tthis.buildOutputLoader();\n\n\t\ttry {\n\t\t\tconst query = `${this.apiQuery}`;\n\t\t\tconst searchQuery = `${this.apiSearchQuery}=${this.value.toLowerCase()}`;\n\t\t\tlet url = this.apiUrl;\n\t\t\tif (this.apiQuery && this.apiSearchQuery) {\n\t\t\t\turl += `?${searchQuery}&${query}`;\n\t\t\t} else if (this.apiQuery) {\n\t\t\t\turl += `?${query}`;\n\t\t\t} else if (this.apiSearchQuery) {\n\t\t\t\turl += `?${searchQuery}`;\n\t\t\t}\n\t\t\tconst res = await fetch(url, this.apiHeaders);\n\t\t\tlet items = await res.json();\n\t\t\tif (this.apiDataPart) {\n\t\t\t\titems = items[this.apiDataPart];\n\t\t\t}\n\t\t\tif (this.apiSearchQuery) {\n\t\t\t\tthis.items = [];\n\t\t\t}\n\t\t\tif (this.itemsWrapper) {\n\t\t\t\tthis.itemsWrapper.innerHTML = '';\n\t\t\t} else {\n\t\t\t\tthis.output.innerHTML = '';\n\t\t\t}\n\n\t\t\tif (this.groupingType === 'tabs') {\n\t\t\t\tthis.setApiGroups(items);\n\t\t\t\tthis.groupTabsRender();\n\t\t\t\tthis.jsonItemsRender(items);\n\t\t\t} else if (this.groupingType === 'default') {\n\t\t\t\tthis.setApiGroups(items);\n\n\t\t\t\tthis.groups.forEach((el) => {\n\t\t\t\t\tconst title = htmlToElement(this.groupingTitleTemplate);\n\t\t\t\t\ttitle.setAttribute('data-hs-combo-box-group-title', el.name);\n\t\t\t\t\ttitle.classList.add('--exclude-accessibility');\n\t\t\t\t\ttitle.innerText = el.title;\n\t\t\t\t\tconst newItems = items.filter(\n\t\t\t\t\t\t(i: any) => i[this.apiGroupField] === el.name,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (this.itemsWrapper) this.itemsWrapper.append(title);\n\t\t\t\t\telse this.output.append(title);\n\n\t\t\t\t\tthis.jsonItemsRender(newItems);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.jsonItemsRender(items);\n\t\t\t}\n\n\t\t\tthis.setResults(this.input.value);\n\t\t} catch (err) {\n\t\t\tconsole.error(err);\n\t\t}\n\n\t\tthis.destroyOutputLoader();\n\t}\n\n\tprivate jsonItemsRender(items: any) {\n\t\titems.forEach((item: never, index: number) => {\n\t\t\t// TODO:: test without checking below\n\t\t\t// if (this.isItemExists(item)) return false;\n\n\t\t\tconst newItem = htmlToElement(this.outputItemTemplate);\n\t\t\tnewItem\n\t\t\t\t.querySelectorAll('[data-hs-combo-box-output-item-field]')\n\t\t\t\t.forEach((el) => {\n\t\t\t\t\tconst value =\n\t\t\t\t\t\titem[el.getAttribute('data-hs-combo-box-output-item-field')];\n\t\t\t\t\tconst hideIfEmpty = el.hasAttribute(\n\t\t\t\t\t\t'data-hs-combo-box-output-item-hide-if-empty',\n\t\t\t\t\t);\n\n\t\t\t\t\tel.textContent = value ?? '';\n\t\t\t\t\tif (!value && hideIfEmpty) (el as HTMLElement).style.display = 'none';\n\t\t\t\t});\n\t\t\tnewItem\n\t\t\t\t.querySelectorAll('[data-hs-combo-box-search-text]')\n\t\t\t\t.forEach((el) => {\n\t\t\t\t\tel.setAttribute(\n\t\t\t\t\t\t'data-hs-combo-box-search-text',\n\t\t\t\t\t\titem[el.getAttribute('data-hs-combo-box-output-item-field')] ?? '',\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\tnewItem\n\t\t\t\t.querySelectorAll('[data-hs-combo-box-output-item-attr]')\n\t\t\t\t.forEach((el) => {\n\t\t\t\t\tconst attributes = JSON.parse(\n\t\t\t\t\t\tel.getAttribute('data-hs-combo-box-output-item-attr'),\n\t\t\t\t\t);\n\n\t\t\t\t\tattributes.forEach((attr: IComboBoxItemAttr) => {\n\t\t\t\t\t\tel.setAttribute(attr.attr, item[attr.valueFrom]);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\tnewItem.setAttribute('tabIndex', `${index}`);\n\t\t\tif (this.groupingType === 'tabs' || this.groupingType === 'default') {\n\t\t\t\tnewItem.setAttribute(\n\t\t\t\t\t'data-hs-combo-box-output-item',\n\t\t\t\t\t`{\"group\": {\"name\": \"${item[this.apiGroupField]}\", \"title\": \"${\n\t\t\t\t\t\titem[this.apiGroupField]\n\t\t\t\t\t}\"}}`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.items = [...this.items, newItem];\n\n\t\t\tif (!this.preventSelection) {\n\t\t\t\t(newItem as HTMLElement).addEventListener('click', () => {\n\t\t\t\t\tthis.close(\n\t\t\t\t\t\t(newItem as HTMLElement)\n\t\t\t\t\t\t\t.querySelector('[data-hs-combo-box-value]')\n\t\t\t\t\t\t\t.getAttribute('data-hs-combo-box-search-text'),\n\t\t\t\t\t);\n\n\t\t\t\t\tthis.setSelectedByValue(this.valuesBySelector(newItem));\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.appendItemsToWrapper(newItem);\n\t\t});\n\t}\n\n\tprivate setGroups() {\n\t\tconst groups: any[] = [];\n\n\t\tthis.items.forEach((item: HTMLElement) => {\n\t\t\tconst { group } = JSON.parse(\n\t\t\t\titem.getAttribute('data-hs-combo-box-output-item'),\n\t\t\t);\n\n\t\t\tif (!groups.some((el) => el?.name === group.name)) {\n\t\t\t\tgroups.push(group);\n\t\t\t}\n\t\t});\n\n\t\tthis.groups = groups;\n\t}\n\n\tpublic setCurrent() {\n\t\tif (window.$hsComboBoxCollection.length) {\n\t\t\twindow.$hsComboBoxCollection.map((el) => (el.element.isCurrent = false));\n\n\t\t\tthis.isCurrent = true;\n\t\t}\n\t}\n\n\tprivate setApiGroups(items: any) {\n\t\tconst groups: any[] = [];\n\n\t\titems.forEach((item: any) => {\n\t\t\tconst group = item[this.apiGroupField];\n\n\t\t\tif (!groups.some((el) => el.name === group)) {\n\t\t\t\tgroups.push({\n\t\t\t\t\tname: group,\n\t\t\t\t\ttitle: group,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis.groups = groups;\n\t}\n\n\tprivate sortItems() {\n\t\tconst compareFn = (i1: HTMLElement, i2: HTMLElement) => {\n\t\t\tconst a = i1\n\t\t\t\t.querySelector('[data-hs-combo-box-value]')\n\t\t\t\t.getAttribute('data-hs-combo-box-search-text');\n\t\t\tconst b = i2\n\t\t\t\t.querySelector('[data-hs-combo-box-value]')\n\t\t\t\t.getAttribute('data-hs-combo-box-search-text');\n\n\t\t\tif (a < b) {\n\t\t\t\treturn -1;\n\t\t\t} else if (a > b) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t};\n\n\t\treturn this.items.sort(compareFn);\n\t}\n\n\tprivate itemRender(item: HTMLElement) {\n\t\tconst val = item\n\t\t\t.querySelector('[data-hs-combo-box-value]')\n\t\t\t.getAttribute('data-hs-combo-box-search-text');\n\n\t\tif (this.itemsWrapper) this.itemsWrapper.append(item);\n\t\telse this.output.append(item);\n\n\t\tif (!this.preventSelection) {\n\t\t\titem.addEventListener('click', () => {\n\t\t\t\tthis.close(val);\n\t\t\t\tthis.setSelectedByValue(this.valuesBySelector(item));\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate plainRender(items: HTMLElement[]) {\n\t\titems.forEach((item: HTMLElement) => {\n\t\t\tthis.itemRender(item);\n\t\t});\n\t}\n\n\tprivate groupTabsRender() {\n\t\tconst tabsScroll = htmlToElement(this.tabsWrapperTemplate);\n\t\tconst tabsWrapper = htmlToElement(\n\t\t\t`
`,\n\t\t);\n\n\t\ttabsScroll.append(tabsWrapper);\n\t\tthis.output.insertBefore(tabsScroll, this.output.firstChild);\n\n\t\tconst tabDef = htmlToElement(this.groupingTitleTemplate);\n\t\ttabDef.setAttribute('data-hs-combo-box-group-title', 'all');\n\t\ttabDef.classList.add('--exclude-accessibility', 'active');\n\t\ttabDef.innerText = 'All';\n\t\tthis.tabs = [...this.tabs, tabDef];\n\t\ttabsWrapper.append(tabDef);\n\t\ttabDef.addEventListener('click', () => {\n\t\t\tthis.selectedGroup = 'all';\n\t\t\tconst selectedTab = this.tabs.find(\n\t\t\t\t(elI: HTMLElement) =>\n\t\t\t\t\telI.getAttribute('data-hs-combo-box-group-title') ===\n\t\t\t\t\tthis.selectedGroup,\n\t\t\t);\n\n\t\t\tthis.tabs.forEach((el: HTMLElement) => el.classList.remove('active'));\n\t\t\tselectedTab.classList.add('active');\n\t\t\tthis.setItemsVisibility();\n\t\t});\n\n\t\tthis.groups.forEach((el) => {\n\t\t\tconst tab = htmlToElement(this.groupingTitleTemplate);\n\t\t\ttab.setAttribute('data-hs-combo-box-group-title', el.name);\n\t\t\ttab.classList.add('--exclude-accessibility');\n\t\t\ttab.innerText = el.title;\n\n\t\t\tthis.tabs = [...this.tabs, tab];\n\t\t\ttabsWrapper.append(tab);\n\n\t\t\ttab.addEventListener('click', () => {\n\t\t\t\tthis.selectedGroup = el.name;\n\t\t\t\tconst selectedTab = this.tabs.find(\n\t\t\t\t\t(elI: HTMLElement) =>\n\t\t\t\t\t\telI.getAttribute('data-hs-combo-box-group-title') ===\n\t\t\t\t\t\tthis.selectedGroup,\n\t\t\t\t);\n\n\t\t\t\tthis.tabs.forEach((el: HTMLElement) => el.classList.remove('active'));\n\t\t\t\tselectedTab.classList.add('active');\n\t\t\t\tthis.setItemsVisibility();\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate groupDefaultRender() {\n\t\tthis.groups.forEach((el) => {\n\t\t\tconst title = htmlToElement(this.groupingTitleTemplate);\n\t\t\ttitle.setAttribute('data-hs-combo-box-group-title', el.name);\n\t\t\ttitle.classList.add('--exclude-accessibility');\n\t\t\ttitle.innerText = el.title;\n\n\t\t\tif (this.itemsWrapper) this.itemsWrapper.append(title);\n\t\t\telse this.output.append(title);\n\n\t\t\tconst items = this.sortItems().filter((f) => {\n\t\t\t\tconst { group } = JSON.parse(\n\t\t\t\t\tf.getAttribute('data-hs-combo-box-output-item'),\n\t\t\t\t);\n\n\t\t\t\treturn group.name === el.name;\n\t\t\t});\n\n\t\t\tthis.plainRender(items);\n\t\t});\n\t}\n\n\tprivate itemsFromHtml() {\n\t\tif (this.groupingType === 'default') {\n\t\t\tthis.groupDefaultRender();\n\t\t} else if (this.groupingType === 'tabs') {\n\t\t\tconst items = this.sortItems();\n\n\t\t\tthis.groupTabsRender();\n\t\t\tthis.plainRender(items);\n\t\t} else {\n\t\t\tconst items = this.sortItems();\n\n\t\t\tthis.plainRender(items);\n\t\t}\n\t\tthis.setResults(this.input.value);\n\t}\n\n\tprivate buildToggle() {\n\t\tif (this.isOpened) {\n\t\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'true';\n\t\t\tif (this?.input?.ariaExpanded) this.input.ariaExpanded = 'true';\n\t\t} else {\n\t\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'false';\n\t\t\tif (this?.input?.ariaExpanded) this.input.ariaExpanded = 'false';\n\t\t}\n\n\t\tthis.toggle.addEventListener('click', () => {\n\t\t\tif (this.isOpened) this.close();\n\t\t\telse this.open(this.toggle.getAttribute('data-hs-combo-box-toggle'));\n\t\t});\n\t}\n\n\tprivate buildToggleClose() {\n\t\tthis.toggleClose.addEventListener('click', () => this.close());\n\t}\n\n\tprivate buildToggleOpen() {\n\t\tthis.toggleOpen.addEventListener('click', () => this.open());\n\t}\n\n\tprivate setSelectedByValue(val: string[]) {\n\t\tthis.items.forEach((el) => {\n\t\t\tif (this.isTextExists(el, val))\n\t\t\t\t(el as HTMLElement).classList.add('selected');\n\t\t\telse (el as HTMLElement).classList.remove('selected');\n\t\t});\n\t}\n\n\tprivate setValue(val: string) {\n\t\tthis.selected = val;\n\t\tthis.value = val;\n\t\tthis.input.value = val;\n\n\t\tthis.fireEvent('select', this.el);\n\t\tdispatch('select.hs.combobox', this.el, this.value);\n\t}\n\n\tprivate setItemsVisibility() {\n\t\tif (this.groupingType === 'tabs' && this.selectedGroup !== 'all') {\n\t\t\tthis.items.forEach((item) => {\n\t\t\t\t(item as HTMLElement).style.display = 'none';\n\t\t\t});\n\t\t}\n\n\t\tconst items =\n\t\t\tthis.groupingType === 'tabs'\n\t\t\t\t? this.selectedGroup === 'all'\n\t\t\t\t\t? this.items\n\t\t\t\t\t: this.items.filter((f: HTMLElement) => {\n\t\t\t\t\t\t\tconst { group } = JSON.parse(\n\t\t\t\t\t\t\t\tf.getAttribute('data-hs-combo-box-output-item'),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\treturn group.name === this.selectedGroup;\n\t\t\t\t\t\t})\n\t\t\t\t: this.items;\n\n\t\tif (this.groupingType === 'tabs' && this.selectedGroup !== 'all') {\n\t\t\titems.forEach((item) => {\n\t\t\t\t(item as HTMLElement).style.display = 'block';\n\t\t\t});\n\t\t}\n\n\t\titems.forEach((item) => {\n\t\t\tif (!this.isTextExistsAny(item, this.value))\n\t\t\t\t(item as HTMLElement).style.display = 'none';\n\t\t\telse (item as HTMLElement).style.display = 'block';\n\t\t});\n\n\t\tif (this.groupingType === 'default') {\n\t\t\tthis.output\n\t\t\t\t.querySelectorAll('[data-hs-combo-box-group-title]')\n\t\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\t\tconst g = el.getAttribute('data-hs-combo-box-group-title');\n\t\t\t\t\tconst items = this.items.filter((f: HTMLElement) => {\n\t\t\t\t\t\tconst { group } = JSON.parse(\n\t\t\t\t\t\t\tf.getAttribute('data-hs-combo-box-output-item'),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn group.name === g && f.style.display === 'block';\n\t\t\t\t\t});\n\n\t\t\t\t\tif (items.length) el.style.display = 'block';\n\t\t\t\t\telse el.style.display = 'none';\n\t\t\t\t});\n\t\t}\n\t}\n\n\tprivate hasVisibleItems() {\n\t\treturn this.items.length\n\t\t\t? this.items.some((el: HTMLElement) => el.style.display === 'block')\n\t\t\t: false;\n\t}\n\n\tprivate appendItemsToWrapper(item: HTMLElement) {\n\t\tif (this.itemsWrapper) {\n\t\t\tthis.itemsWrapper.append(item);\n\t\t} else {\n\t\t\tthis.output.append(item);\n\t\t}\n\t}\n\n\tprivate buildOutputPlaceholder() {\n\t\tif (!this.outputPlaceholder)\n\t\t\tthis.outputPlaceholder = htmlToElement(this.outputEmptyTemplate);\n\n\t\tthis.appendItemsToWrapper(this.outputPlaceholder);\n\t}\n\n\tprivate destroyOutputPlaceholder() {\n\t\tif (this.outputPlaceholder) this.outputPlaceholder.remove();\n\n\t\tthis.outputPlaceholder = null;\n\t}\n\n\tprivate resultItems() {\n\t\tif (!this.items.length) return false;\n\n\t\tthis.setItemsVisibility();\n\t\tthis.setSelectedByValue([this.selected]);\n\t}\n\n\t// Public methods\n\tprivate setValueAndOpen(val: string) {\n\t\tthis.value = val;\n\n\t\tif (this.items.length) {\n\t\t\tthis.setItemsVisibility();\n\t\t}\n\t}\n\n\tpublic open(val?: string) {\n\t\tif (this.animationInProcess) return false;\n\n\t\tif (typeof val !== 'undefined') this.setValueAndOpen(val);\n\n\t\tif (this.preventVisibility) return false;\n\n\t\tthis.animationInProcess = true;\n\n\t\tthis.output.style.display = 'block';\n\t\tif (!this.preventAutoPosition) this.recalculateDirection();\n\n\t\tsetTimeout(() => {\n\t\t\tif (this?.input?.ariaExpanded) this.input.ariaExpanded = 'true';\n\t\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'true';\n\t\t\tthis.el.classList.add('active');\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\n\t\tthis.isOpened = true;\n\t}\n\n\tprivate setValueAndClear(val: string | null) {\n\t\tif (val) this.setValue(val);\n\t\telse this.setValue(this.selected);\n\n\t\tif (this.outputPlaceholder) this.destroyOutputPlaceholder();\n\t}\n\n\tpublic close(val?: string | null) {\n\t\tif (this.animationInProcess) return false;\n\n\t\tif (this.preventVisibility) {\n\t\t\tthis.setValueAndClear(val);\n\n\t\t\tif (this.input.value !== '') this.el.classList.add('has-value');\n\t\t\telse this.el.classList.remove('has-value');\n\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.animationInProcess = true;\n\n\t\tif (this?.input?.ariaExpanded) this.input.ariaExpanded = 'false';\n\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'false';\n\t\tthis.el.classList.remove('active');\n\t\tif (!this.preventAutoPosition) {\n\t\t\tthis.output.classList.remove('bottom-full', 'top-full');\n\t\t\tthis.output.style.marginTop = '';\n\t\t\tthis.output.style.marginBottom = '';\n\t\t}\n\n\t\tafterTransition(this.output, () => {\n\t\t\tthis.output.style.display = 'none';\n\n\t\t\tthis.setValueAndClear(val);\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\n\t\tif (this.input.value !== '') this.el.classList.add('has-value');\n\t\telse this.el.classList.remove('has-value');\n\n\t\tthis.isOpened = false;\n\t}\n\n\tpublic recalculateDirection() {\n\t\tif (\n\t\t\tisEnoughSpace(\n\t\t\t\tthis.output,\n\t\t\t\tthis.input,\n\t\t\t\t'bottom',\n\t\t\t\tthis.gap,\n\t\t\t\tthis.viewport as HTMLElement,\n\t\t\t)\n\t\t) {\n\t\t\tthis.output.classList.remove('bottom-full');\n\t\t\tthis.output.style.marginBottom = '';\n\t\t\tthis.output.classList.add('top-full');\n\t\t\tthis.output.style.marginTop = `${this.gap}px`;\n\t\t} else {\n\t\t\tthis.output.classList.remove('top-full');\n\t\t\tthis.output.style.marginTop = '';\n\t\t\tthis.output.classList.add('bottom-full');\n\t\t\tthis.output.style.marginBottom = `${this.gap}px`;\n\t\t}\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsComboBoxCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsComboBoxCollection) window.$hsComboBoxCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-combo-box]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsComboBoxCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst data = el.getAttribute('data-hs-combo-box');\n\t\t\t\t\tconst options: IComboBoxOptions = data ? JSON.parse(data) : {};\n\n\t\t\t\t\tnew HSComboBox(el, options);\n\t\t\t\t}\n\t\t\t});\n\n\t\tif (window.$hsComboBoxCollection) {\n\t\t\twindow.addEventListener('click', (evt) => {\n\t\t\t\tconst evtTarget = evt.target;\n\n\t\t\t\tHSComboBox.closeCurrentlyOpened(evtTarget as HTMLElement);\n\t\t\t});\n\n\t\t\tdocument.addEventListener('keydown', (evt) =>\n\t\t\t\tHSComboBox.accessibility(evt),\n\t\t\t);\n\t\t}\n\t}\n\n\tstatic close(target: HTMLElement | string) {\n\t\tconst elInCollection = window.$hsComboBoxCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection && elInCollection.element.isOpened) {\n\t\t\telInCollection.element.close();\n\t\t}\n\t}\n\n\tstatic closeCurrentlyOpened(evtTarget: HTMLElement | null = null) {\n\t\tif (!evtTarget.closest('[data-hs-combo-box].active')) {\n\t\t\tconst currentlyOpened =\n\t\t\t\twindow.$hsComboBoxCollection.filter((el) => el.element.isOpened) ||\n\t\t\t\tnull;\n\n\t\t\tif (currentlyOpened) {\n\t\t\t\tcurrentlyOpened.forEach((el) => {\n\t\t\t\t\tel.element.close();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t// Accessibility methods\n\tprivate static getPreparedItems(\n\t\tisReversed = false,\n\t\toutput: HTMLElement | null,\n\t): Element[] | null {\n\t\tif (!output) return null;\n\n\t\tconst preparedItems = isReversed\n\t\t\t? Array.from(\n\t\t\t\t\toutput.querySelectorAll(':scope > *:not(.--exclude-accessibility)'),\n\t\t\t\t)\n\t\t\t\t\t.filter((el) => (el as HTMLElement).style.display !== 'none')\n\t\t\t\t\t.reverse()\n\t\t\t: Array.from(\n\t\t\t\t\toutput.querySelectorAll(':scope > *:not(.--exclude-accessibility)'),\n\t\t\t\t).filter((el) => (el as HTMLElement).style.display !== 'none');\n\t\tconst items = preparedItems.filter(\n\t\t\t(el: any) => !el.classList.contains('disabled'),\n\t\t);\n\n\t\treturn items;\n\t}\n\n\tprivate static setHighlighted(\n\t\tprev: Element,\n\t\tcurrent: HTMLElement,\n\t\tinput: HTMLInputElement,\n\t): void {\n\t\tcurrent.focus();\n\n\t\tinput.value = current\n\t\t\t.querySelector('[data-hs-combo-box-value]')\n\t\t\t.getAttribute('data-hs-combo-box-search-text');\n\n\t\tif (prev) prev.classList.remove('hs-combo-box-output-item-highlighted');\n\t\tcurrent.classList.add('hs-combo-box-output-item-highlighted');\n\t}\n\n\tstatic accessibility(evt: KeyboardEvent) {\n\t\tconst target = window.$hsComboBoxCollection.find((el) =>\n\t\t\tel.element.preventVisibility ? el.element.isCurrent : el.element.isOpened,\n\t\t);\n\n\t\tif (\n\t\t\ttarget &&\n\t\t\tCOMBO_BOX_ACCESSIBILITY_KEY_SET.includes(evt.code) &&\n\t\t\t!evt.metaKey\n\t\t) {\n\t\t\tswitch (evt.code) {\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tthis.onEscape();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onArrow();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onArrow(false);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Home':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onStartEnd();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'End':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onStartEnd(false);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tthis.onEnter(evt);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic onEscape() {\n\t\tconst target = window.$hsComboBoxCollection.find(\n\t\t\t(el) => !el.element.preventVisibility && el.element.isOpened,\n\t\t);\n\n\t\tif (target) {\n\t\t\ttarget.element.close();\n\t\t\ttarget.element.input.blur();\n\t\t}\n\t}\n\n\tstatic onArrow(isArrowUp = true) {\n\t\tconst target = window.$hsComboBoxCollection.find((el) =>\n\t\t\tel.element.preventVisibility ? el.element.isCurrent : el.element.isOpened,\n\t\t);\n\n\t\tif (target) {\n\t\t\tconst output = target.element.itemsWrapper ?? target.element.output;\n\n\t\t\tif (!output) return false;\n\n\t\t\tconst items = HSComboBox.getPreparedItems(isArrowUp, output) as Element[];\n\t\t\tconst current = output.querySelector(\n\t\t\t\t'.hs-combo-box-output-item-highlighted',\n\t\t\t);\n\t\t\tlet currentItem = null;\n\t\t\tif (!current)\n\t\t\t\titems[0].classList.add('hs-combo-box-output-item-highlighted');\n\t\t\tlet currentInd = items.findIndex((el: any) => el === current);\n\t\t\tif (currentInd + 1 < items.length) currentInd++;\n\t\t\tcurrentItem = items[currentInd] as HTMLButtonElement;\n\n\t\t\tHSComboBox.setHighlighted(current, currentItem, target.element.input);\n\t\t}\n\t}\n\n\tstatic onStartEnd(isStart = true) {\n\t\tconst target = window.$hsComboBoxCollection.find((el) =>\n\t\t\tel.element.preventVisibility ? el.element.isCurrent : el.element.isOpened,\n\t\t);\n\n\t\tif (target) {\n\t\t\tconst output = target.element.itemsWrapper ?? target.element.output;\n\n\t\t\tif (!output) return false;\n\n\t\t\tconst items = HSComboBox.getPreparedItems(isStart, output) as Element[];\n\t\t\tconst current = output.querySelector(\n\t\t\t\t'.hs-combo-box-output-item-highlighted',\n\t\t\t);\n\n\t\t\tif (items.length)\n\t\t\t\tHSComboBox.setHighlighted(\n\t\t\t\t\tcurrent,\n\t\t\t\t\titems[0] as HTMLButtonElement,\n\t\t\t\t\ttarget.element.input,\n\t\t\t\t);\n\t\t}\n\t}\n\n\tstatic onEnter(evt: Event) {\n\t\tconst target = evt.target;\n\t\tconst opened = window.$hsComboBoxCollection.find(\n\t\t\t(el) =>\n\t\t\t\t!isParentOrElementHidden(el.element.el) &&\n\t\t\t\t(evt.target as HTMLElement).closest('[data-hs-combo-box]') ===\n\t\t\t\t\tel.element.el,\n\t\t);\n\n\t\tconst link: HTMLAnchorElement = opened.element.el.querySelector(\n\t\t\t'.hs-combo-box-output-item-highlighted a',\n\t\t);\n\n\t\tif ((target as HTMLElement).hasAttribute('data-hs-combo-box-input')) {\n\t\t\topened.element.close();\n\t\t\t(target as HTMLInputElement).blur();\n\t\t} else {\n\t\t\tif (!opened.element.preventSelection) {\n\t\t\t\topened.element.setSelectedByValue(\n\t\t\t\t\topened.element.valuesBySelector(evt.target as HTMLElement),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (opened.element.preventSelection && link) {\n\t\t\t\twindow.location.assign(link.getAttribute('href'));\n\t\t\t}\n\t\t\topened.element.close(\n\t\t\t\t!opened.element.preventSelection\n\t\t\t\t\t? (evt.target as HTMLElement)\n\t\t\t\t\t\t\t.querySelector('[data-hs-combo-box-value]')\n\t\t\t\t\t\t\t.getAttribute('data-hs-combo-box-search-text')\n\t\t\t\t\t: null,\n\t\t\t);\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSComboBox: Function;\n\t\t$hsComboBoxCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSComboBox.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('ComboBox collection:', window.$hsComboBoxCollection);\n});\n\ndocument.addEventListener('scroll', () => {\n\tif (!window.$hsComboBoxCollection) return false;\n\n\tconst target = window.$hsComboBoxCollection.find((el) => el.element.isOpened);\n\n\tif (target && !target.element.preventAutoPosition)\n\t\ttarget.element.recalculateDirection();\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSComboBox = HSComboBox;\n}\n\nexport default HSComboBox;\n","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}","import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}","import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n });\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref) {\n var name = _ref.name,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n effect = _ref.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","/*\n * HSDropdown\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport {\n\tgetClassProperty,\n\tgetClassPropertyAlt,\n\tisIOS,\n\tisIpadOS,\n\tdispatch,\n\tafterTransition,\n\tmenuSearchHistory,\n} from '../../utils';\nimport { IMenuSearchHistory } from '../../utils/interfaces';\n\nimport { createPopper, PositioningStrategy } from '@popperjs/core';\n\nimport { IDropdown, IHTMLElementPopper } from './interfaces';\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nimport { POSITIONS, DROPDOWN_ACCESSIBILITY_KEY_SET } from '../../constants';\n\nclass HSDropdown\n\textends HSBasePlugin<{}, IHTMLElementPopper>\n\timplements IDropdown\n{\n\tprivate static history: IMenuSearchHistory;\n\tprivate readonly toggle: HTMLElement | null;\n\tprivate readonly closers: HTMLElement[] | null;\n\tpublic menu: HTMLElement | null;\n\tprivate eventMode: string;\n\tprivate closeMode: string;\n\tprivate animationInProcess: boolean;\n\n\tconstructor(el: IHTMLElementPopper, options?: {}, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tthis.toggle =\n\t\t\tthis.el.querySelector(':scope > .hs-dropdown-toggle') ||\n\t\t\tthis.el.querySelector(\n\t\t\t\t':scope > .hs-dropdown-toggle-wrapper > .hs-dropdown-toggle',\n\t\t\t) ||\n\t\t\t(this.el.children[0] as HTMLElement);\n\t\tthis.closers =\n\t\t\tArray.from(this.el.querySelectorAll(':scope .hs-dropdown-close')) || null;\n\t\tthis.menu = this.el.querySelector(':scope > .hs-dropdown-menu');\n\t\tthis.eventMode = getClassProperty(this.el, '--trigger', 'click');\n\t\tthis.closeMode = getClassProperty(this.el, '--auto-close', 'true');\n\t\tthis.animationInProcess = false;\n\n\t\tif (this.toggle && this.menu) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsDropdownCollection, this);\n\n\t\tif ((this.toggle as HTMLButtonElement).disabled) return false;\n\n\t\tif (this.toggle) this.buildToggle();\n\t\tif (this.menu) this.buildMenu();\n\t\tif (this.closers) this.buildClosers();\n\n\t\tif (!isIOS() && !isIpadOS()) {\n\t\t\tthis.el.addEventListener('mouseenter', () => this.onMouseEnterHandler());\n\t\t\tthis.el.addEventListener('mouseleave', () => this.onMouseLeaveHandler());\n\t\t}\n\t}\n\n\tresizeHandler() {\n\t\tthis.eventMode = getClassProperty(this.el, '--trigger', 'click');\n\t\tthis.closeMode = getClassProperty(this.el, '--auto-close', 'true');\n\t}\n\n\tprivate buildToggle() {\n\t\tif (this?.toggle?.ariaExpanded) {\n\t\t\tif (this.el.classList.contains('open')) this.toggle.ariaExpanded = 'true';\n\t\t\telse this.toggle.ariaExpanded = 'false';\n\t\t}\n\n\t\tthis.toggle.addEventListener('click', (evt) => this.onClickHandler(evt));\n\t}\n\n\tprivate buildMenu() {\n\t\tthis.menu.role = 'menu';\n\t}\n\n\tprivate buildClosers() {\n\t\tthis.closers.forEach((el: HTMLButtonElement) => {\n\t\t\tel.addEventListener('click', () => this.close());\n\t\t});\n\t}\n\n\tprivate onClickHandler(evt: Event) {\n\t\tif (\n\t\t\tthis.el.classList.contains('open') &&\n\t\t\t!this.menu.classList.contains('hidden')\n\t\t) {\n\t\t\tthis.close();\n\t\t} else {\n\t\t\tthis.open();\n\t\t}\n\t}\n\n\tprivate onMouseEnterHandler() {\n\t\tif (this.eventMode !== 'hover') return false;\n\n\t\tif (this.el._popper) this.forceClearState();\n\n\t\tif (\n\t\t\t!this.el.classList.contains('open') &&\n\t\t\tthis.menu.classList.contains('hidden')\n\t\t) {\n\t\t\tthis.open();\n\t\t}\n\t}\n\n\tprivate onMouseLeaveHandler() {\n\t\tif (this.eventMode !== 'hover') return false;\n\n\t\tif (\n\t\t\tthis.el.classList.contains('open') &&\n\t\t\t!this.menu.classList.contains('hidden')\n\t\t) {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\tprivate destroyPopper() {\n\t\tthis.menu.classList.remove('block');\n\t\tthis.menu.classList.add('hidden');\n\n\t\tthis.menu.style.inset = null;\n\t\tthis.menu.style.position = null;\n\n\t\tif (this.el && this.el._popper) this.el._popper.destroy();\n\n\t\tthis.animationInProcess = false;\n\t}\n\n\tprivate absoluteStrategyModifiers() {\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'applyStyles',\n\t\t\t\tfn: (data: any) => {\n\t\t\t\t\tconst strategy = (\n\t\t\t\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--strategy') ||\n\t\t\t\t\t\t'absolute'\n\t\t\t\t\t).replace(' ', '');\n\t\t\t\t\tconst adaptive = (\n\t\t\t\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--adaptive') ||\n\t\t\t\t\t\t'adaptive'\n\t\t\t\t\t).replace(' ', '');\n\n\t\t\t\t\tdata.state.elements.popper.style.position = strategy;\n\t\t\t\t\tdata.state.elements.popper.style.transform =\n\t\t\t\t\t\tadaptive === 'adaptive' ? data.state.styles.popper.transform : null;\n\t\t\t\t\tdata.state.elements.popper.style.top = null;\n\t\t\t\t\tdata.state.elements.popper.style.bottom = null;\n\t\t\t\t\tdata.state.elements.popper.style.left = null;\n\t\t\t\t\tdata.state.elements.popper.style.right = null;\n\t\t\t\t\tdata.state.elements.popper.style.margin = 0;\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t// Public methods\n\tpublic open() {\n\t\tif (this.el.classList.contains('open')) return false;\n\n\t\tif (this.animationInProcess) return false;\n\n\t\tthis.animationInProcess = true;\n\n\t\tconst placement = (\n\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--placement') || ''\n\t\t).replace(' ', '');\n\t\tconst flip = (\n\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--flip') || 'true'\n\t\t).replace(' ', '');\n\t\tconst strategy = (\n\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--strategy') || 'fixed'\n\t\t).replace(' ', '') as PositioningStrategy;\n\t\tconst offset = parseInt(\n\t\t\t(\n\t\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--offset') || '10'\n\t\t\t).replace(' ', ''),\n\t\t);\n\t\tconst gpuAcceleration = (\n\t\t\twindow.getComputedStyle(this.el).getPropertyValue('--gpu-acceleration') ||\n\t\t\t'true'\n\t\t).replace(' ', '');\n\n\t\tif (strategy !== ('static' as PositioningStrategy)) {\n\t\t\tthis.el._popper = createPopper(this.el, this.menu, {\n\t\t\t\tplacement: POSITIONS[placement] || 'bottom-start',\n\t\t\t\tstrategy: strategy,\n\t\t\t\tmodifiers: [\n\t\t\t\t\t...(strategy !== 'fixed' ? this.absoluteStrategyModifiers() : []),\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'flip',\n\t\t\t\t\t\tenabled: flip === 'true',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'offset',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\toffset: [0, offset],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'computeStyles',\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tadaptive: strategy !== 'fixed' ? false : true,\n\t\t\t\t\t\t\tgpuAcceleration: gpuAcceleration === 'true' ? true : false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\n\t\tthis.menu.style.margin = null;\n\n\t\tthis.menu.classList.remove('hidden');\n\t\tthis.menu.classList.add('block');\n\n\t\tsetTimeout(() => {\n\t\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'true';\n\t\t\tthis.el.classList.add('open');\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\n\t\tthis.fireEvent('open', this.el);\n\t\tdispatch('open.hs.dropdown', this.el, this.el);\n\t}\n\n\tpublic close(isAnimated = true) {\n\t\tif (this.animationInProcess || !this.el.classList.contains('open'))\n\t\t\treturn false;\n\n\t\tconst clearAfterClose = () => {\n\t\t\tthis.menu.style.margin = null;\n\n\t\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'false';\n\t\t\tthis.el.classList.remove('open');\n\n\t\t\tthis.fireEvent('close', this.el);\n\t\t\tdispatch('close.hs.dropdown', this.el, this.el);\n\t\t};\n\n\t\tthis.animationInProcess = true;\n\n\t\tif (isAnimated) {\n\t\t\tconst el: HTMLElement =\n\t\t\t\tthis.el.querySelector('[data-hs-dropdown-transition]') || this.menu;\n\n\t\t\tafterTransition(el, () => this.destroyPopper());\n\t\t} else this.destroyPopper();\n\n\t\tclearAfterClose();\n\t}\n\n\tpublic forceClearState() {\n\t\tthis.destroyPopper();\n\t\tthis.menu.style.margin = null;\n\t\tthis.el.classList.remove('open');\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsDropdownCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsDropdownCollection) window.$hsDropdownCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('.hs-dropdown:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: IHTMLElementPopper) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsDropdownCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSDropdown(el);\n\t\t\t});\n\n\t\tif (window.$hsDropdownCollection) {\n\t\t\tdocument.addEventListener('keydown', (evt) =>\n\t\t\t\tHSDropdown.accessibility(evt),\n\t\t\t);\n\n\t\t\twindow.addEventListener('click', (evt) => {\n\t\t\t\tconst evtTarget = evt.target;\n\n\t\t\t\tHSDropdown.closeCurrentlyOpened(evtTarget as HTMLElement);\n\t\t\t});\n\n\t\t\tlet prevWidth = window.innerWidth;\n\t\t\twindow.addEventListener('resize', () => {\n\t\t\t\tif (window.innerWidth !== prevWidth) {\n\t\t\t\t\tprevWidth = innerWidth;\n\t\t\t\t\tHSDropdown.closeCurrentlyOpened(null, false);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tstatic open(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsDropdownCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\telInCollection.element.menu.classList.contains('hidden')\n\t\t)\n\t\t\telInCollection.element.open();\n\t}\n\n\tstatic close(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsDropdownCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\t!elInCollection.element.menu.classList.contains('hidden')\n\t\t) {\n\t\t\telInCollection.element.close();\n\t\t}\n\t}\n\n\t// Accessibility methods\n\tstatic accessibility(evt: KeyboardEvent) {\n\t\tthis.history = menuSearchHistory;\n\n\t\tconst target: ICollectionItem | null =\n\t\t\twindow.$hsDropdownCollection.find((el) =>\n\t\t\t\tel.element.el.classList.contains('open'),\n\t\t\t);\n\n\t\tif (\n\t\t\ttarget &&\n\t\t\t(DROPDOWN_ACCESSIBILITY_KEY_SET.includes(evt.code) ||\n\t\t\t\t(evt.code.length === 4 &&\n\t\t\t\t\tevt.code[evt.code.length - 1].match(/^[A-Z]*$/))) &&\n\t\t\t!evt.metaKey &&\n\t\t\t!target.element.menu.querySelector('input:focus') &&\n\t\t\t!target.element.menu.querySelector('textarea:focus')\n\t\t) {\n\t\t\tswitch (evt.code) {\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tif (!target.element.menu.querySelector('.hs-select.active')) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tthis.onEscape(evt);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tif (\n\t\t\t\t\t\t!target.element.menu.querySelector('.hs-select button:focus') &&\n\t\t\t\t\t\t!target.element.menu.querySelector('.hs-collapse-toggle:focus')\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.onEnter(evt);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onArrow();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onArrow(false);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Home':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onStartEnd();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'End':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onStartEnd(false);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tthis.onFirstLetter(evt.key);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic onEscape(evt: KeyboardEvent) {\n\t\tconst dropdown = (evt.target as HTMLElement).closest('.hs-dropdown.open');\n\n\t\tif (window.$hsDropdownCollection.find((el) => el.element.el === dropdown)) {\n\t\t\tconst target = window.$hsDropdownCollection.find(\n\t\t\t\t(el) => el.element.el === dropdown,\n\t\t\t);\n\n\t\t\tif (target) {\n\t\t\t\ttarget.element.close();\n\t\t\t\ttarget.element.toggle.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.closeCurrentlyOpened();\n\t\t}\n\t}\n\n\tstatic onEnter(evt: KeyboardEvent) {\n\t\tconst dropdown = (evt.target as HTMLElement).parentElement;\n\n\t\tif (window.$hsDropdownCollection.find((el) => el.element.el === dropdown)) {\n\t\t\tevt.preventDefault();\n\n\t\t\tconst target = window.$hsDropdownCollection.find(\n\t\t\t\t(el) => el.element.el === dropdown,\n\t\t\t);\n\n\t\t\tif (target) target.element.open();\n\t\t}\n\t}\n\n\tstatic onArrow(isArrowUp = true) {\n\t\tconst target = window.$hsDropdownCollection.find((el) =>\n\t\t\tel.element.el.classList.contains('open'),\n\t\t);\n\n\t\tif (target) {\n\t\t\tconst menu = target.element.menu;\n\n\t\t\tif (!menu) return false;\n\n\t\t\tconst preparedLinks = isArrowUp\n\t\t\t\t? Array.from(\n\t\t\t\t\t\tmenu.querySelectorAll(\n\t\t\t\t\t\t\t'a:not([hidden]), .hs-dropdown > button:not([hidden])',\n\t\t\t\t\t\t),\n\t\t\t\t\t).reverse()\n\t\t\t\t: Array.from(\n\t\t\t\t\t\tmenu.querySelectorAll(\n\t\t\t\t\t\t\t'a:not([hidden]), .hs-dropdown > button:not([hidden])',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\tconst links = preparedLinks.filter(\n\t\t\t\t(el: any) => !el.classList.contains('disabled'),\n\t\t\t);\n\t\t\tconst current = menu.querySelector('a:focus, button:focus');\n\t\t\tlet currentInd = links.findIndex((el: any) => el === current);\n\n\t\t\tif (currentInd + 1 < links.length) {\n\t\t\t\tcurrentInd++;\n\t\t\t}\n\n\t\t\t(links[currentInd] as HTMLButtonElement | HTMLAnchorElement).focus();\n\t\t}\n\t}\n\n\tstatic onStartEnd(isStart = true) {\n\t\tconst target = window.$hsDropdownCollection.find((el) =>\n\t\t\tel.element.el.classList.contains('open'),\n\t\t);\n\n\t\tif (target) {\n\t\t\tconst menu = target.element.menu;\n\n\t\t\tif (!menu) return false;\n\n\t\t\tconst preparedLinks = isStart\n\t\t\t\t? Array.from(menu.querySelectorAll('a'))\n\t\t\t\t: Array.from(menu.querySelectorAll('a')).reverse();\n\t\t\tconst links = preparedLinks.filter(\n\t\t\t\t(el: any) => !el.classList.contains('disabled'),\n\t\t\t);\n\n\t\t\tif (links.length) {\n\t\t\t\tlinks[0].focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic onFirstLetter(code: string) {\n\t\tconst target = window.$hsDropdownCollection.find((el) =>\n\t\t\tel.element.el.classList.contains('open'),\n\t\t);\n\n\t\tif (target) {\n\t\t\tconst menu = target.element.menu;\n\n\t\t\tif (!menu) return false;\n\n\t\t\tconst links = Array.from(menu.querySelectorAll('a'));\n\t\t\tconst getCurrentInd = () =>\n\t\t\t\tlinks.findIndex(\n\t\t\t\t\t(el, i) =>\n\t\t\t\t\t\tel.innerText.toLowerCase().charAt(0) === code.toLowerCase() &&\n\t\t\t\t\t\tthis.history.existsInHistory(i),\n\t\t\t\t);\n\t\t\tlet currentInd = getCurrentInd();\n\n\t\t\tif (currentInd === -1) {\n\t\t\t\tthis.history.clearHistory();\n\t\t\t\tcurrentInd = getCurrentInd();\n\t\t\t}\n\n\t\t\tif (currentInd !== -1) {\n\t\t\t\tlinks[currentInd].focus();\n\t\t\t\tthis.history.addHistory(currentInd);\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic closeCurrentlyOpened(\n\t\tevtTarget: HTMLElement | null = null,\n\t\tisAnimated = true,\n\t) {\n\t\tconst parent =\n\t\t\tevtTarget &&\n\t\t\tevtTarget.closest('.hs-dropdown') &&\n\t\t\tevtTarget.closest('.hs-dropdown').parentElement.closest('.hs-dropdown')\n\t\t\t\t? evtTarget\n\t\t\t\t\t\t.closest('.hs-dropdown')\n\t\t\t\t\t\t.parentElement.closest('.hs-dropdown')\n\t\t\t\t: null;\n\t\tlet currentlyOpened = parent\n\t\t\t? window.$hsDropdownCollection.filter(\n\t\t\t\t\t(el) =>\n\t\t\t\t\t\tel.element.el.classList.contains('open') &&\n\t\t\t\t\t\tel.element.menu\n\t\t\t\t\t\t\t.closest('.hs-dropdown')\n\t\t\t\t\t\t\t.parentElement.closest('.hs-dropdown') === parent,\n\t\t\t\t)\n\t\t\t: window.$hsDropdownCollection.filter((el) =>\n\t\t\t\t\tel.element.el.classList.contains('open'),\n\t\t\t\t);\n\n\t\tif (\n\t\t\tevtTarget &&\n\t\t\tevtTarget.closest('.hs-dropdown') &&\n\t\t\tgetClassPropertyAlt(evtTarget.closest('.hs-dropdown'), '--auto-close') ===\n\t\t\t\t'inside'\n\t\t) {\n\t\t\tcurrentlyOpened = currentlyOpened.filter(\n\t\t\t\t(el) => el.element.el !== evtTarget.closest('.hs-dropdown'),\n\t\t\t);\n\t\t}\n\n\t\tif (currentlyOpened) {\n\t\t\tcurrentlyOpened.forEach((el) => {\n\t\t\t\tif (\n\t\t\t\t\tel.element.closeMode === 'false' ||\n\t\t\t\t\tel.element.closeMode === 'outside'\n\t\t\t\t)\n\t\t\t\t\treturn false;\n\n\t\t\t\tel.element.close(isAnimated);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Backward compatibility\n\tstatic on(evt: string, target: HTMLElement, cb: Function) {\n\t\tconst elInCollection = window.$hsDropdownCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.events[evt] = cb;\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSDropdown: Function;\n\t\t$hsDropdownCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSDropdown.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Dropdown collection:', window.$hsDropdownCollection);\n});\n\nwindow.addEventListener('resize', () => {\n\tif (!window.$hsDropdownCollection) window.$hsDropdownCollection = [];\n\n\twindow.$hsDropdownCollection.forEach((el) => el.element.resizeHandler());\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSDropdown = HSDropdown;\n}\n\nexport default HSDropdown;\n","/*\n * HSInputNumber\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch } from '../../utils';\n\nimport { IInputNumberOptions, IInputNumber } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\n\nclass HSInputNumber\n\textends HSBasePlugin\n\timplements IInputNumber\n{\n\tprivate readonly input: HTMLInputElement | null;\n\tprivate readonly increment: HTMLElement | null;\n\tprivate readonly decrement: HTMLElement | null;\n\tprivate inputValue: number | null;\n\tprivate readonly minInputValue: number | null;\n\tprivate readonly maxInputValue: number | null;\n\tprivate readonly step: number;\n\n\tconstructor(el: HTMLElement, options?: IInputNumberOptions) {\n\t\tsuper(el, options);\n\n\t\tthis.input = this.el.querySelector('[data-hs-input-number-input]') || null;\n\t\tthis.increment =\n\t\t\tthis.el.querySelector('[data-hs-input-number-increment]') || null;\n\t\tthis.decrement =\n\t\t\tthis.el.querySelector('[data-hs-input-number-decrement]') || null;\n\n\t\tif (this.input) this.checkIsNumberAndConvert();\n\n\t\tconst data = this.el.dataset.hsInputNumber;\n\t\tconst dataOptions: IInputNumberOptions = data\n\t\t\t? JSON.parse(data)\n\t\t\t: { step: 1 };\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.minInputValue = 'min' in concatOptions ? concatOptions.min : 0;\n\t\tthis.maxInputValue = 'max' in concatOptions ? concatOptions.max : null;\n\t\tthis.step =\n\t\t\t'step' in concatOptions && concatOptions.step > 0\n\t\t\t\t? concatOptions.step\n\t\t\t\t: 1;\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsInputNumberCollection, this);\n\n\t\tif (this.input && this.increment) this.build();\n\t}\n\n\tprivate checkIsNumberAndConvert() {\n\t\tconst value = this.input.value.trim();\n\t\tconst cleanedValue = this.cleanAndExtractNumber(value);\n\n\t\tif (cleanedValue !== null) {\n\t\t\tthis.inputValue = cleanedValue;\n\t\t\tthis.input.value = cleanedValue.toString();\n\t\t} else {\n\t\t\tthis.inputValue = 0;\n\t\t\tthis.input.value = '0';\n\t\t}\n\t}\n\n\tprivate cleanAndExtractNumber(value: string): number | null {\n\t\tconst cleanedArray: string[] = [];\n\t\tlet decimalFound = false;\n\n\t\tvalue.split('').forEach((char) => {\n\t\t\tif (char >= '0' && char <= '9') cleanedArray.push(char);\n\t\t\telse if (char === '.' && !decimalFound) {\n\t\t\t\tcleanedArray.push(char);\n\t\t\t\tdecimalFound = true;\n\t\t\t}\n\t\t});\n\n\t\tconst cleanedValue = cleanedArray.join('');\n\t\tconst number = parseFloat(cleanedValue);\n\n\t\treturn isNaN(number) ? null : number;\n\t}\n\n\tprivate build() {\n\t\tif (this.input) this.buildInput();\n\t\tif (this.increment) this.buildIncrement();\n\t\tif (this.decrement) this.buildDecrement();\n\n\t\tif (this.inputValue <= 0 && this.minInputValue === 0) {\n\t\t\tthis.inputValue = 0;\n\t\t\tthis.input.value = '0';\n\t\t}\n\n\t\tif (this.inputValue <= 0 || this.minInputValue < 0) this.changeValue();\n\n\t\tif (this.input.hasAttribute('disabled')) this.disableButtons();\n\t}\n\n\tprivate buildInput() {\n\t\tthis.input.addEventListener('input', () => this.changeValue());\n\t}\n\n\tprivate buildIncrement() {\n\t\tthis.increment.addEventListener('click', () => {\n\t\t\tthis.changeValue('increment');\n\t\t});\n\t}\n\n\tprivate buildDecrement() {\n\t\tthis.decrement.addEventListener('click', () => {\n\t\t\tthis.changeValue('decrement');\n\t\t});\n\t}\n\n\tprivate changeValue(event = 'none') {\n\t\tconst payload = { inputValue: this.inputValue };\n\t\tconst minInputValue = this.minInputValue ?? Number.MIN_SAFE_INTEGER;\n\t\tconst maxInputValue = this.maxInputValue ?? Number.MAX_SAFE_INTEGER;\n\n\t\tthis.inputValue = isNaN(this.inputValue) ? 0 : this.inputValue;\n\n\t\tswitch (event) {\n\t\t\tcase 'increment':\n\t\t\t\tconst incrementedResult = this.inputValue + this.step;\n\t\t\t\tthis.inputValue =\n\t\t\t\t\tincrementedResult >= minInputValue &&\n\t\t\t\t\tincrementedResult <= maxInputValue\n\t\t\t\t\t\t? incrementedResult\n\t\t\t\t\t\t: maxInputValue;\n\t\t\t\tthis.input.value = this.inputValue.toString();\n\t\t\t\tbreak;\n\t\t\tcase 'decrement':\n\t\t\t\tconst decrementedResult = this.inputValue - this.step;\n\t\t\t\tthis.inputValue =\n\t\t\t\t\tdecrementedResult >= minInputValue &&\n\t\t\t\t\tdecrementedResult <= maxInputValue\n\t\t\t\t\t\t? decrementedResult\n\t\t\t\t\t\t: minInputValue;\n\t\t\t\tthis.input.value = this.inputValue.toString();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconst defaultResult = isNaN(parseInt(this.input.value))\n\t\t\t\t\t? 0\n\t\t\t\t\t: parseInt(this.input.value);\n\t\t\t\tthis.inputValue =\n\t\t\t\t\tdefaultResult >= maxInputValue\n\t\t\t\t\t\t? maxInputValue\n\t\t\t\t\t\t: defaultResult <= minInputValue\n\t\t\t\t\t\t\t? minInputValue\n\t\t\t\t\t\t\t: defaultResult;\n\t\t\t\tif (this.inputValue <= minInputValue)\n\t\t\t\t\tthis.input.value = this.inputValue.toString();\n\t\t\t\tbreak;\n\t\t}\n\n\t\tpayload.inputValue = this.inputValue;\n\n\t\tif (this.inputValue === minInputValue) {\n\t\t\tthis.el.classList.add('disabled');\n\t\t\tif (this.decrement) this.disableButtons('decrement');\n\t\t} else {\n\t\t\tthis.el.classList.remove('disabled');\n\t\t\tif (this.decrement) this.enableButtons('decrement');\n\t\t}\n\t\tif (this.inputValue === maxInputValue) {\n\t\t\tthis.el.classList.add('disabled');\n\t\t\tif (this.increment) this.disableButtons('increment');\n\t\t} else {\n\t\t\tthis.el.classList.remove('disabled');\n\t\t\tif (this.increment) this.enableButtons('increment');\n\t\t}\n\n\t\tthis.fireEvent('change', payload);\n\t\tdispatch('change.hs.inputNumber', this.el, payload);\n\t}\n\n\tprivate disableButtons(mode = 'all') {\n\t\tif (mode === 'all') {\n\t\t\tif (\n\t\t\t\tthis.increment.tagName === 'BUTTON' ||\n\t\t\t\tthis.increment.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.increment.setAttribute('disabled', 'disabled');\n\t\t\tif (\n\t\t\t\tthis.decrement.tagName === 'BUTTON' ||\n\t\t\t\tthis.decrement.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.decrement.setAttribute('disabled', 'disabled');\n\t\t} else if (mode === 'increment') {\n\t\t\tif (\n\t\t\t\tthis.increment.tagName === 'BUTTON' ||\n\t\t\t\tthis.increment.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.increment.setAttribute('disabled', 'disabled');\n\t\t} else if (mode === 'decrement') {\n\t\t\tif (\n\t\t\t\tthis.decrement.tagName === 'BUTTON' ||\n\t\t\t\tthis.decrement.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.decrement.setAttribute('disabled', 'disabled');\n\t\t}\n\t}\n\n\tprivate enableButtons(mode = 'all') {\n\t\tif (mode === 'all') {\n\t\t\tif (\n\t\t\t\tthis.increment.tagName === 'BUTTON' ||\n\t\t\t\tthis.increment.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.increment.removeAttribute('disabled');\n\t\t\tif (\n\t\t\t\tthis.decrement.tagName === 'BUTTON' ||\n\t\t\t\tthis.decrement.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.decrement.removeAttribute('disabled');\n\t\t} else if (mode === 'increment') {\n\t\t\tif (\n\t\t\t\tthis.increment.tagName === 'BUTTON' ||\n\t\t\t\tthis.increment.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.increment.removeAttribute('disabled');\n\t\t} else if (mode === 'decrement') {\n\t\t\tif (\n\t\t\t\tthis.decrement.tagName === 'BUTTON' ||\n\t\t\t\tthis.decrement.tagName === 'INPUT'\n\t\t\t)\n\t\t\t\tthis.decrement.removeAttribute('disabled');\n\t\t}\n\t}\n\n\t// Global method\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsInputNumberCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsInputNumberCollection) window.$hsInputNumberCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-input-number]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsInputNumberCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSInputNumber(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSInputNumber: Function;\n\t\t$hsInputNumberCollection: {\n\t\t\tid: number;\n\t\t\telement: HSInputNumber;\n\t\t}[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSInputNumber.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Input number collection:', window.$hsInputNumberCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSInputNumber = HSInputNumber;\n}\n\nexport default HSInputNumber;\n","/*\n * HSOverlay\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport {\n\tstringToBoolean,\n\tgetClassProperty,\n\tisParentOrElementHidden,\n\tdispatch,\n\tafterTransition,\n} from '../../utils';\n\nimport { IOverlayOptions, IOverlay } from './interfaces';\nimport { ICollectionItem } from '../../interfaces';\nimport { BREAKPOINTS } from '../../constants';\n\nimport HSBasePlugin from '../base-plugin';\n\nclass HSOverlay extends HSBasePlugin<{}> implements IOverlay {\n\tprivate readonly hiddenClass: string | null;\n\tprivate readonly emulateScrollbarSpace: boolean;\n\tprivate readonly isClosePrev: boolean;\n\tprivate readonly backdropClasses: string | null;\n\tprivate readonly backdropExtraClasses: string | null;\n\tprivate readonly animationTarget: HTMLElement | null;\n\n\tprivate openNextOverlay: boolean;\n\tprivate autoHide: ReturnType | null;\n\tprivate readonly overlayId: string | null;\n\n\tpublic overlay: HTMLElement | null;\n\tpublic isCloseWhenClickInside: boolean;\n\tpublic isTabAccessibilityLimited: boolean;\n\tpublic isLayoutAffect: boolean;\n\tpublic hasAutofocus: boolean;\n\tpublic hasAbilityToCloseOnBackdropClick: boolean;\n\tpublic openedBreakpoint: number | null;\n\tpublic autoClose: number | null;\n\n\tconstructor(el: HTMLElement, options?: IOverlayOptions, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tconst data = el.getAttribute('data-hs-overlay-options');\n\t\tconst dataOptions: IOverlayOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.hiddenClass = concatOptions?.hiddenClass || 'hidden';\n\t\tthis.emulateScrollbarSpace = concatOptions?.emulateScrollbarSpace || false;\n\t\tthis.isClosePrev = concatOptions?.isClosePrev ?? true;\n\t\tthis.backdropClasses =\n\t\t\tconcatOptions?.backdropClasses ??\n\t\t\t'hs-overlay-backdrop transition duration fixed inset-0 bg-gray-900 bg-opacity-50 dark:bg-opacity-80 dark:bg-neutral-900';\n\t\tthis.backdropExtraClasses = concatOptions?.backdropExtraClasses ?? '';\n\n\t\tthis.openNextOverlay = false;\n\t\tthis.autoHide = null;\n\t\tthis.overlayId = this.el.getAttribute('data-hs-overlay');\n\t\tthis.overlay = document.querySelector(this.overlayId);\n\t\tif (this.overlay) {\n\t\t\tthis.isCloseWhenClickInside = stringToBoolean(\n\t\t\t\tgetClassProperty(this.overlay, '--close-when-click-inside', 'false') ||\n\t\t\t\t\t'false',\n\t\t\t);\n\t\t\tthis.isTabAccessibilityLimited = stringToBoolean(\n\t\t\t\tgetClassProperty(this.overlay, '--tab-accessibility-limited', 'true') ||\n\t\t\t\t\t'true',\n\t\t\t);\n\t\t\tthis.isLayoutAffect = stringToBoolean(\n\t\t\t\tgetClassProperty(this.overlay, '--is-layout-affect', 'false') ||\n\t\t\t\t\t'false',\n\t\t\t);\n\t\t\tthis.hasAutofocus = stringToBoolean(\n\t\t\t\tgetClassProperty(this.overlay, '--has-autofocus', 'true') || 'true',\n\t\t\t);\n\t\t\tthis.hasAbilityToCloseOnBackdropClick = stringToBoolean(\n\t\t\t\tthis.overlay.getAttribute('data-hs-overlay-keyboard') || 'true',\n\t\t\t);\n\n\t\t\tconst autoCloseBreakpoint = getClassProperty(\n\t\t\t\tthis.overlay,\n\t\t\t\t'--auto-close',\n\t\t\t);\n\t\t\tthis.autoClose =\n\t\t\t\t!isNaN(+autoCloseBreakpoint) && isFinite(+autoCloseBreakpoint)\n\t\t\t\t\t? +autoCloseBreakpoint\n\t\t\t\t\t: BREAKPOINTS[autoCloseBreakpoint] || null;\n\n\t\t\tconst openedBreakpoint = getClassProperty(this.overlay, '--opened');\n\t\t\tthis.openedBreakpoint =\n\t\t\t\t(!isNaN(+openedBreakpoint) && isFinite(+openedBreakpoint)\n\t\t\t\t\t? +openedBreakpoint\n\t\t\t\t\t: BREAKPOINTS[openedBreakpoint]) || null;\n\t\t}\n\n\t\tthis.animationTarget =\n\t\t\tthis?.overlay?.querySelector('.hs-overlay-animation-target') ||\n\t\t\tthis.overlay;\n\n\t\tif (this.overlay) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsOverlayCollection, this);\n\n\t\tif (this.isLayoutAffect && this.openedBreakpoint) {\n\t\t\tconst instance = HSOverlay.getInstance(this.el, true);\n\n\t\t\tHSOverlay.setOpened(\n\t\t\t\tthis.openedBreakpoint,\n\t\t\t\tinstance as ICollectionItem,\n\t\t\t);\n\t\t}\n\n\t\tif (this?.el?.ariaExpanded) {\n\t\t\tif (this.overlay.classList.contains('opened'))\n\t\t\t\tthis.el.ariaExpanded = 'true';\n\t\t\telse this.el.ariaExpanded = 'false';\n\t\t}\n\n\t\tthis.el.addEventListener('click', () => {\n\t\t\tif (this.overlay.classList.contains('opened')) this.close();\n\t\t\telse this.open();\n\t\t});\n\n\t\tthis.overlay.addEventListener('click', (evt) => {\n\t\t\tif (\n\t\t\t\t(evt.target as HTMLElement).id &&\n\t\t\t\t`#${(evt.target as HTMLElement).id}` === this.overlayId &&\n\t\t\t\tthis.isCloseWhenClickInside &&\n\t\t\t\tthis.hasAbilityToCloseOnBackdropClick\n\t\t\t) {\n\t\t\t\tthis.close();\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate hideAuto() {\n\t\tconst time = parseInt(getClassProperty(this.overlay, '--auto-hide', '0'));\n\n\t\tif (time) {\n\t\t\tthis.autoHide = setTimeout(() => {\n\t\t\t\tthis.close();\n\t\t\t}, time);\n\t\t}\n\t}\n\n\tprivate checkTimer() {\n\t\tif (this.autoHide) {\n\t\t\tclearTimeout(this.autoHide);\n\n\t\t\tthis.autoHide = null;\n\t\t}\n\t}\n\n\tprivate buildBackdrop() {\n\t\tconst overlayClasses = this.overlay.classList.value.split(' ');\n\t\tconst overlayZIndex = parseInt(\n\t\t\twindow.getComputedStyle(this.overlay).getPropertyValue('z-index'),\n\t\t);\n\t\tconst backdropId =\n\t\t\tthis.overlay.getAttribute('data-hs-overlay-backdrop-container') || false;\n\t\tlet backdrop: HTMLElement | Node = document.createElement('div');\n\t\tlet backdropClasses = `${this.backdropClasses} ${this.backdropExtraClasses}`;\n\t\tconst closeOnBackdrop =\n\t\t\tgetClassProperty(this.overlay, '--overlay-backdrop', 'true') !== 'static';\n\t\tconst disableBackdrop =\n\t\t\tgetClassProperty(this.overlay, '--overlay-backdrop', 'true') === 'false';\n\n\t\t(backdrop as HTMLElement).id = `${this.overlay.id}-backdrop`;\n\t\tif ('style' in backdrop) backdrop.style.zIndex = `${overlayZIndex - 1}`;\n\n\t\tfor (const value of overlayClasses) {\n\t\t\tif (\n\t\t\t\tvalue.startsWith('hs-overlay-backdrop-open:') ||\n\t\t\t\tvalue.includes(':hs-overlay-backdrop-open:')\n\t\t\t) {\n\t\t\t\tbackdropClasses += ` ${value}`;\n\t\t\t}\n\t\t}\n\n\t\tif (disableBackdrop) return;\n\n\t\tif (backdropId) {\n\t\t\tbackdrop = document.querySelector(backdropId).cloneNode(true);\n\t\t\t(backdrop as HTMLElement).classList.remove('hidden');\n\n\t\t\tbackdropClasses = `${(backdrop as HTMLElement).classList.toString()}`;\n\t\t\t(backdrop as HTMLElement).classList.value = '';\n\t\t}\n\n\t\tif (closeOnBackdrop) {\n\t\t\t(backdrop as HTMLElement).addEventListener(\n\t\t\t\t'click',\n\t\t\t\t() => this.close(),\n\t\t\t\ttrue,\n\t\t\t);\n\t\t}\n\n\t\t(backdrop as HTMLElement).setAttribute(\n\t\t\t'data-hs-overlay-backdrop-template',\n\t\t\t'',\n\t\t);\n\n\t\tdocument.body.appendChild(backdrop);\n\n\t\tsetTimeout(() => {\n\t\t\t(backdrop as HTMLElement).classList.value = backdropClasses;\n\t\t});\n\t}\n\n\tprivate destroyBackdrop() {\n\t\tconst backdrop: HTMLElement = document.querySelector(\n\t\t\t`#${this.overlay.id}-backdrop`,\n\t\t);\n\n\t\tif (!backdrop) return;\n\n\t\tif (this.openNextOverlay) {\n\t\t\tbackdrop.style.transitionDuration = `${\n\t\t\t\tparseFloat(\n\t\t\t\t\twindow\n\t\t\t\t\t\t.getComputedStyle(backdrop)\n\t\t\t\t\t\t.transitionDuration.replace(/[^\\d.-]/g, ''),\n\t\t\t\t) * 1.8\n\t\t\t}s`;\n\t\t}\n\n\t\tbackdrop.classList.add('opacity-0');\n\n\t\tafterTransition(backdrop, () => {\n\t\t\tbackdrop.remove();\n\t\t});\n\t}\n\n\tprivate focusElement() {\n\t\tconst input: HTMLInputElement = this.overlay.querySelector('[autofocus]');\n\n\t\tif (!input) return false;\n\t\telse input.focus();\n\t}\n\n\tprivate getScrollbarSize() {\n\t\tlet div = document.createElement('div');\n\t\tdiv.style.overflow = 'scroll';\n\t\tdiv.style.width = '100px';\n\t\tdiv.style.height = '100px';\n\t\tdocument.body.appendChild(div);\n\n\t\tlet scrollbarSize = div.offsetWidth - div.clientWidth;\n\n\t\tdocument.body.removeChild(div);\n\n\t\treturn scrollbarSize;\n\t}\n\n\t// Public methods\n\tpublic open() {\n\t\tif (!this.overlay) return false;\n\n\t\tconst openedOverlays = document.querySelectorAll('.hs-overlay.open');\n\t\tconst currentlyOpened = window.$hsOverlayCollection.find(\n\t\t\t(el) =>\n\t\t\t\tArray.from(openedOverlays).includes(el.element.overlay) &&\n\t\t\t\t!el.element.isLayoutAffect,\n\t\t);\n\t\tconst toggles = document.querySelectorAll(\n\t\t\t`[data-hs-overlay=\"#${this.overlay.id}\"]`,\n\t\t);\n\t\tconst disabledScroll =\n\t\t\tgetClassProperty(this.overlay, '--body-scroll', 'false') !== 'true';\n\n\t\tif (this.isClosePrev && currentlyOpened) {\n\t\t\tthis.openNextOverlay = true;\n\n\t\t\treturn currentlyOpened.element.close().then(() => {\n\t\t\t\tthis.open();\n\n\t\t\t\tthis.openNextOverlay = false;\n\t\t\t});\n\t\t}\n\n\t\tif (disabledScroll) {\n\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\tif (this.emulateScrollbarSpace)\n\t\t\t\tdocument.body.style.paddingRight = `${this.getScrollbarSize()}px`;\n\t\t}\n\n\t\tthis.buildBackdrop();\n\t\tthis.checkTimer();\n\t\tthis.hideAuto();\n\n\t\ttoggles.forEach((toggle) => {\n\t\t\tif (toggle.ariaExpanded) toggle.ariaExpanded = 'true';\n\t\t});\n\t\tthis.overlay.classList.remove(this.hiddenClass);\n\t\tthis.overlay.setAttribute('aria-overlay', 'true');\n\t\tthis.overlay.setAttribute('tabindex', '-1');\n\n\t\tsetTimeout(() => {\n\t\t\tif (this.overlay.classList.contains('opened')) return false;\n\n\t\t\tthis.overlay.classList.add('open', 'opened');\n\t\t\tif (this.isLayoutAffect)\n\t\t\t\tdocument.body.classList.add('hs-overlay-body-open');\n\n\t\t\tthis.fireEvent('open', this.el);\n\t\t\tdispatch('open.hs.overlay', this.el, this.el);\n\n\t\t\tif (this.hasAutofocus) this.focusElement();\n\t\t}, 50);\n\t}\n\n\tpublic close(forceClose = false) {\n\t\tif (this.isLayoutAffect)\n\t\t\tdocument.body.classList.remove('hs-overlay-body-open');\n\n\t\tconst closeFn = (cb: Function) => {\n\t\t\tif (this.overlay.classList.contains('open')) return false;\n\t\t\tconst toggles = document.querySelectorAll(\n\t\t\t\t`[data-hs-overlay=\"#${this.overlay.id}\"]`,\n\t\t\t);\n\n\t\t\ttoggles.forEach((toggle) => {\n\t\t\t\tif (toggle.ariaExpanded) toggle.ariaExpanded = 'false';\n\t\t\t});\n\t\t\tthis.overlay.classList.add(this.hiddenClass);\n\n\t\t\tthis.destroyBackdrop();\n\n\t\t\tthis.fireEvent('close', this.el);\n\t\t\tdispatch('close.hs.overlay', this.el, this.el);\n\n\t\t\tif (!document.querySelector('.hs-overlay.opened')) {\n\t\t\t\tdocument.body.style.overflow = '';\n\t\t\t\tif (this.emulateScrollbarSpace) document.body.style.paddingRight = '';\n\t\t\t}\n\n\t\t\tcb(this.overlay);\n\t\t};\n\n\t\treturn new Promise((resolve) => {\n\t\t\tif (!this.overlay) return false;\n\n\t\t\tthis.overlay.classList.remove('open', 'opened');\n\t\t\tthis.overlay.removeAttribute('aria-overlay');\n\t\t\tthis.overlay.removeAttribute('tabindex');\n\n\t\t\tif (forceClose) closeFn(resolve);\n\t\t\telse afterTransition(this.animationTarget, () => closeFn(resolve));\n\t\t});\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsOverlayCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target) ||\n\t\t\t\tel.element.overlay ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsOverlayCollection) window.$hsOverlayCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-overlay]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsOverlayCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSOverlay(el);\n\t\t\t});\n\n\t\tif (window.$hsOverlayCollection) {\n\t\t\tdocument.addEventListener('keydown', (evt) =>\n\t\t\t\tHSOverlay.accessibility(evt),\n\t\t\t);\n\t\t}\n\t}\n\n\tstatic open(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsOverlayCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target) ||\n\t\t\t\tel.element.overlay ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\telInCollection.element.overlay.classList.contains(\n\t\t\t\telInCollection.element.hiddenClass,\n\t\t\t)\n\t\t)\n\t\t\telInCollection.element.open();\n\t}\n\n\tstatic close(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsOverlayCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target) ||\n\t\t\t\tel.element.overlay ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target),\n\t\t);\n\n\t\tif (\n\t\t\telInCollection &&\n\t\t\t!elInCollection.element.overlay.classList.contains(\n\t\t\t\telInCollection.element.hiddenClass,\n\t\t\t)\n\t\t)\n\t\t\telInCollection.element.close();\n\t}\n\n\tstatic setOpened(breakpoint: number, el: ICollectionItem) {\n\t\tif (document.body.clientWidth >= breakpoint) {\n\t\t\tdocument.body.classList.add('hs-overlay-body-open');\n\t\t\tel.element.overlay.classList.add('opened');\n\t\t} else el.element.close(true);\n\t}\n\n\t// Accessibility methods\n\tstatic accessibility(evt: KeyboardEvent) {\n\t\tconst targets = window.$hsOverlayCollection.filter((el) =>\n\t\t\tel.element.overlay.classList.contains('open'),\n\t\t);\n\t\tconst target = targets[targets.length - 1];\n\t\tconst focusableElements = target?.element?.overlay?.querySelectorAll(\n\t\t\t'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n\t\t);\n\t\tconst notHiddenFocusableElements: HTMLElement[] = [];\n\t\tif (focusableElements?.length)\n\t\t\tfocusableElements.forEach((el: HTMLElement) => {\n\t\t\t\tif (!isParentOrElementHidden(el)) notHiddenFocusableElements.push(el);\n\t\t\t});\n\t\tconst basicCheck = target && !evt.metaKey;\n\n\t\tif (\n\t\t\tbasicCheck &&\n\t\t\t!target.element.isTabAccessibilityLimited &&\n\t\t\tevt.code === 'Tab'\n\t\t)\n\t\t\treturn false;\n\n\t\tif (basicCheck && notHiddenFocusableElements.length && evt.code === 'Tab') {\n\t\t\tevt.preventDefault();\n\t\t\tthis.onTab(target, notHiddenFocusableElements);\n\t\t}\n\t\tif (basicCheck && evt.code === 'Escape') {\n\t\t\tevt.preventDefault();\n\t\t\tthis.onEscape(target);\n\t\t}\n\t}\n\n\tstatic onEscape(target: ICollectionItem) {\n\t\tif (target && target.element.hasAbilityToCloseOnBackdropClick)\n\t\t\ttarget.element.close();\n\t}\n\n\tstatic onTab(\n\t\ttarget: ICollectionItem,\n\t\tfocusableElements: HTMLElement[],\n\t) {\n\t\tif (!focusableElements.length) return false;\n\n\t\tconst focused = target.element.overlay.querySelector(':focus');\n\t\tconst focusedIndex = Array.from(focusableElements).indexOf(\n\t\t\tfocused as HTMLElement,\n\t\t);\n\n\t\tif (focusedIndex > -1) {\n\t\t\tconst nextIndex = (focusedIndex + 1) % focusableElements.length;\n\t\t\t(focusableElements[nextIndex] as HTMLElement).focus();\n\t\t} else {\n\t\t\t(focusableElements[0] as HTMLElement).focus();\n\t\t}\n\t}\n\n\t// Backward compatibility\n\tstatic on(evt: string, target: HTMLElement, cb: Function) {\n\t\tconst elInCollection = window.$hsOverlayCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target) ||\n\t\t\t\tel.element.overlay ===\n\t\t\t\t\t(typeof target === 'string'\n\t\t\t\t\t\t? document.querySelector(target)\n\t\t\t\t\t\t: target),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.events[evt] = cb;\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSOverlay: Function;\n\t\t$hsOverlayCollection: ICollectionItem[];\n\t}\n}\n\nconst autoCloseResizeFn = () => {\n\tif (\n\t\t!window.$hsOverlayCollection.length ||\n\t\t!window.$hsOverlayCollection.find((el) => el.element.autoClose)\n\t)\n\t\treturn false;\n\n\tconst overlays = window.$hsOverlayCollection.filter(\n\t\t(el) => el.element.autoClose,\n\t);\n\n\toverlays.forEach((overlay) => {\n\t\tif (document.body.clientWidth >= overlay.element.autoClose)\n\t\t\toverlay.element.close(true);\n\t});\n};\n\nconst setOpenedResizeFn = () => {\n\tif (\n\t\t!window.$hsOverlayCollection.length ||\n\t\t!window.$hsOverlayCollection.find((el) => el.element.autoClose)\n\t)\n\t\treturn false;\n\n\tconst overlays = window.$hsOverlayCollection.filter(\n\t\t(el) => el.element.autoClose,\n\t);\n\n\toverlays.forEach((overlay) => {\n\t\tif (document.body.clientWidth >= overlay.element.autoClose)\n\t\t\toverlay.element.close(true);\n\t});\n};\n\nconst setBackdropZIndexResizeFn = () => {\n\tif (\n\t\t!window.$hsOverlayCollection.length ||\n\t\t!window.$hsOverlayCollection.find((el) =>\n\t\t\tel.element.overlay.classList.contains('opened'),\n\t\t)\n\t)\n\t\treturn false;\n\n\tconst overlays = window.$hsOverlayCollection.filter((el) =>\n\t\tel.element.overlay.classList.contains('opened'),\n\t);\n\n\toverlays.forEach((overlay) => {\n\t\tconst overlayZIndex = parseInt(\n\t\t\twindow\n\t\t\t\t.getComputedStyle(overlay.element.overlay)\n\t\t\t\t.getPropertyValue('z-index'),\n\t\t);\n\t\tconst backdrop: HTMLElement = document.querySelector(\n\t\t\t`#${overlay.element.overlay.id}-backdrop`,\n\t\t);\n\t\tconst backdropZIndex = parseInt(\n\t\t\twindow.getComputedStyle(backdrop).getPropertyValue('z-index'),\n\t\t);\n\t\tif (overlayZIndex === backdropZIndex + 1) return false;\n\n\t\tif ('style' in backdrop) backdrop.style.zIndex = `${overlayZIndex - 1}`;\n\t\tdocument.body.classList.add('hs-overlay-body-open');\n\t});\n};\n\nwindow.addEventListener('load', () => {\n\tHSOverlay.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Overlay collection:', window.$hsOverlayCollection);\n});\n\nwindow.addEventListener('resize', () => {\n\tautoCloseResizeFn();\n\tsetOpenedResizeFn();\n\tsetBackdropZIndexResizeFn();\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSOverlay = HSOverlay;\n}\n\nexport default HSOverlay;\n","/*\n * HSPinInput\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch } from '../../utils';\n\nimport { IPinInputOptions, IPinInput } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSPinInput extends HSBasePlugin implements IPinInput {\n\tprivate items: NodeListOf | null;\n\tprivate currentItem: HTMLInputElement | null;\n\tprivate currentValue: string[] | null;\n\tprivate readonly placeholders: string[] | null;\n\tprivate readonly availableCharsRE: RegExp | null;\n\n\tconstructor(el: HTMLElement, options?: IPinInputOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-pin-input');\n\t\tconst dataOptions: IPinInputOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.items = this.el.querySelectorAll('[data-hs-pin-input-item]');\n\t\tthis.currentItem = null;\n\t\tthis.currentValue = new Array(this.items.length).fill('');\n\t\tthis.placeholders = [];\n\t\tthis.availableCharsRE = new RegExp(\n\t\t\tconcatOptions?.availableCharsRE || '^[a-zA-Z0-9]+$',\n\t\t); // '^[0-9]+$'\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsPinInputCollection, this);\n\n\t\tif (this.items.length) this.build();\n\t}\n\n\tprivate build() {\n\t\tthis.buildInputItems();\n\t}\n\n\tprivate buildInputItems() {\n\t\tthis.items.forEach((el, index) => {\n\t\t\tthis.placeholders.push(el.getAttribute('placeholder') || '');\n\n\t\t\tif (el.hasAttribute('autofocus')) this.onFocusIn(index);\n\n\t\t\tel.addEventListener('input', (evt) => this.onInput(evt, index));\n\t\t\tel.addEventListener('paste', (evt) => this.onPaste(evt));\n\t\t\tel.addEventListener('keydown', (evt) => this.onKeydown(evt, index));\n\t\t\tel.addEventListener('focusin', () => this.onFocusIn(index));\n\t\t\tel.addEventListener('focusout', () => this.onFocusOut(index));\n\t\t});\n\t}\n\n\tprivate checkIfNumber(value: string) {\n\t\treturn value.match(this.availableCharsRE);\n\t}\n\n\tprivate autoFillAll(text: string) {\n\t\tArray.from(text).forEach((n, i) => {\n\t\t\tif (!this?.items[i]) return false;\n\n\t\t\t(this.items[i] as HTMLInputElement).value = n;\n\n\t\t\tthis.items[i].dispatchEvent(new Event('input', { bubbles: true }));\n\t\t});\n\t}\n\n\tprivate setCurrentValue() {\n\t\tthis.currentValue = Array.from(this.items).map(\n\t\t\t(el) => (el as HTMLInputElement).value,\n\t\t);\n\t}\n\n\tprivate toggleCompleted() {\n\t\tif (!this.currentValue.includes('')) this.el.classList.add('active');\n\t\telse this.el.classList.remove('active');\n\t}\n\n\tprivate onInput(evt: Event, index: number) {\n\t\tconst originalValue = (evt.target as HTMLInputElement).value;\n\t\tthis.currentItem = evt.target as HTMLInputElement;\n\t\tthis.currentItem.value = '';\n\t\tthis.currentItem.value = originalValue[originalValue.length - 1];\n\n\t\tif (!this.checkIfNumber(this.currentItem.value)) {\n\t\t\tthis.currentItem.value = this.currentValue[index] || '';\n\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.setCurrentValue();\n\n\t\tif (this.currentItem.value) {\n\t\t\tif (index < this.items.length - 1) this.items[index + 1].focus();\n\t\t\tif (!this.currentValue.includes('')) {\n\t\t\t\tconst payload = { currentValue: this.currentValue };\n\n\t\t\t\tthis.fireEvent('completed', payload);\n\t\t\t\tdispatch('completed.hs.pinInput', this.el, payload);\n\t\t\t}\n\n\t\t\tthis.toggleCompleted();\n\t\t} else {\n\t\t\tif (index > 0) this.items[index - 1].focus();\n\t\t}\n\t}\n\n\tprivate onKeydown(evt: KeyboardEvent, index: number) {\n\t\tif (evt.key === 'Backspace' && index > 0) {\n\t\t\tif ((this.items[index] as HTMLInputElement).value === '') {\n\t\t\t\t(this.items[index - 1] as HTMLInputElement).value = '';\n\t\t\t\t(this.items[index - 1] as HTMLInputElement).focus();\n\t\t\t} else {\n\t\t\t\t(this.items[index] as HTMLInputElement).value = '';\n\t\t\t}\n\t\t}\n\n\t\tthis.setCurrentValue();\n\t\tthis.toggleCompleted();\n\t}\n\n\tprivate onFocusIn(index: number) {\n\t\tthis.items[index].setAttribute('placeholder', '');\n\t}\n\n\tprivate onFocusOut(index: number) {\n\t\tthis.items[index].setAttribute('placeholder', this.placeholders[index]);\n\t}\n\n\tprivate onPaste(evt: ClipboardEvent) {\n\t\tevt.preventDefault();\n\n\t\tthis.items.forEach((el) => {\n\t\t\tif (document.activeElement === el)\n\t\t\t\tthis.autoFillAll(evt.clipboardData.getData('text'));\n\t\t});\n\t}\n\n\t// Static method\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsPinInputCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsPinInputCollection) window.$hsPinInputCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-pin-input]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsPinInputCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSPinInput(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSPinInput: Function;\n\t\t$hsPinInputCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSPinInput.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('PIN input collection:', window.$hsPinInputCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSPinInput = HSPinInput;\n}\n\nexport default HSPinInput;\n","/*\n * HSRemoveElement\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { afterTransition } from '../../utils';\n\nimport { IRemoveElementOptions, IRemoveElement } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSRemoveElement\n\textends HSBasePlugin\n\timplements IRemoveElement\n{\n\tprivate readonly removeTargetId: string | null;\n\tprivate readonly removeTarget: HTMLElement | null;\n\tprivate readonly removeTargetAnimationClass: string;\n\n\tconstructor(el: HTMLElement, options?: IRemoveElementOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-remove-element-options');\n\t\tconst dataOptions: IRemoveElementOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.removeTargetId = this.el.getAttribute('data-hs-remove-element');\n\t\tthis.removeTarget = document.querySelector(this.removeTargetId);\n\t\tthis.removeTargetAnimationClass =\n\t\t\tconcatOptions?.removeTargetAnimationClass || 'hs-removing';\n\n\t\tif (this.removeTarget) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsRemoveElementCollection, this);\n\n\t\tthis.el.addEventListener('click', () => this.remove());\n\t}\n\n\tprivate remove() {\n\t\tif (!this.removeTarget) return false;\n\n\t\tthis.removeTarget.classList.add(this.removeTargetAnimationClass);\n\n\t\tafterTransition(this.removeTarget, () => {\n\t\t\tthis.removeTarget.remove();\n\t\t});\n\t}\n\n\t// Static method\n\tstatic autoInit() {\n\t\tif (!window.$hsRemoveElementCollection)\n\t\t\twindow.$hsRemoveElementCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-remove-element]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsRemoveElementCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSRemoveElement(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSRemoveElement: Function;\n\t\t$hsRemoveElementCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSRemoveElement.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Remove element collection:', window.$hsRemoveElementCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSRemoveElement = HSRemoveElement;\n}\n\nexport default HSRemoveElement;\n","/*\n * HSScrollspy\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { getClassProperty, dispatch } from '../../utils';\n\nimport { IScrollspy } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSScrollspy extends HSBasePlugin<{}> implements IScrollspy {\n\tprivate activeSection: HTMLElement | null;\n\tprivate readonly contentId: string | null;\n\tprivate readonly content: HTMLElement | null;\n\tprivate readonly links: NodeListOf | null;\n\tprivate readonly sections: HTMLElement[] | null;\n\tprivate readonly scrollableId: string | null;\n\tprivate readonly scrollable: HTMLElement | Document;\n\n\tconstructor(el: HTMLElement, options = {}) {\n\t\tsuper(el, options);\n\n\t\tthis.activeSection = null;\n\t\tthis.contentId = this.el.getAttribute('data-hs-scrollspy');\n\t\tthis.content = document.querySelector(this.contentId);\n\t\tthis.links = this.el.querySelectorAll('[href]');\n\t\tthis.sections = [];\n\t\tthis.scrollableId = this.el.getAttribute(\n\t\t\t'data-hs-scrollspy-scrollable-parent',\n\t\t);\n\t\tthis.scrollable = this.scrollableId\n\t\t\t? (document.querySelector(this.scrollableId) as HTMLElement)\n\t\t\t: (document as Document);\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsScrollspyCollection, this);\n\n\t\tthis.links.forEach((el) => {\n\t\t\tthis.sections.push(\n\t\t\t\tthis.scrollable.querySelector(el.getAttribute('href')),\n\t\t\t);\n\t\t});\n\n\t\tArray.from(this.sections).forEach((section: HTMLElement) => {\n\t\t\tif (!section.getAttribute('id')) return false;\n\n\t\t\tthis.scrollable.addEventListener('scroll', (evt) =>\n\t\t\t\tthis.update(evt, section),\n\t\t\t);\n\t\t});\n\n\t\tthis.links.forEach((el) => {\n\t\t\tel.addEventListener('click', (evt) => {\n\t\t\t\tevt.preventDefault();\n\n\t\t\t\tif (el.getAttribute('href') === 'javascript:;') return false;\n\n\t\t\t\tthis.scrollTo(el);\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate update(evt: Event, section: HTMLElement) {\n\t\tconst globalOffset = parseInt(\n\t\t\tgetClassProperty(this.el, '--scrollspy-offset', '0'),\n\t\t);\n\t\tconst userOffset =\n\t\t\tparseInt(getClassProperty(section, '--scrollspy-offset')) || globalOffset;\n\t\tconst scrollableParentOffset =\n\t\t\tevt.target === document\n\t\t\t\t? 0\n\t\t\t\t: parseInt(\n\t\t\t\t\t\tString((evt.target as HTMLElement).getBoundingClientRect().top),\n\t\t\t\t\t);\n\t\tconst topOffset =\n\t\t\tparseInt(String(section.getBoundingClientRect().top)) -\n\t\t\tuserOffset -\n\t\t\tscrollableParentOffset;\n\t\tconst height = section.offsetHeight;\n\n\t\tif (topOffset <= 0 && topOffset + height > 0) {\n\t\t\tif (this.activeSection === section) return false;\n\n\t\t\tthis.links.forEach((el) => {\n\t\t\t\tel.classList.remove('active');\n\t\t\t});\n\n\t\t\tconst current = this.el.querySelector(\n\t\t\t\t`[href=\"#${section.getAttribute('id')}\"]`,\n\t\t\t);\n\n\t\t\tif (current) {\n\t\t\t\tcurrent.classList.add('active');\n\n\t\t\t\tconst group = current.closest('[data-hs-scrollspy-group]');\n\n\t\t\t\tif (group) {\n\t\t\t\t\tconst parentLink = group.querySelector('[href]');\n\n\t\t\t\t\tif (parentLink) parentLink.classList.add('active');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.activeSection = section;\n\t\t}\n\t}\n\n\tprivate scrollTo(link: HTMLAnchorElement) {\n\t\tconst targetId = link.getAttribute('href');\n\t\tconst target: HTMLElement = document.querySelector(targetId);\n\t\tconst globalOffset = parseInt(\n\t\t\tgetClassProperty(this.el, '--scrollspy-offset', '0'),\n\t\t);\n\t\tconst userOffset =\n\t\t\tparseInt(getClassProperty(target, '--scrollspy-offset')) || globalOffset;\n\t\tconst scrollableParentOffset =\n\t\t\tthis.scrollable === document\n\t\t\t\t? 0\n\t\t\t\t: (this.scrollable as HTMLElement).offsetTop;\n\t\tconst topOffset = target.offsetTop - userOffset - scrollableParentOffset;\n\t\tconst view = this.scrollable === document ? window : this.scrollable;\n\t\tconst scrollFn = () => {\n\t\t\twindow.history.replaceState(null, null, link.getAttribute('href'));\n\n\t\t\tif ('scrollTo' in view) {\n\t\t\t\tview.scrollTo({\n\t\t\t\t\ttop: topOffset,\n\t\t\t\t\tleft: 0,\n\t\t\t\t\tbehavior: 'smooth',\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tconst beforeScroll = this.fireEvent('beforeScroll', this.el);\n\t\tdispatch('beforeScroll.hs.scrollspy', this.el, this.el);\n\n\t\tif (beforeScroll instanceof Promise) beforeScroll.then(() => scrollFn());\n\t\telse scrollFn();\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement, isInstance = false) {\n\t\tconst elInCollection = window.$hsScrollspyCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsScrollspyCollection) window.$hsScrollspyCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-scrollspy]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsScrollspyCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSScrollspy(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSScrollspy: Function;\n\t\t$hsScrollspyCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSScrollspy.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Scrollspy collection:', window.$hsScrollspyCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSScrollspy = HSScrollspy;\n}\n\nexport default HSScrollspy;\n","/*\n * HSSelect\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport {\n\tisEnoughSpace,\n\tdebounce,\n\tdispatch,\n\tafterTransition,\n\thtmlToElement,\n\tclassToClassList,\n} from '../../utils';\n\nimport {\n\tISelect,\n\tISelectOptions,\n\tISingleOption,\n\tISingleOptionOptions,\n} from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nimport { SELECT_ACCESSIBILITY_KEY_SET } from '../../constants';\n\nclass HSSelect extends HSBasePlugin implements ISelect {\n\tvalue: string | string[] | null;\n\tprivate readonly placeholder: string | null;\n\tprivate readonly hasSearch: boolean;\n\tprivate readonly preventSearchFocus: boolean;\n\tprivate readonly mode: string | null;\n\tprivate readonly viewport: HTMLElement | null;\n\n\tisOpened: boolean | null;\n\tisMultiple: boolean | null;\n\tisDisabled: boolean | null;\n\tselectedItems: string[];\n\n\tprivate readonly toggleTag: string | null;\n\tprivate readonly toggleClasses: string | null;\n\tprivate readonly toggleSeparators: {\n\t\titems?: string;\n\t\tbetweenItemsAndCounter?: string;\n\t} | null;\n\tprivate readonly toggleCountText: string | null;\n\tprivate readonly toggleCountTextMinItems: number | null;\n\tprivate readonly toggleCountTextMode: string | null;\n\tprivate readonly wrapperClasses: string | null;\n\tprivate readonly tagsItemTemplate: string | null;\n\tprivate readonly tagsItemClasses: string | null;\n\tprivate readonly tagsInputClasses: string | null;\n\tprivate readonly dropdownTag: string | null;\n\tprivate readonly dropdownClasses: string | null;\n\tprivate readonly dropdownDirectionClasses: {\n\t\ttop?: string;\n\t\tbottom?: string;\n\t} | null;\n\tpublic dropdownSpace: number | null;\n\tprivate readonly searchWrapperTemplate: string | null;\n\tprivate readonly searchPlaceholder: string | null;\n\tprivate readonly searchClasses: string | null;\n\tprivate readonly searchWrapperClasses: string | null;\n\tprivate readonly searchNoResultText: string | null;\n\tprivate readonly searchNoResultClasses: string | null;\n\tprivate readonly optionTag: string | null;\n\tprivate readonly optionTemplate: string | null;\n\tprivate readonly optionClasses: string | null;\n\tprivate readonly descriptionClasses: string | null;\n\tprivate readonly iconClasses: string | null;\n\n\tprivate animationInProcess: boolean;\n\n\tprivate wrapper: HTMLElement | null;\n\tprivate toggle: HTMLElement | null;\n\tprivate toggleTextWrapper: HTMLElement | null;\n\tprivate tagsInput: HTMLElement | null;\n\tprivate dropdown: HTMLElement | null;\n\tprivate searchWrapper: HTMLElement | null;\n\tprivate search: HTMLInputElement | null;\n\tprivate searchNoResult: HTMLElement | null;\n\tprivate selectOptions: ISingleOption[] | [];\n\tprivate extraMarkup: string | string[] | null;\n\n\tprivate readonly isAddTagOnEnter: boolean;\n\n\tprivate tagsInputHelper: HTMLElement | null;\n\n\tconstructor(el: HTMLElement, options?: ISelectOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-select');\n\t\tconst dataOptions: ISelectOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\t\tconst defaultToggleSeparators = {\n\t\t\titems: ', ',\n\t\t\tbetweenItemsAndCounter: 'and',\n\t\t};\n\n\t\tthis.value =\n\t\t\tconcatOptions?.value || (this.el as HTMLSelectElement).value || null;\n\t\tthis.placeholder = concatOptions?.placeholder || 'Select...';\n\t\tthis.hasSearch = concatOptions?.hasSearch || false;\n\t\tthis.preventSearchFocus = concatOptions?.preventSearchFocus || false;\n\t\tthis.mode = concatOptions?.mode || 'default';\n\t\tthis.viewport =\n\t\t\ttypeof concatOptions?.viewport !== 'undefined'\n\t\t\t\t? document.querySelector(concatOptions?.viewport)\n\t\t\t\t: null;\n\t\tthis.isOpened = Boolean(concatOptions?.isOpened) || false;\n\t\tthis.isMultiple = this.el.hasAttribute('multiple') || false;\n\t\tthis.isDisabled = this.el.hasAttribute('disabled') || false;\n\t\tthis.selectedItems = [];\n\t\tthis.wrapperClasses = concatOptions?.wrapperClasses || null;\n\t\tthis.toggleTag = concatOptions?.toggleTag || null;\n\t\tthis.toggleClasses = concatOptions?.toggleClasses || null;\n\t\tthis.toggleSeparators =\n\t\t\t{\n\t\t\t\t...defaultToggleSeparators,\n\t\t\t\t...concatOptions?.toggleSeparators,\n\t\t\t} ?? defaultToggleSeparators;\n\t\tthis.toggleCountText = concatOptions?.toggleCountText || null;\n\t\tthis.toggleCountTextMinItems = concatOptions?.toggleCountTextMinItems || 1;\n\t\tthis.toggleCountTextMode =\n\t\t\tconcatOptions?.toggleCountTextMode || 'countAfterLimit';\n\t\tthis.tagsItemTemplate = concatOptions?.tagsItemTemplate || null;\n\t\tthis.tagsItemClasses = concatOptions?.tagsItemClasses || null;\n\t\tthis.tagsInputClasses = concatOptions?.tagsInputClasses || null;\n\t\tthis.dropdownTag = concatOptions?.dropdownTag || null;\n\t\tthis.dropdownClasses = concatOptions?.dropdownClasses || null;\n\t\tthis.dropdownDirectionClasses =\n\t\t\tconcatOptions?.dropdownDirectionClasses || null;\n\t\tthis.dropdownSpace = concatOptions?.dropdownSpace || 10;\n\t\tthis.searchWrapperTemplate = concatOptions?.searchWrapperTemplate || null;\n\t\tthis.searchWrapperClasses =\n\t\t\tconcatOptions?.searchWrapperClasses || 'bg-white p-2 sticky top-0';\n\t\tthis.searchClasses =\n\t\t\tconcatOptions?.searchClasses ||\n\t\t\t'block w-[calc(100%-2rem)] text-sm border-gray-200 rounded-md focus:border-blue-500 focus:ring-blue-500 dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 py-2 px-3 my-2 mx-4';\n\t\tthis.searchPlaceholder = concatOptions?.searchPlaceholder || 'Search...';\n\t\tthis.searchNoResultText =\n\t\t\tconcatOptions?.searchNoResultText || 'No results found';\n\t\tthis.searchNoResultClasses =\n\t\t\tconcatOptions?.searchNoResultClasses ||\n\t\t\t'px-4 text-sm text-gray-800 dark:text-neutral-200';\n\t\tthis.optionTemplate = concatOptions?.optionTemplate || null;\n\t\tthis.optionTag = concatOptions?.optionTag || null;\n\t\tthis.optionClasses = concatOptions?.optionClasses || null;\n\t\tthis.extraMarkup = concatOptions?.extraMarkup || null;\n\t\tthis.descriptionClasses = concatOptions?.descriptionClasses || null;\n\t\tthis.iconClasses = concatOptions?.iconClasses || null;\n\t\tthis.isAddTagOnEnter = concatOptions?.isAddTagOnEnter ?? true;\n\n\t\tthis.animationInProcess = false;\n\t\tthis.selectOptions = [];\n\n\t\tthis.tagsInputHelper = null;\n\n\t\tthis.init();\n\t}\n\n\tpublic setValue(val: string | string[]) {\n\t\tthis.value = val;\n\n\t\tthis.clearSelections();\n\n\t\tif (Array.isArray(val)) {\n\t\t\tthis.toggleTextWrapper.innerHTML = this.value.length\n\t\t\t\t? this.stringFromValue()\n\t\t\t\t: this.placeholder;\n\t\t\tthis.unselectMultipleItems();\n\t\t\tthis.selectMultipleItems();\n\t\t} else {\n\t\t\tthis.setToggleTitle();\n\n\t\t\tif (this.toggle.querySelector('[data-icon]')) this.setToggleIcon();\n\t\t\tif (this.toggle.querySelector('[data-title]')) this.setToggleTitle();\n\n\t\t\tthis.selectSingleItem();\n\t\t}\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsSelectCollection, this);\n\n\t\tthis.build();\n\t}\n\n\tprivate build() {\n\t\tthis.el.style.display = 'none';\n\n\t\tif (this.el.children) {\n\t\t\tArray.from(this.el.children)\n\t\t\t\t.filter((el: HTMLOptionElement) => el.value && el.value !== '')\n\t\t\t\t.forEach((el: HTMLOptionElement) => {\n\t\t\t\t\tconst data = el.getAttribute('data-hs-select-option');\n\n\t\t\t\t\tthis.selectOptions = [\n\t\t\t\t\t\t...this.selectOptions,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: el.textContent,\n\t\t\t\t\t\t\tval: el.value,\n\t\t\t\t\t\t\tdisabled: el.disabled,\n\t\t\t\t\t\t\toptions: data !== 'undefined' ? JSON.parse(data) : null,\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\t\t\t\t});\n\t\t}\n\n\t\tif (this.isMultiple) {\n\t\t\tconst selectedOptions = Array.from(this.el.children).filter(\n\t\t\t\t(el: HTMLOptionElement) => el.selected,\n\t\t\t);\n\n\t\t\tif (selectedOptions) {\n\t\t\t\tconst values: string[] = [];\n\n\t\t\t\tselectedOptions.forEach((el: HTMLOptionElement) => {\n\t\t\t\t\tvalues.push(el.value);\n\t\t\t\t});\n\n\t\t\t\tthis.value = values;\n\t\t\t}\n\t\t}\n\n\t\tthis.buildWrapper();\n\t\tif (this.mode === 'tags') this.buildTags();\n\t\telse this.buildToggle();\n\t\tthis.buildDropdown();\n\t\tif (this.extraMarkup) this.buildExtraMarkup();\n\t}\n\n\tprivate buildWrapper() {\n\t\tthis.wrapper = document.createElement('div');\n\t\tthis.wrapper.classList.add('hs-select', 'relative');\n\n\t\tif (this.mode === 'tags') {\n\t\t\tthis.wrapper.addEventListener('click', (evt) => {\n\t\t\t\tif (\n\t\t\t\t\t!(evt.target as HTMLElement).closest('[data-hs-select-dropdown]') &&\n\t\t\t\t\t!(evt.target as HTMLElement).closest('[data-tag-value]')\n\t\t\t\t) {\n\t\t\t\t\tthis.tagsInput.focus();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tif (this.wrapperClasses)\n\t\t\tclassToClassList(this.wrapperClasses, this.wrapper);\n\n\t\tthis.el.before(this.wrapper);\n\n\t\tthis.wrapper.append(this.el);\n\t}\n\n\tprivate buildExtraMarkup() {\n\t\tconst appendMarkup = (markup: string) => {\n\t\t\tthis.wrapper.append(htmlToElement(markup));\n\t\t};\n\n\t\tif (Array.isArray(this.extraMarkup))\n\t\t\tthis.extraMarkup.forEach((el) => appendMarkup(el));\n\t\telse appendMarkup(this.extraMarkup);\n\t}\n\n\tprivate buildToggle() {\n\t\tlet icon, title;\n\t\tthis.toggleTextWrapper = document.createElement('span');\n\t\tthis.toggleTextWrapper.classList.add('truncate');\n\t\tthis.toggle = htmlToElement(this.toggleTag || '
');\n\t\ticon = this.toggle.querySelector('[data-icon]');\n\t\ttitle = this.toggle.querySelector('[data-title]');\n\n\t\tif (!this.isMultiple && icon) this.setToggleIcon();\n\t\tif (!this.isMultiple && title) this.setToggleTitle();\n\t\tif (this.isMultiple) {\n\t\t\tthis.toggleTextWrapper.innerHTML = this.value.length\n\t\t\t\t? this.stringFromValue()\n\t\t\t\t: this.placeholder;\n\t\t} else {\n\t\t\tthis.toggleTextWrapper.innerHTML =\n\t\t\t\tthis.getItemByValue(this.value as string)?.title || this.placeholder;\n\t\t}\n\t\tif (!title) this.toggle.append(this.toggleTextWrapper);\n\t\tif (this.toggleClasses) classToClassList(this.toggleClasses, this.toggle);\n\t\tif (this.isDisabled) this.toggle.classList.add('disabled');\n\t\tif (this.wrapper) this.wrapper.append(this.toggle);\n\n\t\tif (this.toggle?.ariaExpanded) {\n\t\t\tif (this.isOpened) this.toggle.ariaExpanded = 'true';\n\t\t\telse this.toggle.ariaExpanded = 'false';\n\t\t}\n\n\t\tthis.toggle.addEventListener('click', () => {\n\t\t\tif (this.isDisabled) return false;\n\n\t\t\tif (this.isOpened) this.close();\n\t\t\telse this.open();\n\t\t});\n\t}\n\n\tprivate setToggleIcon() {\n\t\tconst icon = this.toggle.querySelector('[data-icon]');\n\t\ticon.innerHTML = '';\n\n\t\tif (icon) {\n\t\t\tconst img = htmlToElement(\n\t\t\t\tthis.getItemByValue(this.value as string)?.options?.icon || '',\n\t\t\t);\n\t\t\ticon.append(img);\n\n\t\t\tif (!img) icon.classList.add('hidden');\n\t\t\telse icon.classList.remove('hidden');\n\t\t}\n\t}\n\n\tprivate setToggleTitle() {\n\t\tconst title = this.toggle.querySelector('[data-title]');\n\t\ttitle.classList.add('truncate');\n\t\ttitle.innerHTML = '';\n\n\t\tif (title) {\n\t\t\tconst titleText =\n\t\t\t\tthis.getItemByValue(this.value as string)?.title || this.placeholder;\n\t\t\ttitle.innerHTML = titleText;\n\n\t\t\tthis.toggle.append(title);\n\t\t}\n\t}\n\n\tprivate buildTags() {\n\t\tif (this.isDisabled) this.wrapper.classList.add('disabled');\n\t\tthis.buildTagsInput();\n\t\tthis.setTagsItems();\n\t}\n\n\tprivate reassignTagsInputPlaceholder(placeholder: string) {\n\t\t(this.tagsInput as HTMLInputElement).placeholder = placeholder;\n\t\tthis.tagsInputHelper.innerHTML = placeholder;\n\t\tthis.calculateInputWidth();\n\t}\n\n\tprivate buildTagsItem(val: string) {\n\t\tconst item = this.getItemByValue(val);\n\n\t\tlet template, title, remove, icon: null | HTMLElement;\n\n\t\tconst newItem = document.createElement('div');\n\t\tnewItem.setAttribute('data-tag-value', val);\n\t\tif (this.tagsItemClasses) classToClassList(this.tagsItemClasses, newItem);\n\n\t\tif (this.tagsItemTemplate) {\n\t\t\ttemplate = htmlToElement(this.tagsItemTemplate);\n\n\t\t\tnewItem.append(template);\n\t\t}\n\n\t\t// Icon\n\t\tif (item?.options?.icon) {\n\t\t\tconst img = htmlToElement(item?.options?.icon);\n\t\t\ticon = template\n\t\t\t\t? template.querySelector('[data-icon]')\n\t\t\t\t: document.createElement('span');\n\n\t\t\ticon.append(img);\n\n\t\t\tif (!template) newItem.append(icon);\n\t\t}\n\t\tif (\n\t\t\ttemplate &&\n\t\t\ttemplate.querySelector('[data-icon]') &&\n\t\t\t!item?.options?.icon\n\t\t) {\n\t\t\ttemplate.querySelector('[data-icon]').classList.add('hidden');\n\t\t}\n\n\t\t// Title\n\t\ttitle = template\n\t\t\t? template.querySelector('[data-title]')\n\t\t\t: document.createElement('span');\n\t\ttitle.textContent = item.title || '';\n\n\t\tif (!template) newItem.append(title);\n\n\t\t// Remove\n\t\tif (template) {\n\t\t\tremove = template.querySelector('[data-remove]');\n\t\t} else {\n\t\t\tremove = document.createElement('span');\n\t\t\tremove.textContent = 'X';\n\n\t\t\tnewItem.append(remove);\n\t\t}\n\n\t\tremove.addEventListener('click', () => {\n\t\t\tthis.value = (this.value as string[]).filter((el) => el !== val);\n\t\t\tthis.selectedItems = this.selectedItems.filter((el) => el !== val);\n\n\t\t\tif (!this.value.length)\n\t\t\t\tthis.reassignTagsInputPlaceholder(this.placeholder);\n\n\t\t\tthis.unselectMultipleItems();\n\t\t\tthis.selectMultipleItems();\n\n\t\t\tnewItem.remove();\n\t\t});\n\n\t\tthis.wrapper.append(newItem);\n\t}\n\n\tprivate getItemByValue(val: string) {\n\t\treturn this.selectOptions.find((el: ISingleOption) => el.val === val);\n\t}\n\n\tprivate setTagsItems() {\n\t\tif (this.value) {\n\t\t\t(this.value as string[]).forEach((val) => {\n\t\t\t\tif (!this.selectedItems.includes(val)) this.buildTagsItem(val);\n\n\t\t\t\tthis.selectedItems = !this.selectedItems.includes(val)\n\t\t\t\t\t? [...this.selectedItems, val]\n\t\t\t\t\t: this.selectedItems;\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate buildTagsInput() {\n\t\tthis.tagsInput = document.createElement('input');\n\n\t\tif (this.tagsInputClasses)\n\t\t\tclassToClassList(this.tagsInputClasses, this.tagsInput);\n\n\t\tthis.tagsInput.addEventListener('focus', () => this.open());\n\t\tthis.tagsInput.addEventListener('input', () => this.calculateInputWidth());\n\t\tthis.tagsInput.addEventListener(\n\t\t\t'input',\n\t\t\tdebounce((evt: InputEvent) =>\n\t\t\t\tthis.searchOptions((evt.target as HTMLInputElement).value),\n\t\t\t),\n\t\t);\n\t\tthis.tagsInput.addEventListener('keydown', (evt) => {\n\t\t\tif (evt.key === 'Enter' && this.isAddTagOnEnter) {\n\t\t\t\tconst val = (evt.target as HTMLInputElement).value;\n\n\t\t\t\tif (this.selectOptions.find((el: ISingleOption) => el.val === val))\n\t\t\t\t\treturn false;\n\n\t\t\t\tthis.addSelectOption(val, val);\n\t\t\t\tthis.buildOption(val, val);\n\t\t\t\t(\n\t\t\t\t\tthis.dropdown.querySelector(`[data-value=\"${val}\"]`) as HTMLElement\n\t\t\t\t).click();\n\n\t\t\t\tthis.resetTagsInputField();\n\t\t\t\t// this.close();\n\t\t\t}\n\t\t});\n\n\t\tthis.wrapper.append(this.tagsInput);\n\n\t\tsetTimeout(() => {\n\t\t\tthis.adjustInputWidth();\n\t\t\tthis.reassignTagsInputPlaceholder(\n\t\t\t\tthis.value.length ? '' : this.placeholder,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate buildDropdown() {\n\t\tthis.dropdown = htmlToElement(this.dropdownTag || '
');\n\t\tthis.dropdown.setAttribute('data-hs-select-dropdown', '');\n\n\t\tthis.dropdown.classList.add('absolute', 'top-full');\n\t\tthis.dropdown.role = 'listbox';\n\t\tthis.dropdown.tabIndex = -1;\n\t\tthis.dropdown.ariaOrientation = 'vertical';\n\n\t\tif (!this.isOpened) this.dropdown.classList.add('hidden');\n\n\t\tif (this.dropdownClasses)\n\t\t\tclassToClassList(this.dropdownClasses, this.dropdown);\n\t\tif (this.wrapper) this.wrapper.append(this.dropdown);\n\t\tif (this.dropdown && this.hasSearch) this.buildSearch();\n\t\tif (this.selectOptions)\n\t\t\tthis.selectOptions.forEach((props: ISingleOption, i) =>\n\t\t\t\tthis.buildOption(\n\t\t\t\t\tprops.title,\n\t\t\t\t\tprops.val,\n\t\t\t\t\tprops.disabled,\n\t\t\t\t\tprops.selected,\n\t\t\t\t\tprops.options,\n\t\t\t\t\t`${i}`,\n\t\t\t\t),\n\t\t\t);\n\t}\n\n\tprivate buildSearch() {\n\t\tlet input;\n\t\tthis.searchWrapper = htmlToElement(\n\t\t\tthis.searchWrapperTemplate || '
',\n\t\t);\n\t\tif (this.searchWrapperClasses)\n\t\t\tclassToClassList(this.searchWrapperClasses, this.searchWrapper);\n\t\tinput = this.searchWrapper.querySelector('[data-input]');\n\n\t\tthis.search = htmlToElement('') as HTMLInputElement;\n\t\tthis.search.placeholder = this.searchPlaceholder;\n\t\tif (this.searchClasses) classToClassList(this.searchClasses, this.search);\n\n\t\tthis.search.addEventListener(\n\t\t\t'input',\n\t\t\tdebounce((evt: InputEvent) =>\n\t\t\t\tthis.searchOptions((evt.target as HTMLInputElement).value),\n\t\t\t),\n\t\t);\n\n\t\tif (input) input.append(this.search);\n\t\telse this.searchWrapper.append(this.search);\n\n\t\tthis.dropdown.append(this.searchWrapper);\n\t}\n\n\tprivate buildOption(\n\t\ttitle: string,\n\t\tval: string,\n\t\tdisabled: boolean = false,\n\t\tselected: boolean = false,\n\t\toptions?: ISingleOptionOptions,\n\t\tindex: string = '1',\n\t) {\n\t\tlet template: HTMLElement | null = null;\n\t\tlet titleWrapper: HTMLElement | null = null;\n\t\tlet iconWrapper: HTMLElement | null = null;\n\t\tlet descriptionWrapper: HTMLElement | null = null;\n\n\t\tconst option = htmlToElement(this.optionTag || '
');\n\t\toption.setAttribute('data-value', val);\n\t\toption.setAttribute('data-title-value', title);\n\t\toption.setAttribute('tabIndex', index);\n\t\toption.classList.add('cursor-pointer');\n\t\tif (disabled) option.classList.add('disabled');\n\t\tif (selected) {\n\t\t\t// @ts-ignore\n\t\t\tif (this.isMultiple) this.value = [...this.value, val];\n\t\t\telse this.value = val;\n\t\t}\n\t\tif (this.optionTemplate) {\n\t\t\ttemplate = htmlToElement(this.optionTemplate);\n\n\t\t\toption.append(template);\n\t\t}\n\t\tif (template) {\n\t\t\ttitleWrapper = template.querySelector('[data-title]');\n\t\t\ttitleWrapper.textContent = title || '';\n\t\t} else {\n\t\t\toption.textContent = title || '';\n\t\t}\n\t\tif (options) {\n\t\t\tif (options.icon) {\n\t\t\t\tconst img = htmlToElement(options.icon);\n\t\t\t\timg.classList.add('max-w-full');\n\n\t\t\t\tif (template) {\n\t\t\t\t\ticonWrapper = template.querySelector('[data-icon]');\n\t\t\t\t\ticonWrapper.append(img);\n\t\t\t\t} else {\n\t\t\t\t\tconst icon = htmlToElement('
');\n\t\t\t\t\tif (this.iconClasses) classToClassList(this.iconClasses, icon);\n\n\t\t\t\t\ticon.append(img);\n\t\t\t\t\toption.append(icon);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (options.description) {\n\t\t\t\tif (template) {\n\t\t\t\t\tdescriptionWrapper = template.querySelector('[data-description]');\n\t\t\t\t\tdescriptionWrapper.append(options.description);\n\t\t\t\t} else {\n\t\t\t\t\tconst description = htmlToElement('
');\n\t\t\t\t\tdescription.textContent = options.description;\n\t\t\t\t\tif (this.descriptionClasses)\n\t\t\t\t\t\tclassToClassList(this.descriptionClasses, description);\n\n\t\t\t\t\toption.append(description);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\ttemplate &&\n\t\t\ttemplate.querySelector('[data-icon]') &&\n\t\t\t!options &&\n\t\t\t!options?.icon\n\t\t) {\n\t\t\ttemplate.querySelector('[data-icon]').classList.add('hidden');\n\t\t}\n\n\t\tif (\n\t\t\tthis.value &&\n\t\t\t(this.isMultiple ? this.value.includes(val) : this.value === val)\n\t\t)\n\t\t\toption.classList.add('selected');\n\n\t\tif (!disabled)\n\t\t\toption.addEventListener('click', () => this.onSelectOption(val));\n\n\t\tif (this.optionClasses) classToClassList(this.optionClasses, option);\n\t\tif (this.dropdown) this.dropdown.append(option);\n\t\tif (selected) this.setNewValue();\n\t}\n\n\tprivate destroyOption(val: string) {\n\t\tconst option = this.dropdown.querySelector(`[data-value=\"${val}\"]`);\n\n\t\tif (!option) return false;\n\n\t\toption.remove();\n\t}\n\n\tprivate buildOriginalOption(\n\t\ttitle: string,\n\t\tval: string,\n\t\tdisabled?: boolean,\n\t\tselected?: boolean,\n\t\toptions?: ISingleOptionOptions,\n\t) {\n\t\tconst option = htmlToElement('');\n\t\toption.setAttribute('value', val);\n\t\tif (disabled) option.setAttribute('disabled', 'disabled');\n\t\tif (selected) option.setAttribute('selected', 'selected');\n\t\toption.setAttribute('data-hs-select-option', JSON.stringify(options));\n\t\toption.innerText = title;\n\n\t\tthis.el.append(option);\n\t}\n\n\tprivate destroyOriginalOption(val: string) {\n\t\tconst option = this.el.querySelector(`[value=\"${val}\"]`);\n\n\t\tif (!option) return false;\n\n\t\toption.remove();\n\t}\n\n\tprivate buildTagsInputHelper() {\n\t\tthis.tagsInputHelper = document.createElement('span');\n\t\tthis.tagsInputHelper.style.fontSize = window.getComputedStyle(\n\t\t\tthis.tagsInput,\n\t\t).fontSize;\n\t\tthis.tagsInputHelper.style.fontFamily = window.getComputedStyle(\n\t\t\tthis.tagsInput,\n\t\t).fontFamily;\n\t\tthis.tagsInputHelper.style.fontWeight = window.getComputedStyle(\n\t\t\tthis.tagsInput,\n\t\t).fontWeight;\n\t\tthis.tagsInputHelper.style.letterSpacing = window.getComputedStyle(\n\t\t\tthis.tagsInput,\n\t\t).letterSpacing;\n\t\tthis.tagsInputHelper.style.visibility = 'hidden';\n\t\tthis.tagsInputHelper.style.whiteSpace = 'pre';\n\t\tthis.tagsInputHelper.style.position = 'absolute';\n\n\t\tthis.wrapper.appendChild(this.tagsInputHelper);\n\t}\n\n\tprivate calculateInputWidth() {\n\t\tthis.tagsInputHelper.textContent =\n\t\t\t(this.tagsInput as HTMLInputElement).value ||\n\t\t\t(this.tagsInput as HTMLInputElement).placeholder;\n\n\t\tconst inputPadding =\n\t\t\tparseInt(window.getComputedStyle(this.tagsInput).paddingLeft) +\n\t\t\tparseInt(window.getComputedStyle(this.tagsInput).paddingRight);\n\t\tconst inputBorder =\n\t\t\tparseInt(window.getComputedStyle(this.tagsInput).borderLeftWidth) +\n\t\t\tparseInt(window.getComputedStyle(this.tagsInput).borderRightWidth);\n\t\tconst newWidth =\n\t\t\tthis.tagsInputHelper.offsetWidth + inputPadding + inputBorder;\n\t\tconst maxWidth =\n\t\t\tthis.wrapper.offsetWidth -\n\t\t\t(parseInt(window.getComputedStyle(this.wrapper).paddingLeft) +\n\t\t\t\tparseInt(window.getComputedStyle(this.wrapper).paddingRight));\n\n\t\t(this.tagsInput as HTMLInputElement).style.width = `${\n\t\t\tMath.min(newWidth, maxWidth) + 2\n\t\t}px`;\n\t}\n\n\tprivate adjustInputWidth() {\n\t\tthis.buildTagsInputHelper();\n\t\tthis.calculateInputWidth();\n\t}\n\n\tprivate onSelectOption(val: string) {\n\t\tthis.clearSelections();\n\n\t\tif (this.isMultiple) {\n\t\t\tthis.value = this.value.includes(val)\n\t\t\t\t? Array.from(this.value).filter((el) => el !== val)\n\t\t\t\t: [...Array.from(this.value), val];\n\n\t\t\tthis.selectMultipleItems();\n\t\t\tthis.setNewValue();\n\t\t} else {\n\t\t\tthis.value = val;\n\n\t\t\tthis.selectSingleItem();\n\t\t\tthis.setNewValue();\n\t\t}\n\n\t\tthis.fireEvent('change', this.value);\n\t\tdispatch('change.hs.select', this.el, this.value);\n\n\t\tif (this.mode === 'tags') {\n\t\t\tconst intersection = this.selectedItems.filter(\n\t\t\t\t(x) => !(this.value as string[]).includes(x),\n\t\t\t);\n\t\t\tif (intersection.length) {\n\t\t\t\tintersection.forEach((el) => {\n\t\t\t\t\tthis.selectedItems = this.selectedItems.filter((elI) => elI !== el);\n\t\t\t\t\tthis.wrapper.querySelector(`[data-tag-value=\"${el}\"]`).remove();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.resetTagsInputField();\n\t\t}\n\n\t\tif (!this.isMultiple) {\n\t\t\tif (this.toggle.querySelector('[data-icon]')) this.setToggleIcon();\n\t\t\tif (this.toggle.querySelector('[data-title]')) this.setToggleTitle();\n\t\t\tthis.close();\n\t\t}\n\n\t\tif (!this.value.length && this.mode === 'tags')\n\t\t\tthis.reassignTagsInputPlaceholder(this.placeholder);\n\n\t\tif (this.isOpened && this.mode === 'tags' && this.tagsInput)\n\t\t\tthis.tagsInput.focus();\n\n\t\tthis.triggerChangeEventForNativeSelect();\n\t}\n\n\tprivate triggerChangeEventForNativeSelect() {\n\t\t// TODO:: test for bugs after comment the line below\n\t\t// (this.el as HTMLSelectElement).value = `${this.value}`;\n\t\tconst selectChangeEvent = new Event('change', { bubbles: true });\n\t\t(this.el as HTMLSelectElement).dispatchEvent(selectChangeEvent);\n\t}\n\n\tprivate addSelectOption(\n\t\ttitle: string,\n\t\tval: string,\n\t\tdisabled?: boolean,\n\t\tselected?: boolean,\n\t\toptions?: ISingleOptionOptions,\n\t) {\n\t\tthis.selectOptions = [\n\t\t\t...this.selectOptions,\n\t\t\t{\n\t\t\t\ttitle,\n\t\t\t\tval,\n\t\t\t\tdisabled,\n\t\t\t\tselected,\n\t\t\t\toptions,\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate removeSelectOption(val: string, isArray = false) {\n\t\tconst hasOption = !!this.selectOptions.some(\n\t\t\t(el: ISingleOption) => el.val === val,\n\t\t);\n\n\t\tif (!hasOption) return false;\n\n\t\tthis.selectOptions = this.selectOptions.filter(\n\t\t\t(el: ISingleOption) => el.val !== val,\n\t\t);\n\n\t\tconsole.log(isArray);\n\n\t\tthis.value = isArray\n\t\t\t? (this.value as string[]).filter((item: string) => item !== val)\n\t\t\t: val;\n\n\t\tconsole.log(this.value);\n\t}\n\n\tprivate resetTagsInputField() {\n\t\t(this.tagsInput as HTMLInputElement).value = '';\n\n\t\tthis.reassignTagsInputPlaceholder('');\n\t\tthis.searchOptions('');\n\t}\n\n\tprivate clearSelections() {\n\t\tArray.from(this.dropdown.children).forEach((el) => {\n\t\t\tif (el.classList.contains('selected')) el.classList.remove('selected');\n\t\t});\n\t\tArray.from(this.el.children).forEach((el) => {\n\t\t\tif ((el as HTMLOptionElement).selected)\n\t\t\t\t(el as HTMLOptionElement).selected = false;\n\t\t});\n\t}\n\n\tprivate setNewValue() {\n\t\tif (this.mode === 'tags') {\n\t\t\tthis.setTagsItems();\n\t\t} else {\n\t\t\tconsole.log();\n\n\t\t\tif (this.value.length)\n\t\t\t\tthis.toggleTextWrapper.innerHTML = this.stringFromValue();\n\t\t\telse this.toggleTextWrapper.innerHTML = this.placeholder;\n\t\t}\n\t}\n\n\tprivate stringFromValue() {\n\t\tconst value: string[] = [];\n\t\tlet title = '';\n\n\t\tthis.selectOptions.forEach((el: ISingleOption) => {\n\t\t\tif (this.isMultiple) {\n\t\t\t\tif (this.value.includes(el.val)) value.push(el.title);\n\t\t\t} else {\n\t\t\t\tif (this.value === el.val) value.push(el.title);\n\t\t\t}\n\t\t});\n\n\t\tif (\n\t\t\tthis.toggleCountText &&\n\t\t\tthis.toggleCountText !== '' &&\n\t\t\tvalue.length >= this.toggleCountTextMinItems\n\t\t) {\n\t\t\tif (this.toggleCountTextMode === 'nItemsAndCount') {\n\t\t\t\tconst nItems = value.slice(0, this.toggleCountTextMinItems - 1);\n\n\t\t\t\ttitle = `${nItems.join(this.toggleSeparators.items)} ${this.toggleSeparators.betweenItemsAndCounter} ${value.length - nItems.length} ${this.toggleCountText}`;\n\t\t\t} else {\n\t\t\t\ttitle = `${value.length} ${this.toggleCountText}`;\n\t\t\t}\n\t\t} else {\n\t\t\ttitle = value.join(this.toggleSeparators.items);\n\t\t}\n\n\t\treturn title;\n\t}\n\n\tprivate selectSingleItem() {\n\t\tconst selectedOption = Array.from(this.el.children).find(\n\t\t\t(el) => this.value === (el as HTMLOptionElement).value,\n\t\t);\n\t\t(selectedOption as HTMLOptionElement).selected = true;\n\n\t\tconst selectedItem = Array.from(this.dropdown.children).find(\n\t\t\t(el) =>\n\t\t\t\tthis.value === (el as HTMLOptionElement).getAttribute('data-value'),\n\t\t);\n\n\t\tif (selectedItem) selectedItem.classList.add('selected');\n\t}\n\n\tprivate selectMultipleItems() {\n\t\tArray.from(this.dropdown.children)\n\t\t\t.filter((el) => this.value.includes(el.getAttribute('data-value')))\n\t\t\t.forEach((el) => el.classList.add('selected'));\n\n\t\tArray.from(this.el.children)\n\t\t\t.filter((el) => this.value.includes((el as HTMLOptionElement).value))\n\t\t\t.forEach((el) => ((el as HTMLOptionElement).selected = true));\n\t}\n\n\tprivate unselectMultipleItems() {\n\t\tArray.from(this.dropdown.children).forEach((el) =>\n\t\t\tel.classList.remove('selected'),\n\t\t);\n\t\tArray.from(this.el.children).forEach(\n\t\t\t(el) => ((el as HTMLOptionElement).selected = false),\n\t\t);\n\t}\n\n\tprivate searchOptions(val: string) {\n\t\tif (this.searchNoResult) {\n\t\t\tthis.searchNoResult.remove();\n\t\t\tthis.searchNoResult = null;\n\t\t}\n\t\tthis.searchNoResult = htmlToElement('');\n\t\tthis.searchNoResult.innerText = this.searchNoResultText;\n\t\tclassToClassList(this.searchNoResultClasses, this.searchNoResult);\n\n\t\tconst options = this.dropdown.querySelectorAll('[data-value]');\n\t\tlet hasItems = false;\n\n\t\toptions.forEach((el) => {\n\t\t\tconst optionVal = el.getAttribute('data-title-value').toLocaleLowerCase();\n\n\t\t\tif (!optionVal.includes(val.toLocaleLowerCase()))\n\t\t\t\tel.classList.add('hidden');\n\t\t\telse {\n\t\t\t\tel.classList.remove('hidden');\n\t\t\t\thasItems = true;\n\t\t\t}\n\t\t});\n\n\t\tif (!hasItems) this.dropdown.append(this.searchNoResult);\n\t}\n\n\tprivate eraseToggleIcon() {\n\t\tconst icon = this.toggle.querySelector('[data-icon]');\n\n\t\tif (icon) {\n\t\t\ticon.innerHTML = null;\n\t\t\ticon.classList.add('hidden');\n\t\t}\n\t}\n\n\tprivate eraseToggleTitle() {\n\t\tconst title = this.toggle.querySelector('[data-title]');\n\n\t\tif (title) {\n\t\t\ttitle.innerHTML = this.placeholder;\n\t\t} else {\n\t\t\tthis.toggleTextWrapper.innerHTML = this.placeholder;\n\t\t}\n\t}\n\n\t// Public methods\n\tpublic destroy() {\n\t\tconst parent = this.el.parentElement.parentElement;\n\n\t\tthis.el.classList.remove('hidden');\n\t\tthis.el.style.display = '';\n\t\tparent.prepend(this.el);\n\t\tparent.querySelector('.hs-select').remove();\n\t\tthis.wrapper = null;\n\t}\n\n\tpublic open() {\n\t\tconst currentlyOpened =\n\t\t\twindow?.$hsSelectCollection?.find((el) => el.element.isOpened) || null;\n\n\t\tif (currentlyOpened) currentlyOpened.element.close();\n\t\tif (this.animationInProcess) return false;\n\n\t\tthis.animationInProcess = true;\n\n\t\tthis.dropdown.classList.remove('hidden');\n\n\t\tthis.recalculateDirection();\n\n\t\tsetTimeout(() => {\n\t\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'true';\n\t\t\tthis.wrapper.classList.add('active');\n\t\t\tthis.dropdown.classList.add('opened');\n\t\t\tif (this.hasSearch && !this.preventSearchFocus) this.search.focus();\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\n\t\tthis.isOpened = true;\n\t}\n\n\tpublic close() {\n\t\tif (this.animationInProcess) return false;\n\n\t\tthis.animationInProcess = true;\n\n\t\tif (this?.toggle?.ariaExpanded) this.toggle.ariaExpanded = 'false';\n\t\tthis.wrapper.classList.remove('active');\n\t\tthis.dropdown.classList.remove('opened', 'bottom-full', 'top-full');\n\t\tif (this.dropdownDirectionClasses?.bottom)\n\t\t\tthis.dropdown.classList.remove(this.dropdownDirectionClasses.bottom);\n\t\tif (this.dropdownDirectionClasses?.top)\n\t\t\tthis.dropdown.classList.remove(this.dropdownDirectionClasses.top);\n\t\tthis.dropdown.style.marginTop = '';\n\t\tthis.dropdown.style.marginBottom = '';\n\n\t\tafterTransition(this.dropdown, () => {\n\t\t\tthis.dropdown.classList.add('hidden');\n\t\t\tif (this.hasSearch) {\n\t\t\t\tthis.search.value = '';\n\t\t\t\tthis.search.dispatchEvent(new Event('input', { bubbles: true }));\n\t\t\t\tthis.search.blur();\n\t\t\t}\n\n\t\t\tthis.animationInProcess = false;\n\t\t});\n\n\t\tthis.dropdown\n\t\t\t.querySelector('.hs-select-option-highlighted')\n\t\t\t?.classList.remove('hs-select-option-highlighted');\n\t\tthis.isOpened = false;\n\t}\n\n\tpublic addOption(items: ISingleOption | ISingleOption[]) {\n\t\tlet i = `${this.selectOptions.length}`;\n\t\tconst addOption = (option: ISingleOption) => {\n\t\t\tconst { title, val, disabled, selected, options } = option;\n\t\t\tconst hasOption = !!this.selectOptions.some(\n\t\t\t\t(el: ISingleOption) => el.val === val,\n\t\t\t);\n\n\t\t\tif (!hasOption) {\n\t\t\t\tthis.addSelectOption(title, val, disabled, selected, options);\n\t\t\t\tthis.buildOption(title, val, disabled, selected, options, i);\n\t\t\t\tthis.buildOriginalOption(title, val, disabled, selected, options);\n\n\t\t\t\tif (selected && !this.isMultiple) this.onSelectOption(val);\n\t\t\t}\n\t\t};\n\n\t\tif (Array.isArray(items)) {\n\t\t\titems.forEach((option) => {\n\t\t\t\taddOption(option);\n\t\t\t});\n\t\t} else {\n\t\t\taddOption(items);\n\t\t}\n\t}\n\n\tpublic removeOption(values: string | string[]) {\n\t\tconst removeOption = (val: string, isArray = false) => {\n\t\t\tconst hasOption = !!this.selectOptions.some(\n\t\t\t\t(el: ISingleOption) => el.val === val,\n\t\t\t);\n\n\t\t\tif (hasOption) {\n\t\t\t\tthis.removeSelectOption(val, isArray);\n\t\t\t\tthis.destroyOption(val);\n\t\t\t\tthis.destroyOriginalOption(val);\n\n\t\t\t\tif (this.value === val) {\n\t\t\t\t\tthis.value = null;\n\n\t\t\t\t\tthis.eraseToggleTitle();\n\t\t\t\t\tthis.eraseToggleIcon();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tif (Array.isArray(values)) {\n\t\t\tvalues.forEach((val) => {\n\t\t\t\tremoveOption(val, this.isMultiple);\n\t\t\t});\n\t\t} else {\n\t\t\tremoveOption(values, this.isMultiple);\n\t\t}\n\n\t\tthis.setNewValue();\n\t}\n\n\tpublic recalculateDirection() {\n\t\tif (\n\t\t\tisEnoughSpace(\n\t\t\t\tthis.dropdown,\n\t\t\t\tthis.toggle || this.tagsInput,\n\t\t\t\t'bottom',\n\t\t\t\tthis.dropdownSpace,\n\t\t\t\tthis.viewport,\n\t\t\t)\n\t\t) {\n\t\t\tthis.dropdown.classList.remove('bottom-full');\n\t\t\tif (this.dropdownDirectionClasses?.bottom)\n\t\t\t\tthis.dropdown.classList.remove(this.dropdownDirectionClasses.bottom);\n\t\t\tthis.dropdown.style.marginBottom = '';\n\t\t\tthis.dropdown.classList.add('top-full');\n\t\t\tif (this.dropdownDirectionClasses?.top)\n\t\t\t\tthis.dropdown.classList.add(this.dropdownDirectionClasses.top);\n\t\t\tthis.dropdown.style.marginTop = `${this.dropdownSpace}px`;\n\t\t} else {\n\t\t\tthis.dropdown.classList.remove('top-full');\n\t\t\tif (this.dropdownDirectionClasses?.top)\n\t\t\t\tthis.dropdown.classList.remove(this.dropdownDirectionClasses.top);\n\t\t\tthis.dropdown.style.marginTop = '';\n\t\t\tthis.dropdown.classList.add('bottom-full');\n\t\t\tif (this.dropdownDirectionClasses?.bottom)\n\t\t\t\tthis.dropdown.classList.add(this.dropdownDirectionClasses.bottom);\n\t\t\tthis.dropdown.style.marginBottom = `${this.dropdownSpace}px`;\n\t\t}\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsSelectCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsSelectCollection) window.$hsSelectCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-select]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsSelectCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst data = el.getAttribute('data-hs-select');\n\t\t\t\t\tconst options: ISelectOptions = data ? JSON.parse(data) : {};\n\n\t\t\t\t\tnew HSSelect(el, options);\n\t\t\t\t}\n\t\t\t});\n\n\t\tif (window.$hsSelectCollection) {\n\t\t\twindow.addEventListener('click', (evt) => {\n\t\t\t\tconst evtTarget = evt.target;\n\n\t\t\t\tHSSelect.closeCurrentlyOpened(evtTarget as HTMLElement);\n\t\t\t});\n\n\t\t\tdocument.addEventListener('keydown', (evt) =>\n\t\t\t\tHSSelect.accessibility(evt),\n\t\t\t);\n\t\t}\n\t}\n\n\tstatic open(target: HTMLElement | string) {\n\t\tconst elInCollection = window.$hsSelectCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection && !elInCollection.element.isOpened)\n\t\t\telInCollection.element.open();\n\t}\n\n\tstatic close(target: HTMLElement | string) {\n\t\tconst elInCollection = window.$hsSelectCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection && elInCollection.element.isOpened) {\n\t\t\telInCollection.element.close();\n\t\t}\n\t}\n\n\tstatic closeCurrentlyOpened(evtTarget: HTMLElement | null = null) {\n\t\tif (!evtTarget.closest('.hs-select.active')) {\n\t\t\tconst currentlyOpened =\n\t\t\t\twindow.$hsSelectCollection.filter((el) => el.element.isOpened) || null;\n\n\t\t\tif (currentlyOpened) {\n\t\t\t\tcurrentlyOpened.forEach((el) => {\n\t\t\t\t\tel.element.close();\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t// Accessibility methods\n\tstatic accessibility(evt: KeyboardEvent) {\n\t\tconst target = window.$hsSelectCollection.find((el) => el.element.isOpened);\n\n\t\tif (\n\t\t\ttarget &&\n\t\t\tSELECT_ACCESSIBILITY_KEY_SET.includes(evt.code) &&\n\t\t\t!evt.metaKey\n\t\t) {\n\t\t\tswitch (evt.code) {\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tthis.onEscape();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onArrow();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onArrow(false);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Tab':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onTab(evt.shiftKey);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Home':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onStartEnd();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'End':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tevt.stopImmediatePropagation();\n\t\t\t\t\tthis.onStartEnd(false);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\tthis.onEnter(evt);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic onEscape() {\n\t\tconst target = window.$hsSelectCollection.find((el) => el.element.isOpened);\n\n\t\tif (target) target.element.close();\n\t}\n\n\tstatic onArrow(isArrowUp = true) {\n\t\tconst target = window.$hsSelectCollection.find((el) => el.element.isOpened);\n\n\t\tif (target) {\n\t\t\tconst dropdown = target.element.dropdown;\n\n\t\t\tif (!dropdown) return false;\n\n\t\t\tconst preparedOptions = isArrowUp\n\t\t\t\t? Array.from(\n\t\t\t\t\t\tdropdown.querySelectorAll(':scope > *:not(.hidden)'),\n\t\t\t\t\t).reverse()\n\t\t\t\t: Array.from(dropdown.querySelectorAll(':scope > *:not(.hidden)'));\n\t\t\tconst options = preparedOptions.filter(\n\t\t\t\t(el: any) => !el.classList.contains('disabled'),\n\t\t\t);\n\t\t\tconst current =\n\t\t\t\tdropdown.querySelector('.hs-select-option-highlighted') ||\n\t\t\t\tdropdown.querySelector('.selected');\n\t\t\tif (!current) options[0].classList.add('hs-select-option-highlighted');\n\t\t\tlet currentInd = options.findIndex((el: any) => el === current);\n\n\t\t\tif (currentInd + 1 < options.length) {\n\t\t\t\tcurrentInd++;\n\t\t\t}\n\n\t\t\t(options[currentInd] as HTMLButtonElement).focus();\n\t\t\tif (current) current.classList.remove('hs-select-option-highlighted');\n\t\t\toptions[currentInd].classList.add('hs-select-option-highlighted');\n\t\t}\n\t}\n\n\tstatic onTab(isArrowUp = true) {\n\t\tconst target = window.$hsSelectCollection.find((el) => el.element.isOpened);\n\n\t\tif (target) {\n\t\t\tconst dropdown = target.element.dropdown;\n\n\t\t\tif (!dropdown) return false;\n\n\t\t\tconst preparedOptions = isArrowUp\n\t\t\t\t? Array.from(\n\t\t\t\t\t\tdropdown.querySelectorAll(':scope > *:not(.hidden)'),\n\t\t\t\t\t).reverse()\n\t\t\t\t: Array.from(dropdown.querySelectorAll(':scope > *:not(.hidden)'));\n\t\t\tconst options = preparedOptions.filter(\n\t\t\t\t(el: any) => !el.classList.contains('disabled'),\n\t\t\t);\n\t\t\tconst current =\n\t\t\t\tdropdown.querySelector('.hs-select-option-highlighted') ||\n\t\t\t\tdropdown.querySelector('.selected');\n\t\t\tif (!current) options[0].classList.add('hs-select-option-highlighted');\n\t\t\tlet currentInd = options.findIndex((el: any) => el === current);\n\n\t\t\tif (currentInd + 1 < options.length) {\n\t\t\t\tcurrentInd++;\n\t\t\t} else {\n\t\t\t\tif (current) current.classList.remove('hs-select-option-highlighted');\n\t\t\t\ttarget.element.close();\n\t\t\t\ttarget.element.toggle.focus();\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t(options[currentInd] as HTMLButtonElement).focus();\n\t\t\tif (current) current.classList.remove('hs-select-option-highlighted');\n\t\t\toptions[currentInd].classList.add('hs-select-option-highlighted');\n\t\t}\n\t}\n\n\tstatic onStartEnd(isStart = true) {\n\t\tconst target = window.$hsSelectCollection.find((el) => el.element.isOpened);\n\n\t\tif (target) {\n\t\t\tconst dropdown = target.element.dropdown;\n\n\t\t\tif (!dropdown) return false;\n\n\t\t\tconst preparedOptions = isStart\n\t\t\t\t? Array.from(dropdown.querySelectorAll(':scope > *:not(.hidden)'))\n\t\t\t\t: Array.from(\n\t\t\t\t\t\tdropdown.querySelectorAll(':scope > *:not(.hidden)'),\n\t\t\t\t\t).reverse();\n\t\t\tconst options = preparedOptions.filter(\n\t\t\t\t(el: any) => !el.classList.contains('disabled'),\n\t\t\t);\n\t\t\tconst current = dropdown.querySelector('.hs-select-option-highlighted');\n\n\t\t\tif (options.length) {\n\t\t\t\t(options[0] as HTMLButtonElement).focus();\n\t\t\t\tif (current) current.classList.remove('hs-select-option-highlighted');\n\t\t\t\toptions[0].classList.add('hs-select-option-highlighted');\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic onEnter(evt: Event) {\n\t\tconst select = (evt.target as HTMLElement).previousSibling;\n\n\t\tif (window.$hsSelectCollection.find((el) => el.element.el === select)) {\n\t\t\tconst opened = window.$hsSelectCollection.find(\n\t\t\t\t(el) => el.element.isOpened,\n\t\t\t);\n\t\t\tconst target = window.$hsSelectCollection.find(\n\t\t\t\t(el) => el.element.el === select,\n\t\t\t);\n\n\t\t\topened.element.close();\n\t\t\ttarget.element.open();\n\t\t} else {\n\t\t\tconst target = window.$hsSelectCollection.find(\n\t\t\t\t(el) => el.element.isOpened,\n\t\t\t);\n\n\t\t\tif (target)\n\t\t\t\ttarget.element.onSelectOption(\n\t\t\t\t\t(evt.target as HTMLElement).dataset.value || '',\n\t\t\t\t);\n\t\t}\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSSelect: Function;\n\t\t$hsSelectCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSSelect.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Select collection:', window.$hsSelectCollection);\n});\n\ndocument.addEventListener('scroll', () => {\n\tif (!window.$hsSelectCollection) return false;\n\n\tconst target = window.$hsSelectCollection.find((el) => el.element.isOpened);\n\n\tif (target) target.element.recalculateDirection();\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSSelect = HSSelect;\n}\n\nexport default HSSelect;\n","/*\n * HSStepper\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch } from '../../utils';\n\nimport { IStepperOptions, IStepper, IStepperItem } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSStepper extends HSBasePlugin<{}> implements IStepper {\n\tprivate currentIndex: number | null;\n\tprivate readonly mode: string | null;\n\tprivate isCompleted: boolean | null;\n\n\tprivate totalSteps: number | null;\n\n\tprivate navItems: IStepperItem[] | null;\n\tprivate contentItems: IStepperItem[] | null;\n\tprivate backBtn: HTMLElement | null;\n\tprivate nextBtn: HTMLElement | null;\n\tprivate skipBtn: HTMLElement | null;\n\tprivate completeStepBtn: HTMLElement | null;\n\tprivate completeStepBtnDefaultText: string | null;\n\tprivate finishBtn: HTMLElement | null;\n\tprivate resetBtn: HTMLElement | null;\n\n\tconstructor(el: HTMLElement, options?: IStepperOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-stepper');\n\t\tconst dataOptions: IStepperOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.currentIndex = concatOptions?.currentIndex || 1;\n\t\tthis.mode = concatOptions?.mode || 'linear';\n\t\tthis.isCompleted =\n\t\t\ttypeof concatOptions?.isCompleted !== 'undefined'\n\t\t\t\t? concatOptions?.isCompleted\n\t\t\t\t: false;\n\n\t\tthis.totalSteps = 1;\n\n\t\tthis.navItems = [];\n\t\tthis.contentItems = [];\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsStepperCollection, this);\n\n\t\tthis.buildNav();\n\t\tthis.buildContent();\n\t\tthis.buildButtons();\n\t\tthis.setTotalSteps();\n\t}\n\n\tprivate getUncompletedSteps(inIncludedSkipped: boolean = false) {\n\t\treturn this.navItems.filter(({ isCompleted, isSkip }) =>\n\t\t\tinIncludedSkipped ? !isCompleted || isSkip : !isCompleted && !isSkip,\n\t\t);\n\t}\n\n\tprivate setTotalSteps() {\n\t\tthis.navItems.forEach((item) => {\n\t\t\tconst { index } = item;\n\n\t\t\tif (index > this.totalSteps) this.totalSteps = index;\n\t\t});\n\t}\n\n\t// Nav\n\tprivate buildNav() {\n\t\tthis.el\n\t\t\t.querySelectorAll('[data-hs-stepper-nav-item]')\n\t\t\t.forEach((el) => this.addNavItem(el as HTMLElement));\n\n\t\tthis.navItems.forEach((item) => this.buildNavItem(item));\n\t}\n\n\tprivate buildNavItem(item: IStepperItem) {\n\t\tconst { index, isDisabled, el } = item;\n\n\t\tif (index === this.currentIndex) this.setCurrentNavItem();\n\n\t\tif (this.mode !== 'linear' || isDisabled) {\n\t\t\tel.addEventListener('click', () => this.handleNavItemClick(item));\n\t\t}\n\t}\n\n\tprivate addNavItem(el: HTMLElement) {\n\t\tconst {\n\t\t\tindex,\n\t\t\tisFinal = false,\n\t\t\tisCompleted = false,\n\t\t\tisSkip = false,\n\t\t\tisOptional = false,\n\t\t\tisDisabled = false,\n\t\t\tisProcessed = false,\n\t\t\thasError = false,\n\t\t} = JSON.parse(el.getAttribute('data-hs-stepper-nav-item'));\n\n\t\tif (isCompleted) el.classList.add('success');\n\t\tif (isSkip) el.classList.add('skipped');\n\t\tif (isDisabled) {\n\t\t\tif (el.tagName === 'BUTTON' || el.tagName === 'INPUT')\n\t\t\t\tel.setAttribute('disabled', 'disabled');\n\n\t\t\tel.classList.add('disabled');\n\t\t}\n\t\tif (hasError) el.classList.add('error');\n\n\t\tthis.navItems.push({\n\t\t\tindex,\n\t\t\tisFinal,\n\t\t\tisCompleted,\n\t\t\tisSkip,\n\t\t\tisOptional,\n\t\t\tisDisabled,\n\t\t\tisProcessed,\n\t\t\thasError,\n\t\t\tel: el as HTMLElement,\n\t\t});\n\t}\n\n\tprivate setCurrentNavItem() {\n\t\tthis.navItems.forEach((item) => {\n\t\t\tconst { index, el } = item;\n\n\t\t\tif (index === this.currentIndex) this.setCurrentNavItemActions(el);\n\t\t\telse this.unsetCurrentNavItemActions(el);\n\t\t});\n\t}\n\n\tprivate setCurrentNavItemActions(el: HTMLElement) {\n\t\tel.classList.add('active');\n\n\t\tthis.fireEvent('active', this.currentIndex);\n\t\tdispatch('active.hs.stepper', this.el, this.currentIndex);\n\t}\n\n\tprivate getNavItem(n = this.currentIndex) {\n\t\treturn this.navItems.find(({ index }) => index === n);\n\t}\n\n\tprivate setProcessedNavItemActions(item: IStepperItem) {\n\t\titem.isProcessed = true;\n\n\t\titem.el.classList.add('processed');\n\t}\n\n\tprivate setErrorNavItemActions(item: IStepperItem) {\n\t\titem.hasError = true;\n\n\t\titem.el.classList.add('error');\n\t}\n\n\tprivate unsetCurrentNavItemActions(el: HTMLElement) {\n\t\tel.classList.remove('active');\n\t}\n\n\tprivate handleNavItemClick(item: IStepperItem) {\n\t\tconst { index } = item;\n\n\t\tthis.currentIndex = index;\n\n\t\tthis.setCurrentNavItem();\n\t\tthis.setCurrentContentItem();\n\n\t\tthis.checkForTheFirstStep();\n\t}\n\n\t// Content\n\tprivate buildContent() {\n\t\tthis.el\n\t\t\t.querySelectorAll('[data-hs-stepper-content-item]')\n\t\t\t.forEach((el) => this.addContentItem(el as HTMLElement));\n\n\t\tthis.navItems.forEach((item) => this.buildContentItem(item));\n\t}\n\n\tprivate buildContentItem(item: IStepperItem) {\n\t\tconst { index } = item;\n\n\t\tif (index === this.currentIndex) this.setCurrentContentItem();\n\t}\n\n\tprivate addContentItem(el: HTMLElement) {\n\t\tconst {\n\t\t\tindex,\n\t\t\tisFinal = false,\n\t\t\tisCompleted = false,\n\t\t\tisSkip = false,\n\t\t} = JSON.parse(el.getAttribute('data-hs-stepper-content-item'));\n\n\t\tif (isCompleted) el.classList.add('success');\n\t\tif (isSkip) el.classList.add('skipped');\n\n\t\tthis.contentItems.push({\n\t\t\tindex,\n\t\t\tisFinal,\n\t\t\tisCompleted,\n\t\t\tisSkip,\n\t\t\tel: el as HTMLElement,\n\t\t});\n\t}\n\n\tprivate setCurrentContentItem() {\n\t\tif (this.isCompleted) {\n\t\t\tconst finalContentItem = this.contentItems.find(({ isFinal }) => isFinal);\n\t\t\tconst otherContentItems = this.contentItems.filter(\n\t\t\t\t({ isFinal }) => !isFinal,\n\t\t\t);\n\t\t\tfinalContentItem.el.style.display = '';\n\t\t\totherContentItems.forEach(({ el }) => (el.style.display = 'none'));\n\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.contentItems.forEach((item) => {\n\t\t\tconst { index, el } = item;\n\n\t\t\tif (index === this.currentIndex) this.setCurrentContentItemActions(el);\n\t\t\telse this.unsetCurrentContentItemActions(el);\n\t\t});\n\t}\n\n\tprivate hideAllContentItems() {\n\t\tthis.contentItems.forEach(({ el }) => (el.style.display = 'none'));\n\t}\n\n\tprivate setCurrentContentItemActions(el: HTMLElement) {\n\t\tel.style.display = '';\n\t}\n\n\tprivate unsetCurrentContentItemActions(el: HTMLElement) {\n\t\tel.style.display = 'none';\n\t}\n\n\tprivate disableAll() {\n\t\tconst currentNavItem = this.getNavItem(this.currentIndex);\n\t\tcurrentNavItem.hasError = false;\n\t\tcurrentNavItem.isCompleted = false;\n\t\tcurrentNavItem.isDisabled = false;\n\t\tcurrentNavItem.el.classList.remove('error', 'success');\n\n\t\tthis.disableButtons();\n\t}\n\n\tprivate disableNavItemActions(item: IStepperItem) {\n\t\titem.isDisabled = true;\n\t\titem.el.classList.add('disabled');\n\t}\n\n\tprivate enableNavItemActions(item: IStepperItem) {\n\t\titem.isDisabled = false;\n\t\titem.el.classList.remove('disabled');\n\t}\n\n\t// Buttons\n\tprivate buildButtons() {\n\t\tthis.backBtn = this.el.querySelector('[data-hs-stepper-back-btn]');\n\t\tthis.nextBtn = this.el.querySelector('[data-hs-stepper-next-btn]');\n\t\tthis.skipBtn = this.el.querySelector('[data-hs-stepper-skip-btn]');\n\t\tthis.completeStepBtn = this.el.querySelector(\n\t\t\t'[data-hs-stepper-complete-step-btn]',\n\t\t);\n\t\tthis.finishBtn = this.el.querySelector('[data-hs-stepper-finish-btn]');\n\t\tthis.resetBtn = this.el.querySelector('[data-hs-stepper-reset-btn]');\n\n\t\tthis.buildBackButton();\n\t\tthis.buildNextButton();\n\t\tthis.buildSkipButton();\n\t\tthis.buildCompleteStepButton();\n\t\tthis.buildFinishButton();\n\t\tthis.buildResetButton();\n\t}\n\n\t// back\n\tprivate buildBackButton() {\n\t\tif (!this.backBtn) return;\n\n\t\tthis.checkForTheFirstStep();\n\n\t\tthis.backBtn.addEventListener('click', () => {\n\t\t\tthis.handleBackButtonClick();\n\n\t\t\tif (this.mode === 'linear') {\n\t\t\t\tconst currentNavItem = this.navItems.find(\n\t\t\t\t\t({ index }) => index === this.currentIndex,\n\t\t\t\t);\n\t\t\t\tconst currentContentItem = this.contentItems.find(\n\t\t\t\t\t({ index }) => index === this.currentIndex,\n\t\t\t\t);\n\n\t\t\t\tif (!currentNavItem || !currentContentItem) return;\n\n\t\t\t\tif (currentNavItem.isCompleted) {\n\t\t\t\t\tcurrentNavItem.isCompleted = false;\n\t\t\t\t\tcurrentNavItem.isSkip = false;\n\n\t\t\t\t\tcurrentNavItem.el.classList.remove('success', 'skipped');\n\t\t\t\t}\n\n\t\t\t\tif (currentContentItem.isCompleted) {\n\t\t\t\t\tcurrentContentItem.isCompleted = false;\n\t\t\t\t\tcurrentContentItem.isSkip = false;\n\n\t\t\t\t\tcurrentContentItem.el.classList.remove('success', 'skipped');\n\t\t\t\t}\n\n\t\t\t\tif (this.mode === 'linear' && this.currentIndex !== this.totalSteps) {\n\t\t\t\t\tif (this.nextBtn) this.nextBtn.style.display = '';\n\t\t\t\t\tif (this.completeStepBtn) this.completeStepBtn.style.display = '';\n\t\t\t\t}\n\n\t\t\t\tthis.showSkipButton();\n\t\t\t\tthis.showFinishButton();\n\t\t\t\tthis.showCompleteStepButton();\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate handleBackButtonClick() {\n\t\tif (this.currentIndex === 1) return;\n\n\t\tif (this.mode === 'linear') {\n\t\t\tthis.removeOptionalClasses();\n\t\t}\n\n\t\tthis.currentIndex--;\n\n\t\tif (this.mode === 'linear') {\n\t\t\tthis.removeOptionalClasses();\n\t\t}\n\n\t\tthis.setCurrentNavItem();\n\t\tthis.setCurrentContentItem();\n\n\t\tthis.checkForTheFirstStep();\n\t\tif (this.completeStepBtn)\n\t\t\tthis.changeTextAndDisableCompleteButtonIfStepCompleted();\n\n\t\tthis.fireEvent('back', this.currentIndex);\n\t\tdispatch('back.hs.stepper', this.el, this.currentIndex);\n\t}\n\n\tprivate checkForTheFirstStep() {\n\t\tif (this.currentIndex === 1) {\n\t\t\tthis.setToDisabled(this.backBtn);\n\t\t} else {\n\t\t\tthis.setToNonDisabled(this.backBtn);\n\t\t}\n\t}\n\n\tprivate setToDisabled(el: HTMLElement) {\n\t\tif (el.tagName === 'BUTTON' || el.tagName === 'INPUT')\n\t\t\tel.setAttribute('disabled', 'disabled');\n\n\t\tel.classList.add('disabled');\n\t}\n\n\tprivate setToNonDisabled(el: HTMLElement) {\n\t\tif (el.tagName === 'BUTTON' || el.tagName === 'INPUT')\n\t\t\tel.removeAttribute('disabled');\n\n\t\tel.classList.remove('disabled');\n\t}\n\n\t// next\n\tprivate buildNextButton() {\n\t\tif (!this.nextBtn) return;\n\n\t\tthis.nextBtn.addEventListener('click', () => {\n\t\t\tthis.fireEvent('beforeNext', this.currentIndex);\n\t\t\tdispatch('beforeNext.hs.stepper', this.el, this.currentIndex);\n\n\t\t\tif (this.getNavItem(this.currentIndex)?.isProcessed) {\n\t\t\t\tthis.disableAll();\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthis.goToNext();\n\t\t});\n\t}\n\n\tprivate unsetProcessedNavItemActions(item: IStepperItem) {\n\t\titem.isProcessed = false;\n\n\t\titem.el.classList.remove('processed');\n\t}\n\n\tprivate handleNextButtonClick(infinite = true) {\n\t\tif (infinite) {\n\t\t\tif (this.currentIndex === this.totalSteps) this.currentIndex = 1;\n\t\t\telse this.currentIndex++;\n\t\t} else {\n\t\t\tconst nonCompletedSteps = this.getUncompletedSteps();\n\n\t\t\tif (nonCompletedSteps.length === 1) {\n\t\t\t\tconst { index } = nonCompletedSteps[0];\n\n\t\t\t\tthis.currentIndex = index;\n\t\t\t} else {\n\t\t\t\tif (this.currentIndex === this.totalSteps) return;\n\n\t\t\t\tthis.currentIndex++;\n\t\t\t}\n\t\t}\n\n\t\tif (this.mode === 'linear') {\n\t\t\tthis.removeOptionalClasses();\n\t\t}\n\n\t\tthis.setCurrentNavItem();\n\t\tthis.setCurrentContentItem();\n\n\t\tthis.checkForTheFirstStep();\n\t\tif (this.completeStepBtn)\n\t\t\tthis.changeTextAndDisableCompleteButtonIfStepCompleted();\n\n\t\tthis.showSkipButton();\n\t\tthis.showFinishButton();\n\t\tthis.showCompleteStepButton();\n\n\t\tthis.fireEvent('next', this.currentIndex);\n\t\tdispatch('next.hs.stepper', this.el, this.currentIndex);\n\t}\n\n\tprivate removeOptionalClasses() {\n\t\tconst currentNavItem = this.navItems.find(\n\t\t\t({ index }) => index === this.currentIndex,\n\t\t);\n\t\tconst currentContentItem = this.contentItems.find(\n\t\t\t({ index }) => index === this.currentIndex,\n\t\t);\n\n\t\tcurrentNavItem.isSkip = false;\n\t\tcurrentNavItem.hasError = false;\n\t\tcurrentNavItem.isDisabled = false;\n\t\tcurrentContentItem.isSkip = false;\n\n\t\tcurrentNavItem.el.classList.remove('skipped', 'success', 'error');\n\t\tcurrentContentItem.el.classList.remove('skipped', 'success', 'error');\n\t}\n\n\t// skip\n\tprivate buildSkipButton() {\n\t\tif (!this.skipBtn) return;\n\n\t\tthis.showSkipButton();\n\n\t\tthis.skipBtn.addEventListener('click', () => {\n\t\t\tthis.handleSkipButtonClick();\n\n\t\t\tif (this.mode === 'linear' && this.currentIndex === this.totalSteps) {\n\t\t\t\tif (this.nextBtn) this.nextBtn.style.display = 'none';\n\t\t\t\tif (this.completeStepBtn) this.completeStepBtn.style.display = 'none';\n\t\t\t\tif (this.finishBtn) this.finishBtn.style.display = '';\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate setSkipItem(n?: number) {\n\t\tconst targetNavItem = this.navItems.find(\n\t\t\t({ index }) => index === (n || this.currentIndex),\n\t\t);\n\t\tconst targetContentItem = this.contentItems.find(\n\t\t\t({ index }) => index === (n || this.currentIndex),\n\t\t);\n\n\t\tif (!targetNavItem || !targetContentItem) return;\n\n\t\tthis.setSkipItemActions(targetNavItem);\n\t\tthis.setSkipItemActions(targetContentItem);\n\t}\n\n\tprivate setSkipItemActions(item: IStepperItem) {\n\t\titem.isSkip = true;\n\n\t\titem.el.classList.add('skipped');\n\t}\n\n\tprivate showSkipButton() {\n\t\tif (!this.skipBtn) return;\n\n\t\tconst { isOptional } = this.navItems.find(\n\t\t\t({ index }) => index === this.currentIndex,\n\t\t);\n\n\t\tif (isOptional) this.skipBtn.style.display = '';\n\t\telse this.skipBtn.style.display = 'none';\n\t}\n\n\tprivate handleSkipButtonClick() {\n\t\tthis.setSkipItem();\n\t\tthis.handleNextButtonClick();\n\n\t\tthis.fireEvent('skip', this.currentIndex);\n\t\tdispatch('skip.hs.stepper', this.el, this.currentIndex);\n\t}\n\n\t// complete\n\tprivate buildCompleteStepButton() {\n\t\tif (!this.completeStepBtn) return;\n\n\t\tthis.completeStepBtnDefaultText = this.completeStepBtn.innerText;\n\n\t\tthis.completeStepBtn.addEventListener('click', () =>\n\t\t\tthis.handleCompleteStepButtonClick(),\n\t\t);\n\t}\n\n\tprivate changeTextAndDisableCompleteButtonIfStepCompleted() {\n\t\tconst currentNavItem = this.navItems.find(\n\t\t\t({ index }) => index === this.currentIndex,\n\t\t);\n\t\tconst { completedText } = JSON.parse(\n\t\t\tthis.completeStepBtn.getAttribute('data-hs-stepper-complete-step-btn'),\n\t\t);\n\n\t\tif (!currentNavItem) return;\n\n\t\tif (currentNavItem.isCompleted) {\n\t\t\tthis.completeStepBtn.innerText =\n\t\t\t\tcompletedText || this.completeStepBtnDefaultText;\n\t\t\tthis.completeStepBtn.setAttribute('disabled', 'disabled');\n\t\t\tthis.completeStepBtn.classList.add('disabled');\n\t\t} else {\n\t\t\tthis.completeStepBtn.innerText = this.completeStepBtnDefaultText;\n\t\t\tthis.completeStepBtn.removeAttribute('disabled');\n\t\t\tthis.completeStepBtn.classList.remove('disabled');\n\t\t}\n\t}\n\n\tprivate setCompleteItem(n?: number) {\n\t\tconst targetNavItem = this.navItems.find(\n\t\t\t({ index }) => index === (n || this.currentIndex),\n\t\t);\n\t\tconst targetContentItem = this.contentItems.find(\n\t\t\t({ index }) => index === (n || this.currentIndex),\n\t\t);\n\n\t\tif (!targetNavItem || !targetContentItem) return;\n\n\t\tthis.setCompleteItemActions(targetNavItem);\n\t\tthis.setCompleteItemActions(targetContentItem);\n\t}\n\n\tprivate setCompleteItemActions(item: IStepperItem) {\n\t\titem.isCompleted = true;\n\n\t\titem.el.classList.add('success');\n\t}\n\n\tprivate showCompleteStepButton() {\n\t\tif (!this.completeStepBtn) return;\n\n\t\tconst nonCompletedSteps = this.getUncompletedSteps();\n\n\t\tif (nonCompletedSteps.length === 1)\n\t\t\tthis.completeStepBtn.style.display = 'none';\n\t\telse this.completeStepBtn.style.display = '';\n\t}\n\n\tprivate handleCompleteStepButtonClick() {\n\t\tthis.setCompleteItem();\n\n\t\tthis.fireEvent('complete', this.currentIndex);\n\t\tdispatch('complete.hs.stepper', this.el, this.currentIndex);\n\n\t\tthis.handleNextButtonClick(false);\n\t\tthis.showFinishButton();\n\t\tthis.showCompleteStepButton();\n\t\tthis.checkForTheFirstStep();\n\t\tif (this.completeStepBtn)\n\t\t\tthis.changeTextAndDisableCompleteButtonIfStepCompleted();\n\t\tthis.showSkipButton();\n\t}\n\n\t// finish\n\tprivate buildFinishButton() {\n\t\tif (!this.finishBtn) return;\n\n\t\tif (this.isCompleted) {\n\t\t\tthis.setCompleted();\n\t\t}\n\n\t\tthis.finishBtn.addEventListener('click', () =>\n\t\t\tthis.handleFinishButtonClick(),\n\t\t);\n\t}\n\n\tprivate setCompleted() {\n\t\tthis.el.classList.add('completed');\n\t}\n\n\tprivate unsetCompleted() {\n\t\tthis.el.classList.remove('completed');\n\t}\n\n\tprivate showFinishButton() {\n\t\tif (!this.finishBtn) return;\n\n\t\tconst nonCompletedSteps = this.getUncompletedSteps();\n\n\t\tif (nonCompletedSteps.length === 1) this.finishBtn.style.display = '';\n\t\telse this.finishBtn.style.display = 'none';\n\t}\n\n\tprivate handleFinishButtonClick() {\n\t\tconst uncompletedSteps = this.getUncompletedSteps();\n\t\tconst uncompletedOrSkipSteps = this.getUncompletedSteps(true);\n\t\tconst { el } = this.contentItems.find(({ isFinal }) => isFinal);\n\n\t\tif (uncompletedSteps.length)\n\t\t\tuncompletedSteps.forEach(({ index }) => this.setCompleteItem(index));\n\n\t\tthis.currentIndex = this.totalSteps;\n\n\t\tthis.setCurrentNavItem();\n\t\tthis.hideAllContentItems();\n\n\t\tconst currentNavItem = this.navItems.find(\n\t\t\t({ index }) => index === this.currentIndex,\n\t\t);\n\t\tconst currentNavItemEl = currentNavItem ? currentNavItem.el : null;\n\n\t\tcurrentNavItemEl.classList.remove('active');\n\n\t\tel.style.display = 'block';\n\t\tif (this.backBtn) this.backBtn.style.display = 'none';\n\t\tif (this.nextBtn) this.nextBtn.style.display = 'none';\n\t\tif (this.skipBtn) this.skipBtn.style.display = 'none';\n\t\tif (this.completeStepBtn) this.completeStepBtn.style.display = 'none';\n\t\tif (this.finishBtn) this.finishBtn.style.display = 'none';\n\t\tif (this.resetBtn) this.resetBtn.style.display = '';\n\n\t\tif (uncompletedOrSkipSteps.length <= 1) {\n\t\t\tthis.isCompleted = true;\n\t\t\tthis.setCompleted();\n\t\t}\n\n\t\tthis.fireEvent('finish', this.currentIndex);\n\t\tdispatch('finish.hs.stepper', this.el, this.currentIndex);\n\t}\n\n\t// reset\n\tprivate buildResetButton() {\n\t\tif (!this.resetBtn) return;\n\n\t\tthis.resetBtn.addEventListener('click', () =>\n\t\t\tthis.handleResetButtonClick(),\n\t\t);\n\t}\n\n\tprivate handleResetButtonClick() {\n\t\tif (this.backBtn) this.backBtn.style.display = '';\n\t\tif (this.nextBtn) this.nextBtn.style.display = '';\n\t\tif (this.completeStepBtn) {\n\t\t\tthis.completeStepBtn.style.display = '';\n\t\t\tthis.completeStepBtn.innerText = this.completeStepBtnDefaultText;\n\t\t\tthis.completeStepBtn.removeAttribute('disabled');\n\t\t\tthis.completeStepBtn.classList.remove('disabled');\n\t\t}\n\t\tif (this.resetBtn) this.resetBtn.style.display = 'none';\n\n\t\tthis.navItems.forEach((item) => {\n\t\t\tconst { el } = item;\n\t\t\titem.isSkip = false;\n\t\t\titem.isCompleted = false;\n\n\t\t\tthis.unsetCurrentNavItemActions(el);\n\t\t\tel.classList.remove('success', 'skipped');\n\t\t});\n\n\t\tthis.contentItems.forEach((item) => {\n\t\t\tconst { el } = item;\n\t\t\titem.isSkip = false;\n\t\t\titem.isCompleted = false;\n\n\t\t\tthis.unsetCurrentContentItemActions(el);\n\t\t\tel.classList.remove('success', 'skipped');\n\t\t});\n\n\t\tthis.currentIndex = 1;\n\n\t\tthis.setCurrentNavItem();\n\t\tthis.setCurrentContentItem();\n\t\tthis.showFinishButton();\n\t\tthis.showCompleteStepButton();\n\t\tthis.checkForTheFirstStep();\n\n\t\tthis.unsetCompleted();\n\t\tthis.isCompleted = false;\n\n\t\tthis.fireEvent('reset', this.currentIndex);\n\t\tdispatch('reset.hs.stepper', this.el, this.currentIndex);\n\t}\n\n\t// Public methods\n\tpublic setProcessedNavItem(n?: number) {\n\t\tconst targetNavItem = this.getNavItem(n);\n\n\t\tif (!targetNavItem) return;\n\n\t\tthis.setProcessedNavItemActions(targetNavItem);\n\t}\n\n\tpublic unsetProcessedNavItem(n?: number) {\n\t\tconst targetNavItem = this.getNavItem(n);\n\n\t\tif (!targetNavItem) return;\n\n\t\tthis.unsetProcessedNavItemActions(targetNavItem);\n\t}\n\n\tpublic goToNext() {\n\t\tif (this.mode === 'linear') this.setCompleteItem();\n\n\t\tthis.handleNextButtonClick(this.mode !== 'linear');\n\n\t\tif (this.mode === 'linear' && this.currentIndex === this.totalSteps) {\n\t\t\tif (this.nextBtn) this.nextBtn.style.display = 'none';\n\t\t\tif (this.completeStepBtn) this.completeStepBtn.style.display = 'none';\n\t\t}\n\t}\n\n\tpublic disableButtons() {\n\t\tif (this.backBtn) this.setToDisabled(this.backBtn);\n\t\tif (this.nextBtn) this.setToDisabled(this.nextBtn);\n\t}\n\n\tpublic enableButtons() {\n\t\tif (this.backBtn) this.setToNonDisabled(this.backBtn);\n\t\tif (this.nextBtn) this.setToNonDisabled(this.nextBtn);\n\t}\n\n\tpublic setErrorNavItem(n?: number) {\n\t\tconst targetNavItem = this.getNavItem(n);\n\n\t\tif (!targetNavItem) return;\n\n\t\tthis.setErrorNavItemActions(targetNavItem);\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsStepperCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsStepperCollection) window.$hsStepperCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-stepper]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsStepperCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSStepper(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSStepper: Function;\n\t\t$hsStepperCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSStepper.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Stepper collection:', window.$hsStepperCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSStepper = HSStepper;\n}\n\nexport default HSStepper;\n","/*\n * HSStrongPassword\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport {\n\tisEnoughSpace,\n\tdispatch,\n\thtmlToElement,\n\tclassToClassList,\n} from '../../utils';\n\nimport { IStrongPasswordOptions, IStrongPassword } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSStrongPassword\n\textends HSBasePlugin\n\timplements IStrongPassword\n{\n\tprivate readonly target: string | HTMLInputElement | null;\n\tprivate readonly hints: string | HTMLElement | null;\n\tprivate readonly stripClasses: string | null;\n\tprivate readonly minLength: number;\n\tprivate readonly mode: string;\n\tprivate readonly popoverSpace: number;\n\tprivate readonly checksExclude: string[] | null;\n\tprivate readonly specialCharactersSet: string | null;\n\n\tpublic isOpened: boolean = false;\n\tprivate strength: number = 0;\n\tprivate passedRules: Set = new Set();\n\tprivate weakness: HTMLElement | null;\n\tprivate rules: HTMLElement[] | null;\n\tprivate availableChecks: string[] | null;\n\n\tconstructor(el: HTMLElement, options?: IStrongPasswordOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-strong-password');\n\t\tconst dataOptions: IStrongPasswordOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.target = concatOptions?.target\n\t\t\t? typeof concatOptions?.target === 'string'\n\t\t\t\t? (document.querySelector(concatOptions.target) as HTMLInputElement)\n\t\t\t\t: concatOptions.target\n\t\t\t: null;\n\t\tthis.hints = concatOptions?.hints\n\t\t\t? typeof concatOptions?.hints === 'string'\n\t\t\t\t? (document.querySelector(concatOptions.hints) as HTMLElement)\n\t\t\t\t: concatOptions.hints\n\t\t\t: null;\n\t\tthis.stripClasses = concatOptions?.stripClasses || null;\n\t\tthis.minLength = concatOptions?.minLength || 6;\n\t\tthis.mode = concatOptions?.mode || 'default';\n\t\tthis.popoverSpace = concatOptions?.popoverSpace || 10;\n\t\tthis.checksExclude = concatOptions?.checksExclude || [];\n\t\tthis.availableChecks = [\n\t\t\t'lowercase',\n\t\t\t'uppercase',\n\t\t\t'numbers',\n\t\t\t'special-characters',\n\t\t\t'min-length',\n\t\t].filter((el) => !this.checksExclude.includes(el));\n\t\tthis.specialCharactersSet =\n\t\t\tconcatOptions?.specialCharactersSet ||\n\t\t\t'!\"#$%&\\'()*+,-./:;<=>?@[\\\\\\\\\\\\]^_`{|}~';\n\n\t\tif (this.target) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsStrongPasswordCollection, this);\n\n\t\tif (this.availableChecks.length) this.build();\n\t}\n\n\tprivate build() {\n\t\tthis.buildStrips();\n\t\tif (this.hints) this.buildHints();\n\n\t\tthis.setStrength((this.target as HTMLInputElement).value);\n\n\t\t(this.target as HTMLInputElement).addEventListener(\n\t\t\t'input',\n\t\t\t(evt: InputEvent) => {\n\t\t\t\tthis.setStrength((evt.target as HTMLInputElement).value);\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate buildStrips() {\n\t\tthis.el.innerHTML = '';\n\n\t\tif (this.stripClasses) {\n\t\t\tfor (let i = 0; i < this.availableChecks.length; i++) {\n\t\t\t\tconst newStrip = htmlToElement('
');\n\t\t\t\tclassToClassList(this.stripClasses, newStrip);\n\n\t\t\t\tthis.el.append(newStrip);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate buildHints() {\n\t\tthis.weakness =\n\t\t\t(this.hints as HTMLElement).querySelector(\n\t\t\t\t'[data-hs-strong-password-hints-weakness-text]',\n\t\t\t) || null;\n\t\tthis.rules =\n\t\t\tArray.from(\n\t\t\t\t(this.hints as HTMLElement).querySelectorAll(\n\t\t\t\t\t'[data-hs-strong-password-hints-rule-text]',\n\t\t\t\t),\n\t\t\t) || null;\n\n\t\tthis.rules.forEach((rule) => {\n\t\t\tconst ruleValue = rule.getAttribute(\n\t\t\t\t'data-hs-strong-password-hints-rule-text',\n\t\t\t);\n\n\t\t\tif (this.checksExclude?.includes(ruleValue)) rule.remove();\n\t\t});\n\n\t\tif (this.weakness) this.buildWeakness();\n\t\tif (this.rules) this.buildRules();\n\t\tif (this.mode === 'popover') {\n\t\t\t(this.target as HTMLInputElement).addEventListener('focus', () => {\n\t\t\t\tthis.isOpened = true;\n\t\t\t\t(this.hints as HTMLElement).classList.remove('hidden');\n\t\t\t\t(this.hints as HTMLElement).classList.add('block');\n\n\t\t\t\tthis.recalculateDirection();\n\t\t\t});\n\n\t\t\t(this.target as HTMLInputElement).addEventListener('blur', () => {\n\t\t\t\tthis.isOpened = false;\n\t\t\t\t(this.hints as HTMLElement).classList.remove(\n\t\t\t\t\t'block',\n\t\t\t\t\t'bottom-full',\n\t\t\t\t\t'top-full',\n\t\t\t\t);\n\t\t\t\t(this.hints as HTMLElement).classList.add('hidden');\n\t\t\t\t(this.hints as HTMLElement).style.marginTop = '';\n\t\t\t\t(this.hints as HTMLElement).style.marginBottom = '';\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate buildWeakness() {\n\t\tthis.checkStrength((this.target as HTMLInputElement).value);\n\t\tthis.setWeaknessText();\n\n\t\t(this.target as HTMLInputElement).addEventListener('input', () =>\n\t\t\tsetTimeout(() => this.setWeaknessText()),\n\t\t);\n\t}\n\n\tprivate buildRules() {\n\t\tthis.setRulesText();\n\n\t\t(this.target as HTMLInputElement).addEventListener('input', () =>\n\t\t\tsetTimeout(() => this.setRulesText()),\n\t\t);\n\t}\n\n\tprivate setWeaknessText() {\n\t\tconst weaknessText = this.weakness.getAttribute(\n\t\t\t'data-hs-strong-password-hints-weakness-text',\n\t\t);\n\t\tconst weaknessTextToJson = JSON.parse(weaknessText as string);\n\n\t\tthis.weakness.textContent = weaknessTextToJson[this.strength];\n\t}\n\n\tprivate setRulesText() {\n\t\tthis.rules.forEach((rule) => {\n\t\t\tconst ruleValue = rule.getAttribute(\n\t\t\t\t'data-hs-strong-password-hints-rule-text',\n\t\t\t);\n\n\t\t\tthis.checkIfPassed(rule, this.passedRules.has(ruleValue));\n\t\t});\n\t}\n\n\tprivate togglePopover() {\n\t\tconst popover = this.el.querySelector('.popover');\n\n\t\tif (popover) popover.classList.toggle('show');\n\t}\n\n\tprivate checkStrength(val: string): { strength: number; rules: Set } {\n\t\tconst passedRules = new Set();\n\t\tconst regexps = {\n\t\t\tlowercase: /[a-z]+/,\n\t\t\tuppercase: /[A-Z]+/,\n\t\t\tnumbers: /[0-9]+/,\n\t\t\t'special-characters': new RegExp(`[${this.specialCharactersSet}]`),\n\t\t};\n\t\tlet strength = 0;\n\n\t\tif (\n\t\t\tthis.availableChecks.includes('lowercase') &&\n\t\t\tval.match(regexps['lowercase'])\n\t\t) {\n\t\t\tstrength += 1;\n\t\t\tpassedRules.add('lowercase');\n\t\t}\n\t\tif (\n\t\t\tthis.availableChecks.includes('uppercase') &&\n\t\t\tval.match(regexps['uppercase'])\n\t\t) {\n\t\t\tstrength += 1;\n\t\t\tpassedRules.add('uppercase');\n\t\t}\n\t\tif (\n\t\t\tthis.availableChecks.includes('numbers') &&\n\t\t\tval.match(regexps['numbers'])\n\t\t) {\n\t\t\tstrength += 1;\n\t\t\tpassedRules.add('numbers');\n\t\t}\n\t\tif (\n\t\t\tthis.availableChecks.includes('special-characters') &&\n\t\t\tval.match(regexps['special-characters'])\n\t\t) {\n\t\t\tstrength += 1;\n\t\t\tpassedRules.add('special-characters');\n\t\t}\n\t\tif (\n\t\t\tthis.availableChecks.includes('min-length') &&\n\t\t\tval.length >= this.minLength\n\t\t) {\n\t\t\tstrength += 1;\n\t\t\tpassedRules.add('min-length');\n\t\t}\n\t\tif (!val.length) {\n\t\t\tstrength = 0;\n\t\t}\n\n\t\tif (strength === this.availableChecks.length)\n\t\t\tthis.el.classList.add('accepted');\n\t\telse this.el.classList.remove('accepted');\n\n\t\tthis.strength = strength;\n\t\tthis.passedRules = passedRules;\n\n\t\treturn {\n\t\t\tstrength: this.strength,\n\t\t\trules: this.passedRules,\n\t\t};\n\t}\n\n\tprivate checkIfPassed(el: HTMLElement, isRulePassed = false) {\n\t\tconst check = el.querySelector('[data-check]');\n\t\tconst uncheck = el.querySelector('[data-uncheck]');\n\n\t\tif (isRulePassed) {\n\t\t\tel.classList.add('active');\n\t\t\tcheck.classList.remove('hidden');\n\t\t\tuncheck.classList.add('hidden');\n\t\t} else {\n\t\t\tel.classList.remove('active');\n\t\t\tcheck.classList.add('hidden');\n\t\t\tuncheck.classList.remove('hidden');\n\t\t}\n\t}\n\n\tprivate setStrength(val: string) {\n\t\tconst { strength, rules } = this.checkStrength(val);\n\t\tconst payload = {\n\t\t\tstrength,\n\t\t\trules,\n\t\t};\n\n\t\tthis.hideStrips(strength);\n\n\t\tthis.fireEvent('change', payload);\n\t\tdispatch('change.hs.strongPassword', this.el, payload);\n\t}\n\n\tprivate hideStrips(qty: number) {\n\t\tArray.from(this.el.children).forEach((el: HTMLElement, i: number) => {\n\t\t\tif (i < qty) el.classList.add('passed');\n\t\t\telse el.classList.remove('passed');\n\t\t});\n\t}\n\n\t// Public methods\n\tpublic recalculateDirection() {\n\t\tif (\n\t\t\tisEnoughSpace(\n\t\t\t\tthis.hints as HTMLElement,\n\t\t\t\tthis.target as HTMLInputElement,\n\t\t\t\t'bottom',\n\t\t\t\tthis.popoverSpace,\n\t\t\t)\n\t\t) {\n\t\t\t(this.hints as HTMLElement).classList.remove('bottom-full');\n\t\t\t(this.hints as HTMLElement).classList.add('top-full');\n\t\t\t(this.hints as HTMLElement).style.marginBottom = '';\n\t\t\t(this.hints as HTMLElement).style.marginTop = `${this.popoverSpace}px`;\n\t\t} else {\n\t\t\t(this.hints as HTMLElement).classList.remove('top-full');\n\t\t\t(this.hints as HTMLElement).classList.add('bottom-full');\n\t\t\t(this.hints as HTMLElement).style.marginTop = '';\n\t\t\t(this.hints as HTMLElement).style.marginBottom = `${this.popoverSpace}px`;\n\t\t}\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string) {\n\t\tconst elInCollection = window.$hsStrongPasswordCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection ? elInCollection.element : null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsStrongPasswordCollection)\n\t\t\twindow.$hsStrongPasswordCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll(\n\t\t\t\t'[data-hs-strong-password]:not(.--prevent-on-load-init)',\n\t\t\t)\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsStrongPasswordCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst data = el.getAttribute('data-hs-strong-password');\n\t\t\t\t\tconst options: IStrongPasswordOptions = data ? JSON.parse(data) : {};\n\n\t\t\t\t\tnew HSStrongPassword(el, options);\n\t\t\t\t}\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSStrongPassword: Function;\n\t\t$hsStrongPasswordCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSStrongPassword.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Strong password collection:', window.$hsStrongPasswordCollection);\n});\n\ndocument.addEventListener('scroll', () => {\n\tif (!window.$hsStrongPasswordCollection) return false;\n\n\tconst target = window.$hsStrongPasswordCollection.find(\n\t\t(el) => el.element.isOpened,\n\t);\n\n\tif (target) target.element.recalculateDirection();\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSStrongPassword = HSStrongPassword;\n}\n\nexport default HSStrongPassword;\n","/*\n * HSTabs\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { dispatch } from '../../utils';\n\nimport { ITabs } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nimport { TABS_ACCESSIBILITY_KEY_SET } from '../../constants';\n\nclass HSTabs extends HSBasePlugin<{}> implements ITabs {\n\tpublic toggles: NodeListOf | null;\n\tprivate readonly extraToggleId: string | null;\n\tprivate readonly extraToggle: HTMLSelectElement | null;\n\tprivate current: HTMLElement | null;\n\tprivate currentContentId: string | null;\n\tpublic currentContent: HTMLElement | null;\n\tprivate prev: HTMLElement | null;\n\tprivate prevContentId: string | null;\n\tprivate prevContent: HTMLElement | null;\n\n\tconstructor(el: HTMLElement, options?: {}, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tthis.toggles = this.el.querySelectorAll('[data-hs-tab]');\n\t\tthis.extraToggleId = this.el.getAttribute('data-hs-tab-select');\n\t\tthis.extraToggle = document.querySelector(this.extraToggleId);\n\t\tthis.current = Array.from(this.toggles).find((el) =>\n\t\t\tel.classList.contains('active'),\n\t\t);\n\t\tthis.currentContentId = this.current.getAttribute('data-hs-tab');\n\t\tthis.currentContent = document.querySelector(this.currentContentId);\n\t\tthis.prev = null;\n\t\tthis.prevContentId = null;\n\t\tthis.prevContent = null;\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsTabsCollection, this);\n\n\t\tthis.toggles.forEach((el) => {\n\t\t\tel.addEventListener('click', () => this.open(el));\n\t\t});\n\n\t\tif (this.extraToggle) {\n\t\t\tthis.extraToggle.addEventListener('change', (evt) => this.change(evt));\n\t\t}\n\t}\n\n\tprivate open(el: HTMLElement) {\n\t\tthis.prev = this.current;\n\t\tthis.prevContentId = this.currentContentId;\n\t\tthis.prevContent = this.currentContent;\n\n\t\tthis.current = el;\n\t\tthis.currentContentId = this.current.getAttribute('data-hs-tab');\n\t\tthis.currentContent = document.querySelector(this.currentContentId);\n\n\t\tif (this?.prev?.ariaSelected) this.prev.ariaSelected = 'false';\n\t\tthis.prev.classList.remove('active');\n\t\tthis.prevContent.classList.add('hidden');\n\n\t\tif (this?.current?.ariaSelected) this.current.ariaSelected = 'true';\n\t\tthis.current.classList.add('active');\n\t\tthis.currentContent.classList.remove('hidden');\n\n\t\tthis.fireEvent('change', {\n\t\t\tel,\n\t\t\tprev: this.prevContentId,\n\t\t\tcurrent: this.currentContentId,\n\t\t});\n\t\tdispatch('change.hs.tab', el, {\n\t\t\tel,\n\t\t\tprev: this.prevContentId,\n\t\t\tcurrent: this.currentContentId,\n\t\t});\n\t}\n\n\tprivate change(evt: Event) {\n\t\tconst toggle: HTMLElement = document.querySelector(\n\t\t\t`[data-hs-tab=\"${(evt.target as HTMLSelectElement).value}\"]`,\n\t\t);\n\n\t\tif (toggle) toggle.click();\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsTabsCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsTabsCollection) window.$hsTabsCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll(\n\t\t\t\t'[role=\"tablist\"]:not(select):not(.--prevent-on-load-init)',\n\t\t\t)\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsTabsCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSTabs(el);\n\t\t\t});\n\n\t\tif (window.$hsTabsCollection)\n\t\t\tdocument.addEventListener('keydown', (evt) => HSTabs.accessibility(evt));\n\t}\n\n\tstatic open(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsTabsCollection.find((el) =>\n\t\t\tArray.from(el.element.toggles).includes(\n\t\t\t\ttypeof target === 'string' ? document.querySelector(target) : target,\n\t\t\t),\n\t\t);\n\t\tconst targetInCollection = Array.from(elInCollection.element.toggles).find(\n\t\t\t(el) =>\n\t\t\t\tel ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (targetInCollection && !targetInCollection.classList.contains('active'))\n\t\t\telInCollection.element.open(targetInCollection);\n\t}\n\n\t// Accessibility methods\n\tstatic accessibility(evt: KeyboardEvent) {\n\t\tconst target = document.querySelector('[data-hs-tab]:focus');\n\n\t\tif (\n\t\t\ttarget &&\n\t\t\tTABS_ACCESSIBILITY_KEY_SET.includes(evt.code) &&\n\t\t\t!evt.metaKey\n\t\t) {\n\t\t\tconst isVertical = target\n\t\t\t\t.closest('[role=\"tablist\"]')\n\t\t\t\t.getAttribute('data-hs-tabs-vertical');\n\n\t\t\tevt.preventDefault();\n\n\t\t\tswitch (evt.code) {\n\t\t\t\tcase isVertical === 'true' ? 'ArrowUp' : 'ArrowLeft':\n\t\t\t\t\tthis.onArrow();\n\t\t\t\t\tbreak;\n\t\t\t\tcase isVertical === 'true' ? 'ArrowDown' : 'ArrowRight':\n\t\t\t\t\tthis.onArrow(false);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Home':\n\t\t\t\t\tthis.onStartEnd();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'End':\n\t\t\t\t\tthis.onStartEnd(false);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic onArrow(isOpposite = true) {\n\t\tconst target = document\n\t\t\t.querySelector('[data-hs-tab]:focus')\n\t\t\t.closest('[role=\"tablist\"]');\n\t\tconst targetInCollection = window.$hsTabsCollection.find(\n\t\t\t(el) => el.element.el === target,\n\t\t);\n\n\t\tif (targetInCollection) {\n\t\t\tconst toggles = isOpposite\n\t\t\t\t? Array.from(targetInCollection.element.toggles).reverse()\n\t\t\t\t: Array.from(targetInCollection.element.toggles);\n\t\t\tconst focused = toggles.find((el) => document.activeElement === el);\n\t\t\tlet focusedInd = toggles.findIndex((el: any) => el === focused);\n\t\t\tfocusedInd = focusedInd + 1 < toggles.length ? focusedInd + 1 : 0;\n\n\t\t\ttoggles[focusedInd].focus();\n\t\t\ttoggles[focusedInd].click();\n\t\t}\n\t}\n\n\tstatic onStartEnd(isOpposite = true) {\n\t\tconst target = document\n\t\t\t.querySelector('[data-hs-tab]:focus')\n\t\t\t.closest('[role=\"tablist\"]');\n\t\tconst targetInCollection = window.$hsTabsCollection.find(\n\t\t\t(el) => el.element.el === target,\n\t\t);\n\n\t\tif (targetInCollection) {\n\t\t\tconst toggles = isOpposite\n\t\t\t\t? Array.from(targetInCollection.element.toggles)\n\t\t\t\t: Array.from(targetInCollection.element.toggles).reverse();\n\n\t\t\tif (toggles.length) {\n\t\t\t\ttoggles[0].focus();\n\t\t\t\ttoggles[0].click();\n\t\t\t}\n\t\t}\n\t}\n\n\t// Backward compatibility\n\tstatic on(evt: string, target: HTMLElement, cb: Function) {\n\t\tconst elInCollection = window.$hsTabsCollection.find((el) =>\n\t\t\tArray.from(el.element.toggles).includes(\n\t\t\t\ttypeof target === 'string' ? document.querySelector(target) : target,\n\t\t\t),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.events[evt] = cb;\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSTabs: Function;\n\t\t$hsTabsCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSTabs.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Tabs collection:', window.$hsTabsCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSTabs = HSTabs;\n}\n\nexport default HSTabs;\n","/*\n * HSThemeSwitch\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\nimport { IThemeSwitchOptions, IThemeSwitch } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSThemeSwitch\n\textends HSBasePlugin\n\timplements IThemeSwitch\n{\n\tpublic theme: string;\n\tprivate readonly themeSet: string[];\n\n\tconstructor(el: HTMLElement, options?: IThemeSwitchOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-theme-switch');\n\t\tconst dataOptions: IThemeSwitchOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.theme =\n\t\t\tconcatOptions?.theme || localStorage.getItem('hs_theme') || 'default';\n\t\tthis.themeSet = ['light', 'dark', 'default'];\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsThemeSwitchCollection, this);\n\n\t\tif (this.theme !== 'default') this.setAppearance();\n\t}\n\n\tprivate setResetStyles() {\n\t\tconst style = document.createElement('style');\n\n\t\tstyle.innerText = `*{transition: unset !important;}`;\n\t\tstyle.setAttribute('data-hs-appearance-onload-styles', '');\n\n\t\tdocument.head.appendChild(style);\n\n\t\treturn style;\n\t}\n\n\tprivate addSystemThemeObserver() {\n\t\twindow\n\t\t\t.matchMedia('(prefers-color-scheme: dark)')\n\t\t\t.addEventListener('change', ({ matches }) => {\n\t\t\t\tif (matches) this.setAppearance('dark', false);\n\t\t\t\telse this.setAppearance('default', false);\n\t\t\t});\n\t}\n\n\tprivate removeSystemThemeObserver() {\n\t\twindow.matchMedia('(prefers-color-scheme: dark)').removeEventListener;\n\t}\n\n\t// Public methods\n\tpublic setAppearance(\n\t\ttheme = this.theme,\n\t\tisSaveToLocalStorage = true,\n\t\tisSetDispatchEvent = true,\n\t) {\n\t\tconst html = document.querySelector('html');\n\t\tconst resetStyles = this.setResetStyles();\n\n\t\tif (isSaveToLocalStorage) localStorage.setItem('hs_theme', theme);\n\t\tif (theme === 'auto')\n\t\t\ttheme = window.matchMedia('(prefers-color-scheme: dark)').matches\n\t\t\t\t? 'dark'\n\t\t\t\t: 'default';\n\n\t\thtml.classList.remove('light', 'dark', 'default', 'auto');\n\t\thtml.classList.add(theme);\n\n\t\tsetTimeout(() => resetStyles.remove());\n\n\t\tif (isSetDispatchEvent)\n\t\t\twindow.dispatchEvent(\n\t\t\t\tnew CustomEvent('on-hs-appearance-change', { detail: theme }),\n\t\t\t);\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string) {\n\t\tconst elInCollection = window.$hsThemeSwitchCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection ? elInCollection.element : null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsThemeSwitchCollection) window.$hsThemeSwitchCollection = [];\n\n\t\tconst toggleObserveSystemTheme = (el: HSThemeSwitch) => {\n\t\t\tif (localStorage.getItem('hs_theme') === 'auto')\n\t\t\t\tel.addSystemThemeObserver();\n\t\t\telse el.removeSystemThemeObserver();\n\t\t};\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-theme-switch]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsThemeSwitchCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst switchTheme = new HSThemeSwitch(el);\n\t\t\t\t\t(switchTheme.el as HTMLInputElement).checked =\n\t\t\t\t\t\tswitchTheme.theme === 'dark';\n\n\t\t\t\t\ttoggleObserveSystemTheme(switchTheme);\n\n\t\t\t\t\tswitchTheme.el.addEventListener('change', (evt) => {\n\t\t\t\t\t\tconst theme = (evt.target as HTMLInputElement).checked\n\t\t\t\t\t\t\t? 'dark'\n\t\t\t\t\t\t\t: 'default';\n\t\t\t\t\t\tswitchTheme.setAppearance(theme);\n\n\t\t\t\t\t\ttoggleObserveSystemTheme(switchTheme);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\n\t\tdocument\n\t\t\t.querySelectorAll(\n\t\t\t\t'[data-hs-theme-click-value]:not(.--prevent-on-load-init)',\n\t\t\t)\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tconst theme = el.getAttribute('data-hs-theme-click-value');\n\t\t\t\tconst switchTheme = new HSThemeSwitch(el);\n\n\t\t\t\ttoggleObserveSystemTheme(switchTheme);\n\n\t\t\t\tswitchTheme.el.addEventListener('click', () => {\n\t\t\t\t\tswitchTheme.setAppearance(theme);\n\n\t\t\t\t\ttoggleObserveSystemTheme(switchTheme);\n\t\t\t\t});\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSThemeSwitch: Function;\n\t\t$hsThemeSwitchCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSThemeSwitch.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Theme switch collection:', window.$hsThemeSwitchCollection);\n});\n\nif (window.$hsThemeSwitchCollection) {\n\twindow.addEventListener(\n\t\t'on-hs-appearance-change',\n\t\t(evt: Event & { detail: string }) => {\n\t\t\twindow.$hsThemeSwitchCollection.forEach((el) => {\n\t\t\t\t(el.element.el as HTMLInputElement).checked = evt.detail === 'dark';\n\t\t\t});\n\t\t},\n\t);\n}\n\nif (typeof window !== 'undefined') {\n\twindow.HSThemeSwitch = HSThemeSwitch;\n}\n\nexport default HSThemeSwitch;\n","/*\n * HSToggleCount\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { IToggleCountOptions, IToggleCount } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSToggleCount\n\textends HSBasePlugin\n\timplements IToggleCount\n{\n\tprivate readonly target: HTMLInputElement | null;\n\tprivate readonly min: number | null;\n\tprivate readonly max: number | null;\n\tprivate readonly duration: number | null;\n\tprivate isChecked: boolean;\n\n\tconstructor(el: HTMLElement, options?: IToggleCountOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-toggle-count');\n\t\tconst dataOptions: IToggleCountOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.target = concatOptions?.target\n\t\t\t? typeof concatOptions?.target === 'string'\n\t\t\t\t? (document.querySelector(concatOptions.target) as HTMLInputElement)\n\t\t\t\t: concatOptions.target\n\t\t\t: null;\n\t\tthis.min = concatOptions?.min || 0;\n\t\tthis.max = concatOptions?.max || 0;\n\t\tthis.duration = concatOptions?.duration || 700;\n\n\t\tthis.isChecked = (this.target as HTMLInputElement).checked || false;\n\n\t\tif (this.target) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsToggleCountCollection, this);\n\n\t\tif (this.isChecked) this.el.innerText = String(this.max);\n\n\t\tthis.target.addEventListener('change', () => {\n\t\t\tthis.isChecked = !this.isChecked;\n\n\t\t\tthis.toggle();\n\t\t});\n\t}\n\n\tprivate toggle() {\n\t\tif (this.isChecked) this.countUp();\n\t\telse this.countDown();\n\t}\n\n\tprivate animate(from: number, to: number) {\n\t\tlet startTimestamp = 0;\n\n\t\tconst step = (timestamp: number) => {\n\t\t\tif (!startTimestamp) startTimestamp = timestamp;\n\t\t\tconst progress = Math.min(\n\t\t\t\t(timestamp - startTimestamp) / this.duration,\n\t\t\t\t1,\n\t\t\t);\n\n\t\t\tthis.el.innerText = String(Math.floor(progress * (to - from) + from));\n\n\t\t\tif (progress < 1) window.requestAnimationFrame(step);\n\t\t};\n\n\t\twindow.requestAnimationFrame(step);\n\t}\n\n\t// Public methods\n\tpublic countUp() {\n\t\tthis.animate(this.min, this.max);\n\t}\n\n\tpublic countDown() {\n\t\tthis.animate(this.max, this.min);\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsToggleCountCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsToggleCountCollection) window.$hsToggleCountCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-toggle-count]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsToggleCountCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSToggleCount(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSToggleCount: Function;\n\t\t$hsToggleCountCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSToggleCount.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Toggle count collection:', window.$hsToggleCountCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSToggleCount = HSToggleCount;\n}\n\nexport default HSToggleCount;\n","/*\n * HSTogglePassword\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { isFormElement, dispatch } from '../../utils';\n\nimport { ITogglePasswordOptions, ITogglePassword } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nclass HSTogglePassword\n\textends HSBasePlugin\n\timplements ITogglePassword\n{\n\tprivate readonly target:\n\t\t| string\n\t\t| string[]\n\t\t| HTMLInputElement\n\t\t| HTMLInputElement[]\n\t\t| null;\n\tprivate isShown: boolean;\n\tprivate isMultiple: boolean;\n\tprivate eventType: string;\n\n\tconstructor(el: HTMLElement, options?: ITogglePasswordOptions) {\n\t\tsuper(el, options);\n\n\t\tconst data = el.getAttribute('data-hs-toggle-password');\n\t\tconst dataOptions: ITogglePasswordOptions = data ? JSON.parse(data) : {};\n\t\tconst concatOptions = {\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\t\tconst targets: HTMLInputElement[] = [];\n\t\tif (concatOptions?.target && typeof concatOptions?.target === 'string') {\n\t\t\tconst ids = concatOptions?.target.split(',');\n\t\t\tids.forEach((id) => {\n\t\t\t\ttargets.push(document.querySelector(id) as HTMLInputElement);\n\t\t\t});\n\t\t} else if (\n\t\t\tconcatOptions?.target &&\n\t\t\ttypeof concatOptions?.target === 'object'\n\t\t) {\n\t\t\t(concatOptions.target as string[]).forEach((el) =>\n\t\t\t\ttargets.push(document.querySelector(el)),\n\t\t\t);\n\t\t} else {\n\t\t\t(concatOptions.target as HTMLInputElement[]).forEach((el) =>\n\t\t\t\ttargets.push(el),\n\t\t\t);\n\t\t}\n\n\t\tthis.target = targets;\n\t\tthis.isShown = this.el.hasAttribute('type')\n\t\t\t? (this.el as HTMLInputElement).checked\n\t\t\t: false;\n\t\tthis.eventType = isFormElement(this.el) ? 'change' : 'click';\n\t\tthis.isMultiple =\n\t\t\tthis.target.length > 1 &&\n\t\t\t!!this.el.closest('[data-hs-toggle-password-group]');\n\n\t\tif (this.target) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsTogglePasswordCollection, this);\n\n\t\tif (!this.isShown) {\n\t\t\tthis.hide();\n\t\t} else {\n\t\t\tthis.show();\n\t\t}\n\n\t\tthis.el.addEventListener(this.eventType, () => {\n\t\t\tif (this.isShown) {\n\t\t\t\tthis.hide();\n\t\t\t} else {\n\t\t\t\tthis.show();\n\t\t\t}\n\n\t\t\tthis.fireEvent('toggle', this.target);\n\t\t\tdispatch('toggle.hs.toggle-select', this.el, this.target);\n\t\t});\n\t}\n\n\tprivate getMultipleToggles(): HSTogglePassword[] {\n\t\tconst group = this.el.closest('[data-hs-toggle-password-group]');\n\t\tconst toggles = group.querySelectorAll('[data-hs-toggle-password]');\n\t\tconst togglesInCollection: HSTogglePassword[] = [];\n\n\t\ttoggles.forEach((el: HTMLElement) => {\n\t\t\ttogglesInCollection.push(\n\t\t\t\tHSTogglePassword.getInstance(el) as HSTogglePassword,\n\t\t\t);\n\t\t});\n\n\t\treturn togglesInCollection;\n\t}\n\n\t// Public methods\n\tpublic show() {\n\t\tif (this.isMultiple) {\n\t\t\tconst toggles = this.getMultipleToggles();\n\n\t\t\ttoggles.forEach((el: HSTogglePassword) =>\n\t\t\t\tel ? (el.isShown = true) : false,\n\t\t\t);\n\n\t\t\tthis.el\n\t\t\t\t.closest('[data-hs-toggle-password-group]')\n\t\t\t\t.classList.add('active');\n\t\t} else {\n\t\t\tthis.isShown = true;\n\n\t\t\tthis.el.classList.add('active');\n\t\t}\n\t\t(this.target as HTMLInputElement[]).forEach((el) => {\n\t\t\t(el as HTMLInputElement).type = 'text';\n\t\t});\n\t}\n\n\tpublic hide() {\n\t\tif (this.isMultiple) {\n\t\t\tconst toggles = this.getMultipleToggles();\n\n\t\t\ttoggles.forEach((el: HSTogglePassword) =>\n\t\t\t\tel ? (el.isShown = false) : false,\n\t\t\t);\n\n\t\t\tthis.el\n\t\t\t\t.closest('[data-hs-toggle-password-group]')\n\t\t\t\t.classList.remove('active');\n\t\t} else {\n\t\t\tthis.isShown = false;\n\n\t\t\tthis.el.classList.remove('active');\n\t\t}\n\t\t(this.target as HTMLInputElement[]).forEach((el) => {\n\t\t\t(el as HTMLInputElement).type = 'password';\n\t\t});\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsTogglePasswordCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsTogglePasswordCollection)\n\t\t\twindow.$hsTogglePasswordCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll(\n\t\t\t\t'[data-hs-toggle-password]:not(.--prevent-on-load-init)',\n\t\t\t)\n\t\t\t.forEach((el: HTMLInputElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsTogglePasswordCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSTogglePassword(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSTogglePassword: Function;\n\t\t$hsTogglePasswordCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSTogglePassword.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Toggle password collection:', window.$hsTogglePasswordCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSTogglePassword = HSTogglePassword;\n}\n\nexport default HSTogglePassword;\n","/*\n * HSTooltip\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { createPopper, PositioningStrategy, Instance } from '@popperjs/core';\nimport { getClassProperty, dispatch, afterTransition } from '../../utils';\n\nimport { ITooltip } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\nimport { POSITIONS } from '../../constants';\n\nclass HSTooltip extends HSBasePlugin<{}> implements ITooltip {\n\tprivate readonly toggle: HTMLElement | null;\n\tpublic content: HTMLElement | null;\n\treadonly eventMode: string;\n\tprivate readonly preventPopper: string;\n\tprivate popperInstance: Instance;\n\tprivate readonly placement: string;\n\tprivate readonly strategy: PositioningStrategy;\n\n\tconstructor(el: HTMLElement, options?: {}, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tif (this.el) {\n\t\t\tthis.toggle = this.el.querySelector('.hs-tooltip-toggle') || this.el;\n\t\t\tthis.content = this.el.querySelector('.hs-tooltip-content');\n\t\t\tthis.eventMode = getClassProperty(this.el, '--trigger') || 'hover';\n\t\t\tthis.preventPopper = getClassProperty(\n\t\t\t\tthis.el,\n\t\t\t\t'--prevent-popper',\n\t\t\t\t'false',\n\t\t\t);\n\t\t\tthis.placement = getClassProperty(this.el, '--placement');\n\t\t\tthis.strategy = getClassProperty(\n\t\t\t\tthis.el,\n\t\t\t\t'--strategy',\n\t\t\t) as PositioningStrategy;\n\t\t}\n\n\t\tif (this.el && this.toggle && this.content) this.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsTooltipCollection, this);\n\n\t\tif (this.eventMode === 'click') {\n\t\t\tthis.toggle.addEventListener('click', () => this.click());\n\t\t} else if (this.eventMode === 'focus') {\n\t\t\tthis.toggle.addEventListener('click', () => this.focus());\n\t\t} else if (this.eventMode === 'hover') {\n\t\t\tthis.toggle.addEventListener('mouseenter', () => this.enter());\n\t\t\tthis.toggle.addEventListener('mouseleave', () => this.leave());\n\t\t}\n\n\t\tif (this.preventPopper === 'false') this.buildPopper();\n\t}\n\n\tprivate enter() {\n\t\tthis.show();\n\t}\n\n\tprivate leave() {\n\t\tthis.hide();\n\t}\n\n\tprivate click() {\n\t\tif (this.el.classList.contains('show')) return false;\n\n\t\tthis.show();\n\n\t\tconst handle = () => {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.hide();\n\n\t\t\t\tthis.toggle.removeEventListener('click', handle, true);\n\t\t\t\tthis.toggle.removeEventListener('blur', handle, true);\n\t\t\t});\n\t\t};\n\n\t\tthis.toggle.addEventListener('click', handle, true);\n\t\tthis.toggle.addEventListener('blur', handle, true);\n\t}\n\n\tprivate focus() {\n\t\tthis.show();\n\n\t\tconst handle = () => {\n\t\t\tthis.hide();\n\n\t\t\tthis.toggle.removeEventListener('blur', handle, true);\n\t\t};\n\n\t\tthis.toggle.addEventListener('blur', handle, true);\n\t}\n\n\tprivate buildPopper() {\n\t\tthis.popperInstance = createPopper(this.toggle, this.content, {\n\t\t\tplacement: POSITIONS[this.placement] || 'top',\n\t\t\tstrategy: this.strategy || 'fixed',\n\t\t\tmodifiers: [\n\t\t\t\t{\n\t\t\t\t\tname: 'offset',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\toffset: [0, 5],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t}\n\n\t// Public methods\n\tpublic show() {\n\t\tthis.content.classList.remove('hidden');\n\n\t\tif (this.preventPopper === 'false') {\n\t\t\tthis.popperInstance.setOptions((options) => ({\n\t\t\t\t...options,\n\t\t\t\tmodifiers: [\n\t\t\t\t\t...options.modifiers,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'eventListeners',\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}));\n\n\t\t\tthis.popperInstance.update();\n\t\t}\n\n\t\tsetTimeout(() => {\n\t\t\tthis.el.classList.add('show');\n\n\t\t\tthis.fireEvent('show', this.el);\n\t\t\tdispatch('show.hs.tooltip', this.el, this.el);\n\t\t});\n\t}\n\n\tpublic hide() {\n\t\tthis.el.classList.remove('show');\n\n\t\tif (this.preventPopper === 'false') {\n\t\t\tthis.popperInstance.setOptions((options) => ({\n\t\t\t\t...options,\n\t\t\t\tmodifiers: [\n\t\t\t\t\t...options.modifiers,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'eventListeners',\n\t\t\t\t\t\tenabled: false,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}));\n\t\t}\n\n\t\tthis.fireEvent('hide', this.el);\n\t\tdispatch('hide.hs.tooltip', this.el, this.el);\n\n\t\tafterTransition(this.content, () => {\n\t\t\tif (this.el.classList.contains('show')) return false;\n\n\t\t\tthis.content.classList.add('hidden');\n\t\t});\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance = false) {\n\t\tconst elInCollection = window.$hsTooltipCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsTooltipCollection) window.$hsTooltipCollection = [];\n\n\t\tdocument.querySelectorAll('.hs-tooltip').forEach((el: HTMLElement) => {\n\t\t\tif (\n\t\t\t\t!window.$hsTooltipCollection.find(\n\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t)\n\t\t\t)\n\t\t\t\tnew HSTooltip(el);\n\t\t});\n\t}\n\n\tstatic show(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsTooltipCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection) {\n\t\t\tswitch (elInCollection.element.eventMode) {\n\t\t\t\tcase 'click':\n\t\t\t\t\telInCollection.element.click();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'focus':\n\t\t\t\t\telInCollection.element.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\telInCollection.element.enter();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic hide(target: HTMLElement) {\n\t\tconst elInCollection = window.$hsTooltipCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.hide();\n\t}\n\n\t// Backward compatibility\n\tstatic on(evt: string, target: HTMLElement, cb: Function) {\n\t\tconst elInCollection = window.$hsTooltipCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\tif (elInCollection) elInCollection.element.events[evt] = cb;\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSTooltip: Function;\n\t\t$hsTooltipCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tHSTooltip.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Tooltip collection:', window.$hsTooltipCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSTooltip = HSTooltip;\n}\n\nexport default HSTooltip;\n","/*\n * HSDataTable\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { Api } from 'datatables.net';\n\nimport { debounce, htmlToElement, classToClassList } from '../../utils';\n\nimport { IDataTableOptions, IDataTable } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\ndeclare var DataTable: any;\n\ninterface IColumnDef {\n\ttargets: number;\n\torderable: boolean;\n}\n\nclass HSDataTable\n\textends HSBasePlugin\n\timplements IDataTable\n{\n\tprivate concatOptions: IDataTableOptions;\n\n\tprivate dataTable: Api;\n\n\tprivate readonly table: HTMLTableElement;\n\n\tprivate readonly search: HTMLElement | null;\n\n\tprivate readonly pageEntities: HTMLSelectElement | HTMLInputElement | null;\n\n\tprivate readonly paging: HTMLElement | null;\n\tprivate readonly pagingPrev: HTMLElement | null;\n\tprivate readonly pagingNext: HTMLElement | null;\n\tprivate readonly pagingPages: HTMLElement | null;\n\n\tprivate readonly info: HTMLElement | null;\n\tprivate readonly infoFrom: HTMLElement | null;\n\tprivate readonly infoTo: HTMLElement | null;\n\tprivate readonly infoLength: HTMLElement | null;\n\n\tprivate rowSelectingAll: HTMLElement | null;\n\tprivate rowSelectingIndividual: string | null;\n\n\tprivate maxPagesToShow: number;\n\tprivate isRowSelecting: boolean;\n\tprivate readonly pageBtnClasses: string | null;\n\n\tconstructor(el: HTMLElement, options?: IDataTableOptions, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tthis.el = typeof el === 'string' ? document.querySelector(el) : el;\n\n\t\t// Exclude columns from ordering\n\t\tconst columnDefs: IColumnDef[] = [];\n\t\tArray.from(this.el.querySelectorAll('thead th, thead td')).forEach(\n\t\t\t(th: HTMLElement, ind: number) => {\n\t\t\t\tif (th.classList.contains('--exclude-from-ordering'))\n\t\t\t\t\tcolumnDefs.push({\n\t\t\t\t\t\ttargets: ind,\n\t\t\t\t\t\torderable: false,\n\t\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t\tconst data = this.el.getAttribute('data-hs-datatable');\n\t\tconst dataOptions: IDataTableOptions = data ? JSON.parse(data) : {};\n\n\t\tthis.concatOptions = {\n\t\t\tsearching: true,\n\t\t\tlengthChange: false,\n\t\t\torder: [],\n\t\t\tcolumnDefs: [...columnDefs],\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.table = this.el.querySelector('table');\n\n\t\tthis.search = this.el.querySelector('[data-hs-datatable-search]') ?? null;\n\n\t\tthis.pageEntities =\n\t\t\tthis.el.querySelector('[data-hs-datatable-page-entities]') ?? null;\n\n\t\tthis.paging = this.el.querySelector('[data-hs-datatable-paging]') ?? null;\n\t\tthis.pagingPrev =\n\t\t\tthis.el.querySelector('[data-hs-datatable-paging-prev]') ?? null;\n\t\tthis.pagingNext =\n\t\t\tthis.el.querySelector('[data-hs-datatable-paging-next]') ?? null;\n\t\tthis.pagingPages =\n\t\t\tthis.el.querySelector('[data-hs-datatable-paging-pages]') ?? null;\n\n\t\tthis.info = this.el.querySelector('[data-hs-datatable-info]') ?? null;\n\t\tthis.infoFrom =\n\t\t\tthis.el.querySelector('[data-hs-datatable-info-from]') ?? null;\n\t\tthis.infoTo = this.el.querySelector('[data-hs-datatable-info-to]') ?? null;\n\t\tthis.infoLength =\n\t\t\tthis.el.querySelector('[data-hs-datatable-info-length]') ?? null;\n\n\t\tif (this.concatOptions?.rowSelectingOptions)\n\t\t\tthis.rowSelectingAll =\n\t\t\t\t(this.concatOptions?.rowSelectingOptions?.selectAllSelector\n\t\t\t\t\t? document.querySelector(\n\t\t\t\t\t\t\tthis.concatOptions?.rowSelectingOptions?.selectAllSelector,\n\t\t\t\t\t\t)\n\t\t\t\t\t: document.querySelector('[data-hs-datatable-row-selecting-all]')) ??\n\t\t\t\tnull;\n\t\tif (this.concatOptions?.rowSelectingOptions)\n\t\t\tthis.rowSelectingIndividual =\n\t\t\t\tthis.concatOptions?.rowSelectingOptions?.individualSelector ??\n\t\t\t\t'[data-hs-datatable-row-selecting-individual]' ??\n\t\t\t\tnull;\n\n\t\tif (this.pageEntities)\n\t\t\tthis.concatOptions.pageLength = parseInt(this.pageEntities.value);\n\n\t\tthis.maxPagesToShow = 3;\n\t\tthis.isRowSelecting = !!this.concatOptions?.rowSelectingOptions;\n\t\tthis.pageBtnClasses =\n\t\t\tthis.concatOptions?.pagingOptions?.pageBtnClasses ?? null;\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsDataTableCollection, this);\n\n\t\tthis.initTable();\n\n\t\tif (this.search) this.initSearch();\n\n\t\tif (this.pageEntities) this.initPageEntities();\n\n\t\tif (this.paging) this.initPaging();\n\t\tif (this.pagingPrev) this.initPagingPrev();\n\t\tif (this.pagingNext) this.initPagingNext();\n\t\tif (this.pagingPages) this.buildPagingPages();\n\n\t\tif (this.info) this.initInfo();\n\n\t\tif (this.isRowSelecting) this.initRowSelecting();\n\t}\n\n\tprivate initTable() {\n\t\tthis.dataTable = new DataTable(this.table, this.concatOptions);\n\n\t\tif (this.isRowSelecting) this.triggerChangeEventToRow();\n\n\t\tthis.dataTable.on('draw', () => {\n\t\t\tif (this.isRowSelecting) this.updateSelectAllCheckbox();\n\t\t\tif (this.isRowSelecting) this.triggerChangeEventToRow();\n\t\t\tthis.updateInfo();\n\t\t\tthis.updatePaging();\n\t\t});\n\t}\n\n\t// Search\n\tprivate initSearch() {\n\t\tthis.search.addEventListener(\n\t\t\t'input',\n\t\t\tdebounce((evt: InputEvent) =>\n\t\t\t\tthis.onSearchInput((evt.target as HTMLInputElement).value),\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate onSearchInput(val: string) {\n\t\tthis.dataTable.search(val).draw();\n\t}\n\n\t// Page entities\n\tprivate initPageEntities() {\n\t\tthis.pageEntities.addEventListener('change', (evt: Event) =>\n\t\t\tthis.onEntitiesChange(parseInt((evt.target as HTMLSelectElement).value)),\n\t\t);\n\t}\n\n\tprivate onEntitiesChange(entities: number) {\n\t\tthis.dataTable.page.len(entities).draw();\n\t}\n\n\t// Info\n\tprivate initInfo() {\n\t\tif (this.infoFrom) this.initInfoFrom();\n\t\tif (this.infoTo) this.initInfoTo();\n\t\tif (this.infoLength) this.initInfoLength();\n\t}\n\n\tprivate initInfoFrom() {\n\t\tconst { start } = this.dataTable.page.info();\n\n\t\tthis.infoFrom.innerText = `${start + 1}`;\n\t}\n\n\tprivate initInfoTo() {\n\t\tconst { end } = this.dataTable.page.info();\n\n\t\tthis.infoTo.innerText = `${end}`;\n\t}\n\n\tprivate initInfoLength() {\n\t\tconst { recordsTotal } = this.dataTable.page.info();\n\n\t\tthis.infoLength.innerText = `${recordsTotal}`;\n\t}\n\n\tprivate updateInfo() {\n\t\tthis.initInfo();\n\t}\n\n\t// Paging\n\tprivate initPaging() {\n\t\tthis.hidePagingIfSinglePage();\n\t}\n\n\tprivate hidePagingIfSinglePage() {\n\t\tconst { pages } = this.dataTable.page.info();\n\n\t\tif (pages < 2) {\n\t\t\tthis.paging.classList.add('hidden');\n\t\t\tthis.paging.style.display = 'none';\n\t\t} else {\n\t\t\tthis.paging.classList.remove('hidden');\n\t\t\tthis.paging.style.display = '';\n\t\t}\n\t}\n\n\tprivate initPagingPrev() {\n\t\tthis.pagingPrev.addEventListener('click', () => {\n\t\t\tthis.onPrevClick();\n\t\t});\n\t}\n\n\tprivate onPrevClick() {\n\t\tthis.dataTable.page('previous').draw('page');\n\t}\n\n\tprivate disablePagingArrow(el: HTMLElement, statement: boolean) {\n\t\tif (statement) {\n\t\t\tel.classList.add('disabled');\n\t\t\tel.setAttribute('disabled', 'disabled');\n\t\t} else {\n\t\t\tel.classList.remove('disabled');\n\t\t\tel.removeAttribute('disabled');\n\t\t}\n\t}\n\n\tprivate initPagingNext() {\n\t\tthis.pagingNext.addEventListener('click', () => {\n\t\t\tthis.onNextClick();\n\t\t});\n\t}\n\n\tprivate onNextClick() {\n\t\tthis.dataTable.page('next').draw('page');\n\t}\n\n\tprivate buildPagingPages() {\n\t\tthis.updatePaging();\n\t}\n\n\tprivate updatePaging() {\n\t\tconst { page, pages, length } = this.dataTable.page.info();\n\t\tconst totalRecords = this.dataTable.rows({ search: 'applied' }).count();\n\t\tconst totalPages = Math.ceil(totalRecords / length);\n\t\tconst currentPage = page + 1;\n\n\t\tlet startPage = Math.max(\n\t\t\t1,\n\t\t\tcurrentPage - Math.floor(this.maxPagesToShow / 2),\n\t\t);\n\t\tlet endPage = Math.min(totalPages, startPage + (this.maxPagesToShow - 1));\n\n\t\tif (endPage - startPage + 1 < this.maxPagesToShow) {\n\t\t\tstartPage = Math.max(1, endPage - this.maxPagesToShow + 1);\n\t\t}\n\n\t\tthis.pagingPages.innerHTML = '';\n\n\t\tif (startPage > 1) {\n\t\t\tthis.buildPagingPage(1);\n\n\t\t\tif (startPage > 2) {\n\t\t\t\tthis.pagingPages.appendChild(\n\t\t\t\t\thtmlToElement(`...`),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = startPage; i <= endPage; i++) {\n\t\t\tthis.buildPagingPage(i);\n\t\t}\n\n\t\tif (endPage < totalPages) {\n\t\t\tif (endPage < totalPages - 1) {\n\t\t\t\tthis.pagingPages.appendChild(\n\t\t\t\t\thtmlToElement(`...`),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.buildPagingPage(totalPages);\n\t\t}\n\n\t\tthis.disablePagingArrow(this.pagingPrev, page === 0);\n\t\tthis.disablePagingArrow(this.pagingNext, page === pages - 1);\n\t\tthis.hidePagingIfSinglePage();\n\t}\n\n\tprivate buildPagingPage(counter: number) {\n\t\tconst { page } = this.dataTable.page.info();\n\t\tconst pageEl = htmlToElement(``);\n\t\tpageEl.innerText = `${counter}`;\n\t\tpageEl.setAttribute('data-page', `${counter}`);\n\t\tif (this.pageBtnClasses) classToClassList(this.pageBtnClasses, pageEl);\n\t\tif (page === counter - 1) pageEl.classList.add('active');\n\n\t\tpageEl.addEventListener('click', () => this.onPageClick(counter));\n\n\t\tthis.pagingPages.append(pageEl);\n\t}\n\n\tprivate onPageClick(counter: number) {\n\t\tthis.dataTable.page(counter - 1).draw('page');\n\t}\n\n\t// Select row\n\tprivate initRowSelecting() {\n\t\tthis.rowSelectingAll.addEventListener('change', () =>\n\t\t\tthis.onSelectAllChange(),\n\t\t);\n\t}\n\n\tprivate triggerChangeEventToRow() {\n\t\tthis.table\n\t\t\t.querySelectorAll(`tbody ${this.rowSelectingIndividual}`)\n\t\t\t.forEach((el) => {\n\t\t\t\tel.addEventListener('change', () => {\n\t\t\t\t\tthis.updateSelectAllCheckbox();\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\tprivate onSelectAllChange() {\n\t\tlet isChecked = (this.rowSelectingAll as HTMLInputElement).checked;\n\t\tconst visibleRows = Array.from(\n\t\t\tthis.dataTable.rows({ page: 'current', search: 'applied' }).nodes(),\n\t\t);\n\n\t\tvisibleRows.forEach((el) => {\n\t\t\tconst checkbox = el.querySelector(this.rowSelectingIndividual);\n\n\t\t\tif (checkbox) checkbox.checked = isChecked;\n\t\t});\n\n\t\tthis.updateSelectAllCheckbox();\n\t}\n\n\tprivate updateSelectAllCheckbox() {\n\t\tconst searchRelatedItems = this.dataTable\n\t\t\t.rows({ search: 'applied' })\n\t\t\t.count();\n\n\t\tif (!searchRelatedItems) {\n\t\t\t(this.rowSelectingAll as HTMLInputElement).checked = false;\n\n\t\t\treturn false;\n\t\t}\n\n\t\tlet isChecked = true;\n\t\tconst visibleRows = Array.from(\n\t\t\tthis.dataTable\n\t\t\t\t.rows({\n\t\t\t\t\tpage: 'current',\n\t\t\t\t\tsearch: 'applied',\n\t\t\t\t})\n\t\t\t\t.nodes(),\n\t\t);\n\n\t\tvisibleRows.forEach((el) => {\n\t\t\tconst checkbox = el.querySelector(this.rowSelectingIndividual);\n\n\t\t\tif (checkbox && !checkbox.checked) {\n\t\t\t\tisChecked = false;\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\n\t\t(this.rowSelectingAll as HTMLInputElement).checked = isChecked;\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsDataTableCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsDataTableCollection) window.$hsDataTableCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-datatable]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsDataTableCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSDataTable(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSDataTable: Function;\n\t\t$hsDataTableCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tif (\n\t\tdocument.querySelectorAll(\n\t\t\t'[data-hs-datatable]:not(.--prevent-on-load-init)',\n\t\t).length\n\t) {\n\t\tif (typeof jQuery === 'undefined')\n\t\t\tconsole.error(\n\t\t\t\t'HSDataTable: jQuery is not available, please add it to the page.',\n\t\t\t);\n\t\tif (typeof DataTable === 'undefined')\n\t\t\tconsole.error(\n\t\t\t\t'HSDataTable: DataTable is not available, please add it to the page.',\n\t\t\t);\n\t}\n\n\tif (typeof DataTable !== 'undefined' && typeof jQuery !== 'undefined')\n\t\tHSDataTable.autoInit();\n\n\t// Uncomment for debug\n\t// console.log('Datatable collection:', window.$hsDataTableCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSDataTable = HSDataTable;\n}\n\nexport default HSDataTable;\n","/*\n * HSFileUpload\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { DropzoneFile } from 'dropzone';\n\nimport { htmlToElement, classToClassList } from '../../utils';\n\nimport { IFileUploadOptions, IFileUpload } from './interfaces';\n\nimport HSBasePlugin from '../base-plugin';\nimport { ICollectionItem } from '../../interfaces';\n\ndeclare var _: any;\ndeclare var Dropzone: any;\n\nif (typeof Dropzone !== 'undefined') Dropzone.autoDiscover = false;\n\nclass HSFileUpload\n\textends HSBasePlugin\n\timplements IFileUpload\n{\n\tprivate concatOptions: IFileUploadOptions;\n\tprivate previewTemplate: string;\n\tprivate extensions: any = {};\n\tprivate singleton: boolean;\n\n\tprivate dropzone: Dropzone | null;\n\n\tconstructor(el: HTMLElement, options?: IFileUploadOptions, events?: {}) {\n\t\tsuper(el, options, events);\n\n\t\tthis.el = typeof el === 'string' ? document.querySelector(el) : el;\n\n\t\tconst data = this.el.getAttribute('data-hs-file-upload');\n\t\tconst dataOptions: IFileUploadOptions = data ? JSON.parse(data) : {};\n\n\t\tthis.previewTemplate =\n\t\t\tthis.el.querySelector('[data-hs-file-upload-preview]')?.innerHTML ||\n\t\t\t`
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t0%\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
`;\n\t\tthis.extensions = _.merge(\n\t\t\t{\n\t\t\t\tdefault: {\n\t\t\t\t\ticon: '',\n\t\t\t\t\tclass: 'size-5',\n\t\t\t\t},\n\t\t\t\txls: {\n\t\t\t\t\ticon: '',\n\t\t\t\t\tclass: 'size-5',\n\t\t\t\t},\n\t\t\t\tdoc: {\n\t\t\t\t\ticon: '',\n\t\t\t\t\tclass: 'size-5',\n\t\t\t\t},\n\t\t\t\tzip: {\n\t\t\t\t\ticon: '',\n\t\t\t\t\tclass: 'size-5',\n\t\t\t\t},\n\t\t\t},\n\t\t\tdataOptions.extensions,\n\t\t);\n\t\tthis.singleton = dataOptions.singleton;\n\n\t\tthis.concatOptions = {\n\t\t\tclickable: this.el.querySelector(\n\t\t\t\t'[data-hs-file-upload-trigger]',\n\t\t\t) as HTMLElement,\n\t\t\tpreviewsContainer: this.el.querySelector(\n\t\t\t\t'[data-hs-file-upload-previews]',\n\t\t\t) as HTMLElement,\n\t\t\taddRemoveLinks: false,\n\t\t\tpreviewTemplate: this.previewTemplate,\n\t\t\tautoHideTrigger: false,\n\t\t\t...dataOptions,\n\t\t\t...options,\n\t\t};\n\n\t\tthis.init();\n\t}\n\n\tprivate init() {\n\t\tthis.createCollection(window.$hsFileUploadCollection, this);\n\n\t\tthis.initDropzone();\n\t}\n\n\tprivate initDropzone() {\n\t\tconst clear = this.el.querySelector(\n\t\t\t'[data-hs-file-upload-clear]',\n\t\t) as HTMLButtonElement;\n\t\tconst pseudoTriggers = Array.from(\n\t\t\tthis.el.querySelectorAll('[data-hs-file-upload-pseudo-trigger]'),\n\t\t) as HTMLButtonElement[];\n\t\tthis.dropzone = new Dropzone(this.el, this.concatOptions);\n\n\t\tthis.dropzone.on('addedfile', (file: DropzoneFile) => this.onAddFile(file));\n\t\tthis.dropzone.on('removedfile', () => this.onRemoveFile());\n\t\tthis.dropzone.on('uploadprogress', (file: DropzoneFile, progress: number) =>\n\t\t\tthis.onUploadProgress(file, progress),\n\t\t);\n\t\tthis.dropzone.on('complete', (file: DropzoneFile) => this.onComplete(file));\n\n\t\tif (clear)\n\t\t\tclear.onclick = () => {\n\t\t\t\tif (this.dropzone.files.length) this.dropzone.removeAllFiles(true);\n\t\t\t};\n\n\t\tif (pseudoTriggers.length)\n\t\t\tpseudoTriggers.forEach((el) => {\n\t\t\t\tel.onclick = () => {\n\t\t\t\t\tif (this.concatOptions?.clickable)\n\t\t\t\t\t\t(this.concatOptions?.clickable as HTMLButtonElement).click();\n\t\t\t\t};\n\t\t\t});\n\t}\n\n\tprivate onAddFile(file: DropzoneFile) {\n\t\tconst { previewElement } = file;\n\t\tconst reloadButton = file.previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-reload]',\n\t\t);\n\n\t\tif (!previewElement) return false;\n\n\t\tif (this.singleton && this.dropzone.files.length > 1)\n\t\t\tthis.dropzone.removeFile(this.dropzone.files[0]);\n\n\t\tif (reloadButton) {\n\t\t\treloadButton.addEventListener('click', (evt: MouseEvent) => {\n\t\t\t\tevt.preventDefault();\n\t\t\t\tevt.stopPropagation();\n\n\t\t\t\tconst tempFileInput = document.createElement('input');\n\t\t\t\ttempFileInput.type = 'file';\n\n\t\t\t\ttempFileInput.click();\n\n\t\t\t\ttempFileInput.addEventListener('change', (event: Event) => {\n\t\t\t\t\tconst input = event.target as HTMLInputElement;\n\t\t\t\t\tconst newFile = input.files?.[0];\n\n\t\t\t\t\tif (newFile) {\n\t\t\t\t\t\tconst dzNewFile = newFile as Dropzone.DropzoneFile;\n\t\t\t\t\t\tdzNewFile.status = Dropzone.ADDED;\n\t\t\t\t\t\tdzNewFile.accepted = true;\n\t\t\t\t\t\tdzNewFile.previewElement = file.previewElement;\n\t\t\t\t\t\tdzNewFile.previewTemplate = file.previewTemplate;\n\t\t\t\t\t\tdzNewFile.previewsContainer = file.previewsContainer;\n\n\t\t\t\t\t\tthis.dropzone.removeFile(file);\n\t\t\t\t\t\tthis.dropzone.addFile(dzNewFile);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\tthis.previewAccepted(file);\n\t}\n\n\tprivate previewAccepted(file: DropzoneFile) {\n\t\tconst { previewElement } = file;\n\t\tconst fileInfo = this.splitFileName(file.name);\n\n\t\tconst fileName = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-file-name]',\n\t\t);\n\t\tconst fileExt = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-file-ext]',\n\t\t);\n\t\tconst fileSize = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-file-size]',\n\t\t);\n\t\tconst fileIcon = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-file-icon]',\n\t\t) as HTMLElement;\n\t\tconst trigger = this.el.querySelector(\n\t\t\t'[data-hs-file-upload-trigger]',\n\t\t) as HTMLElement;\n\t\tconst preview = previewElement.querySelector(\n\t\t\t'[data-dz-thumbnail]',\n\t\t) as HTMLElement;\n\t\tconst remove = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-remove]',\n\t\t) as HTMLButtonElement;\n\n\t\tif (fileName) fileName.textContent = fileInfo.name;\n\t\tif (fileExt) fileExt.textContent = fileInfo.extension;\n\t\tif (fileSize) fileSize.textContent = this.formatFileSize(file.size);\n\n\t\tif (preview) {\n\t\t\tif (file.type.includes('image/')) preview.classList.remove('hidden');\n\t\t\telse this.setIcon(fileInfo.extension, fileIcon);\n\t\t}\n\n\t\tif (this.dropzone.files.length > 0 && this.concatOptions.autoHideTrigger)\n\t\t\ttrigger.style.display = 'none';\n\n\t\tif (remove) remove.onclick = () => this.dropzone.removeFile(file);\n\t}\n\n\tprivate onRemoveFile() {\n\t\tconst trigger = this.el.querySelector(\n\t\t\t'[data-hs-file-upload-trigger]',\n\t\t) as HTMLElement;\n\n\t\tif (this.dropzone.files.length === 0 && this.concatOptions.autoHideTrigger)\n\t\t\ttrigger.style.display = '';\n\t}\n\n\tprivate onUploadProgress(file: DropzoneFile, progress: number) {\n\t\tconst { previewElement } = file;\n\n\t\tif (!previewElement) return false;\n\n\t\tconst progressBar = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-progress-bar]',\n\t\t);\n\t\tconst progressBarPane = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-progress-bar-pane]',\n\t\t) as HTMLElement;\n\t\tconst progressBarValue = previewElement.querySelector(\n\t\t\t'[data-hs-file-upload-progress-bar-value]',\n\t\t) as HTMLElement;\n\n\t\tconst currentProgress = Math.floor(progress);\n\n\t\tif (progressBar)\n\t\t\tprogressBar.setAttribute('aria-valuenow', `${currentProgress}`);\n\t\tif (progressBarPane) progressBarPane.style.width = `${currentProgress}%`;\n\t\tif (progressBarValue) progressBarValue.innerText = `${currentProgress}`;\n\t}\n\n\tprivate onComplete(file: DropzoneFile) {\n\t\tconst { previewElement } = file;\n\n\t\tif (!previewElement) return false;\n\n\t\tpreviewElement.classList.add('complete');\n\t}\n\n\tprivate setIcon(ext: string, file: HTMLElement) {\n\t\tconst icon = this.createIcon(ext);\n\n\t\tfile.append(icon);\n\t}\n\n\tprivate createIcon(ext: string) {\n\t\tconst icon = this.extensions[ext]?.icon\n\t\t\t? htmlToElement(this.extensions[ext].icon)\n\t\t\t: htmlToElement(this.extensions.default.icon);\n\n\t\tclassToClassList(\n\t\t\tthis.extensions[ext]?.class\n\t\t\t\t? this.extensions[ext].class\n\t\t\t\t: this.extensions.default.class,\n\t\t\ticon,\n\t\t);\n\n\t\treturn icon;\n\t}\n\n\tprivate formatFileSize(size: number) {\n\t\tif (size < 1024) {\n\t\t\treturn size.toFixed(2) + ' B';\n\t\t} else if (size < 1024 * 1024) {\n\t\t\treturn (size / 1024).toFixed(2) + ' KB';\n\t\t} else if (size < 1024 * 1024 * 1024) {\n\t\t\treturn (size / (1024 * 1024)).toFixed(2) + ' MB';\n\t\t} else if (size < 1024 * 1024 * 1024 * 1024) {\n\t\t\treturn (size / (1024 * 1024 * 1024)).toFixed(2) + ' GB';\n\t\t} else {\n\t\t\treturn (size / (1024 * 1024 * 1024 * 1024)).toFixed(2) + ' TB';\n\t\t}\n\t}\n\n\tprivate splitFileName(file: string): {\n\t\tname: string;\n\t\textension: string;\n\t} {\n\t\tlet dotIndex = file.lastIndexOf('.');\n\n\t\tif (dotIndex == -1) return { name: file, extension: '' };\n\n\t\treturn {\n\t\t\tname: file.substring(0, dotIndex),\n\t\t\textension: file.substring(dotIndex + 1),\n\t\t};\n\t}\n\n\t// Static methods\n\tstatic getInstance(target: HTMLElement | string, isInstance?: boolean) {\n\t\tconst elInCollection = window.$hsFileUploadCollection.find(\n\t\t\t(el) =>\n\t\t\t\tel.element.el ===\n\t\t\t\t(typeof target === 'string' ? document.querySelector(target) : target),\n\t\t);\n\n\t\treturn elInCollection\n\t\t\t? isInstance\n\t\t\t\t? elInCollection\n\t\t\t\t: elInCollection.element.el\n\t\t\t: null;\n\t}\n\n\tstatic autoInit() {\n\t\tif (!window.$hsFileUploadCollection) window.$hsFileUploadCollection = [];\n\n\t\tdocument\n\t\t\t.querySelectorAll('[data-hs-file-upload]:not(.--prevent-on-load-init)')\n\t\t\t.forEach((el: HTMLElement) => {\n\t\t\t\tif (\n\t\t\t\t\t!window.$hsFileUploadCollection.find(\n\t\t\t\t\t\t(elC) => (elC?.element?.el as HTMLElement) === el,\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t\tnew HSFileUpload(el);\n\t\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface Window {\n\t\tHSFileUpload: Function;\n\t\t$hsFileUploadCollection: ICollectionItem[];\n\t}\n}\n\nwindow.addEventListener('load', () => {\n\tif (\n\t\tdocument.querySelectorAll(\n\t\t\t'[data-hs-file-upload]:not(.--prevent-on-load-init)',\n\t\t).length\n\t) {\n\t\tif (typeof _ === 'undefined')\n\t\t\tconsole.error(\n\t\t\t\t'HSFileUpload: Lodash is not available, please add it to the page.',\n\t\t\t);\n\t\tif (typeof Dropzone === 'undefined')\n\t\t\tconsole.error(\n\t\t\t\t'HSFileUpload: Dropzone is not available, please add it to the page.',\n\t\t\t);\n\t}\n\n\tif (typeof _ !== 'undefined' && typeof Dropzone !== 'undefined') {\n\t\tHSFileUpload.autoInit();\n\t}\n\n\t// Uncomment for debug\n\t// console.log('File upload collection:', window.$hsFileUploadCollection);\n});\n\nif (typeof window !== 'undefined') {\n\twindow.HSFileUpload = HSFileUpload;\n}\n\nexport default HSFileUpload;\n","import { ISpaCollectionItem } from './interfaces';\n\nimport HSCopyMarkup from '../plugins/copy-markup';\nimport HSAccordion from '../plugins/accordion';\nimport HSCarousel from '../plugins/carousel';\nimport HSCollapse from '../plugins/collapse';\nimport HSComboBox from '../plugins/combobox';\nimport HSDataTable from '../plugins/datatable';\nimport HSDropdown from '../plugins/dropdown';\nimport HSFileUpload from '../plugins/file-upload';\nimport HSInputNumber from '../plugins/input-number';\nimport HSOverlay from '../plugins/overlay';\nimport HSPinInput from '../plugins/pin-input';\nimport HSRemoveElement from '../plugins/remove-element';\nimport HSScrollspy from '../plugins/scrollspy';\nimport HSSelect from '../plugins/select';\nimport HSStepper from '../plugins/stepper';\nimport HSStrongPassword from '../plugins/strong-password';\nimport HSTabs from '../plugins/tabs';\nimport HSThemeSwitch from '../plugins/theme-switch';\nimport HSToggleCount from '../plugins/toggle-count';\nimport HSTogglePassword from '../plugins/toggle-password';\nimport HSTooltip from '../plugins/tooltip';\n\nexport const COLLECTIONS: ISpaCollectionItem[] = [\n\t{\n\t\tkey: 'copy-markup',\n\t\tfn: HSCopyMarkup,\n\t\tcollection: '$hsCopyMarkupCollection',\n\t},\n\t{ key: 'accordion', fn: HSAccordion, collection: '$hsAccordionCollection' },\n\t{ key: 'carousel', fn: HSCarousel, collection: '$hsCarouselCollection' },\n\t{ key: 'collapse', fn: HSCollapse, collection: '$hsCollapseCollection' },\n\t{ key: 'combobox', fn: HSComboBox, collection: '$hsComboBoxCollection' },\n\t{ key: 'datatable', fn: HSDataTable, collection: '$hsDataTableCollection' },\n\t{ key: 'dropdown', fn: HSDropdown, collection: '$hsDropdownCollection' },\n\t{\n\t\tkey: 'file-upload',\n\t\tfn: HSFileUpload,\n\t\tcollection: '$hsFileUploadCollection',\n\t},\n\t{\n\t\tkey: 'input-number',\n\t\tfn: HSInputNumber,\n\t\tcollection: '$hsInputNumberCollection',\n\t},\n\t{ key: 'overlay', fn: HSOverlay, collection: '$hsOverlayCollection' },\n\t{ key: 'pin-input', fn: HSPinInput, collection: '$hsPinInputCollection' },\n\t{\n\t\tkey: 'remove-element',\n\t\tfn: HSRemoveElement,\n\t\tcollection: '$hsRemoveElementCollection',\n\t},\n\t{ key: 'scrollspy', fn: HSScrollspy, collection: '$hsScrollspyCollection' },\n\t{ key: 'select', fn: HSSelect, collection: '$hsSelectCollection' },\n\t{ key: 'stepper', fn: HSStepper, collection: '$hsStepperCollection' },\n\t{\n\t\tkey: 'strong-password',\n\t\tfn: HSStrongPassword,\n\t\tcollection: '$hsStrongPasswordCollection',\n\t},\n\t{ key: 'tabs', fn: HSTabs, collection: '$hsTabsCollection' },\n\t{\n\t\tkey: 'theme-switch',\n\t\tfn: HSThemeSwitch,\n\t\tcollection: '$hsThemeSwitchCollection',\n\t},\n\t{\n\t\tkey: 'toggle-count',\n\t\tfn: HSToggleCount,\n\t\tcollection: '$hsToggleCountCollection',\n\t},\n\t{\n\t\tkey: 'toggle-password',\n\t\tfn: HSTogglePassword,\n\t\tcollection: '$hsTogglePasswordCollection',\n\t},\n\t{ key: 'tooltip', fn: HSTooltip, collection: '$hsTooltipCollection' },\n];\n","/*\n * HSStaticMethods\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\n\nimport { getClassProperty, afterTransition } from '../utils';\nimport { COLLECTIONS } from '../spa';\nimport { IStaticMethods } from './interfaces';\nimport { ICollectionItem } from '../interfaces';\nimport type HSCopyMarkup from '../plugins/copy-markup';\nimport type HSAccordion from '../plugins/accordion';\nimport type HSCarousel from '../plugins/carousel';\nimport type HSCollapse from '../plugins/collapse';\nimport type HSComboBox from '../plugins/combobox';\nimport type HSDataTable from '../plugins/datatable';\nimport type HSDropdown from '../plugins/dropdown';\nimport type HSFileUpload from '../plugins/file-upload';\nimport type HSInputNumber from '../plugins/input-number';\nimport type HSOverlay from '../plugins/overlay';\nimport type HSPinInput from '../plugins/pin-input';\nimport type HSRemoveElement from '../plugins/remove-element';\nimport type HSScrollspy from '../plugins/scrollspy';\nimport type HSSelect from '../plugins/select';\nimport type HSStepper from '../plugins/stepper';\nimport type HSStrongPassword from '../plugins/strong-password';\nimport type HSTabs from '../plugins/tabs';\nimport type HSThemeSwitch from '../plugins/theme-switch';\nimport type HSToggleCount from '../plugins/toggle-count';\nimport type HSTogglePassword from '../plugins/toggle-password';\nimport type HSTooltip from '../plugins/tooltip';\n\ndeclare global {\n\tinterface Window {\n\t\tHSStaticMethods: IStaticMethods;\n\t\t$hsCopyMarkupCollection: ICollectionItem[];\n\t\t$hsAccordionCollection: ICollectionItem[];\n\t\t$hsCarouselCollection: ICollectionItem[];\n\t\t$hsCollapseCollection: ICollectionItem[];\n\t\t$hsComboBoxCollection: ICollectionItem[];\n\t\t$hsDataTableCollection: ICollectionItem[];\n\t\t$hsDropdownCollection: ICollectionItem[];\n\t\t$hsFileUploadCollection: ICollectionItem[];\n\t\t$hsInputNumberCollection: { id: number; element: HSInputNumber }[];\n\t\t$hsOverlayCollection: ICollectionItem[];\n\t\t$hsPinInputCollection: ICollectionItem[];\n\t\t$hsRemoveElementCollection: ICollectionItem[];\n\t\t$hsScrollspyCollection: ICollectionItem[];\n\t\t$hsSelectCollection: ICollectionItem[];\n\t\t$hsStepperCollection: ICollectionItem[];\n\t\t$hsStrongPasswordCollection: ICollectionItem[];\n\t\t$hsTabsCollection: ICollectionItem[];\n\t\t$hsThemeSwitchCollection: ICollectionItem[];\n\t\t$hsToggleCountCollection: ICollectionItem[];\n\t\t$hsTogglePasswordCollection: ICollectionItem[];\n\t\t$hsTooltipCollection: ICollectionItem[];\n\t}\n}\n\nconst HSStaticMethods: IStaticMethods = {\n\tgetClassProperty,\n\tafterTransition,\n\tautoInit(collection: string | string[] = 'all') {\n\t\tif (collection === 'all') {\n\t\t\tCOLLECTIONS.forEach(({ fn }) => {\n\t\t\t\tfn?.autoInit();\n\t\t\t});\n\t\t} else {\n\t\t\tCOLLECTIONS.forEach(({ key, fn }) => {\n\t\t\t\tif (collection.includes(key)) fn?.autoInit();\n\t\t\t});\n\t\t}\n\t},\n\tcleanCollection(name: string | string[] = 'all') {\n\t\tif (name === 'all') {\n\t\t\tCOLLECTIONS.forEach(({ collection }) => {\n\t\t\t\tif ((window as any)[collection] instanceof Array) {\n\t\t\t\t\t(window as any)[collection] = [];\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tCOLLECTIONS.forEach(({ key, collection }) => {\n\t\t\t\tif (\n\t\t\t\t\tname.includes(key) &&\n\t\t\t\t\t(window as any)[collection] instanceof Array\n\t\t\t\t) {\n\t\t\t\t\t(window as any)[collection] = [];\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n};\n\nif (typeof window !== 'undefined') {\n\twindow.HSStaticMethods = HSStaticMethods;\n}\n\nexport default HSStaticMethods;\n","declare var _: any;\ndeclare var DataTable: any;\ndeclare var Dropzone: any;\n\nlet HSDataTableModule;\nlet HSFileUploadModule;\n\nexport { default as HSCopyMarkup } from './plugins/copy-markup';\nexport { default as HSAccordion } from './plugins/accordion';\nexport { default as HSCarousel } from './plugins/carousel';\nexport { default as HSCollapse } from './plugins/collapse';\nexport { default as HSComboBox } from './plugins/combobox';\nexport { default as HSDropdown } from './plugins/dropdown';\nexport { default as HSInputNumber } from './plugins/input-number';\nexport { default as HSOverlay } from './plugins/overlay';\nexport { default as HSPinInput } from './plugins/pin-input';\nexport { default as HSRemoveElement } from './plugins/remove-element';\nexport { default as HSScrollspy } from './plugins/scrollspy';\nexport { default as HSSelect } from './plugins/select';\nexport { default as HSStepper } from './plugins/stepper';\nexport { default as HSStrongPassword } from './plugins/strong-password';\nexport { default as HSTabs } from './plugins/tabs';\nexport { default as HSThemeSwitch } from './plugins/theme-switch';\nexport { default as HSToggleCount } from './plugins/toggle-count';\nexport { default as HSTogglePassword } from './plugins/toggle-password';\nexport { default as HSTooltip } from './plugins/tooltip';\nexport { default as HSStaticMethods } from './static';\n\nif (typeof DataTable !== 'undefined' && typeof jQuery !== 'undefined')\n\tHSDataTableModule = require('./plugins/datatable').default;\nelse HSDataTableModule = null;\nexport { HSDataTableModule as HSDataTable };\n\nif (typeof _ !== 'undefined' && typeof Dropzone !== 'undefined')\n\tHSFileUploadModule = require('./plugins/file-upload').default;\nelse HSFileUploadModule = null;\nexport { HSFileUploadModule as HSFileUpload };","!function(t,e){if(\"object\"==typeof exports&&\"object\"==typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var i=e();for(var n in i)(\"object\"==typeof exports?exports:t)[n]=i[n]}}(self,(()=>(()=>{\"use strict\";var t={223:(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\",\"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\",\"Tab\"],e.COMBO_BOX_ACCESSIBILITY_KEY_SET=[\"ArrowUp\",\"ArrowLeft\",\"ArrowDown\",\"ArrowRight\",\"Home\",\"End\",\"Escape\",\"Enter\"],e.BREAKPOINTS={sm:640,md:768,lg:1024,xl:1280,\"2xl\":1536}},961:(t,e)=>{\n/*\n * HSBasePlugin\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\nObject.defineProperty(e,\"__esModule\",{value:!0});var i=function(){function t(t,e,i){this.el=t,this.options=e,this.events=i,this.el=t,this.options=e,this.events={}}return t.prototype.createCollection=function(t,e){var i;t.push({id:(null===(i=null==e?void 0:e.el)||void 0===i?void 0:i.id)||t.length+1,element:e})},t.prototype.fireEvent=function(t,e){if(void 0===e&&(e=null),this.events.hasOwnProperty(t))return this.events[t](e)},t.prototype.on=function(t,e){this.events[t]=e},t}();e.default=i},442:function(t,e,i){\n/*\n * HSSelect\n * @version: 2.4.1\n * @author: Preline Labs Ltd.\n * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html)\n * Copyright 2024 Preline Labs Ltd.\n */\nvar n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},n(t,e)},function(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Class extends value \"+String(e)+\" is not a constructor or null\");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,i=1,n=arguments.length;i\"),i=this.toggle.querySelector(\"[data-icon]\"),n=this.toggle.querySelector(\"[data-title]\"),!this.isMultiple&&i&&this.setToggleIcon(),!this.isMultiple&&n&&this.setToggleTitle(),this.isMultiple?this.toggleTextWrapper.innerHTML=this.value.length?this.stringFromValue():this.placeholder:this.toggleTextWrapper.innerHTML=(null===(t=this.getItemByValue(this.value))||void 0===t?void 0:t.title)||this.placeholder,n||this.toggle.append(this.toggleTextWrapper),this.toggleClasses&&(0,a.classToClassList)(this.toggleClasses,this.toggle),this.isDisabled&&this.toggle.classList.add(\"disabled\"),this.wrapper&&this.wrapper.append(this.toggle),(null===(e=this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.isOpened?this.toggle.ariaExpanded=\"true\":this.toggle.ariaExpanded=\"false\"),this.toggle.addEventListener(\"click\",(function(){if(s.isDisabled)return!1;s.isOpened?s.close():s.open()}))},e.prototype.setToggleIcon=function(){var t,e,i=this.toggle.querySelector(\"[data-icon]\");if(i.innerHTML=\"\",i){var n=(0,a.htmlToElement)((null===(e=null===(t=this.getItemByValue(this.value))||void 0===t?void 0:t.options)||void 0===e?void 0:e.icon)||\"\");i.append(n),n?i.classList.remove(\"hidden\"):i.classList.add(\"hidden\")}},e.prototype.setToggleTitle=function(){var t,e=this.toggle.querySelector(\"[data-title]\");if(e.classList.add(\"truncate\"),e.innerHTML=\"\",e){var i=(null===(t=this.getItemByValue(this.value))||void 0===t?void 0:t.title)||this.placeholder;e.innerHTML=i,this.toggle.append(e)}},e.prototype.buildTags=function(){this.isDisabled&&this.wrapper.classList.add(\"disabled\"),this.buildTagsInput(),this.setTagsItems()},e.prototype.reassignTagsInputPlaceholder=function(t){this.tagsInput.placeholder=t,this.tagsInputHelper.innerHTML=t,this.calculateInputWidth()},e.prototype.buildTagsItem=function(t){var e,i,n,s,o,l,r,d=this,c=this.getItemByValue(t),u=document.createElement(\"div\");if(u.setAttribute(\"data-tag-value\",t),this.tagsItemClasses&&(0,a.classToClassList)(this.tagsItemClasses,u),this.tagsItemTemplate&&(s=(0,a.htmlToElement)(this.tagsItemTemplate),u.append(s)),null===(e=null==c?void 0:c.options)||void 0===e?void 0:e.icon){var p=(0,a.htmlToElement)(null===(i=null==c?void 0:c.options)||void 0===i?void 0:i.icon);(r=s?s.querySelector(\"[data-icon]\"):document.createElement(\"span\")).append(p),s||u.append(r)}s&&s.querySelector(\"[data-icon]\")&&!(null===(n=null==c?void 0:c.options)||void 0===n?void 0:n.icon)&&s.querySelector(\"[data-icon]\").classList.add(\"hidden\"),(o=s?s.querySelector(\"[data-title]\"):document.createElement(\"span\")).textContent=c.title||\"\",s||u.append(o),s?l=s.querySelector(\"[data-remove]\"):((l=document.createElement(\"span\")).textContent=\"X\",u.append(l)),l.addEventListener(\"click\",(function(){d.value=d.value.filter((function(e){return e!==t})),d.selectedItems=d.selectedItems.filter((function(e){return e!==t})),d.value.length||d.reassignTagsInputPlaceholder(d.placeholder),d.unselectMultipleItems(),d.selectMultipleItems(),u.remove()})),this.wrapper.append(u)},e.prototype.getItemByValue=function(t){return this.selectOptions.find((function(e){return e.val===t}))},e.prototype.setTagsItems=function(){var t=this;this.value&&this.value.forEach((function(e){t.selectedItems.includes(e)||t.buildTagsItem(e),t.selectedItems=t.selectedItems.includes(e)?t.selectedItems:l(l([],t.selectedItems,!0),[e],!1)}))},e.prototype.buildTagsInput=function(){var t=this;this.tagsInput=document.createElement(\"input\"),this.tagsInputClasses&&(0,a.classToClassList)(this.tagsInputClasses,this.tagsInput),this.tagsInput.addEventListener(\"focus\",(function(){return t.open()})),this.tagsInput.addEventListener(\"input\",(function(){return t.calculateInputWidth()})),this.tagsInput.addEventListener(\"input\",(0,a.debounce)((function(e){return t.searchOptions(e.target.value)}))),this.tagsInput.addEventListener(\"keydown\",(function(e){if(\"Enter\"===e.key&&t.isAddTagOnEnter){var i=e.target.value;if(t.selectOptions.find((function(t){return t.val===i})))return!1;t.addSelectOption(i,i),t.buildOption(i,i),t.dropdown.querySelector('[data-value=\"'.concat(i,'\"]')).click(),t.resetTagsInputField()}})),this.wrapper.append(this.tagsInput),setTimeout((function(){t.adjustInputWidth(),t.reassignTagsInputPlaceholder(t.value.length?\"\":t.placeholder)}))},e.prototype.buildDropdown=function(){var t=this;this.dropdown=(0,a.htmlToElement)(this.dropdownTag||\"
\"),this.dropdown.setAttribute(\"data-hs-select-dropdown\",\"\"),this.dropdown.classList.add(\"absolute\",\"top-full\"),this.dropdown.role=\"listbox\",this.dropdown.tabIndex=-1,this.dropdown.ariaOrientation=\"vertical\",this.isOpened||this.dropdown.classList.add(\"hidden\"),this.dropdownClasses&&(0,a.classToClassList)(this.dropdownClasses,this.dropdown),this.wrapper&&this.wrapper.append(this.dropdown),this.dropdown&&this.hasSearch&&this.buildSearch(),this.selectOptions&&this.selectOptions.forEach((function(e,i){return t.buildOption(e.title,e.val,e.disabled,e.selected,e.options,\"\".concat(i))}))},e.prototype.buildSearch=function(){var t,e=this;this.searchWrapper=(0,a.htmlToElement)(this.searchWrapperTemplate||\"
\"),this.searchWrapperClasses&&(0,a.classToClassList)(this.searchWrapperClasses,this.searchWrapper),t=this.searchWrapper.querySelector(\"[data-input]\"),this.search=(0,a.htmlToElement)(''),this.search.placeholder=this.searchPlaceholder,this.searchClasses&&(0,a.classToClassList)(this.searchClasses,this.search),this.search.addEventListener(\"input\",(0,a.debounce)((function(t){return e.searchOptions(t.target.value)}))),t?t.append(this.search):this.searchWrapper.append(this.search),this.dropdown.append(this.searchWrapper)},e.prototype.buildOption=function(t,e,i,n,s,o){var r=this;void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===o&&(o=\"1\");var d=null,c=(0,a.htmlToElement)(this.optionTag||\"
\");if(c.setAttribute(\"data-value\",e),c.setAttribute(\"data-title-value\",t),c.setAttribute(\"tabIndex\",o),c.classList.add(\"cursor-pointer\"),i&&c.classList.add(\"disabled\"),n&&(this.isMultiple?this.value=l(l([],this.value,!0),[e],!1):this.value=e),this.optionTemplate&&(d=(0,a.htmlToElement)(this.optionTemplate),c.append(d)),d?d.querySelector(\"[data-title]\").textContent=t||\"\":c.textContent=t||\"\",s){if(s.icon){var u=(0,a.htmlToElement)(s.icon);if(u.classList.add(\"max-w-full\"),d)d.querySelector(\"[data-icon]\").append(u);else{var p=(0,a.htmlToElement)(\"
\");this.iconClasses&&(0,a.classToClassList)(this.iconClasses,p),p.append(u),c.append(p)}}if(s.description)if(d)d.querySelector(\"[data-description]\").append(s.description);else{var h=(0,a.htmlToElement)(\"
\");h.textContent=s.description,this.descriptionClasses&&(0,a.classToClassList)(this.descriptionClasses,h),c.append(h)}}d&&d.querySelector(\"[data-icon]\")&&!s&&!(null==s?void 0:s.icon)&&d.querySelector(\"[data-icon]\").classList.add(\"hidden\"),this.value&&(this.isMultiple?this.value.includes(e):this.value===e)&&c.classList.add(\"selected\"),i||c.addEventListener(\"click\",(function(){return r.onSelectOption(e)})),this.optionClasses&&(0,a.classToClassList)(this.optionClasses,c),this.dropdown&&this.dropdown.append(c),n&&this.setNewValue()},e.prototype.destroyOption=function(t){var e=this.dropdown.querySelector('[data-value=\"'.concat(t,'\"]'));if(!e)return!1;e.remove()},e.prototype.buildOriginalOption=function(t,e,i,n,s){var o=(0,a.htmlToElement)(\"\");o.setAttribute(\"value\",e),i&&o.setAttribute(\"disabled\",\"disabled\"),n&&o.setAttribute(\"selected\",\"selected\"),o.setAttribute(\"data-hs-select-option\",JSON.stringify(s)),o.innerText=t,this.el.append(o)},e.prototype.destroyOriginalOption=function(t){var e=this.el.querySelector('[value=\"'.concat(t,'\"]'));if(!e)return!1;e.remove()},e.prototype.buildTagsInputHelper=function(){this.tagsInputHelper=document.createElement(\"span\"),this.tagsInputHelper.style.fontSize=window.getComputedStyle(this.tagsInput).fontSize,this.tagsInputHelper.style.fontFamily=window.getComputedStyle(this.tagsInput).fontFamily,this.tagsInputHelper.style.fontWeight=window.getComputedStyle(this.tagsInput).fontWeight,this.tagsInputHelper.style.letterSpacing=window.getComputedStyle(this.tagsInput).letterSpacing,this.tagsInputHelper.style.visibility=\"hidden\",this.tagsInputHelper.style.whiteSpace=\"pre\",this.tagsInputHelper.style.position=\"absolute\",this.wrapper.appendChild(this.tagsInputHelper)},e.prototype.calculateInputWidth=function(){this.tagsInputHelper.textContent=this.tagsInput.value||this.tagsInput.placeholder;var t=parseInt(window.getComputedStyle(this.tagsInput).paddingLeft)+parseInt(window.getComputedStyle(this.tagsInput).paddingRight),e=parseInt(window.getComputedStyle(this.tagsInput).borderLeftWidth)+parseInt(window.getComputedStyle(this.tagsInput).borderRightWidth),i=this.tagsInputHelper.offsetWidth+t+e,n=this.wrapper.offsetWidth-(parseInt(window.getComputedStyle(this.wrapper).paddingLeft)+parseInt(window.getComputedStyle(this.wrapper).paddingRight));this.tagsInput.style.width=\"\".concat(Math.min(i,n)+2,\"px\")},e.prototype.adjustInputWidth=function(){this.buildTagsInputHelper(),this.calculateInputWidth()},e.prototype.onSelectOption=function(t){var e=this;if(this.clearSelections(),this.isMultiple?(this.value=this.value.includes(t)?Array.from(this.value).filter((function(e){return e!==t})):l(l([],Array.from(this.value),!0),[t],!1),this.selectMultipleItems(),this.setNewValue()):(this.value=t,this.selectSingleItem(),this.setNewValue()),this.fireEvent(\"change\",this.value),(0,a.dispatch)(\"change.hs.select\",this.el,this.value),\"tags\"===this.mode){var i=this.selectedItems.filter((function(t){return!e.value.includes(t)}));i.length&&i.forEach((function(t){e.selectedItems=e.selectedItems.filter((function(e){return e!==t})),e.wrapper.querySelector('[data-tag-value=\"'.concat(t,'\"]')).remove()})),this.resetTagsInputField()}this.isMultiple||(this.toggle.querySelector(\"[data-icon]\")&&this.setToggleIcon(),this.toggle.querySelector(\"[data-title]\")&&this.setToggleTitle(),this.close()),this.value.length||\"tags\"!==this.mode||this.reassignTagsInputPlaceholder(this.placeholder),this.isOpened&&\"tags\"===this.mode&&this.tagsInput&&this.tagsInput.focus(),this.triggerChangeEventForNativeSelect()},e.prototype.triggerChangeEventForNativeSelect=function(){var t=new Event(\"change\",{bubbles:!0});this.el.dispatchEvent(t)},e.prototype.addSelectOption=function(t,e,i,n,s){this.selectOptions=l(l([],this.selectOptions,!0),[{title:t,val:e,disabled:i,selected:n,options:s}],!1)},e.prototype.removeSelectOption=function(t,e){if(void 0===e&&(e=!1),!!!this.selectOptions.some((function(e){return e.val===t})))return!1;this.selectOptions=this.selectOptions.filter((function(e){return e.val!==t})),console.log(e),this.value=e?this.value.filter((function(e){return e!==t})):t,console.log(this.value)},e.prototype.resetTagsInputField=function(){this.tagsInput.value=\"\",this.reassignTagsInputPlaceholder(\"\"),this.searchOptions(\"\")},e.prototype.clearSelections=function(){Array.from(this.dropdown.children).forEach((function(t){t.classList.contains(\"selected\")&&t.classList.remove(\"selected\")})),Array.from(this.el.children).forEach((function(t){t.selected&&(t.selected=!1)}))},e.prototype.setNewValue=function(){\"tags\"===this.mode?this.setTagsItems():(console.log(),this.value.length?this.toggleTextWrapper.innerHTML=this.stringFromValue():this.toggleTextWrapper.innerHTML=this.placeholder)},e.prototype.stringFromValue=function(){var t=this,e=[],i=\"\";if(this.selectOptions.forEach((function(i){t.isMultiple?t.value.includes(i.val)&&e.push(i.title):t.value===i.val&&e.push(i.title)})),this.toggleCountText&&\"\"!==this.toggleCountText&&e.length>=this.toggleCountTextMinItems)if(\"nItemsAndCount\"===this.toggleCountTextMode){var n=e.slice(0,this.toggleCountTextMinItems-1);i=\"\".concat(n.join(this.toggleSeparators.items),\" \").concat(this.toggleSeparators.betweenItemsAndCounter,\" \").concat(e.length-n.length,\" \").concat(this.toggleCountText)}else i=\"\".concat(e.length,\" \").concat(this.toggleCountText);else i=e.join(this.toggleSeparators.items);return i},e.prototype.selectSingleItem=function(){var t=this;Array.from(this.el.children).find((function(e){return t.value===e.value})).selected=!0;var e=Array.from(this.dropdown.children).find((function(e){return t.value===e.getAttribute(\"data-value\")}));e&&e.classList.add(\"selected\")},e.prototype.selectMultipleItems=function(){var t=this;Array.from(this.dropdown.children).filter((function(e){return t.value.includes(e.getAttribute(\"data-value\"))})).forEach((function(t){return t.classList.add(\"selected\")})),Array.from(this.el.children).filter((function(e){return t.value.includes(e.value)})).forEach((function(t){return t.selected=!0}))},e.prototype.unselectMultipleItems=function(){Array.from(this.dropdown.children).forEach((function(t){return t.classList.remove(\"selected\")})),Array.from(this.el.children).forEach((function(t){return t.selected=!1}))},e.prototype.searchOptions=function(t){this.searchNoResult&&(this.searchNoResult.remove(),this.searchNoResult=null),this.searchNoResult=(0,a.htmlToElement)(\"\"),this.searchNoResult.innerText=this.searchNoResultText,(0,a.classToClassList)(this.searchNoResultClasses,this.searchNoResult);var e=this.dropdown.querySelectorAll(\"[data-value]\"),i=!1;e.forEach((function(e){e.getAttribute(\"data-title-value\").toLocaleLowerCase().includes(t.toLocaleLowerCase())?(e.classList.remove(\"hidden\"),i=!0):e.classList.add(\"hidden\")})),i||this.dropdown.append(this.searchNoResult)},e.prototype.eraseToggleIcon=function(){var t=this.toggle.querySelector(\"[data-icon]\");t&&(t.innerHTML=null,t.classList.add(\"hidden\"))},e.prototype.eraseToggleTitle=function(){var t=this.toggle.querySelector(\"[data-title]\");t?t.innerHTML=this.placeholder:this.toggleTextWrapper.innerHTML=this.placeholder},e.prototype.destroy=function(){var t=this.el.parentElement.parentElement;this.el.classList.remove(\"hidden\"),this.el.style.display=\"\",t.prepend(this.el),t.querySelector(\".hs-select\").remove(),this.wrapper=null},e.prototype.open=function(){var t,e=this,i=(null===(t=null===window||void 0===window?void 0:window.$hsSelectCollection)||void 0===t?void 0:t.find((function(t){return t.element.isOpened})))||null;if(i&&i.element.close(),this.animationInProcess)return!1;this.animationInProcess=!0,this.dropdown.classList.remove(\"hidden\"),this.recalculateDirection(),setTimeout((function(){var t;(null===(t=null==e?void 0:e.toggle)||void 0===t?void 0:t.ariaExpanded)&&(e.toggle.ariaExpanded=\"true\"),e.wrapper.classList.add(\"active\"),e.dropdown.classList.add(\"opened\"),e.hasSearch&&!e.preventSearchFocus&&e.search.focus(),e.animationInProcess=!1})),this.isOpened=!0},e.prototype.close=function(){var t,e,i,n,s=this;if(this.animationInProcess)return!1;this.animationInProcess=!0,(null===(t=null==this?void 0:this.toggle)||void 0===t?void 0:t.ariaExpanded)&&(this.toggle.ariaExpanded=\"false\"),this.wrapper.classList.remove(\"active\"),this.dropdown.classList.remove(\"opened\",\"bottom-full\",\"top-full\"),(null===(e=this.dropdownDirectionClasses)||void 0===e?void 0:e.bottom)&&this.dropdown.classList.remove(this.dropdownDirectionClasses.bottom),(null===(i=this.dropdownDirectionClasses)||void 0===i?void 0:i.top)&&this.dropdown.classList.remove(this.dropdownDirectionClasses.top),this.dropdown.style.marginTop=\"\",this.dropdown.style.marginBottom=\"\",(0,a.afterTransition)(this.dropdown,(function(){s.dropdown.classList.add(\"hidden\"),s.hasSearch&&(s.search.value=\"\",s.search.dispatchEvent(new Event(\"input\",{bubbles:!0})),s.search.blur()),s.animationInProcess=!1})),null===(n=this.dropdown.querySelector(\".hs-select-option-highlighted\"))||void 0===n||n.classList.remove(\"hs-select-option-highlighted\"),this.isOpened=!1},e.prototype.addOption=function(t){var e=this,i=\"\".concat(this.selectOptions.length),n=function(t){var n=t.title,s=t.val,o=t.disabled,l=t.selected,r=t.options;!!e.selectOptions.some((function(t){return t.val===s}))||(e.addSelectOption(n,s,o,l,r),e.buildOption(n,s,o,l,r,i),e.buildOriginalOption(n,s,o,l,r),l&&!e.isMultiple&&e.onSelectOption(s))};Array.isArray(t)?t.forEach((function(t){n(t)})):n(t)},e.prototype.removeOption=function(t){var e=this,i=function(t,i){void 0===i&&(i=!1),!!e.selectOptions.some((function(e){return e.val===t}))&&(e.removeSelectOption(t,i),e.destroyOption(t),e.destroyOriginalOption(t),e.value===t&&(e.value=null,e.eraseToggleTitle(),e.eraseToggleIcon()))};Array.isArray(t)?t.forEach((function(t){i(t,e.isMultiple)})):i(t,this.isMultiple),this.setNewValue()},e.prototype.recalculateDirection=function(){var t,e,i,n;(0,a.isEnoughSpace)(this.dropdown,this.toggle||this.tagsInput,\"bottom\",this.dropdownSpace,this.viewport)?(this.dropdown.classList.remove(\"bottom-full\"),(null===(t=this.dropdownDirectionClasses)||void 0===t?void 0:t.bottom)&&this.dropdown.classList.remove(this.dropdownDirectionClasses.bottom),this.dropdown.style.marginBottom=\"\",this.dropdown.classList.add(\"top-full\"),(null===(e=this.dropdownDirectionClasses)||void 0===e?void 0:e.top)&&this.dropdown.classList.add(this.dropdownDirectionClasses.top),this.dropdown.style.marginTop=\"\".concat(this.dropdownSpace,\"px\")):(this.dropdown.classList.remove(\"top-full\"),(null===(i=this.dropdownDirectionClasses)||void 0===i?void 0:i.top)&&this.dropdown.classList.remove(this.dropdownDirectionClasses.top),this.dropdown.style.marginTop=\"\",this.dropdown.classList.add(\"bottom-full\"),(null===(n=this.dropdownDirectionClasses)||void 0===n?void 0:n.bottom)&&this.dropdown.classList.add(this.dropdownDirectionClasses.bottom),this.dropdown.style.marginBottom=\"\".concat(this.dropdownSpace,\"px\"))},e.getInstance=function(t,e){var i=window.$hsSelectCollection.find((function(e){return e.element.el===(\"string\"==typeof t?document.querySelector(t):t)}));return i?e?i:i.element:null},e.autoInit=function(){window.$hsSelectCollection||(window.$hsSelectCollection=[]),document.querySelectorAll(\"[data-hs-select]:not(.--prevent-on-load-init)\").forEach((function(t){if(!window.$hsSelectCollection.find((function(e){var i;return(null===(i=null==e?void 0:e.element)||void 0===i?void 0:i.el)===t}))){var i=t.getAttribute(\"data-hs-select\"),n=i?JSON.parse(i):{};new e(t,n)}})),window.$hsSelectCollection&&(window.addEventListener(\"click\",(function(t){var i=t.target;e.closeCurrentlyOpened(i)})),document.addEventListener(\"keydown\",(function(t){return e.accessibility(t)})))},e.open=function(t){var e=window.$hsSelectCollection.find((function(e){return e.element.el===(\"string\"==typeof t?document.querySelector(t):t)}));e&&!e.element.isOpened&&e.element.open()},e.close=function(t){var e=window.$hsSelectCollection.find((function(e){return e.element.el===(\"string\"==typeof t?document.querySelector(t):t)}));e&&e.element.isOpened&&e.element.close()},e.closeCurrentlyOpened=function(t){if(void 0===t&&(t=null),!t.closest(\".hs-select.active\")){var e=window.$hsSelectCollection.filter((function(t){return t.element.isOpened}))||null;e&&e.forEach((function(t){t.element.close()}))}},e.accessibility=function(t){if(window.$hsSelectCollection.find((function(t){return t.element.isOpened}))&&c.SELECT_ACCESSIBILITY_KEY_SET.includes(t.code)&&!t.metaKey)switch(t.code){case\"Escape\":t.preventDefault(),this.onEscape();break;case\"ArrowUp\":t.preventDefault(),t.stopImmediatePropagation(),this.onArrow();break;case\"ArrowDown\":t.preventDefault(),t.stopImmediatePropagation(),this.onArrow(!1);break;case\"Tab\":t.preventDefault(),t.stopImmediatePropagation(),this.onTab(t.shiftKey);break;case\"Home\":t.preventDefault(),t.stopImmediatePropagation(),this.onStartEnd();break;case\"End\":t.preventDefault(),t.stopImmediatePropagation(),this.onStartEnd(!1);break;case\"Enter\":t.preventDefault(),this.onEnter(t)}},e.onEscape=function(){var t=window.$hsSelectCollection.find((function(t){return t.element.isOpened}));t&&t.element.close()},e.onArrow=function(t){void 0===t&&(t=!0);var e=window.$hsSelectCollection.find((function(t){return t.element.isOpened}));if(e){var i=e.element.dropdown;if(!i)return!1;var n=(t?Array.from(i.querySelectorAll(\":scope > *:not(.hidden)\")).reverse():Array.from(i.querySelectorAll(\":scope > *:not(.hidden)\"))).filter((function(t){return!t.classList.contains(\"disabled\")})),s=i.querySelector(\".hs-select-option-highlighted\")||i.querySelector(\".selected\");s||n[0].classList.add(\"hs-select-option-highlighted\");var o=n.findIndex((function(t){return t===s}));o+1 *:not(.hidden)\")).reverse():Array.from(i.querySelectorAll(\":scope > *:not(.hidden)\"))).filter((function(t){return!t.classList.contains(\"disabled\")})),s=i.querySelector(\".hs-select-option-highlighted\")||i.querySelector(\".selected\");s||n[0].classList.add(\"hs-select-option-highlighted\");var o=n.findIndex((function(t){return t===s}));if(!(o+1 *:not(.hidden)\")):Array.from(i.querySelectorAll(\":scope > *:not(.hidden)\")).reverse()).filter((function(t){return!t.classList.contains(\"disabled\")})),s=i.querySelector(\".hs-select-option-highlighted\");n.length&&(n[0].focus(),s&&s.classList.remove(\"hs-select-option-highlighted\"),n[0].classList.add(\"hs-select-option-highlighted\"))}},e.onEnter=function(t){var e=t.target.previousSibling;if(window.$hsSelectCollection.find((function(t){return t.element.el===e}))){var i=window.$hsSelectCollection.find((function(t){return t.element.isOpened})),n=window.$hsSelectCollection.find((function(t){return t.element.el===e}));i.element.close(),n.element.open()}else{(n=window.$hsSelectCollection.find((function(t){return t.element.isOpened})))&&n.element.onSelectOption(t.target.dataset.value||\"\")}},e}(d.default);window.addEventListener(\"load\",(function(){u.autoInit()})),document.addEventListener(\"scroll\",(function(){if(!window.$hsSelectCollection)return!1;var t=window.$hsSelectCollection.find((function(t){return t.element.isOpened}));t&&t.element.recalculateDirection()})),\"undefined\"!=typeof window&&(window.HSSelect=u),e.default=u},292:function(t,e){var i=this;Object.defineProperty(e,\"__esModule\",{value:!0}),e.menuSearchHistory=e.classToClassList=e.htmlToElement=e.afterTransition=e.dispatch=e.debounce=e.isFormElement=e.isParentOrElementHidden=e.isEnoughSpace=e.isIpadOS=e.isIOS=e.getZIndex=e.getClassPropertyAlt=e.getClassProperty=e.stringToBoolean=void 0,e.getHighestZIndex=function(t){var e=Number.NEGATIVE_INFINITY;return t.forEach((function(t){var i=n(t);\"auto\"!==i&&(i=parseInt(i,10))>e&&(e=i)})),e};e.stringToBoolean=function(t){return\"true\"===t};e.getClassProperty=function(t,e,i){return void 0===i&&(i=\"\"),(window.getComputedStyle(t).getPropertyValue(e)||i).replace(\" \",\"\")};e.getClassPropertyAlt=function(t,e,i){void 0===i&&(i=\"\");var n=\"\";return t.classList.forEach((function(t){t.includes(e)&&(n=t)})),n.match(/:(.*)]/)?n.match(/:(.*)]/)[1]:i};var n=function(t){return window.getComputedStyle(t).getPropertyValue(\"z-index\")};e.getZIndex=n;e.isIOS=function(){return!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)};e.isIpadOS=function(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)};e.isEnoughSpace=function(t,e,i,n,s){void 0===i&&(i=\"auto\"),void 0===n&&(n=10),void 0===s&&(s=null);var o=e.getBoundingClientRect(),l=s?s.getBoundingClientRect():null,r=window.innerHeight,a=l?o.top-l.top:o.top,d=(s?l.bottom:r)-o.bottom,c=t.clientHeight+n;return\"bottom\"===i?d>=c:\"top\"===i?a>=c:a>=c||d>=c};e.isFormElement=function(t){return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement};var s=function(t){return!!t&&(\"none\"===window.getComputedStyle(t).display||s(t.parentElement))};e.isParentOrElementHidden=s;e.debounce=function(t,e){var n;return void 0===e&&(e=200),function(){for(var s=[],o=0;o0?t.addEventListener(\"transitionend\",i,!0):e()};e.htmlToElement=function(t){var e=document.createElement(\"template\");return t=t.trim(),e.innerHTML=t,e.content.firstChild};e.classToClassList=function(t,e,i,n){void 0===i&&(i=\" \"),void 0===n&&(n=\"add\"),t.split(i).forEach((function(t){return\"add\"===n?e.classList.add(t):e.classList.remove(t)}))};e.menuSearchHistory={historyIndex:-1,addHistory:function(t){this.historyIndex=t},existsInHistory:function(t){return t>this.historyIndex},clearHistory:function(){this.historyIndex=-1}}}},e={};var i=function i(n){var s=e[n];if(void 0!==s)return s.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}(442);return i})()));","export default class FormDataWithToken extends FormData {\r\n constructor() {\r\n super()\r\n\r\n const rvfEl = document.querySelector('[name=__RequestVerificationToken]')\r\n\r\n if (rvfEl) {\r\n this.append('__RequestVerificationToken', rvfEl.value)\r\n }\r\n }\r\n}","export const currencyFormatter = new Intl.NumberFormat('en-US', {\r\n style: 'currency',\r\n currency: 'USD',\r\n minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)\r\n maximumFractionDigits: 2, // (causes 2500.99 to be printed as $2,501)\r\n})\r\n\r\nexport const numberformatter = new Intl.NumberFormat('en-US', {\r\n minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)\r\n maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)\r\n})\r\n\r\nexport const rateformatter = new Intl.NumberFormat('en-US', {\r\n minimumFractionDigits: 2, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)\r\n maximumFractionDigits: 2, // (causes 2500.99 to be printed as $2,501)\r\n})","import { currencyFormatter, rateformatter } from './formatters';\r\n\r\ndeclare global {\r\n interface HTMLElement {\r\n readonly SearchRates: SearchRates | undefined;\r\n }\r\n\r\n}\r\n\r\nif (!HTMLElement.prototype.SearchRates) {\r\n Object.defineProperty(HTMLElement.prototype, 'SearchRates', {\r\n get: function () {\r\n const modalId = this.getAttribute('id');\r\n return SearchRates.instances.get(modalId || '');\r\n }\r\n });\r\n}\r\n\r\nexport default class SearchRates {\r\n static instances = new Map();\r\n\r\n id: string\r\n formEl: HTMLFormElement\r\n termEls: NodeListOf\r\n rateEls: NodeListOf\r\n creditRatingEls: NodeListOf\r\n cashDownEl: HTMLInputElement | null\r\n\r\n disabledButtonEl: HTMLButtonElement | null\r\n activeButtonEl: HTMLButtonElement | null\r\n monthlyPaymentLabelEls: NodeListOf | null\r\n financeAmountLabelEl: HTMLElement | null\r\n rateLabelEls: NodeListOf | null\r\n errorLabelEl: HTMLElement | null\r\n\r\n private constructor(triggerElement: HTMLElement) {\r\n let id = triggerElement.getAttribute('id');\r\n if (!id) {\r\n triggerElement.setAttribute('id', 'search-rates-0')\r\n this.id = 'search-rates-0'\r\n }\r\n else {\r\n this.id = id\r\n }\r\n\r\n this.formEl = triggerElement as HTMLFormElement;\r\n this.termEls = this.formEl.querySelectorAll('[search-rates-term]')\r\n this.rateEls = this.formEl.querySelectorAll('[search-rates-rate]')\r\n this.creditRatingEls = this.formEl.querySelectorAll('[search-rates-credit]')\r\n this.cashDownEl = this.formEl.querySelector('[search-rates-cashdown]')\r\n\r\n this.disabledButtonEl = this.formEl.querySelector('[search-rates-disabled-button]')\r\n this.activeButtonEl = this.formEl.querySelector('[search-rates-active-button]')\r\n this.monthlyPaymentLabelEls = document.querySelectorAll('[search-rates-monthlypayment-label]')\r\n this.financeAmountLabelEl = this.formEl.querySelector('[search-rates-financeamount-label]')\r\n this.rateLabelEls = this.formEl.querySelectorAll('[search-rates-rate-label]')\r\n this.errorLabelEl = this.formEl.querySelector('[search-rates-error-label]')\r\n\r\n\r\n this.termEls?.forEach(trigger => {\r\n trigger.addEventListener('click', () => this.termChanged())\r\n })\r\n\r\n this.rateEls?.forEach(trigger => {\r\n trigger.addEventListener('change', () => this.rateChanged())\r\n })\r\n\r\n this.creditRatingEls?.forEach(trigger => {\r\n trigger.addEventListener('click', () => this.creditChanged())\r\n })\r\n\r\n this.cashDownEl?.addEventListener('change', () => this.cashDownChanged())\r\n\r\n this.search()\r\n }\r\n\r\n public async termChanged() {\r\n this.setRates('')\r\n await this.search()\r\n }\r\n\r\n public async rateChanged() {\r\n await this.search()\r\n }\r\n\r\n public async creditChanged() {\r\n this.setRates('')\r\n await this.search()\r\n }\r\n\r\n public async cashDownChanged() {\r\n await this.search()\r\n }\r\n\r\n public setRates(val: string) {\r\n this.rateLabelEls?.forEach(item => {\r\n if (item.tagName == 'INPUT') (item as HTMLInputElement).value = val\r\n else item.innerHTML = val\r\n })\r\n }\r\n\r\n public async search() {\r\n const formData = new FormData(this.formEl);\r\n console.log(formData)\r\n\r\n if (formData.has('Rate')) {\r\n let val = formData.get('Rate')?.toString().replaceAll('%', '')\r\n if (val) formData.set('Rate', val)\r\n }\r\n\r\n if (formData.get(\"__RequestVerificationToken\") == null) {\r\n let token = document.querySelector('[name=\"__RequestVerificationToken\"]') as HTMLFormElement\r\n formData.append(\"__RequestVerificationToken\", token.value)\r\n }\r\n\r\n const response = await fetch('/details/citystate/vehicle?handler=Search', { method: 'POST', body: formData })\r\n const data = await response.json()\r\n\r\n if (data.isError == true) {\r\n if (this.disabledButtonEl) this.disabledButtonEl.style.display = 'none'\r\n if (this.activeButtonEl) this.activeButtonEl.style.display = ''\r\n if (this.errorLabelEl) this.errorLabelEl.style.display = ''\r\n if (this.errorLabelEl) this.errorLabelEl.innerHTML = data.failedReasons\r\n\r\n if (this.financeAmountLabelEl) this.financeAmountLabelEl.innerHTML = ''\r\n if (this.monthlyPaymentLabelEls) this.monthlyPaymentLabelEls.forEach(item => item.innerHTML = '')\r\n this.setRates('')\r\n }\r\n else {\r\n if (this.errorLabelEl) this.errorLabelEl.style.display = 'none'\r\n if (this.financeAmountLabelEl) this.financeAmountLabelEl.innerHTML = currencyFormatter.format(data.financeAmount)\r\n if (this.monthlyPaymentLabelEls) this.monthlyPaymentLabelEls.forEach(item => item.innerHTML = currencyFormatter.format(data.monthlyPayment))\r\n if (this.rateLabelEls) {\r\n let val = rateformatter.format(data.rate) + ' %'\r\n this.setRates(val)\r\n }\r\n if (this.disabledButtonEl) this.disabledButtonEl.style.display = 'none'\r\n if (this.activeButtonEl) this.activeButtonEl.style.display = ''\r\n\r\n if (data.failedReasons && this.errorLabelEl) {\r\n this.errorLabelEl.style.display = ''\r\n this.errorLabelEl.innerHTML = data.failedReasons.join(\"
\");\r\n }\r\n\r\n //if (data.tradeEquity > 0 || data.tradeEquity < 0) {\r\n // $(\"#trade-equity-section\").show()\r\n // $(\"#trade-equity\").html(formatter.format(data.tradeEquity))\r\n\r\n // if (data.tradeEquity < 0) {\r\n // $(\"#trade-equity\").css(\"color\", \"rgb(255, 68, 88)\")\r\n // }\r\n // else if (data.tradeEquity > 0) {\r\n // $(\"#trade-equity\").css(\"color\", \"#6dbd44\")\r\n // }\r\n //}\r\n //else {\r\n // $(\"#trade-equity-section\").hide()\r\n // $(\"#trade-equity\").html(\"\")\r\n //}\r\n\r\n // Update Product Costs\r\n //$.each(data.dealershipProducts, function (i, obj) {\r\n // $(\"#ProductCost-\" + obj.id).html(formatter.format(obj.monthlyPayment))\r\n //})\r\n\r\n this.updateTermSliders(data.maxTerm)\r\n }\r\n }\r\n\r\n private updateTermSliders(maxTerm: number) {\r\n const termElsArray = Array.from(this.termEls); // Convert NodeList to Array\r\n const checkedCheckbox = termElsArray.find(checkbox => checkbox.checked);\r\n\r\n if (checkedCheckbox) {\r\n let currentTerm = parseInt(checkedCheckbox.value);\r\n\r\n this.toggleTerm(84, maxTerm);\r\n this.toggleTerm(72, maxTerm);\r\n this.toggleTerm(60, maxTerm);\r\n\r\n if (currentTerm > maxTerm) {\r\n let checkboxToCheck = null;\r\n\r\n if (maxTerm >= 36 && maxTerm <= 47) {\r\n checkboxToCheck = termElsArray.find(el => el.value === \"36\");\r\n } else if (maxTerm >= 48 && maxTerm <= 59) {\r\n checkboxToCheck = termElsArray.find(el => el.value === \"48\");\r\n } else if (maxTerm >= 60 && maxTerm <= 71) {\r\n checkboxToCheck = termElsArray.find(el => el.value === \"60\");\r\n } else if (maxTerm >= 72 && maxTerm <= 83) {\r\n checkboxToCheck = termElsArray.find(el => el.value === \"72\");\r\n } else if (maxTerm >= 84) {\r\n checkboxToCheck = termElsArray.find(el => el.value === \"84\");\r\n }\r\n\r\n if (checkboxToCheck) {\r\n checkboxToCheck.checked = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private toggleTerm(value:number, maxTerm:number) {\r\n const termElsArray = Array.from(this.termEls); // Convert NodeList to Array\r\n\r\n const checkbox = termElsArray.find(el => el.value === value.toString()); // Find checkbox by value\r\n if (checkbox) {\r\n if (maxTerm < value) {\r\n checkbox.disabled = true;\r\n checkbox.closest(\".radio-btn-group\")?.classList.add(\"bg-gray-2\");\r\n } else {\r\n checkbox.disabled = false;\r\n checkbox.closest(\".radio-btn-group\")?.classList.remove(\"bg-gray-2\");\r\n }\r\n }\r\n }\r\n\r\n static getInstance(triggerElement: HTMLElement): SearchRates {\r\n const id = triggerElement.getAttribute('id') ?? '';\r\n let instance = SearchRates.instances.get(id);\r\n\r\n if (!instance) {\r\n instance = new SearchRates(triggerElement);\r\n SearchRates.instances.set(id, instance);\r\n }\r\n\r\n return instance;\r\n }\r\n}\r\n\r\n// Instantiation based on the HTML element with the `data-modal-trigger` attribute\r\ndocument.querySelectorAll('[search-rates]').forEach(triggerElement => {\r\n SearchRates.getInstance(triggerElement as HTMLElement);\r\n});","export class SimpleValidate {\r\n static instances = new Map();\r\n\r\n el: HTMLFormElement;\r\n invalidElements: HTMLInputElement[] = [];\r\n \r\n private constructor(triggerElement: HTMLFormElement) {\r\n this.el = triggerElement;\r\n\r\n this.el.querySelectorAll('input, select, textarea').forEach(item => {\r\n item.addEventListener('blur', () => this.validateElement(item, false))\r\n })\r\n\r\n this.el.querySelectorAll('[simple-validate-check]').forEach(item => {\r\n item.addEventListener('click', (event) => {\r\n if (!this.validate()) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n })\r\n })\r\n }\r\n\r\n static getInstance(triggerElement: HTMLFormElement): SimpleValidate {\r\n const modalId = triggerElement.getAttribute('id') ?? 'simple-validate-form-1';\r\n let instance = SimpleValidate.instances.get(modalId);\r\n\r\n if (!instance) {\r\n instance = new SimpleValidate(triggerElement);\r\n SimpleValidate.instances.set(modalId, instance);\r\n }\r\n\r\n return instance;\r\n }\r\n\r\n validate() {\r\n let isValid: boolean = true\r\n let firstError: HTMLElement | null = null\r\n\r\n this.el.querySelectorAll('input, select, textarea').forEach(f => {\r\n if (f.disabled != true && this.validateElement(f, firstError == null) == false) {\r\n firstError = f\r\n isValid = false\r\n }\r\n })\r\n \r\n return isValid\r\n }\r\n\r\n validateElement(itemToValidate: HTMLInputElement, scrollToError: boolean) {\r\n if (this.checkVisibility(itemToValidate) == true) {\r\n \r\n if (itemToValidate.checkValidity() == false) {\r\n itemToValidate.classList.add('error')\r\n\r\n if (scrollToError) {\r\n itemToValidate.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest' })\r\n }\r\n\r\n this.invalidElements.push(itemToValidate)\r\n\r\n return false\r\n }\r\n else {\r\n itemToValidate.classList.remove('error')\r\n }\r\n }\r\n\r\n return true\r\n }\r\n\r\n checkVisibility(el: HTMLInputElement) {\r\n if (el.checkVisibility)\r\n return el.checkVisibility()\r\n else {\r\n // Traverse up the DOM\r\n let newEl: HTMLElement | null = el\r\n while (newEl) {\r\n // Get computed style of the current element\r\n const style = getComputedStyle(newEl)\r\n \r\n // Check for visibility conditions\r\n if (style.display === 'none' || style.visibility === 'hidden' || parseFloat(style.opacity) === 0) {\r\n return false\r\n }\r\n\r\n // Move to the parent element\r\n newEl = newEl.parentElement as HTMLElement | null\r\n }\r\n\r\n return true\r\n }\r\n }\r\n}\r\n\r\n// Instantiation based on the HTML element with the `data-modal-trigger` attribute\r\ndocument.querySelectorAll('[simple-validate]').forEach(triggerElement => {\r\n SimpleValidate.getInstance(triggerElement as HTMLFormElement);\r\n})\r\n","import FormDataWithToken from \"./FormDataWithToken\"\r\nimport SearchRates from \"./SearchRates\"\r\nimport { SimpleValidate } from \"./SimpleValidate\"\r\nimport { currencyFormatter } from \"./formatters\"\r\n\r\nconst tes = document.getElementById('trade-equity-strong') as HTMLElement\r\n\r\ndocument.querySelector('.js-set-trade')?.addEventListener('click', async () => {\r\n const tf = document.getElementById('trade-form') as HTMLFormElement\r\n const md = document.getElementById('trade-modal')\r\n const tv = document.getElementById('trade-value')\r\n const to = (document.getElementById('trade-owed') as HTMLInputElement)\r\n\r\n if (tf) {\r\n let vf = SimpleValidate.getInstance(tf)\r\n if (vf?.validate() && md) {\r\n if (md) {\r\n md.style.display = 'none'\r\n }\r\n\r\n let tradeValue = parseInt('0' + tv?.innerHTML.replace('$', '').replace(/,/g, ''))\r\n let tradeOwed = parseInt('0' + to?.value.replace('$', '').replace(/,/g, ''))\r\n let newVal = tradeValue - tradeOwed\r\n\r\n if (tes) tes.innerHTML = currencyFormatter.format(newVal)\r\n\r\n document.body.classList.add('has-trade')\r\n\r\n // Save Trade Equity\r\n let parms = new FormData(tf)\r\n await fetch('/details/citystate/vehicle?handler=SaveTradeEquity', { method: 'POST', body: parms })\r\n\r\n // Refresh Search\r\n const frm2 = document.getElementById('frmLoan') as HTMLFormElement\r\n var sr = SearchRates.getInstance(frm2)\r\n if (sr) sr.search()\r\n }\r\n }\r\n})\r\n\r\ndocument.querySelector('.js-remove-trade')?.addEventListener('click', async () => {\r\n if (tes) tes.innerHTML = currencyFormatter.format(0)\r\n\r\n document.body.classList.remove('has-trade')\r\n\r\n // Remove Trade\r\n await fetch('/details/citystate/vehicle?handler=RemoveTrade', { method: 'POST', body: new FormDataWithToken() })\r\n\r\n // Refresh Search\r\n const frm2 = document.getElementById('frmLoan') as HTMLFormElement\r\n var sr = SearchRates.getInstance(frm2)\r\n if (sr) sr.search()\r\n})\r\n\r\nconst itv = document.querySelector('.input-trade-value') as HTMLFormElement\r\nconst taov = document.getElementById('trade-in-amount-owed-in-vehicle') as HTMLFormElement\r\nconst te = document.querySelectorAll('.trade-equity')\r\n\r\ntaov?.addEventListener('change', setTradeEquity)\r\nitv?.addEventListener('change', setTradeEquity)\r\n\r\nfunction setTradeEquity() {\r\n let tradeValue = Number(itv.value.replace(/[^0-9.]/g, ''))\r\n let tradeOwed = Number(taov.value.replace(/[^0-9.]/g, ''))\r\n let tradeEquity = tradeValue - tradeOwed\r\n\r\n document.querySelectorAll('.input-trade-value').forEach(m => (m as HTMLFormElement).value = tradeValue)\r\n document.querySelectorAll('.input-trade-owed').forEach(m => (m as HTMLFormElement).value = tradeOwed)\r\n\r\n if (te) {\r\n te.forEach(m => {\r\n m.innerHTML = currencyFormatter.format(tradeEquity)\r\n\r\n if (tradeEquity >= 0) {\r\n m.classList.add(\"text-green\")\r\n m.classList.remove(\"text-red\")\r\n }\r\n else {\r\n m.classList.remove(\"text-green\")\r\n m.classList.add(\"text-red\")\r\n }\r\n })\r\n }\r\n\r\n document.querySelectorAll('[search-rates]').forEach(triggerElement => {\r\n var sr = SearchRates.getInstance(triggerElement as HTMLElement)\r\n sr.search()\r\n })\r\n}","document.querySelectorAll('.js-nav-trigger').forEach(trigger => {\n trigger.addEventListener('click', event => {\n event.preventDefault();\n\n trigger.classList.toggle('is-active');\n\n document.querySelectorAll('.js-nav').forEach(sib => sib.classList.toggle('is-active'));\n \n document.body.classList.toggle('has-open-nav');\n });\n});\n","/**\r\n * Handle Scroll Spy Nav \r\n */\r\n\r\nwindow.addEventListener('load', handleScroll);\r\nwindow.addEventListener('scroll', handleScroll);\r\nwindow.addEventListener('resize', handleScroll);\r\nconst scrollSpyMainNav = document.querySelectorAll('.js-scroll-spy-main-nav');\r\nconst scrollSpySubNav = document.querySelectorAll('.js-scroll-spy-sub-nav');\r\nconst navLinks = document.querySelectorAll('.js-scroll-spy-nav a');\r\n\r\nfunction handleScroll() {\r\n if (scrollSpyMainNav && scrollSpyMainNav[0]) {\r\n const windowScroll = window.scrollY;\r\n const scrollSpyMainNavHeight = scrollSpyMainNav[0].offsetHeight;\r\n const stickyNavThreshold = scrollSpyMainNavHeight;\r\n const scrollSpySubNavOffset = scrollSpySubNav[0].getBoundingClientRect().top + window.scrollY;\r\n \r\n if (windowScroll >= scrollSpySubNavOffset) {\r\n scrollSpyMainNav[0].classList.add('is-active');\r\n } else {\r\n scrollSpyMainNav[0].classList.remove('is-active');\r\n }\r\n \r\n navLinks?.forEach(function (navLink) {\r\n const section = document.querySelector(navLink.getAttribute('href') ?? '');\r\n\r\n if (section) {\r\n const sectionOffset = section.getBoundingClientRect().top + window.scrollY;\r\n const sectionHeight = section.offsetHeight;\r\n const sectionBottom = sectionHeight + sectionOffset;\r\n\r\n if (windowScroll - 12 < sectionBottom - stickyNavThreshold && windowScroll + 20 >= sectionOffset - stickyNavThreshold) {\r\n navLink.parentElement?.classList.add('is-active');\r\n } else {\r\n navLink.parentElement?.classList.remove('is-active');\r\n }\r\n }\r\n })\r\n }\r\n}\r\n\r\n//addEventListener('click', function (event) {\r\n// let el = event.target as HTMLElement;\r\n\r\n//\tif (el.tagName === 'A' && el.classList.contains('js-scroll-spy-nav')) {\r\n//\t\tevent.preventDefault();\r\n\r\n//\t\tvar topOffset = anchorContent.getBoundingClientRect().top + window.scrollY;\r\n\r\n//\t\t$('html, body').animate({ scrollTop: topOffset - 70 }, 500);\r\n//\t}\r\n//})\r\n","document.querySelectorAll('.js-scroll-to').forEach(button => {\n button.addEventListener('click', event => {\n event.preventDefault();\n const href = button.getAttribute('href') ?? '';\n const anchorContent = document.querySelector(href);\n const anchorContentOffset = (anchorContent?.getBoundingClientRect().top ?? 0) + window.scrollY;\n\n window.scrollTo({\n top: anchorContentOffset,\n behavior: 'smooth'\n });\n });\n});\n","addEventListener(\"click\", function (event) {\r\n let trigger = event.target as HTMLElement;\r\n\r\n if (trigger.closest('.js-show-hide-trigger')) {\r\n event.preventDefault();\r\n\r\n const closestStep = trigger.closest('[data-step]');\r\n const inputs = closestStep?.querySelectorAll('input[type=\"radio\"], input[type=\"checkbox\"]');\r\n //const search = closestStep?.querySelector('.js-search-autocomplete');\r\n\r\n //if (search != null)\r\n // search.value = '';\r\n\r\n if (inputs) {\r\n inputs.forEach(input => {\r\n input.dispatchEvent(new Event('change'));\r\n input.checked = false;\r\n });\r\n }\r\n\r\n const closestContent = trigger.closest('.js-show-hide-content');\r\n closestContent?.parentElement?.querySelectorAll('.js-show-hide-content').forEach(sibling => sibling.classList.toggle('is-active'));\r\n }\r\n});","document.querySelectorAll('.js-show-more-trigger').forEach(trigger => {\n trigger.addEventListener('click', event => {\n event.preventDefault();\n const showMoreWrapper = trigger.closest('.js-show-more-wrapper');\n showMoreWrapper?.classList.toggle('is-open');\n });\n});\n","/**\n * SSR Window 4.0.2\n * Better handling for window object in SSR environment\n * https://github.com/nolimits4web/ssr-window\n *\n * Copyright 2021, Vladimir Kharlampidi\n *\n * Licensed under MIT\n *\n * Released on: December 13, 2021\n */\n/* eslint-disable no-param-reassign */\nfunction isObject(obj) {\n return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;\n}\nfunction extend(target, src) {\n if (target === void 0) {\n target = {};\n }\n if (src === void 0) {\n src = {};\n }\n Object.keys(src).forEach(key => {\n if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {\n extend(target[key], src[key]);\n }\n });\n}\nconst ssrDocument = {\n body: {},\n addEventListener() {},\n removeEventListener() {},\n activeElement: {\n blur() {},\n nodeName: ''\n },\n querySelector() {\n return null;\n },\n querySelectorAll() {\n return [];\n },\n getElementById() {\n return null;\n },\n createEvent() {\n return {\n initEvent() {}\n };\n },\n createElement() {\n return {\n children: [],\n childNodes: [],\n style: {},\n setAttribute() {},\n getElementsByTagName() {\n return [];\n }\n };\n },\n createElementNS() {\n return {};\n },\n importNode() {\n return null;\n },\n location: {\n hash: '',\n host: '',\n hostname: '',\n href: '',\n origin: '',\n pathname: '',\n protocol: '',\n search: ''\n }\n};\nfunction getDocument() {\n const doc = typeof document !== 'undefined' ? document : {};\n extend(doc, ssrDocument);\n return doc;\n}\nconst ssrWindow = {\n document: ssrDocument,\n navigator: {\n userAgent: ''\n },\n location: {\n hash: '',\n host: '',\n hostname: '',\n href: '',\n origin: '',\n pathname: '',\n protocol: '',\n search: ''\n },\n history: {\n replaceState() {},\n pushState() {},\n go() {},\n back() {}\n },\n CustomEvent: function CustomEvent() {\n return this;\n },\n addEventListener() {},\n removeEventListener() {},\n getComputedStyle() {\n return {\n getPropertyValue() {\n return '';\n }\n };\n },\n Image() {},\n Date() {},\n screen: {},\n setTimeout() {},\n clearTimeout() {},\n matchMedia() {\n return {};\n },\n requestAnimationFrame(callback) {\n if (typeof setTimeout === 'undefined') {\n callback();\n return null;\n }\n return setTimeout(callback, 0);\n },\n cancelAnimationFrame(id) {\n if (typeof setTimeout === 'undefined') {\n return;\n }\n clearTimeout(id);\n }\n};\nfunction getWindow() {\n const win = typeof window !== 'undefined' ? window : {};\n extend(win, ssrWindow);\n return win;\n}\n\nexport { getWindow as a, getDocument as g };\n","import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';\n\nfunction classesToTokens(classes) {\n if (classes === void 0) {\n classes = '';\n }\n return classes.trim().split(' ').filter(c => !!c.trim());\n}\n\nfunction deleteProps(obj) {\n const object = obj;\n Object.keys(object).forEach(key => {\n try {\n object[key] = null;\n } catch (e) {\n // no getter for object\n }\n try {\n delete object[key];\n } catch (e) {\n // something got wrong\n }\n });\n}\nfunction nextTick(callback, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return setTimeout(callback, delay);\n}\nfunction now() {\n return Date.now();\n}\nfunction getComputedStyle(el) {\n const window = getWindow();\n let style;\n if (window.getComputedStyle) {\n style = window.getComputedStyle(el, null);\n }\n if (!style && el.currentStyle) {\n style = el.currentStyle;\n }\n if (!style) {\n style = el.style;\n }\n return style;\n}\nfunction getTranslate(el, axis) {\n if (axis === void 0) {\n axis = 'x';\n }\n const window = getWindow();\n let matrix;\n let curTransform;\n let transformMatrix;\n const curStyle = getComputedStyle(el);\n if (window.WebKitCSSMatrix) {\n curTransform = curStyle.transform || curStyle.webkitTransform;\n if (curTransform.split(',').length > 6) {\n curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');\n }\n // Some old versions of Webkit choke when 'none' is passed; pass\n // empty string instead in this case\n transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n } else {\n transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n matrix = transformMatrix.toString().split(',');\n }\n if (axis === 'x') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;\n // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);\n // Normal Browsers\n else curTransform = parseFloat(matrix[4]);\n }\n if (axis === 'y') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;\n // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);\n // Normal Browsers\n else curTransform = parseFloat(matrix[5]);\n }\n return curTransform || 0;\n}\nfunction isObject(o) {\n return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';\n}\nfunction isNode(node) {\n // eslint-disable-next-line\n if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {\n return node instanceof HTMLElement;\n }\n return node && (node.nodeType === 1 || node.nodeType === 11);\n}\nfunction extend() {\n const to = Object(arguments.length <= 0 ? undefined : arguments[0]);\n const noExtend = ['__proto__', 'constructor', 'prototype'];\n for (let i = 1; i < arguments.length; i += 1) {\n const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];\n if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {\n const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);\n for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {\n const nextKey = keysArray[nextIndex];\n const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n to[nextKey] = {};\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n }\n return to;\n}\nfunction setCSSProperty(el, varName, varValue) {\n el.style.setProperty(varName, varValue);\n}\nfunction animateCSSModeScroll(_ref) {\n let {\n swiper,\n targetPosition,\n side\n } = _ref;\n const window = getWindow();\n const startPosition = -swiper.translate;\n let startTime = null;\n let time;\n const duration = swiper.params.speed;\n swiper.wrapperEl.style.scrollSnapType = 'none';\n window.cancelAnimationFrame(swiper.cssModeFrameID);\n const dir = targetPosition > startPosition ? 'next' : 'prev';\n const isOutOfBound = (current, target) => {\n return dir === 'next' && current >= target || dir === 'prev' && current <= target;\n };\n const animate = () => {\n time = new Date().getTime();\n if (startTime === null) {\n startTime = time;\n }\n const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);\n const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;\n let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);\n if (isOutOfBound(currentPosition, targetPosition)) {\n currentPosition = targetPosition;\n }\n swiper.wrapperEl.scrollTo({\n [side]: currentPosition\n });\n if (isOutOfBound(currentPosition, targetPosition)) {\n swiper.wrapperEl.style.overflow = 'hidden';\n swiper.wrapperEl.style.scrollSnapType = '';\n setTimeout(() => {\n swiper.wrapperEl.style.overflow = '';\n swiper.wrapperEl.scrollTo({\n [side]: currentPosition\n });\n });\n window.cancelAnimationFrame(swiper.cssModeFrameID);\n return;\n }\n swiper.cssModeFrameID = window.requestAnimationFrame(animate);\n };\n animate();\n}\nfunction getSlideTransformEl(slideEl) {\n return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;\n}\nfunction elementChildren(element, selector) {\n if (selector === void 0) {\n selector = '';\n }\n return [...element.children].filter(el => el.matches(selector));\n}\nfunction showWarning(text) {\n try {\n console.warn(text);\n return;\n } catch (err) {\n // err\n }\n}\nfunction createElement(tag, classes) {\n if (classes === void 0) {\n classes = [];\n }\n const el = document.createElement(tag);\n el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));\n return el;\n}\nfunction elementOffset(el) {\n const window = getWindow();\n const document = getDocument();\n const box = el.getBoundingClientRect();\n const body = document.body;\n const clientTop = el.clientTop || body.clientTop || 0;\n const clientLeft = el.clientLeft || body.clientLeft || 0;\n const scrollTop = el === window ? window.scrollY : el.scrollTop;\n const scrollLeft = el === window ? window.scrollX : el.scrollLeft;\n return {\n top: box.top + scrollTop - clientTop,\n left: box.left + scrollLeft - clientLeft\n };\n}\nfunction elementPrevAll(el, selector) {\n const prevEls = [];\n while (el.previousElementSibling) {\n const prev = el.previousElementSibling; // eslint-disable-line\n if (selector) {\n if (prev.matches(selector)) prevEls.push(prev);\n } else prevEls.push(prev);\n el = prev;\n }\n return prevEls;\n}\nfunction elementNextAll(el, selector) {\n const nextEls = [];\n while (el.nextElementSibling) {\n const next = el.nextElementSibling; // eslint-disable-line\n if (selector) {\n if (next.matches(selector)) nextEls.push(next);\n } else nextEls.push(next);\n el = next;\n }\n return nextEls;\n}\nfunction elementStyle(el, prop) {\n const window = getWindow();\n return window.getComputedStyle(el, null).getPropertyValue(prop);\n}\nfunction elementIndex(el) {\n let child = el;\n let i;\n if (child) {\n i = 0;\n // eslint-disable-next-line\n while ((child = child.previousSibling) !== null) {\n if (child.nodeType === 1) i += 1;\n }\n return i;\n }\n return undefined;\n}\nfunction elementParents(el, selector) {\n const parents = []; // eslint-disable-line\n let parent = el.parentElement; // eslint-disable-line\n while (parent) {\n if (selector) {\n if (parent.matches(selector)) parents.push(parent);\n } else {\n parents.push(parent);\n }\n parent = parent.parentElement;\n }\n return parents;\n}\nfunction elementTransitionEnd(el, callback) {\n function fireCallBack(e) {\n if (e.target !== el) return;\n callback.call(el, e);\n el.removeEventListener('transitionend', fireCallBack);\n }\n if (callback) {\n el.addEventListener('transitionend', fireCallBack);\n }\n}\nfunction elementOuterSize(el, size, includeMargins) {\n const window = getWindow();\n if (includeMargins) {\n return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));\n }\n return el.offsetWidth;\n}\nfunction makeElementsArray(el) {\n return (Array.isArray(el) ? el : [el]).filter(e => !!e);\n}\n\nexport { elementParents as a, elementOffset as b, createElement as c, now as d, elementChildren as e, elementOuterSize as f, elementIndex as g, classesToTokens as h, getTranslate as i, elementTransitionEnd as j, isObject as k, getSlideTransformEl as l, makeElementsArray as m, nextTick as n, elementStyle as o, elementNextAll as p, elementPrevAll as q, animateCSSModeScroll as r, setCSSProperty as s, showWarning as t, extend as u, deleteProps as v };\n","import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';\nimport { a as elementParents, o as elementStyle, e as elementChildren, s as setCSSProperty, f as elementOuterSize, p as elementNextAll, q as elementPrevAll, i as getTranslate, r as animateCSSModeScroll, n as nextTick, t as showWarning, c as createElement, d as now, u as extend, g as elementIndex, v as deleteProps } from './utils.mjs';\n\nlet support;\nfunction calcSupport() {\n const window = getWindow();\n const document = getDocument();\n return {\n smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,\n touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)\n };\n}\nfunction getSupport() {\n if (!support) {\n support = calcSupport();\n }\n return support;\n}\n\nlet deviceCached;\nfunction calcDevice(_temp) {\n let {\n userAgent\n } = _temp === void 0 ? {} : _temp;\n const support = getSupport();\n const window = getWindow();\n const platform = window.navigator.platform;\n const ua = userAgent || window.navigator.userAgent;\n const device = {\n ios: false,\n android: false\n };\n const screenWidth = window.screen.width;\n const screenHeight = window.screen.height;\n const android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/); // eslint-disable-line\n let ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n const ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n const iphone = !ipad && ua.match(/(iPhone\\sOS|iOS)\\s([\\d_]+)/);\n const windows = platform === 'Win32';\n let macos = platform === 'MacIntel';\n\n // iPadOs 13 fix\n const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];\n if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {\n ipad = ua.match(/(Version)\\/([\\d.]+)/);\n if (!ipad) ipad = [0, 1, '13_0_0'];\n macos = false;\n }\n\n // Android\n if (android && !windows) {\n device.os = 'android';\n device.android = true;\n }\n if (ipad || iphone || ipod) {\n device.os = 'ios';\n device.ios = true;\n }\n\n // Export object\n return device;\n}\nfunction getDevice(overrides) {\n if (overrides === void 0) {\n overrides = {};\n }\n if (!deviceCached) {\n deviceCached = calcDevice(overrides);\n }\n return deviceCached;\n}\n\nlet browser;\nfunction calcBrowser() {\n const window = getWindow();\n const device = getDevice();\n let needPerspectiveFix = false;\n function isSafari() {\n const ua = window.navigator.userAgent.toLowerCase();\n return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;\n }\n if (isSafari()) {\n const ua = String(window.navigator.userAgent);\n if (ua.includes('Version/')) {\n const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num));\n needPerspectiveFix = major < 16 || major === 16 && minor < 2;\n }\n }\n const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent);\n const isSafariBrowser = isSafari();\n const need3dFix = isSafariBrowser || isWebView && device.ios;\n return {\n isSafari: needPerspectiveFix || isSafariBrowser,\n needPerspectiveFix,\n need3dFix,\n isWebView\n };\n}\nfunction getBrowser() {\n if (!browser) {\n browser = calcBrowser();\n }\n return browser;\n}\n\nfunction Resize(_ref) {\n let {\n swiper,\n on,\n emit\n } = _ref;\n const window = getWindow();\n let observer = null;\n let animationFrame = null;\n const resizeHandler = () => {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n emit('beforeResize');\n emit('resize');\n };\n const createObserver = () => {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n observer = new ResizeObserver(entries => {\n animationFrame = window.requestAnimationFrame(() => {\n const {\n width,\n height\n } = swiper;\n let newWidth = width;\n let newHeight = height;\n entries.forEach(_ref2 => {\n let {\n contentBoxSize,\n contentRect,\n target\n } = _ref2;\n if (target && target !== swiper.el) return;\n newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;\n newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;\n });\n if (newWidth !== width || newHeight !== height) {\n resizeHandler();\n }\n });\n });\n observer.observe(swiper.el);\n };\n const removeObserver = () => {\n if (animationFrame) {\n window.cancelAnimationFrame(animationFrame);\n }\n if (observer && observer.unobserve && swiper.el) {\n observer.unobserve(swiper.el);\n observer = null;\n }\n };\n const orientationChangeHandler = () => {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n emit('orientationchange');\n };\n on('init', () => {\n if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {\n createObserver();\n return;\n }\n window.addEventListener('resize', resizeHandler);\n window.addEventListener('orientationchange', orientationChangeHandler);\n });\n on('destroy', () => {\n removeObserver();\n window.removeEventListener('resize', resizeHandler);\n window.removeEventListener('orientationchange', orientationChangeHandler);\n });\n}\n\nfunction Observer(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const observers = [];\n const window = getWindow();\n const attach = function (target, options) {\n if (options === void 0) {\n options = {};\n }\n const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;\n const observer = new ObserverFunc(mutations => {\n // The observerUpdate event should only be triggered\n // once despite the number of mutations. Additional\n // triggers are redundant and are very costly\n if (swiper.__preventObserver__) return;\n if (mutations.length === 1) {\n emit('observerUpdate', mutations[0]);\n return;\n }\n const observerUpdate = function observerUpdate() {\n emit('observerUpdate', mutations[0]);\n };\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(observerUpdate);\n } else {\n window.setTimeout(observerUpdate, 0);\n }\n });\n observer.observe(target, {\n attributes: typeof options.attributes === 'undefined' ? true : options.attributes,\n childList: typeof options.childList === 'undefined' ? true : options.childList,\n characterData: typeof options.characterData === 'undefined' ? true : options.characterData\n });\n observers.push(observer);\n };\n const init = () => {\n if (!swiper.params.observer) return;\n if (swiper.params.observeParents) {\n const containerParents = elementParents(swiper.hostEl);\n for (let i = 0; i < containerParents.length; i += 1) {\n attach(containerParents[i]);\n }\n }\n // Observe container\n attach(swiper.hostEl, {\n childList: swiper.params.observeSlideChildren\n });\n\n // Observe wrapper\n attach(swiper.wrapperEl, {\n attributes: false\n });\n };\n const destroy = () => {\n observers.forEach(observer => {\n observer.disconnect();\n });\n observers.splice(0, observers.length);\n };\n extendParams({\n observer: false,\n observeParents: false,\n observeSlideChildren: false\n });\n on('init', init);\n on('destroy', destroy);\n}\n\n/* eslint-disable no-underscore-dangle */\n\nvar eventsEmitter = {\n on(events, handler, priority) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (typeof handler !== 'function') return self;\n const method = priority ? 'unshift' : 'push';\n events.split(' ').forEach(event => {\n if (!self.eventsListeners[event]) self.eventsListeners[event] = [];\n self.eventsListeners[event][method](handler);\n });\n return self;\n },\n once(events, handler, priority) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (typeof handler !== 'function') return self;\n function onceHandler() {\n self.off(events, onceHandler);\n if (onceHandler.__emitterProxy) {\n delete onceHandler.__emitterProxy;\n }\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n handler.apply(self, args);\n }\n onceHandler.__emitterProxy = handler;\n return self.on(events, onceHandler, priority);\n },\n onAny(handler, priority) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (typeof handler !== 'function') return self;\n const method = priority ? 'unshift' : 'push';\n if (self.eventsAnyListeners.indexOf(handler) < 0) {\n self.eventsAnyListeners[method](handler);\n }\n return self;\n },\n offAny(handler) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (!self.eventsAnyListeners) return self;\n const index = self.eventsAnyListeners.indexOf(handler);\n if (index >= 0) {\n self.eventsAnyListeners.splice(index, 1);\n }\n return self;\n },\n off(events, handler) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (!self.eventsListeners) return self;\n events.split(' ').forEach(event => {\n if (typeof handler === 'undefined') {\n self.eventsListeners[event] = [];\n } else if (self.eventsListeners[event]) {\n self.eventsListeners[event].forEach((eventHandler, index) => {\n if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {\n self.eventsListeners[event].splice(index, 1);\n }\n });\n }\n });\n return self;\n },\n emit() {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (!self.eventsListeners) return self;\n let events;\n let data;\n let context;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (typeof args[0] === 'string' || Array.isArray(args[0])) {\n events = args[0];\n data = args.slice(1, args.length);\n context = self;\n } else {\n events = args[0].events;\n data = args[0].data;\n context = args[0].context || self;\n }\n data.unshift(context);\n const eventsArray = Array.isArray(events) ? events : events.split(' ');\n eventsArray.forEach(event => {\n if (self.eventsAnyListeners && self.eventsAnyListeners.length) {\n self.eventsAnyListeners.forEach(eventHandler => {\n eventHandler.apply(context, [event, ...data]);\n });\n }\n if (self.eventsListeners && self.eventsListeners[event]) {\n self.eventsListeners[event].forEach(eventHandler => {\n eventHandler.apply(context, data);\n });\n }\n });\n return self;\n }\n};\n\nfunction updateSize() {\n const swiper = this;\n let width;\n let height;\n const el = swiper.el;\n if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {\n width = swiper.params.width;\n } else {\n width = el.clientWidth;\n }\n if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {\n height = swiper.params.height;\n } else {\n height = el.clientHeight;\n }\n if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {\n return;\n }\n\n // Subtract paddings\n width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10);\n height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10);\n if (Number.isNaN(width)) width = 0;\n if (Number.isNaN(height)) height = 0;\n Object.assign(swiper, {\n width,\n height,\n size: swiper.isHorizontal() ? width : height\n });\n}\n\nfunction updateSlides() {\n const swiper = this;\n function getDirectionPropertyValue(node, label) {\n return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);\n }\n const params = swiper.params;\n const {\n wrapperEl,\n slidesEl,\n size: swiperSize,\n rtlTranslate: rtl,\n wrongRTL\n } = swiper;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;\n const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);\n const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;\n let snapGrid = [];\n const slidesGrid = [];\n const slidesSizesGrid = [];\n let offsetBefore = params.slidesOffsetBefore;\n if (typeof offsetBefore === 'function') {\n offsetBefore = params.slidesOffsetBefore.call(swiper);\n }\n let offsetAfter = params.slidesOffsetAfter;\n if (typeof offsetAfter === 'function') {\n offsetAfter = params.slidesOffsetAfter.call(swiper);\n }\n const previousSnapGridLength = swiper.snapGrid.length;\n const previousSlidesGridLength = swiper.slidesGrid.length;\n let spaceBetween = params.spaceBetween;\n let slidePosition = -offsetBefore;\n let prevSlideSize = 0;\n let index = 0;\n if (typeof swiperSize === 'undefined') {\n return;\n }\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;\n } else if (typeof spaceBetween === 'string') {\n spaceBetween = parseFloat(spaceBetween);\n }\n swiper.virtualSize = -spaceBetween;\n\n // reset margins\n slides.forEach(slideEl => {\n if (rtl) {\n slideEl.style.marginLeft = '';\n } else {\n slideEl.style.marginRight = '';\n }\n slideEl.style.marginBottom = '';\n slideEl.style.marginTop = '';\n });\n\n // reset cssMode offsets\n if (params.centeredSlides && params.cssMode) {\n setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');\n setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');\n }\n const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;\n if (gridEnabled) {\n swiper.grid.initSlides(slides);\n } else if (swiper.grid) {\n swiper.grid.unsetSlides();\n }\n\n // Calc slides\n let slideSize;\n const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {\n return typeof params.breakpoints[key].slidesPerView !== 'undefined';\n }).length > 0;\n for (let i = 0; i < slidesLength; i += 1) {\n slideSize = 0;\n let slide;\n if (slides[i]) slide = slides[i];\n if (gridEnabled) {\n swiper.grid.updateSlide(i, slide, slides);\n }\n if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line\n\n if (params.slidesPerView === 'auto') {\n if (shouldResetSlideSize) {\n slides[i].style[swiper.getDirectionLabel('width')] = ``;\n }\n const slideStyles = getComputedStyle(slide);\n const currentTransform = slide.style.transform;\n const currentWebKitTransform = slide.style.webkitTransform;\n if (currentTransform) {\n slide.style.transform = 'none';\n }\n if (currentWebKitTransform) {\n slide.style.webkitTransform = 'none';\n }\n if (params.roundLengths) {\n slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true);\n } else {\n // eslint-disable-next-line\n const width = getDirectionPropertyValue(slideStyles, 'width');\n const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');\n const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');\n const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');\n const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');\n const boxSizing = slideStyles.getPropertyValue('box-sizing');\n if (boxSizing && boxSizing === 'border-box') {\n slideSize = width + marginLeft + marginRight;\n } else {\n const {\n clientWidth,\n offsetWidth\n } = slide;\n slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);\n }\n }\n if (currentTransform) {\n slide.style.transform = currentTransform;\n }\n if (currentWebKitTransform) {\n slide.style.webkitTransform = currentWebKitTransform;\n }\n if (params.roundLengths) slideSize = Math.floor(slideSize);\n } else {\n slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;\n if (params.roundLengths) slideSize = Math.floor(slideSize);\n if (slides[i]) {\n slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;\n }\n }\n if (slides[i]) {\n slides[i].swiperSlideSize = slideSize;\n }\n slidesSizesGrid.push(slideSize);\n if (params.centeredSlides) {\n slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;\n if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;\n if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;\n if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;\n if (params.roundLengths) slidePosition = Math.floor(slidePosition);\n if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);\n slidesGrid.push(slidePosition);\n } else {\n if (params.roundLengths) slidePosition = Math.floor(slidePosition);\n if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);\n slidesGrid.push(slidePosition);\n slidePosition = slidePosition + slideSize + spaceBetween;\n }\n swiper.virtualSize += slideSize + spaceBetween;\n prevSlideSize = slideSize;\n index += 1;\n }\n swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;\n if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {\n wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;\n }\n if (params.setWrapperSize) {\n wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;\n }\n if (gridEnabled) {\n swiper.grid.updateWrapperSize(slideSize, snapGrid);\n }\n\n // Remove last grid elements depending on width\n if (!params.centeredSlides) {\n const newSlidesGrid = [];\n for (let i = 0; i < snapGrid.length; i += 1) {\n let slidesGridItem = snapGrid[i];\n if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);\n if (snapGrid[i] <= swiper.virtualSize - swiperSize) {\n newSlidesGrid.push(slidesGridItem);\n }\n }\n snapGrid = newSlidesGrid;\n if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {\n snapGrid.push(swiper.virtualSize - swiperSize);\n }\n }\n if (isVirtual && params.loop) {\n const size = slidesSizesGrid[0] + spaceBetween;\n if (params.slidesPerGroup > 1) {\n const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);\n const groupSize = size * params.slidesPerGroup;\n for (let i = 0; i < groups; i += 1) {\n snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);\n }\n }\n for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {\n if (params.slidesPerGroup === 1) {\n snapGrid.push(snapGrid[snapGrid.length - 1] + size);\n }\n slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);\n swiper.virtualSize += size;\n }\n }\n if (snapGrid.length === 0) snapGrid = [0];\n if (spaceBetween !== 0) {\n const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');\n slides.filter((_, slideIndex) => {\n if (!params.cssMode || params.loop) return true;\n if (slideIndex === slides.length - 1) {\n return false;\n }\n return true;\n }).forEach(slideEl => {\n slideEl.style[key] = `${spaceBetween}px`;\n });\n }\n if (params.centeredSlides && params.centeredSlidesBounds) {\n let allSlidesSize = 0;\n slidesSizesGrid.forEach(slideSizeValue => {\n allSlidesSize += slideSizeValue + (spaceBetween || 0);\n });\n allSlidesSize -= spaceBetween;\n const maxSnap = allSlidesSize - swiperSize;\n snapGrid = snapGrid.map(snap => {\n if (snap <= 0) return -offsetBefore;\n if (snap > maxSnap) return maxSnap + offsetAfter;\n return snap;\n });\n }\n if (params.centerInsufficientSlides) {\n let allSlidesSize = 0;\n slidesSizesGrid.forEach(slideSizeValue => {\n allSlidesSize += slideSizeValue + (spaceBetween || 0);\n });\n allSlidesSize -= spaceBetween;\n if (allSlidesSize < swiperSize) {\n const allSlidesOffset = (swiperSize - allSlidesSize) / 2;\n snapGrid.forEach((snap, snapIndex) => {\n snapGrid[snapIndex] = snap - allSlidesOffset;\n });\n slidesGrid.forEach((snap, snapIndex) => {\n slidesGrid[snapIndex] = snap + allSlidesOffset;\n });\n }\n }\n Object.assign(swiper, {\n slides,\n snapGrid,\n slidesGrid,\n slidesSizesGrid\n });\n if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {\n setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);\n setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);\n const addToSnapGrid = -swiper.snapGrid[0];\n const addToSlidesGrid = -swiper.slidesGrid[0];\n swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);\n swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);\n }\n if (slidesLength !== previousSlidesLength) {\n swiper.emit('slidesLengthChange');\n }\n if (snapGrid.length !== previousSnapGridLength) {\n if (swiper.params.watchOverflow) swiper.checkOverflow();\n swiper.emit('snapGridLengthChange');\n }\n if (slidesGrid.length !== previousSlidesGridLength) {\n swiper.emit('slidesGridLengthChange');\n }\n if (params.watchSlidesProgress) {\n swiper.updateSlidesOffset();\n }\n swiper.emit('slidesUpdated');\n if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {\n const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;\n const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);\n if (slidesLength <= params.maxBackfaceHiddenSlides) {\n if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass);\n } else if (hasClassBackfaceClassAdded) {\n swiper.el.classList.remove(backFaceHiddenClass);\n }\n }\n}\n\nfunction updateAutoHeight(speed) {\n const swiper = this;\n const activeSlides = [];\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n let newHeight = 0;\n let i;\n if (typeof speed === 'number') {\n swiper.setTransition(speed);\n } else if (speed === true) {\n swiper.setTransition(swiper.params.speed);\n }\n const getSlideByIndex = index => {\n if (isVirtual) {\n return swiper.slides[swiper.getSlideIndexByData(index)];\n }\n return swiper.slides[index];\n };\n // Find slides currently in view\n if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {\n if (swiper.params.centeredSlides) {\n (swiper.visibleSlides || []).forEach(slide => {\n activeSlides.push(slide);\n });\n } else {\n for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {\n const index = swiper.activeIndex + i;\n if (index > swiper.slides.length && !isVirtual) break;\n activeSlides.push(getSlideByIndex(index));\n }\n }\n } else {\n activeSlides.push(getSlideByIndex(swiper.activeIndex));\n }\n\n // Find new height from highest slide in view\n for (i = 0; i < activeSlides.length; i += 1) {\n if (typeof activeSlides[i] !== 'undefined') {\n const height = activeSlides[i].offsetHeight;\n newHeight = height > newHeight ? height : newHeight;\n }\n }\n\n // Update Height\n if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;\n}\n\nfunction updateSlidesOffset() {\n const swiper = this;\n const slides = swiper.slides;\n // eslint-disable-next-line\n const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;\n for (let i = 0; i < slides.length; i += 1) {\n slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();\n }\n}\n\nfunction updateSlidesProgress(translate) {\n if (translate === void 0) {\n translate = this && this.translate || 0;\n }\n const swiper = this;\n const params = swiper.params;\n const {\n slides,\n rtlTranslate: rtl,\n snapGrid\n } = swiper;\n if (slides.length === 0) return;\n if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();\n let offsetCenter = -translate;\n if (rtl) offsetCenter = translate;\n\n // Visible Slides\n slides.forEach(slideEl => {\n slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass);\n });\n swiper.visibleSlidesIndexes = [];\n swiper.visibleSlides = [];\n let spaceBetween = params.spaceBetween;\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;\n } else if (typeof spaceBetween === 'string') {\n spaceBetween = parseFloat(spaceBetween);\n }\n for (let i = 0; i < slides.length; i += 1) {\n const slide = slides[i];\n let slideOffset = slide.swiperSlideOffset;\n if (params.cssMode && params.centeredSlides) {\n slideOffset -= slides[0].swiperSlideOffset;\n }\n const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);\n const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);\n const slideBefore = -(offsetCenter - slideOffset);\n const slideAfter = slideBefore + swiper.slidesSizesGrid[i];\n const isFullyVisible = slideBefore >= 0 && slideBefore <= swiper.size - swiper.slidesSizesGrid[i];\n const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;\n if (isVisible) {\n swiper.visibleSlides.push(slide);\n swiper.visibleSlidesIndexes.push(i);\n slides[i].classList.add(params.slideVisibleClass);\n }\n if (isFullyVisible) {\n slides[i].classList.add(params.slideFullyVisibleClass);\n }\n slide.progress = rtl ? -slideProgress : slideProgress;\n slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;\n }\n}\n\nfunction updateProgress(translate) {\n const swiper = this;\n if (typeof translate === 'undefined') {\n const multiplier = swiper.rtlTranslate ? -1 : 1;\n // eslint-disable-next-line\n translate = swiper && swiper.translate && swiper.translate * multiplier || 0;\n }\n const params = swiper.params;\n const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n let {\n progress,\n isBeginning,\n isEnd,\n progressLoop\n } = swiper;\n const wasBeginning = isBeginning;\n const wasEnd = isEnd;\n if (translatesDiff === 0) {\n progress = 0;\n isBeginning = true;\n isEnd = true;\n } else {\n progress = (translate - swiper.minTranslate()) / translatesDiff;\n const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1;\n const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1;\n isBeginning = isBeginningRounded || progress <= 0;\n isEnd = isEndRounded || progress >= 1;\n if (isBeginningRounded) progress = 0;\n if (isEndRounded) progress = 1;\n }\n if (params.loop) {\n const firstSlideIndex = swiper.getSlideIndexByData(0);\n const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1);\n const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex];\n const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex];\n const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1];\n const translateAbs = Math.abs(translate);\n if (translateAbs >= firstSlideTranslate) {\n progressLoop = (translateAbs - firstSlideTranslate) / translateMax;\n } else {\n progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax;\n }\n if (progressLoop > 1) progressLoop -= 1;\n }\n Object.assign(swiper, {\n progress,\n progressLoop,\n isBeginning,\n isEnd\n });\n if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);\n if (isBeginning && !wasBeginning) {\n swiper.emit('reachBeginning toEdge');\n }\n if (isEnd && !wasEnd) {\n swiper.emit('reachEnd toEdge');\n }\n if (wasBeginning && !isBeginning || wasEnd && !isEnd) {\n swiper.emit('fromEdge');\n }\n swiper.emit('progress', progress);\n}\n\nfunction updateSlidesClasses() {\n const swiper = this;\n const {\n slides,\n params,\n slidesEl,\n activeIndex\n } = swiper;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;\n const getFilteredSlide = selector => {\n return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];\n };\n slides.forEach(slideEl => {\n slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);\n });\n let activeSlide;\n let prevSlide;\n let nextSlide;\n if (isVirtual) {\n if (params.loop) {\n let slideIndex = activeIndex - swiper.virtual.slidesBefore;\n if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;\n if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;\n activeSlide = getFilteredSlide(`[data-swiper-slide-index=\"${slideIndex}\"]`);\n } else {\n activeSlide = getFilteredSlide(`[data-swiper-slide-index=\"${activeIndex}\"]`);\n }\n } else {\n if (gridEnabled) {\n activeSlide = slides.filter(slideEl => slideEl.column === activeIndex)[0];\n nextSlide = slides.filter(slideEl => slideEl.column === activeIndex + 1)[0];\n prevSlide = slides.filter(slideEl => slideEl.column === activeIndex - 1)[0];\n } else {\n activeSlide = slides[activeIndex];\n }\n }\n if (activeSlide) {\n // Active classes\n activeSlide.classList.add(params.slideActiveClass);\n if (gridEnabled) {\n if (nextSlide) {\n nextSlide.classList.add(params.slideNextClass);\n }\n if (prevSlide) {\n prevSlide.classList.add(params.slidePrevClass);\n }\n } else {\n // Next Slide\n nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];\n if (params.loop && !nextSlide) {\n nextSlide = slides[0];\n }\n if (nextSlide) {\n nextSlide.classList.add(params.slideNextClass);\n }\n\n // Prev Slide\n prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];\n if (params.loop && !prevSlide === 0) {\n prevSlide = slides[slides.length - 1];\n }\n if (prevSlide) {\n prevSlide.classList.add(params.slidePrevClass);\n }\n }\n }\n swiper.emitSlidesClasses();\n}\n\nconst processLazyPreloader = (swiper, imageEl) => {\n if (!swiper || swiper.destroyed || !swiper.params) return;\n const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;\n const slideEl = imageEl.closest(slideSelector());\n if (slideEl) {\n let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);\n if (!lazyEl && swiper.isElement) {\n if (slideEl.shadowRoot) {\n lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);\n } else {\n // init later\n requestAnimationFrame(() => {\n if (slideEl.shadowRoot) {\n lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);\n if (lazyEl) lazyEl.remove();\n }\n });\n }\n }\n if (lazyEl) lazyEl.remove();\n }\n};\nconst unlazy = (swiper, index) => {\n if (!swiper.slides[index]) return;\n const imageEl = swiper.slides[index].querySelector('[loading=\"lazy\"]');\n if (imageEl) imageEl.removeAttribute('loading');\n};\nconst preload = swiper => {\n if (!swiper || swiper.destroyed || !swiper.params) return;\n let amount = swiper.params.lazyPreloadPrevNext;\n const len = swiper.slides.length;\n if (!len || !amount || amount < 0) return;\n amount = Math.min(amount, len);\n const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView);\n const activeIndex = swiper.activeIndex;\n if (swiper.params.grid && swiper.params.grid.rows > 1) {\n const activeColumn = activeIndex;\n const preloadColumns = [activeColumn - amount];\n preloadColumns.push(...Array.from({\n length: amount\n }).map((_, i) => {\n return activeColumn + slidesPerView + i;\n }));\n swiper.slides.forEach((slideEl, i) => {\n if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i);\n });\n return;\n }\n const slideIndexLastInView = activeIndex + slidesPerView - 1;\n if (swiper.params.rewind || swiper.params.loop) {\n for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {\n const realIndex = (i % len + len) % len;\n if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex);\n }\n } else {\n for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) {\n if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) {\n unlazy(swiper, i);\n }\n }\n }\n};\n\nfunction getActiveIndexByTranslate(swiper) {\n const {\n slidesGrid,\n params\n } = swiper;\n const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n let activeIndex;\n for (let i = 0; i < slidesGrid.length; i += 1) {\n if (typeof slidesGrid[i + 1] !== 'undefined') {\n if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {\n activeIndex = i;\n } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {\n activeIndex = i + 1;\n }\n } else if (translate >= slidesGrid[i]) {\n activeIndex = i;\n }\n }\n // Normalize slideIndex\n if (params.normalizeSlideIndex) {\n if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;\n }\n return activeIndex;\n}\nfunction updateActiveIndex(newActiveIndex) {\n const swiper = this;\n const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n const {\n snapGrid,\n params,\n activeIndex: previousIndex,\n realIndex: previousRealIndex,\n snapIndex: previousSnapIndex\n } = swiper;\n let activeIndex = newActiveIndex;\n let snapIndex;\n const getVirtualRealIndex = aIndex => {\n let realIndex = aIndex - swiper.virtual.slidesBefore;\n if (realIndex < 0) {\n realIndex = swiper.virtual.slides.length + realIndex;\n }\n if (realIndex >= swiper.virtual.slides.length) {\n realIndex -= swiper.virtual.slides.length;\n }\n return realIndex;\n };\n if (typeof activeIndex === 'undefined') {\n activeIndex = getActiveIndexByTranslate(swiper);\n }\n if (snapGrid.indexOf(translate) >= 0) {\n snapIndex = snapGrid.indexOf(translate);\n } else {\n const skip = Math.min(params.slidesPerGroupSkip, activeIndex);\n snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);\n }\n if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;\n if (activeIndex === previousIndex && !swiper.params.loop) {\n if (snapIndex !== previousSnapIndex) {\n swiper.snapIndex = snapIndex;\n swiper.emit('snapIndexChange');\n }\n return;\n }\n if (activeIndex === previousIndex && swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {\n swiper.realIndex = getVirtualRealIndex(activeIndex);\n return;\n }\n const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;\n\n // Get real index\n let realIndex;\n if (swiper.virtual && params.virtual.enabled && params.loop) {\n realIndex = getVirtualRealIndex(activeIndex);\n } else if (gridEnabled) {\n const firstSlideInColumn = swiper.slides.filter(slideEl => slideEl.column === activeIndex)[0];\n let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);\n if (Number.isNaN(activeSlideIndex)) {\n activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);\n }\n realIndex = Math.floor(activeSlideIndex / params.grid.rows);\n } else if (swiper.slides[activeIndex]) {\n const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');\n if (slideIndex) {\n realIndex = parseInt(slideIndex, 10);\n } else {\n realIndex = activeIndex;\n }\n } else {\n realIndex = activeIndex;\n }\n Object.assign(swiper, {\n previousSnapIndex,\n snapIndex,\n previousRealIndex,\n realIndex,\n previousIndex,\n activeIndex\n });\n if (swiper.initialized) {\n preload(swiper);\n }\n swiper.emit('activeIndexChange');\n swiper.emit('snapIndexChange');\n if (swiper.initialized || swiper.params.runCallbacksOnInit) {\n if (previousRealIndex !== realIndex) {\n swiper.emit('realIndexChange');\n }\n swiper.emit('slideChange');\n }\n}\n\nfunction updateClickedSlide(el, path) {\n const swiper = this;\n const params = swiper.params;\n let slide = el.closest(`.${params.slideClass}, swiper-slide`);\n if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {\n [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => {\n if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) {\n slide = pathEl;\n }\n });\n }\n let slideFound = false;\n let slideIndex;\n if (slide) {\n for (let i = 0; i < swiper.slides.length; i += 1) {\n if (swiper.slides[i] === slide) {\n slideFound = true;\n slideIndex = i;\n break;\n }\n }\n }\n if (slide && slideFound) {\n swiper.clickedSlide = slide;\n if (swiper.virtual && swiper.params.virtual.enabled) {\n swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);\n } else {\n swiper.clickedIndex = slideIndex;\n }\n } else {\n swiper.clickedSlide = undefined;\n swiper.clickedIndex = undefined;\n return;\n }\n if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {\n swiper.slideToClickedSlide();\n }\n}\n\nvar update = {\n updateSize,\n updateSlides,\n updateAutoHeight,\n updateSlidesOffset,\n updateSlidesProgress,\n updateProgress,\n updateSlidesClasses,\n updateActiveIndex,\n updateClickedSlide\n};\n\nfunction getSwiperTranslate(axis) {\n if (axis === void 0) {\n axis = this.isHorizontal() ? 'x' : 'y';\n }\n const swiper = this;\n const {\n params,\n rtlTranslate: rtl,\n translate,\n wrapperEl\n } = swiper;\n if (params.virtualTranslate) {\n return rtl ? -translate : translate;\n }\n if (params.cssMode) {\n return translate;\n }\n let currentTranslate = getTranslate(wrapperEl, axis);\n currentTranslate += swiper.cssOverflowAdjustment();\n if (rtl) currentTranslate = -currentTranslate;\n return currentTranslate || 0;\n}\n\nfunction setTranslate(translate, byController) {\n const swiper = this;\n const {\n rtlTranslate: rtl,\n params,\n wrapperEl,\n progress\n } = swiper;\n let x = 0;\n let y = 0;\n const z = 0;\n if (swiper.isHorizontal()) {\n x = rtl ? -translate : translate;\n } else {\n y = translate;\n }\n if (params.roundLengths) {\n x = Math.floor(x);\n y = Math.floor(y);\n }\n swiper.previousTranslate = swiper.translate;\n swiper.translate = swiper.isHorizontal() ? x : y;\n if (params.cssMode) {\n wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;\n } else if (!params.virtualTranslate) {\n if (swiper.isHorizontal()) {\n x -= swiper.cssOverflowAdjustment();\n } else {\n y -= swiper.cssOverflowAdjustment();\n }\n wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;\n }\n\n // Check if we need to update progress\n let newProgress;\n const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n if (translatesDiff === 0) {\n newProgress = 0;\n } else {\n newProgress = (translate - swiper.minTranslate()) / translatesDiff;\n }\n if (newProgress !== progress) {\n swiper.updateProgress(translate);\n }\n swiper.emit('setTranslate', swiper.translate, byController);\n}\n\nfunction minTranslate() {\n return -this.snapGrid[0];\n}\n\nfunction maxTranslate() {\n return -this.snapGrid[this.snapGrid.length - 1];\n}\n\nfunction translateTo(translate, speed, runCallbacks, translateBounds, internal) {\n if (translate === void 0) {\n translate = 0;\n }\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (translateBounds === void 0) {\n translateBounds = true;\n }\n const swiper = this;\n const {\n params,\n wrapperEl\n } = swiper;\n if (swiper.animating && params.preventInteractionOnTransition) {\n return false;\n }\n const minTranslate = swiper.minTranslate();\n const maxTranslate = swiper.maxTranslate();\n let newTranslate;\n if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate;\n\n // Update progress\n swiper.updateProgress(newTranslate);\n if (params.cssMode) {\n const isH = swiper.isHorizontal();\n if (speed === 0) {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;\n } else {\n if (!swiper.support.smoothScroll) {\n animateCSSModeScroll({\n swiper,\n targetPosition: -newTranslate,\n side: isH ? 'left' : 'top'\n });\n return true;\n }\n wrapperEl.scrollTo({\n [isH ? 'left' : 'top']: -newTranslate,\n behavior: 'smooth'\n });\n }\n return true;\n }\n if (speed === 0) {\n swiper.setTransition(0);\n swiper.setTranslate(newTranslate);\n if (runCallbacks) {\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.emit('transitionEnd');\n }\n } else {\n swiper.setTransition(speed);\n swiper.setTranslate(newTranslate);\n if (runCallbacks) {\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.emit('transitionStart');\n }\n if (!swiper.animating) {\n swiper.animating = true;\n if (!swiper.onTranslateToWrapperTransitionEnd) {\n swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {\n if (!swiper || swiper.destroyed) return;\n if (e.target !== this) return;\n swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);\n swiper.onTranslateToWrapperTransitionEnd = null;\n delete swiper.onTranslateToWrapperTransitionEnd;\n if (runCallbacks) {\n swiper.emit('transitionEnd');\n }\n };\n }\n swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);\n }\n }\n return true;\n}\n\nvar translate = {\n getTranslate: getSwiperTranslate,\n setTranslate,\n minTranslate,\n maxTranslate,\n translateTo\n};\n\nfunction setTransition(duration, byController) {\n const swiper = this;\n if (!swiper.params.cssMode) {\n swiper.wrapperEl.style.transitionDuration = `${duration}ms`;\n swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : '';\n }\n swiper.emit('setTransition', duration, byController);\n}\n\nfunction transitionEmit(_ref) {\n let {\n swiper,\n runCallbacks,\n direction,\n step\n } = _ref;\n const {\n activeIndex,\n previousIndex\n } = swiper;\n let dir = direction;\n if (!dir) {\n if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';\n }\n swiper.emit(`transition${step}`);\n if (runCallbacks && activeIndex !== previousIndex) {\n if (dir === 'reset') {\n swiper.emit(`slideResetTransition${step}`);\n return;\n }\n swiper.emit(`slideChangeTransition${step}`);\n if (dir === 'next') {\n swiper.emit(`slideNextTransition${step}`);\n } else {\n swiper.emit(`slidePrevTransition${step}`);\n }\n }\n}\n\nfunction transitionStart(runCallbacks, direction) {\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n params\n } = swiper;\n if (params.cssMode) return;\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n transitionEmit({\n swiper,\n runCallbacks,\n direction,\n step: 'Start'\n });\n}\n\nfunction transitionEnd(runCallbacks, direction) {\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n params\n } = swiper;\n swiper.animating = false;\n if (params.cssMode) return;\n swiper.setTransition(0);\n transitionEmit({\n swiper,\n runCallbacks,\n direction,\n step: 'End'\n });\n}\n\nvar transition = {\n setTransition,\n transitionStart,\n transitionEnd\n};\n\nfunction slideTo(index, speed, runCallbacks, internal, initial) {\n if (index === void 0) {\n index = 0;\n }\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (typeof index === 'string') {\n index = parseInt(index, 10);\n }\n const swiper = this;\n let slideIndex = index;\n if (slideIndex < 0) slideIndex = 0;\n const {\n params,\n snapGrid,\n slidesGrid,\n previousIndex,\n activeIndex,\n rtlTranslate: rtl,\n wrapperEl,\n enabled\n } = swiper;\n if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial || swiper.destroyed) {\n return false;\n }\n const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);\n let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);\n if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;\n const translate = -snapGrid[snapIndex];\n // Normalize slideIndex\n if (params.normalizeSlideIndex) {\n for (let i = 0; i < slidesGrid.length; i += 1) {\n const normalizedTranslate = -Math.floor(translate * 100);\n const normalizedGrid = Math.floor(slidesGrid[i] * 100);\n const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);\n if (typeof slidesGrid[i + 1] !== 'undefined') {\n if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {\n slideIndex = i;\n } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {\n slideIndex = i + 1;\n }\n } else if (normalizedTranslate >= normalizedGrid) {\n slideIndex = i;\n }\n }\n }\n // Directions locks\n if (swiper.initialized && slideIndex !== activeIndex) {\n if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) {\n return false;\n }\n if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {\n if ((activeIndex || 0) !== slideIndex) {\n return false;\n }\n }\n }\n if (slideIndex !== (previousIndex || 0) && runCallbacks) {\n swiper.emit('beforeSlideChangeStart');\n }\n\n // Update progress\n swiper.updateProgress(translate);\n let direction;\n if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';\n\n // Update Index\n if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {\n swiper.updateActiveIndex(slideIndex);\n // Update Height\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n swiper.updateSlidesClasses();\n if (params.effect !== 'slide') {\n swiper.setTranslate(translate);\n }\n if (direction !== 'reset') {\n swiper.transitionStart(runCallbacks, direction);\n swiper.transitionEnd(runCallbacks, direction);\n }\n return false;\n }\n if (params.cssMode) {\n const isH = swiper.isHorizontal();\n const t = rtl ? translate : -translate;\n if (speed === 0) {\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n if (isVirtual) {\n swiper.wrapperEl.style.scrollSnapType = 'none';\n swiper._immediateVirtual = true;\n }\n if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {\n swiper._cssModeVirtualInitialSet = true;\n requestAnimationFrame(() => {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;\n });\n } else {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;\n }\n if (isVirtual) {\n requestAnimationFrame(() => {\n swiper.wrapperEl.style.scrollSnapType = '';\n swiper._immediateVirtual = false;\n });\n }\n } else {\n if (!swiper.support.smoothScroll) {\n animateCSSModeScroll({\n swiper,\n targetPosition: t,\n side: isH ? 'left' : 'top'\n });\n return true;\n }\n wrapperEl.scrollTo({\n [isH ? 'left' : 'top']: t,\n behavior: 'smooth'\n });\n }\n return true;\n }\n swiper.setTransition(speed);\n swiper.setTranslate(translate);\n swiper.updateActiveIndex(slideIndex);\n swiper.updateSlidesClasses();\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.transitionStart(runCallbacks, direction);\n if (speed === 0) {\n swiper.transitionEnd(runCallbacks, direction);\n } else if (!swiper.animating) {\n swiper.animating = true;\n if (!swiper.onSlideToWrapperTransitionEnd) {\n swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {\n if (!swiper || swiper.destroyed) return;\n if (e.target !== this) return;\n swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);\n swiper.onSlideToWrapperTransitionEnd = null;\n delete swiper.onSlideToWrapperTransitionEnd;\n swiper.transitionEnd(runCallbacks, direction);\n };\n }\n swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);\n }\n return true;\n}\n\nfunction slideToLoop(index, speed, runCallbacks, internal) {\n if (index === void 0) {\n index = 0;\n }\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (typeof index === 'string') {\n const indexAsNumber = parseInt(index, 10);\n index = indexAsNumber;\n }\n const swiper = this;\n if (swiper.destroyed) return;\n const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;\n let newIndex = index;\n if (swiper.params.loop) {\n if (swiper.virtual && swiper.params.virtual.enabled) {\n // eslint-disable-next-line\n newIndex = newIndex + swiper.virtual.slidesBefore;\n } else {\n let targetSlideIndex;\n if (gridEnabled) {\n const slideIndex = newIndex * swiper.params.grid.rows;\n targetSlideIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;\n } else {\n targetSlideIndex = swiper.getSlideIndexByData(newIndex);\n }\n const cols = gridEnabled ? Math.ceil(swiper.slides.length / swiper.params.grid.rows) : swiper.slides.length;\n const {\n centeredSlides\n } = swiper.params;\n let slidesPerView = swiper.params.slidesPerView;\n if (slidesPerView === 'auto') {\n slidesPerView = swiper.slidesPerViewDynamic();\n } else {\n slidesPerView = Math.ceil(parseFloat(swiper.params.slidesPerView, 10));\n if (centeredSlides && slidesPerView % 2 === 0) {\n slidesPerView = slidesPerView + 1;\n }\n }\n let needLoopFix = cols - targetSlideIndex < slidesPerView;\n if (centeredSlides) {\n needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);\n }\n if (needLoopFix) {\n const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';\n swiper.loopFix({\n direction,\n slideTo: true,\n activeSlideIndex: direction === 'next' ? targetSlideIndex + 1 : targetSlideIndex - cols + 1,\n slideRealIndex: direction === 'next' ? swiper.realIndex : undefined\n });\n }\n if (gridEnabled) {\n const slideIndex = newIndex * swiper.params.grid.rows;\n newIndex = swiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === slideIndex)[0].column;\n } else {\n newIndex = swiper.getSlideIndexByData(newIndex);\n }\n }\n }\n requestAnimationFrame(() => {\n swiper.slideTo(newIndex, speed, runCallbacks, internal);\n });\n return swiper;\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slideNext(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n enabled,\n params,\n animating\n } = swiper;\n if (!enabled || swiper.destroyed) return swiper;\n let perGroup = params.slidesPerGroup;\n if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {\n perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);\n }\n const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n if (params.loop) {\n if (animating && !isVirtual && params.loopPreventsSliding) return false;\n swiper.loopFix({\n direction: 'next'\n });\n // eslint-disable-next-line\n swiper._clientLeft = swiper.wrapperEl.clientLeft;\n if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {\n requestAnimationFrame(() => {\n swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);\n });\n return true;\n }\n }\n if (params.rewind && swiper.isEnd) {\n return swiper.slideTo(0, speed, runCallbacks, internal);\n }\n return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slidePrev(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n params,\n snapGrid,\n slidesGrid,\n rtlTranslate,\n enabled,\n animating\n } = swiper;\n if (!enabled || swiper.destroyed) return swiper;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n if (params.loop) {\n if (animating && !isVirtual && params.loopPreventsSliding) return false;\n swiper.loopFix({\n direction: 'prev'\n });\n // eslint-disable-next-line\n swiper._clientLeft = swiper.wrapperEl.clientLeft;\n }\n const translate = rtlTranslate ? swiper.translate : -swiper.translate;\n function normalize(val) {\n if (val < 0) return -Math.floor(Math.abs(val));\n return Math.floor(val);\n }\n const normalizedTranslate = normalize(translate);\n const normalizedSnapGrid = snapGrid.map(val => normalize(val));\n let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];\n if (typeof prevSnap === 'undefined' && params.cssMode) {\n let prevSnapIndex;\n snapGrid.forEach((snap, snapIndex) => {\n if (normalizedTranslate >= snap) {\n // prevSnap = snap;\n prevSnapIndex = snapIndex;\n }\n });\n if (typeof prevSnapIndex !== 'undefined') {\n prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];\n }\n }\n let prevIndex = 0;\n if (typeof prevSnap !== 'undefined') {\n prevIndex = slidesGrid.indexOf(prevSnap);\n if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;\n if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {\n prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;\n prevIndex = Math.max(prevIndex, 0);\n }\n }\n if (params.rewind && swiper.isBeginning) {\n const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;\n return swiper.slideTo(lastIndex, speed, runCallbacks, internal);\n } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {\n requestAnimationFrame(() => {\n swiper.slideTo(prevIndex, speed, runCallbacks, internal);\n });\n return true;\n }\n return swiper.slideTo(prevIndex, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slideReset(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n if (swiper.destroyed) return;\n return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slideToClosest(speed, runCallbacks, internal, threshold) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (threshold === void 0) {\n threshold = 0.5;\n }\n const swiper = this;\n if (swiper.destroyed) return;\n let index = swiper.activeIndex;\n const skip = Math.min(swiper.params.slidesPerGroupSkip, index);\n const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);\n const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n if (translate >= swiper.snapGrid[snapIndex]) {\n // The current translate is on or after the current snap index, so the choice\n // is between the current index and the one after it.\n const currentSnap = swiper.snapGrid[snapIndex];\n const nextSnap = swiper.snapGrid[snapIndex + 1];\n if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {\n index += swiper.params.slidesPerGroup;\n }\n } else {\n // The current translate is before the current snap index, so the choice\n // is between the current index and the one before it.\n const prevSnap = swiper.snapGrid[snapIndex - 1];\n const currentSnap = swiper.snapGrid[snapIndex];\n if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {\n index -= swiper.params.slidesPerGroup;\n }\n }\n index = Math.max(index, 0);\n index = Math.min(index, swiper.slidesGrid.length - 1);\n return swiper.slideTo(index, speed, runCallbacks, internal);\n}\n\nfunction slideToClickedSlide() {\n const swiper = this;\n if (swiper.destroyed) return;\n const {\n params,\n slidesEl\n } = swiper;\n const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;\n let slideToIndex = swiper.clickedIndex;\n let realIndex;\n const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;\n if (params.loop) {\n if (swiper.animating) return;\n realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);\n if (params.centeredSlides) {\n if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {\n swiper.loopFix();\n slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index=\"${realIndex}\"]`)[0]);\n nextTick(() => {\n swiper.slideTo(slideToIndex);\n });\n } else {\n swiper.slideTo(slideToIndex);\n }\n } else if (slideToIndex > swiper.slides.length - slidesPerView) {\n swiper.loopFix();\n slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index=\"${realIndex}\"]`)[0]);\n nextTick(() => {\n swiper.slideTo(slideToIndex);\n });\n } else {\n swiper.slideTo(slideToIndex);\n }\n } else {\n swiper.slideTo(slideToIndex);\n }\n}\n\nvar slide = {\n slideTo,\n slideToLoop,\n slideNext,\n slidePrev,\n slideReset,\n slideToClosest,\n slideToClickedSlide\n};\n\nfunction loopCreate(slideRealIndex) {\n const swiper = this;\n const {\n params,\n slidesEl\n } = swiper;\n if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;\n const initSlides = () => {\n const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);\n slides.forEach((el, index) => {\n el.setAttribute('data-swiper-slide-index', index);\n });\n };\n const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;\n const slidesPerGroup = params.slidesPerGroup * (gridEnabled ? params.grid.rows : 1);\n const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;\n const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;\n const addBlankSlides = amountOfSlides => {\n for (let i = 0; i < amountOfSlides; i += 1) {\n const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);\n swiper.slidesEl.append(slideEl);\n }\n };\n if (shouldFillGroup) {\n if (params.loopAddBlankSlides) {\n const slidesToAdd = slidesPerGroup - swiper.slides.length % slidesPerGroup;\n addBlankSlides(slidesToAdd);\n swiper.recalcSlides();\n swiper.updateSlides();\n } else {\n showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');\n }\n initSlides();\n } else if (shouldFillGrid) {\n if (params.loopAddBlankSlides) {\n const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;\n addBlankSlides(slidesToAdd);\n swiper.recalcSlides();\n swiper.updateSlides();\n } else {\n showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');\n }\n initSlides();\n } else {\n initSlides();\n }\n swiper.loopFix({\n slideRealIndex,\n direction: params.centeredSlides ? undefined : 'next'\n });\n}\n\nfunction loopFix(_temp) {\n let {\n slideRealIndex,\n slideTo = true,\n direction,\n setTranslate,\n activeSlideIndex,\n byController,\n byMousewheel\n } = _temp === void 0 ? {} : _temp;\n const swiper = this;\n if (!swiper.params.loop) return;\n swiper.emit('beforeLoopFix');\n const {\n slides,\n allowSlidePrev,\n allowSlideNext,\n slidesEl,\n params\n } = swiper;\n const {\n centeredSlides\n } = params;\n swiper.allowSlidePrev = true;\n swiper.allowSlideNext = true;\n if (swiper.virtual && params.virtual.enabled) {\n if (slideTo) {\n if (!params.centeredSlides && swiper.snapIndex === 0) {\n swiper.slideTo(swiper.virtual.slides.length, 0, false, true);\n } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {\n swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);\n } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {\n swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);\n }\n }\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n swiper.emit('loopFix');\n return;\n }\n let slidesPerView = params.slidesPerView;\n if (slidesPerView === 'auto') {\n slidesPerView = swiper.slidesPerViewDynamic();\n } else {\n slidesPerView = Math.ceil(parseFloat(params.slidesPerView, 10));\n if (centeredSlides && slidesPerView % 2 === 0) {\n slidesPerView = slidesPerView + 1;\n }\n }\n const slidesPerGroup = params.slidesPerGroupAuto ? slidesPerView : params.slidesPerGroup;\n let loopedSlides = slidesPerGroup;\n if (loopedSlides % slidesPerGroup !== 0) {\n loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;\n }\n loopedSlides += params.loopAdditionalSlides;\n swiper.loopedSlides = loopedSlides;\n const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;\n if (slides.length < slidesPerView + loopedSlides) {\n showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled and not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');\n } else if (gridEnabled && params.grid.fill === 'row') {\n showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');\n }\n const prependSlidesIndexes = [];\n const appendSlidesIndexes = [];\n let activeIndex = swiper.activeIndex;\n if (typeof activeSlideIndex === 'undefined') {\n activeSlideIndex = swiper.getSlideIndex(slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);\n } else {\n activeIndex = activeSlideIndex;\n }\n const isNext = direction === 'next' || !direction;\n const isPrev = direction === 'prev' || !direction;\n let slidesPrepended = 0;\n let slidesAppended = 0;\n const cols = gridEnabled ? Math.ceil(slides.length / params.grid.rows) : slides.length;\n const activeColIndex = gridEnabled ? slides[activeSlideIndex].column : activeSlideIndex;\n const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);\n // prepend last slides before start\n if (activeColIndexWithShift < loopedSlides) {\n slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);\n for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {\n const index = i - Math.floor(i / cols) * cols;\n if (gridEnabled) {\n const colIndexToPrepend = cols - index - 1;\n for (let i = slides.length - 1; i >= 0; i -= 1) {\n if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);\n }\n // slides.forEach((slide, slideIndex) => {\n // if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);\n // });\n } else {\n prependSlidesIndexes.push(cols - index - 1);\n }\n }\n } else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {\n slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);\n for (let i = 0; i < slidesAppended; i += 1) {\n const index = i - Math.floor(i / cols) * cols;\n if (gridEnabled) {\n slides.forEach((slide, slideIndex) => {\n if (slide.column === index) appendSlidesIndexes.push(slideIndex);\n });\n } else {\n appendSlidesIndexes.push(index);\n }\n }\n }\n swiper.__preventObserver__ = true;\n requestAnimationFrame(() => {\n swiper.__preventObserver__ = false;\n });\n if (isPrev) {\n prependSlidesIndexes.forEach(index => {\n slides[index].swiperLoopMoveDOM = true;\n slidesEl.prepend(slides[index]);\n slides[index].swiperLoopMoveDOM = false;\n });\n }\n if (isNext) {\n appendSlidesIndexes.forEach(index => {\n slides[index].swiperLoopMoveDOM = true;\n slidesEl.append(slides[index]);\n slides[index].swiperLoopMoveDOM = false;\n });\n }\n swiper.recalcSlides();\n if (params.slidesPerView === 'auto') {\n swiper.updateSlides();\n } else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {\n swiper.slides.forEach((slide, slideIndex) => {\n swiper.grid.updateSlide(slideIndex, slide, swiper.slides);\n });\n }\n if (params.watchSlidesProgress) {\n swiper.updateSlidesOffset();\n }\n if (slideTo) {\n if (prependSlidesIndexes.length > 0 && isPrev) {\n if (typeof slideRealIndex === 'undefined') {\n const currentSlideTranslate = swiper.slidesGrid[activeIndex];\n const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended];\n const diff = newSlideTranslate - currentSlideTranslate;\n if (byMousewheel) {\n swiper.setTranslate(swiper.translate - diff);\n } else {\n swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);\n if (setTranslate) {\n swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;\n swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;\n }\n }\n } else {\n if (setTranslate) {\n const shift = gridEnabled ? prependSlidesIndexes.length / params.grid.rows : prependSlidesIndexes.length;\n swiper.slideTo(swiper.activeIndex + shift, 0, false, true);\n swiper.touchEventsData.currentTranslate = swiper.translate;\n }\n }\n } else if (appendSlidesIndexes.length > 0 && isNext) {\n if (typeof slideRealIndex === 'undefined') {\n const currentSlideTranslate = swiper.slidesGrid[activeIndex];\n const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended];\n const diff = newSlideTranslate - currentSlideTranslate;\n if (byMousewheel) {\n swiper.setTranslate(swiper.translate - diff);\n } else {\n swiper.slideTo(activeIndex - slidesAppended, 0, false, true);\n if (setTranslate) {\n swiper.touchEventsData.startTranslate = swiper.touchEventsData.startTranslate - diff;\n swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;\n }\n }\n } else {\n const shift = gridEnabled ? appendSlidesIndexes.length / params.grid.rows : appendSlidesIndexes.length;\n swiper.slideTo(swiper.activeIndex - shift, 0, false, true);\n }\n }\n }\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n if (swiper.controller && swiper.controller.control && !byController) {\n const loopParams = {\n slideRealIndex,\n direction,\n setTranslate,\n activeSlideIndex,\n byController: true\n };\n if (Array.isArray(swiper.controller.control)) {\n swiper.controller.control.forEach(c => {\n if (!c.destroyed && c.params.loop) c.loopFix({\n ...loopParams,\n slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false\n });\n });\n } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {\n swiper.controller.control.loopFix({\n ...loopParams,\n slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false\n });\n }\n }\n swiper.emit('loopFix');\n}\n\nfunction loopDestroy() {\n const swiper = this;\n const {\n params,\n slidesEl\n } = swiper;\n if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;\n swiper.recalcSlides();\n const newSlidesOrder = [];\n swiper.slides.forEach(slideEl => {\n const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex;\n newSlidesOrder[index] = slideEl;\n });\n swiper.slides.forEach(slideEl => {\n slideEl.removeAttribute('data-swiper-slide-index');\n });\n newSlidesOrder.forEach(slideEl => {\n slidesEl.append(slideEl);\n });\n swiper.recalcSlides();\n swiper.slideTo(swiper.realIndex, 0);\n}\n\nvar loop = {\n loopCreate,\n loopFix,\n loopDestroy\n};\n\nfunction setGrabCursor(moving) {\n const swiper = this;\n if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;\n const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;\n if (swiper.isElement) {\n swiper.__preventObserver__ = true;\n }\n el.style.cursor = 'move';\n el.style.cursor = moving ? 'grabbing' : 'grab';\n if (swiper.isElement) {\n requestAnimationFrame(() => {\n swiper.__preventObserver__ = false;\n });\n }\n}\n\nfunction unsetGrabCursor() {\n const swiper = this;\n if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {\n return;\n }\n if (swiper.isElement) {\n swiper.__preventObserver__ = true;\n }\n swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';\n if (swiper.isElement) {\n requestAnimationFrame(() => {\n swiper.__preventObserver__ = false;\n });\n }\n}\n\nvar grabCursor = {\n setGrabCursor,\n unsetGrabCursor\n};\n\n// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd\nfunction closestElement(selector, base) {\n if (base === void 0) {\n base = this;\n }\n function __closestFrom(el) {\n if (!el || el === getDocument() || el === getWindow()) return null;\n if (el.assignedSlot) el = el.assignedSlot;\n const found = el.closest(selector);\n if (!found && !el.getRootNode) {\n return null;\n }\n return found || __closestFrom(el.getRootNode().host);\n }\n return __closestFrom(base);\n}\nfunction preventEdgeSwipe(swiper, event, startX) {\n const window = getWindow();\n const {\n params\n } = swiper;\n const edgeSwipeDetection = params.edgeSwipeDetection;\n const edgeSwipeThreshold = params.edgeSwipeThreshold;\n if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {\n if (edgeSwipeDetection === 'prevent') {\n event.preventDefault();\n return true;\n }\n return false;\n }\n return true;\n}\nfunction onTouchStart(event) {\n const swiper = this;\n const document = getDocument();\n let e = event;\n if (e.originalEvent) e = e.originalEvent;\n const data = swiper.touchEventsData;\n if (e.type === 'pointerdown') {\n if (data.pointerId !== null && data.pointerId !== e.pointerId) {\n return;\n }\n data.pointerId = e.pointerId;\n } else if (e.type === 'touchstart' && e.targetTouches.length === 1) {\n data.touchId = e.targetTouches[0].identifier;\n }\n if (e.type === 'touchstart') {\n // don't proceed touch event\n preventEdgeSwipe(swiper, e, e.targetTouches[0].pageX);\n return;\n }\n const {\n params,\n touches,\n enabled\n } = swiper;\n if (!enabled) return;\n if (!params.simulateTouch && e.pointerType === 'mouse') return;\n if (swiper.animating && params.preventInteractionOnTransition) {\n return;\n }\n if (!swiper.animating && params.cssMode && params.loop) {\n swiper.loopFix();\n }\n let targetEl = e.target;\n if (params.touchEventsTarget === 'wrapper') {\n if (!swiper.wrapperEl.contains(targetEl)) return;\n }\n if ('which' in e && e.which === 3) return;\n if ('button' in e && e.button > 0) return;\n if (data.isTouched && data.isMoved) return;\n\n // change target el for shadow root component\n const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';\n // eslint-disable-next-line\n const eventPath = e.composedPath ? e.composedPath() : e.path;\n if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {\n targetEl = eventPath[0];\n }\n const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;\n const isTargetShadow = !!(e.target && e.target.shadowRoot);\n\n // use closestElement for shadow root element to get the actual closest for nested shadow root element\n if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {\n swiper.allowClick = true;\n return;\n }\n if (params.swipeHandler) {\n if (!targetEl.closest(params.swipeHandler)) return;\n }\n touches.currentX = e.pageX;\n touches.currentY = e.pageY;\n const startX = touches.currentX;\n const startY = touches.currentY;\n\n // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore\n\n if (!preventEdgeSwipe(swiper, e, startX)) {\n return;\n }\n Object.assign(data, {\n isTouched: true,\n isMoved: false,\n allowTouchCallbacks: true,\n isScrolling: undefined,\n startMoving: undefined\n });\n touches.startX = startX;\n touches.startY = startY;\n data.touchStartTime = now();\n swiper.allowClick = true;\n swiper.updateSize();\n swiper.swipeDirection = undefined;\n if (params.threshold > 0) data.allowThresholdMove = false;\n let preventDefault = true;\n if (targetEl.matches(data.focusableElements)) {\n preventDefault = false;\n if (targetEl.nodeName === 'SELECT') {\n data.isTouched = false;\n }\n }\n if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl) {\n document.activeElement.blur();\n }\n const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;\n if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {\n e.preventDefault();\n }\n if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {\n swiper.freeMode.onTouchStart();\n }\n swiper.emit('touchStart', e);\n}\n\nfunction onTouchMove(event) {\n const document = getDocument();\n const swiper = this;\n const data = swiper.touchEventsData;\n const {\n params,\n touches,\n rtlTranslate: rtl,\n enabled\n } = swiper;\n if (!enabled) return;\n if (!params.simulateTouch && event.pointerType === 'mouse') return;\n let e = event;\n if (e.originalEvent) e = e.originalEvent;\n if (e.type === 'pointermove') {\n if (data.touchId !== null) return; // return from pointer if we use touch\n const id = e.pointerId;\n if (id !== data.pointerId) return;\n }\n let targetTouch;\n if (e.type === 'touchmove') {\n targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];\n if (!targetTouch || targetTouch.identifier !== data.touchId) return;\n } else {\n targetTouch = e;\n }\n if (!data.isTouched) {\n if (data.startMoving && data.isScrolling) {\n swiper.emit('touchMoveOpposite', e);\n }\n return;\n }\n const pageX = targetTouch.pageX;\n const pageY = targetTouch.pageY;\n if (e.preventedByNestedSwiper) {\n touches.startX = pageX;\n touches.startY = pageY;\n return;\n }\n if (!swiper.allowTouchMove) {\n if (!e.target.matches(data.focusableElements)) {\n swiper.allowClick = false;\n }\n if (data.isTouched) {\n Object.assign(touches, {\n startX: pageX,\n startY: pageY,\n currentX: pageX,\n currentY: pageY\n });\n data.touchStartTime = now();\n }\n return;\n }\n if (params.touchReleaseOnEdges && !params.loop) {\n if (swiper.isVertical()) {\n // Vertical\n if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {\n data.isTouched = false;\n data.isMoved = false;\n return;\n }\n } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {\n return;\n }\n }\n if (document.activeElement) {\n if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {\n data.isMoved = true;\n swiper.allowClick = false;\n return;\n }\n }\n if (data.allowTouchCallbacks) {\n swiper.emit('touchMove', e);\n }\n touches.previousX = touches.currentX;\n touches.previousY = touches.currentY;\n touches.currentX = pageX;\n touches.currentY = pageY;\n const diffX = touches.currentX - touches.startX;\n const diffY = touches.currentY - touches.startY;\n if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;\n if (typeof data.isScrolling === 'undefined') {\n let touchAngle;\n if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {\n data.isScrolling = false;\n } else {\n // eslint-disable-next-line\n if (diffX * diffX + diffY * diffY >= 25) {\n touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;\n data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;\n }\n }\n }\n if (data.isScrolling) {\n swiper.emit('touchMoveOpposite', e);\n }\n if (typeof data.startMoving === 'undefined') {\n if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {\n data.startMoving = true;\n }\n }\n if (data.isScrolling) {\n data.isTouched = false;\n return;\n }\n if (!data.startMoving) {\n return;\n }\n swiper.allowClick = false;\n if (!params.cssMode && e.cancelable) {\n e.preventDefault();\n }\n if (params.touchMoveStopPropagation && !params.nested) {\n e.stopPropagation();\n }\n let diff = swiper.isHorizontal() ? diffX : diffY;\n let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY;\n if (params.oneWayMovement) {\n diff = Math.abs(diff) * (rtl ? 1 : -1);\n touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1);\n }\n touches.diff = diff;\n diff *= params.touchRatio;\n if (rtl) {\n diff = -diff;\n touchesDiff = -touchesDiff;\n }\n const prevTouchesDirection = swiper.touchesDirection;\n swiper.swipeDirection = diff > 0 ? 'prev' : 'next';\n swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';\n const isLoop = swiper.params.loop && !params.cssMode;\n const allowLoopFix = swiper.touchesDirection === 'next' && swiper.allowSlideNext || swiper.touchesDirection === 'prev' && swiper.allowSlidePrev;\n if (!data.isMoved) {\n if (isLoop && allowLoopFix) {\n swiper.loopFix({\n direction: swiper.swipeDirection\n });\n }\n data.startTranslate = swiper.getTranslate();\n swiper.setTransition(0);\n if (swiper.animating) {\n const evt = new window.CustomEvent('transitionend', {\n bubbles: true,\n cancelable: true\n });\n swiper.wrapperEl.dispatchEvent(evt);\n }\n data.allowMomentumBounce = false;\n // Grab Cursor\n if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {\n swiper.setGrabCursor(true);\n }\n swiper.emit('sliderFirstMove', e);\n }\n let loopFixed;\n new Date().getTime();\n if (data.isMoved && data.allowThresholdMove && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {\n Object.assign(touches, {\n startX: pageX,\n startY: pageY,\n currentX: pageX,\n currentY: pageY,\n startTranslate: data.currentTranslate\n });\n data.loopSwapReset = true;\n data.startTranslate = data.currentTranslate;\n return;\n }\n swiper.emit('sliderMove', e);\n data.isMoved = true;\n data.currentTranslate = diff + data.startTranslate;\n let disableParentSwiper = true;\n let resistanceRatio = params.resistanceRatio;\n if (params.touchReleaseOnEdges) {\n resistanceRatio = 0;\n }\n if (diff > 0) {\n if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.slidesSizesGrid[swiper.activeIndex + 1] : swiper.minTranslate())) {\n swiper.loopFix({\n direction: 'prev',\n setTranslate: true,\n activeSlideIndex: 0\n });\n }\n if (data.currentTranslate > swiper.minTranslate()) {\n disableParentSwiper = false;\n if (params.resistance) {\n data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;\n }\n }\n } else if (diff < 0) {\n if (isLoop && allowLoopFix && !loopFixed && data.allowThresholdMove && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.slidesSizesGrid[swiper.slidesSizesGrid.length - 1] : swiper.maxTranslate())) {\n swiper.loopFix({\n direction: 'next',\n setTranslate: true,\n activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10)))\n });\n }\n if (data.currentTranslate < swiper.maxTranslate()) {\n disableParentSwiper = false;\n if (params.resistance) {\n data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;\n }\n }\n }\n if (disableParentSwiper) {\n e.preventedByNestedSwiper = true;\n }\n\n // Directions locks\n if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {\n data.currentTranslate = data.startTranslate;\n }\n if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {\n data.currentTranslate = data.startTranslate;\n }\n if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {\n data.currentTranslate = data.startTranslate;\n }\n\n // Threshold\n if (params.threshold > 0) {\n if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {\n if (!data.allowThresholdMove) {\n data.allowThresholdMove = true;\n touches.startX = touches.currentX;\n touches.startY = touches.currentY;\n data.currentTranslate = data.startTranslate;\n touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;\n return;\n }\n } else {\n data.currentTranslate = data.startTranslate;\n return;\n }\n }\n if (!params.followFinger || params.cssMode) return;\n\n // Update active index in free mode\n if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n if (params.freeMode && params.freeMode.enabled && swiper.freeMode) {\n swiper.freeMode.onTouchMove();\n }\n // Update progress\n swiper.updateProgress(data.currentTranslate);\n // Update translate\n swiper.setTranslate(data.currentTranslate);\n}\n\nfunction onTouchEnd(event) {\n const swiper = this;\n const data = swiper.touchEventsData;\n let e = event;\n if (e.originalEvent) e = e.originalEvent;\n let targetTouch;\n const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';\n if (!isTouchEvent) {\n if (data.touchId !== null) return; // return from pointer if we use touch\n if (e.pointerId !== data.pointerId) return;\n targetTouch = e;\n } else {\n targetTouch = [...e.changedTouches].filter(t => t.identifier === data.touchId)[0];\n if (!targetTouch || targetTouch.identifier !== data.touchId) return;\n }\n if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {\n const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);\n if (!proceed) {\n return;\n }\n }\n data.pointerId = null;\n data.touchId = null;\n const {\n params,\n touches,\n rtlTranslate: rtl,\n slidesGrid,\n enabled\n } = swiper;\n if (!enabled) return;\n if (!params.simulateTouch && e.pointerType === 'mouse') return;\n if (data.allowTouchCallbacks) {\n swiper.emit('touchEnd', e);\n }\n data.allowTouchCallbacks = false;\n if (!data.isTouched) {\n if (data.isMoved && params.grabCursor) {\n swiper.setGrabCursor(false);\n }\n data.isMoved = false;\n data.startMoving = false;\n return;\n }\n\n // Return Grab Cursor\n if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {\n swiper.setGrabCursor(false);\n }\n\n // Time diff\n const touchEndTime = now();\n const timeDiff = touchEndTime - data.touchStartTime;\n\n // Tap, doubleTap, Click\n if (swiper.allowClick) {\n const pathTree = e.path || e.composedPath && e.composedPath();\n swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree);\n swiper.emit('tap click', e);\n if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {\n swiper.emit('doubleTap doubleClick', e);\n }\n }\n data.lastClickTime = now();\n nextTick(() => {\n if (!swiper.destroyed) swiper.allowClick = true;\n });\n if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 && !data.loopSwapReset || data.currentTranslate === data.startTranslate && !data.loopSwapReset) {\n data.isTouched = false;\n data.isMoved = false;\n data.startMoving = false;\n return;\n }\n data.isTouched = false;\n data.isMoved = false;\n data.startMoving = false;\n let currentPos;\n if (params.followFinger) {\n currentPos = rtl ? swiper.translate : -swiper.translate;\n } else {\n currentPos = -data.currentTranslate;\n }\n if (params.cssMode) {\n return;\n }\n if (params.freeMode && params.freeMode.enabled) {\n swiper.freeMode.onTouchEnd({\n currentPos\n });\n return;\n }\n\n // Find current slide\n const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;\n let stopIndex = 0;\n let groupSize = swiper.slidesSizesGrid[0];\n for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {\n const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;\n if (typeof slidesGrid[i + increment] !== 'undefined') {\n if (swipeToLast || currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {\n stopIndex = i;\n groupSize = slidesGrid[i + increment] - slidesGrid[i];\n }\n } else if (swipeToLast || currentPos >= slidesGrid[i]) {\n stopIndex = i;\n groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];\n }\n }\n let rewindFirstIndex = null;\n let rewindLastIndex = null;\n if (params.rewind) {\n if (swiper.isBeginning) {\n rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;\n } else if (swiper.isEnd) {\n rewindFirstIndex = 0;\n }\n }\n // Find current slide size\n const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;\n const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;\n if (timeDiff > params.longSwipesMs) {\n // Long touches\n if (!params.longSwipes) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n if (swiper.swipeDirection === 'next') {\n if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);\n }\n if (swiper.swipeDirection === 'prev') {\n if (ratio > 1 - params.longSwipesRatio) {\n swiper.slideTo(stopIndex + increment);\n } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {\n swiper.slideTo(rewindLastIndex);\n } else {\n swiper.slideTo(stopIndex);\n }\n }\n } else {\n // Short swipes\n if (!params.shortSwipes) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);\n if (!isNavButtonTarget) {\n if (swiper.swipeDirection === 'next') {\n swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);\n }\n if (swiper.swipeDirection === 'prev') {\n swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);\n }\n } else if (e.target === swiper.navigation.nextEl) {\n swiper.slideTo(stopIndex + increment);\n } else {\n swiper.slideTo(stopIndex);\n }\n }\n}\n\nfunction onResize() {\n const swiper = this;\n const {\n params,\n el\n } = swiper;\n if (el && el.offsetWidth === 0) return;\n\n // Breakpoints\n if (params.breakpoints) {\n swiper.setBreakpoint();\n }\n\n // Save locks\n const {\n allowSlideNext,\n allowSlidePrev,\n snapGrid\n } = swiper;\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n\n // Disable locks on resize\n swiper.allowSlideNext = true;\n swiper.allowSlidePrev = true;\n swiper.updateSize();\n swiper.updateSlides();\n swiper.updateSlidesClasses();\n const isVirtualLoop = isVirtual && params.loop;\n if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {\n swiper.slideTo(swiper.slides.length - 1, 0, false, true);\n } else {\n if (swiper.params.loop && !isVirtual) {\n swiper.slideToLoop(swiper.realIndex, 0, false, true);\n } else {\n swiper.slideTo(swiper.activeIndex, 0, false, true);\n }\n }\n if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {\n clearTimeout(swiper.autoplay.resizeTimeout);\n swiper.autoplay.resizeTimeout = setTimeout(() => {\n if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {\n swiper.autoplay.resume();\n }\n }, 500);\n }\n // Return locks after resize\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {\n swiper.checkOverflow();\n }\n}\n\nfunction onClick(e) {\n const swiper = this;\n if (!swiper.enabled) return;\n if (!swiper.allowClick) {\n if (swiper.params.preventClicks) e.preventDefault();\n if (swiper.params.preventClicksPropagation && swiper.animating) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n }\n}\n\nfunction onScroll() {\n const swiper = this;\n const {\n wrapperEl,\n rtlTranslate,\n enabled\n } = swiper;\n if (!enabled) return;\n swiper.previousTranslate = swiper.translate;\n if (swiper.isHorizontal()) {\n swiper.translate = -wrapperEl.scrollLeft;\n } else {\n swiper.translate = -wrapperEl.scrollTop;\n }\n // eslint-disable-next-line\n if (swiper.translate === 0) swiper.translate = 0;\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n let newProgress;\n const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n if (translatesDiff === 0) {\n newProgress = 0;\n } else {\n newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;\n }\n if (newProgress !== swiper.progress) {\n swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);\n }\n swiper.emit('setTranslate', swiper.translate, false);\n}\n\nfunction onLoad(e) {\n const swiper = this;\n processLazyPreloader(swiper, e.target);\n if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) {\n return;\n }\n swiper.update();\n}\n\nfunction onDocumentTouchStart() {\n const swiper = this;\n if (swiper.documentTouchHandlerProceeded) return;\n swiper.documentTouchHandlerProceeded = true;\n if (swiper.params.touchReleaseOnEdges) {\n swiper.el.style.touchAction = 'auto';\n }\n}\n\nconst events = (swiper, method) => {\n const document = getDocument();\n const {\n params,\n el,\n wrapperEl,\n device\n } = swiper;\n const capture = !!params.nested;\n const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';\n const swiperMethod = method;\n\n // Touch Events\n document[domMethod]('touchstart', swiper.onDocumentTouchStart, {\n passive: false,\n capture\n });\n el[domMethod]('touchstart', swiper.onTouchStart, {\n passive: false\n });\n el[domMethod]('pointerdown', swiper.onTouchStart, {\n passive: false\n });\n document[domMethod]('touchmove', swiper.onTouchMove, {\n passive: false,\n capture\n });\n document[domMethod]('pointermove', swiper.onTouchMove, {\n passive: false,\n capture\n });\n document[domMethod]('touchend', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointerup', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointercancel', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('touchcancel', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointerout', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointerleave', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('contextmenu', swiper.onTouchEnd, {\n passive: true\n });\n\n // Prevent Links Clicks\n if (params.preventClicks || params.preventClicksPropagation) {\n el[domMethod]('click', swiper.onClick, true);\n }\n if (params.cssMode) {\n wrapperEl[domMethod]('scroll', swiper.onScroll);\n }\n\n // Resize handler\n if (params.updateOnWindowResize) {\n swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);\n } else {\n swiper[swiperMethod]('observerUpdate', onResize, true);\n }\n\n // Images loader\n el[domMethod]('load', swiper.onLoad, {\n capture: true\n });\n};\nfunction attachEvents() {\n const swiper = this;\n const {\n params\n } = swiper;\n swiper.onTouchStart = onTouchStart.bind(swiper);\n swiper.onTouchMove = onTouchMove.bind(swiper);\n swiper.onTouchEnd = onTouchEnd.bind(swiper);\n swiper.onDocumentTouchStart = onDocumentTouchStart.bind(swiper);\n if (params.cssMode) {\n swiper.onScroll = onScroll.bind(swiper);\n }\n swiper.onClick = onClick.bind(swiper);\n swiper.onLoad = onLoad.bind(swiper);\n events(swiper, 'on');\n}\nfunction detachEvents() {\n const swiper = this;\n events(swiper, 'off');\n}\nvar events$1 = {\n attachEvents,\n detachEvents\n};\n\nconst isGridEnabled = (swiper, params) => {\n return swiper.grid && params.grid && params.grid.rows > 1;\n};\nfunction setBreakpoint() {\n const swiper = this;\n const {\n realIndex,\n initialized,\n params,\n el\n } = swiper;\n const breakpoints = params.breakpoints;\n if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return;\n\n // Get breakpoint for window width and update parameters\n const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);\n if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;\n const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;\n const breakpointParams = breakpointOnlyParams || swiper.originalParams;\n const wasMultiRow = isGridEnabled(swiper, params);\n const isMultiRow = isGridEnabled(swiper, breakpointParams);\n const wasEnabled = params.enabled;\n if (wasMultiRow && !isMultiRow) {\n el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);\n swiper.emitContainerClasses();\n } else if (!wasMultiRow && isMultiRow) {\n el.classList.add(`${params.containerModifierClass}grid`);\n if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {\n el.classList.add(`${params.containerModifierClass}grid-column`);\n }\n swiper.emitContainerClasses();\n }\n\n // Toggle navigation, pagination, scrollbar\n ['navigation', 'pagination', 'scrollbar'].forEach(prop => {\n if (typeof breakpointParams[prop] === 'undefined') return;\n const wasModuleEnabled = params[prop] && params[prop].enabled;\n const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;\n if (wasModuleEnabled && !isModuleEnabled) {\n swiper[prop].disable();\n }\n if (!wasModuleEnabled && isModuleEnabled) {\n swiper[prop].enable();\n }\n });\n const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;\n const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);\n const wasLoop = params.loop;\n if (directionChanged && initialized) {\n swiper.changeDirection();\n }\n extend(swiper.params, breakpointParams);\n const isEnabled = swiper.params.enabled;\n const hasLoop = swiper.params.loop;\n Object.assign(swiper, {\n allowTouchMove: swiper.params.allowTouchMove,\n allowSlideNext: swiper.params.allowSlideNext,\n allowSlidePrev: swiper.params.allowSlidePrev\n });\n if (wasEnabled && !isEnabled) {\n swiper.disable();\n } else if (!wasEnabled && isEnabled) {\n swiper.enable();\n }\n swiper.currentBreakpoint = breakpoint;\n swiper.emit('_beforeBreakpoint', breakpointParams);\n if (initialized) {\n if (needsReLoop) {\n swiper.loopDestroy();\n swiper.loopCreate(realIndex);\n swiper.updateSlides();\n } else if (!wasLoop && hasLoop) {\n swiper.loopCreate(realIndex);\n swiper.updateSlides();\n } else if (wasLoop && !hasLoop) {\n swiper.loopDestroy();\n }\n }\n swiper.emit('breakpoint', breakpointParams);\n}\n\nfunction getBreakpoint(breakpoints, base, containerEl) {\n if (base === void 0) {\n base = 'window';\n }\n if (!breakpoints || base === 'container' && !containerEl) return undefined;\n let breakpoint = false;\n const window = getWindow();\n const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;\n const points = Object.keys(breakpoints).map(point => {\n if (typeof point === 'string' && point.indexOf('@') === 0) {\n const minRatio = parseFloat(point.substr(1));\n const value = currentHeight * minRatio;\n return {\n value,\n point\n };\n }\n return {\n value: point,\n point\n };\n });\n points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));\n for (let i = 0; i < points.length; i += 1) {\n const {\n point,\n value\n } = points[i];\n if (base === 'window') {\n if (window.matchMedia(`(min-width: ${value}px)`).matches) {\n breakpoint = point;\n }\n } else if (value <= containerEl.clientWidth) {\n breakpoint = point;\n }\n }\n return breakpoint || 'max';\n}\n\nvar breakpoints = {\n setBreakpoint,\n getBreakpoint\n};\n\nfunction prepareClasses(entries, prefix) {\n const resultClasses = [];\n entries.forEach(item => {\n if (typeof item === 'object') {\n Object.keys(item).forEach(classNames => {\n if (item[classNames]) {\n resultClasses.push(prefix + classNames);\n }\n });\n } else if (typeof item === 'string') {\n resultClasses.push(prefix + item);\n }\n });\n return resultClasses;\n}\nfunction addClasses() {\n const swiper = this;\n const {\n classNames,\n params,\n rtl,\n el,\n device\n } = swiper;\n // prettier-ignore\n const suffixes = prepareClasses(['initialized', params.direction, {\n 'free-mode': swiper.params.freeMode && params.freeMode.enabled\n }, {\n 'autoheight': params.autoHeight\n }, {\n 'rtl': rtl\n }, {\n 'grid': params.grid && params.grid.rows > 1\n }, {\n 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'\n }, {\n 'android': device.android\n }, {\n 'ios': device.ios\n }, {\n 'css-mode': params.cssMode\n }, {\n 'centered': params.cssMode && params.centeredSlides\n }, {\n 'watch-progress': params.watchSlidesProgress\n }], params.containerModifierClass);\n classNames.push(...suffixes);\n el.classList.add(...classNames);\n swiper.emitContainerClasses();\n}\n\nfunction removeClasses() {\n const swiper = this;\n const {\n el,\n classNames\n } = swiper;\n el.classList.remove(...classNames);\n swiper.emitContainerClasses();\n}\n\nvar classes = {\n addClasses,\n removeClasses\n};\n\nfunction checkOverflow() {\n const swiper = this;\n const {\n isLocked: wasLocked,\n params\n } = swiper;\n const {\n slidesOffsetBefore\n } = params;\n if (slidesOffsetBefore) {\n const lastSlideIndex = swiper.slides.length - 1;\n const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;\n swiper.isLocked = swiper.size > lastSlideRightEdge;\n } else {\n swiper.isLocked = swiper.snapGrid.length === 1;\n }\n if (params.allowSlideNext === true) {\n swiper.allowSlideNext = !swiper.isLocked;\n }\n if (params.allowSlidePrev === true) {\n swiper.allowSlidePrev = !swiper.isLocked;\n }\n if (wasLocked && wasLocked !== swiper.isLocked) {\n swiper.isEnd = false;\n }\n if (wasLocked !== swiper.isLocked) {\n swiper.emit(swiper.isLocked ? 'lock' : 'unlock');\n }\n}\nvar checkOverflow$1 = {\n checkOverflow\n};\n\nvar defaults = {\n init: true,\n direction: 'horizontal',\n oneWayMovement: false,\n swiperElementNodeName: 'SWIPER-CONTAINER',\n touchEventsTarget: 'wrapper',\n initialSlide: 0,\n speed: 300,\n cssMode: false,\n updateOnWindowResize: true,\n resizeObserver: true,\n nested: false,\n createElements: false,\n eventsPrefix: 'swiper',\n enabled: true,\n focusableElements: 'input, select, option, textarea, button, video, label',\n // Overrides\n width: null,\n height: null,\n //\n preventInteractionOnTransition: false,\n // ssr\n userAgent: null,\n url: null,\n // To support iOS's swipe-to-go-back gesture (when being used in-app).\n edgeSwipeDetection: false,\n edgeSwipeThreshold: 20,\n // Autoheight\n autoHeight: false,\n // Set wrapper width\n setWrapperSize: false,\n // Virtual Translate\n virtualTranslate: false,\n // Effects\n effect: 'slide',\n // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'\n\n // Breakpoints\n breakpoints: undefined,\n breakpointsBase: 'window',\n // Slides grid\n spaceBetween: 0,\n slidesPerView: 1,\n slidesPerGroup: 1,\n slidesPerGroupSkip: 0,\n slidesPerGroupAuto: false,\n centeredSlides: false,\n centeredSlidesBounds: false,\n slidesOffsetBefore: 0,\n // in px\n slidesOffsetAfter: 0,\n // in px\n normalizeSlideIndex: true,\n centerInsufficientSlides: false,\n // Disable swiper and hide navigation when container not overflow\n watchOverflow: true,\n // Round length\n roundLengths: false,\n // Touches\n touchRatio: 1,\n touchAngle: 45,\n simulateTouch: true,\n shortSwipes: true,\n longSwipes: true,\n longSwipesRatio: 0.5,\n longSwipesMs: 300,\n followFinger: true,\n allowTouchMove: true,\n threshold: 5,\n touchMoveStopPropagation: false,\n touchStartPreventDefault: true,\n touchStartForcePreventDefault: false,\n touchReleaseOnEdges: false,\n // Unique Navigation Elements\n uniqueNavElements: true,\n // Resistance\n resistance: true,\n resistanceRatio: 0.85,\n // Progress\n watchSlidesProgress: false,\n // Cursor\n grabCursor: false,\n // Clicks\n preventClicks: true,\n preventClicksPropagation: true,\n slideToClickedSlide: false,\n // loop\n loop: false,\n loopAddBlankSlides: true,\n loopAdditionalSlides: 0,\n loopPreventsSliding: true,\n // rewind\n rewind: false,\n // Swiping/no swiping\n allowSlidePrev: true,\n allowSlideNext: true,\n swipeHandler: null,\n // '.swipe-handler',\n noSwiping: true,\n noSwipingClass: 'swiper-no-swiping',\n noSwipingSelector: null,\n // Passive Listeners\n passiveListeners: true,\n maxBackfaceHiddenSlides: 10,\n // NS\n containerModifierClass: 'swiper-',\n // NEW\n slideClass: 'swiper-slide',\n slideBlankClass: 'swiper-slide-blank',\n slideActiveClass: 'swiper-slide-active',\n slideVisibleClass: 'swiper-slide-visible',\n slideFullyVisibleClass: 'swiper-slide-fully-visible',\n slideNextClass: 'swiper-slide-next',\n slidePrevClass: 'swiper-slide-prev',\n wrapperClass: 'swiper-wrapper',\n lazyPreloaderClass: 'swiper-lazy-preloader',\n lazyPreloadPrevNext: 0,\n // Callbacks\n runCallbacksOnInit: true,\n // Internals\n _emitClasses: false\n};\n\nfunction moduleExtendParams(params, allModulesParams) {\n return function extendParams(obj) {\n if (obj === void 0) {\n obj = {};\n }\n const moduleParamName = Object.keys(obj)[0];\n const moduleParams = obj[moduleParamName];\n if (typeof moduleParams !== 'object' || moduleParams === null) {\n extend(allModulesParams, obj);\n return;\n }\n if (params[moduleParamName] === true) {\n params[moduleParamName] = {\n enabled: true\n };\n }\n if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {\n params[moduleParamName].auto = true;\n }\n if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {\n params[moduleParamName].auto = true;\n }\n if (!(moduleParamName in params && 'enabled' in moduleParams)) {\n extend(allModulesParams, obj);\n return;\n }\n if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {\n params[moduleParamName].enabled = true;\n }\n if (!params[moduleParamName]) params[moduleParamName] = {\n enabled: false\n };\n extend(allModulesParams, obj);\n };\n}\n\n/* eslint no-param-reassign: \"off\" */\nconst prototypes = {\n eventsEmitter,\n update,\n translate,\n transition,\n slide,\n loop,\n grabCursor,\n events: events$1,\n breakpoints,\n checkOverflow: checkOverflow$1,\n classes\n};\nconst extendedDefaults = {};\nclass Swiper {\n constructor() {\n let el;\n let params;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {\n params = args[0];\n } else {\n [el, params] = args;\n }\n if (!params) params = {};\n params = extend({}, params);\n if (el && !params.el) params.el = el;\n const document = getDocument();\n if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) {\n const swipers = [];\n document.querySelectorAll(params.el).forEach(containerEl => {\n const newParams = extend({}, params, {\n el: containerEl\n });\n swipers.push(new Swiper(newParams));\n });\n // eslint-disable-next-line no-constructor-return\n return swipers;\n }\n\n // Swiper Instance\n const swiper = this;\n swiper.__swiper__ = true;\n swiper.support = getSupport();\n swiper.device = getDevice({\n userAgent: params.userAgent\n });\n swiper.browser = getBrowser();\n swiper.eventsListeners = {};\n swiper.eventsAnyListeners = [];\n swiper.modules = [...swiper.__modules__];\n if (params.modules && Array.isArray(params.modules)) {\n swiper.modules.push(...params.modules);\n }\n const allModulesParams = {};\n swiper.modules.forEach(mod => {\n mod({\n params,\n swiper,\n extendParams: moduleExtendParams(params, allModulesParams),\n on: swiper.on.bind(swiper),\n once: swiper.once.bind(swiper),\n off: swiper.off.bind(swiper),\n emit: swiper.emit.bind(swiper)\n });\n });\n\n // Extend defaults with modules params\n const swiperParams = extend({}, defaults, allModulesParams);\n\n // Extend defaults with passed params\n swiper.params = extend({}, swiperParams, extendedDefaults, params);\n swiper.originalParams = extend({}, swiper.params);\n swiper.passedParams = extend({}, params);\n\n // add event listeners\n if (swiper.params && swiper.params.on) {\n Object.keys(swiper.params.on).forEach(eventName => {\n swiper.on(eventName, swiper.params.on[eventName]);\n });\n }\n if (swiper.params && swiper.params.onAny) {\n swiper.onAny(swiper.params.onAny);\n }\n\n // Extend Swiper\n Object.assign(swiper, {\n enabled: swiper.params.enabled,\n el,\n // Classes\n classNames: [],\n // Slides\n slides: [],\n slidesGrid: [],\n snapGrid: [],\n slidesSizesGrid: [],\n // isDirection\n isHorizontal() {\n return swiper.params.direction === 'horizontal';\n },\n isVertical() {\n return swiper.params.direction === 'vertical';\n },\n // Indexes\n activeIndex: 0,\n realIndex: 0,\n //\n isBeginning: true,\n isEnd: false,\n // Props\n translate: 0,\n previousTranslate: 0,\n progress: 0,\n velocity: 0,\n animating: false,\n cssOverflowAdjustment() {\n // Returns 0 unless `translate` is > 2**23\n // Should be subtracted from css values to prevent overflow\n return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;\n },\n // Locks\n allowSlideNext: swiper.params.allowSlideNext,\n allowSlidePrev: swiper.params.allowSlidePrev,\n // Touch Events\n touchEventsData: {\n isTouched: undefined,\n isMoved: undefined,\n allowTouchCallbacks: undefined,\n touchStartTime: undefined,\n isScrolling: undefined,\n currentTranslate: undefined,\n startTranslate: undefined,\n allowThresholdMove: undefined,\n // Form elements to match\n focusableElements: swiper.params.focusableElements,\n // Last click time\n lastClickTime: 0,\n clickTimeout: undefined,\n // Velocities\n velocities: [],\n allowMomentumBounce: undefined,\n startMoving: undefined,\n pointerId: null,\n touchId: null\n },\n // Clicks\n allowClick: true,\n // Touches\n allowTouchMove: swiper.params.allowTouchMove,\n touches: {\n startX: 0,\n startY: 0,\n currentX: 0,\n currentY: 0,\n diff: 0\n },\n // Images\n imagesToLoad: [],\n imagesLoaded: 0\n });\n swiper.emit('_swiper');\n\n // Init\n if (swiper.params.init) {\n swiper.init();\n }\n\n // Return app instance\n // eslint-disable-next-line no-constructor-return\n return swiper;\n }\n getDirectionLabel(property) {\n if (this.isHorizontal()) {\n return property;\n }\n // prettier-ignore\n return {\n 'width': 'height',\n 'margin-top': 'margin-left',\n 'margin-bottom ': 'margin-right',\n 'margin-left': 'margin-top',\n 'margin-right': 'margin-bottom',\n 'padding-left': 'padding-top',\n 'padding-right': 'padding-bottom',\n 'marginRight': 'marginBottom'\n }[property];\n }\n getSlideIndex(slideEl) {\n const {\n slidesEl,\n params\n } = this;\n const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);\n const firstSlideIndex = elementIndex(slides[0]);\n return elementIndex(slideEl) - firstSlideIndex;\n }\n getSlideIndexByData(index) {\n return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]);\n }\n recalcSlides() {\n const swiper = this;\n const {\n slidesEl,\n params\n } = swiper;\n swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);\n }\n enable() {\n const swiper = this;\n if (swiper.enabled) return;\n swiper.enabled = true;\n if (swiper.params.grabCursor) {\n swiper.setGrabCursor();\n }\n swiper.emit('enable');\n }\n disable() {\n const swiper = this;\n if (!swiper.enabled) return;\n swiper.enabled = false;\n if (swiper.params.grabCursor) {\n swiper.unsetGrabCursor();\n }\n swiper.emit('disable');\n }\n setProgress(progress, speed) {\n const swiper = this;\n progress = Math.min(Math.max(progress, 0), 1);\n const min = swiper.minTranslate();\n const max = swiper.maxTranslate();\n const current = (max - min) * progress + min;\n swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n emitContainerClasses() {\n const swiper = this;\n if (!swiper.params._emitClasses || !swiper.el) return;\n const cls = swiper.el.className.split(' ').filter(className => {\n return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;\n });\n swiper.emit('_containerClasses', cls.join(' '));\n }\n getSlideClasses(slideEl) {\n const swiper = this;\n if (swiper.destroyed) return '';\n return slideEl.className.split(' ').filter(className => {\n return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;\n }).join(' ');\n }\n emitSlidesClasses() {\n const swiper = this;\n if (!swiper.params._emitClasses || !swiper.el) return;\n const updates = [];\n swiper.slides.forEach(slideEl => {\n const classNames = swiper.getSlideClasses(slideEl);\n updates.push({\n slideEl,\n classNames\n });\n swiper.emit('_slideClass', slideEl, classNames);\n });\n swiper.emit('_slideClasses', updates);\n }\n slidesPerViewDynamic(view, exact) {\n if (view === void 0) {\n view = 'current';\n }\n if (exact === void 0) {\n exact = false;\n }\n const swiper = this;\n const {\n params,\n slides,\n slidesGrid,\n slidesSizesGrid,\n size: swiperSize,\n activeIndex\n } = swiper;\n let spv = 1;\n if (typeof params.slidesPerView === 'number') return params.slidesPerView;\n if (params.centeredSlides) {\n let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;\n let breakLoop;\n for (let i = activeIndex + 1; i < slides.length; i += 1) {\n if (slides[i] && !breakLoop) {\n slideSize += Math.ceil(slides[i].swiperSlideSize);\n spv += 1;\n if (slideSize > swiperSize) breakLoop = true;\n }\n }\n for (let i = activeIndex - 1; i >= 0; i -= 1) {\n if (slides[i] && !breakLoop) {\n slideSize += slides[i].swiperSlideSize;\n spv += 1;\n if (slideSize > swiperSize) breakLoop = true;\n }\n }\n } else {\n // eslint-disable-next-line\n if (view === 'current') {\n for (let i = activeIndex + 1; i < slides.length; i += 1) {\n const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;\n if (slideInView) {\n spv += 1;\n }\n }\n } else {\n // previous\n for (let i = activeIndex - 1; i >= 0; i -= 1) {\n const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;\n if (slideInView) {\n spv += 1;\n }\n }\n }\n }\n return spv;\n }\n update() {\n const swiper = this;\n if (!swiper || swiper.destroyed) return;\n const {\n snapGrid,\n params\n } = swiper;\n // Breakpoints\n if (params.breakpoints) {\n swiper.setBreakpoint();\n }\n [...swiper.el.querySelectorAll('[loading=\"lazy\"]')].forEach(imageEl => {\n if (imageEl.complete) {\n processLazyPreloader(swiper, imageEl);\n }\n });\n swiper.updateSize();\n swiper.updateSlides();\n swiper.updateProgress();\n swiper.updateSlidesClasses();\n function setTranslate() {\n const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;\n const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());\n swiper.setTranslate(newTranslate);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n let translated;\n if (params.freeMode && params.freeMode.enabled && !params.cssMode) {\n setTranslate();\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n } else {\n if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) {\n const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;\n translated = swiper.slideTo(slides.length - 1, 0, false, true);\n } else {\n translated = swiper.slideTo(swiper.activeIndex, 0, false, true);\n }\n if (!translated) {\n setTranslate();\n }\n }\n if (params.watchOverflow && snapGrid !== swiper.snapGrid) {\n swiper.checkOverflow();\n }\n swiper.emit('update');\n }\n changeDirection(newDirection, needUpdate) {\n if (needUpdate === void 0) {\n needUpdate = true;\n }\n const swiper = this;\n const currentDirection = swiper.params.direction;\n if (!newDirection) {\n // eslint-disable-next-line\n newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';\n }\n if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {\n return swiper;\n }\n swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`);\n swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`);\n swiper.emitContainerClasses();\n swiper.params.direction = newDirection;\n swiper.slides.forEach(slideEl => {\n if (newDirection === 'vertical') {\n slideEl.style.width = '';\n } else {\n slideEl.style.height = '';\n }\n });\n swiper.emit('changeDirection');\n if (needUpdate) swiper.update();\n return swiper;\n }\n changeLanguageDirection(direction) {\n const swiper = this;\n if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;\n swiper.rtl = direction === 'rtl';\n swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;\n if (swiper.rtl) {\n swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`);\n swiper.el.dir = 'rtl';\n } else {\n swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`);\n swiper.el.dir = 'ltr';\n }\n swiper.update();\n }\n mount(element) {\n const swiper = this;\n if (swiper.mounted) return true;\n\n // Find el\n let el = element || swiper.params.el;\n if (typeof el === 'string') {\n el = document.querySelector(el);\n }\n if (!el) {\n return false;\n }\n el.swiper = swiper;\n if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {\n swiper.isElement = true;\n }\n const getWrapperSelector = () => {\n return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;\n };\n const getWrapper = () => {\n if (el && el.shadowRoot && el.shadowRoot.querySelector) {\n const res = el.shadowRoot.querySelector(getWrapperSelector());\n // Children needs to return slot items\n return res;\n }\n return elementChildren(el, getWrapperSelector())[0];\n };\n // Find Wrapper\n let wrapperEl = getWrapper();\n if (!wrapperEl && swiper.params.createElements) {\n wrapperEl = createElement('div', swiper.params.wrapperClass);\n el.append(wrapperEl);\n elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => {\n wrapperEl.append(slideEl);\n });\n }\n Object.assign(swiper, {\n el,\n wrapperEl,\n slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl,\n hostEl: swiper.isElement ? el.parentNode.host : el,\n mounted: true,\n // RTL\n rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',\n rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),\n wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'\n });\n return true;\n }\n init(el) {\n const swiper = this;\n if (swiper.initialized) return swiper;\n const mounted = swiper.mount(el);\n if (mounted === false) return swiper;\n swiper.emit('beforeInit');\n\n // Set breakpoint\n if (swiper.params.breakpoints) {\n swiper.setBreakpoint();\n }\n\n // Add Classes\n swiper.addClasses();\n\n // Update size\n swiper.updateSize();\n\n // Update slides\n swiper.updateSlides();\n if (swiper.params.watchOverflow) {\n swiper.checkOverflow();\n }\n\n // Set Grab Cursor\n if (swiper.params.grabCursor && swiper.enabled) {\n swiper.setGrabCursor();\n }\n\n // Slide To Initial Slide\n if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {\n swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);\n } else {\n swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);\n }\n\n // Create loop\n if (swiper.params.loop) {\n swiper.loopCreate();\n }\n\n // Attach events\n swiper.attachEvents();\n const lazyElements = [...swiper.el.querySelectorAll('[loading=\"lazy\"]')];\n if (swiper.isElement) {\n lazyElements.push(...swiper.hostEl.querySelectorAll('[loading=\"lazy\"]'));\n }\n lazyElements.forEach(imageEl => {\n if (imageEl.complete) {\n processLazyPreloader(swiper, imageEl);\n } else {\n imageEl.addEventListener('load', e => {\n processLazyPreloader(swiper, e.target);\n });\n }\n });\n preload(swiper);\n\n // Init Flag\n swiper.initialized = true;\n preload(swiper);\n\n // Emit\n swiper.emit('init');\n swiper.emit('afterInit');\n return swiper;\n }\n destroy(deleteInstance, cleanStyles) {\n if (deleteInstance === void 0) {\n deleteInstance = true;\n }\n if (cleanStyles === void 0) {\n cleanStyles = true;\n }\n const swiper = this;\n const {\n params,\n el,\n wrapperEl,\n slides\n } = swiper;\n if (typeof swiper.params === 'undefined' || swiper.destroyed) {\n return null;\n }\n swiper.emit('beforeDestroy');\n\n // Init Flag\n swiper.initialized = false;\n\n // Detach events\n swiper.detachEvents();\n\n // Destroy loop\n if (params.loop) {\n swiper.loopDestroy();\n }\n\n // Cleanup styles\n if (cleanStyles) {\n swiper.removeClasses();\n el.removeAttribute('style');\n wrapperEl.removeAttribute('style');\n if (slides && slides.length) {\n slides.forEach(slideEl => {\n slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);\n slideEl.removeAttribute('style');\n slideEl.removeAttribute('data-swiper-slide-index');\n });\n }\n }\n swiper.emit('destroy');\n\n // Detach emitter events\n Object.keys(swiper.eventsListeners).forEach(eventName => {\n swiper.off(eventName);\n });\n if (deleteInstance !== false) {\n swiper.el.swiper = null;\n deleteProps(swiper);\n }\n swiper.destroyed = true;\n return null;\n }\n static extendDefaults(newDefaults) {\n extend(extendedDefaults, newDefaults);\n }\n static get extendedDefaults() {\n return extendedDefaults;\n }\n static get defaults() {\n return defaults;\n }\n static installModule(mod) {\n if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];\n const modules = Swiper.prototype.__modules__;\n if (typeof mod === 'function' && modules.indexOf(mod) < 0) {\n modules.push(mod);\n }\n }\n static use(module) {\n if (Array.isArray(module)) {\n module.forEach(m => Swiper.installModule(m));\n return Swiper;\n }\n Swiper.installModule(module);\n return Swiper;\n }\n}\nObject.keys(prototypes).forEach(prototypeGroup => {\n Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {\n Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];\n });\n});\nSwiper.use([Resize, Observer]);\n\nexport { Swiper as S, defaults as d };\n","import { e as elementChildren, c as createElement } from './utils.mjs';\n\nfunction createElementIfNotDefined(swiper, originalParams, params, checkProps) {\n if (swiper.params.createElements) {\n Object.keys(checkProps).forEach(key => {\n if (!params[key] && params.auto === true) {\n let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];\n if (!element) {\n element = createElement('div', checkProps[key]);\n element.className = checkProps[key];\n swiper.el.append(element);\n }\n params[key] = element;\n originalParams[key] = element;\n }\n });\n }\n return params;\n}\n\nexport { createElementIfNotDefined as c };\n","import { c as createElementIfNotDefined } from '../shared/create-element-if-not-defined.mjs';\nimport { m as makeElementsArray } from '../shared/utils.mjs';\n\nfunction Navigation(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n extendParams({\n navigation: {\n nextEl: null,\n prevEl: null,\n hideOnClick: false,\n disabledClass: 'swiper-button-disabled',\n hiddenClass: 'swiper-button-hidden',\n lockClass: 'swiper-button-lock',\n navigationDisabledClass: 'swiper-navigation-disabled'\n }\n });\n swiper.navigation = {\n nextEl: null,\n prevEl: null\n };\n function getEl(el) {\n let res;\n if (el && typeof el === 'string' && swiper.isElement) {\n res = swiper.el.querySelector(el);\n if (res) return res;\n }\n if (el) {\n if (typeof el === 'string') res = [...document.querySelectorAll(el)];\n if (swiper.params.uniqueNavElements && typeof el === 'string' && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {\n res = swiper.el.querySelector(el);\n }\n }\n if (el && !res) return el;\n // if (Array.isArray(res) && res.length === 1) res = res[0];\n return res;\n }\n function toggleEl(el, disabled) {\n const params = swiper.params.navigation;\n el = makeElementsArray(el);\n el.forEach(subEl => {\n if (subEl) {\n subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));\n if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;\n if (swiper.params.watchOverflow && swiper.enabled) {\n subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);\n }\n }\n });\n }\n function update() {\n // Update Navigation Buttons\n const {\n nextEl,\n prevEl\n } = swiper.navigation;\n if (swiper.params.loop) {\n toggleEl(prevEl, false);\n toggleEl(nextEl, false);\n return;\n }\n toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);\n toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);\n }\n function onPrevClick(e) {\n e.preventDefault();\n if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;\n swiper.slidePrev();\n emit('navigationPrev');\n }\n function onNextClick(e) {\n e.preventDefault();\n if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;\n swiper.slideNext();\n emit('navigationNext');\n }\n function init() {\n const params = swiper.params.navigation;\n swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {\n nextEl: 'swiper-button-next',\n prevEl: 'swiper-button-prev'\n });\n if (!(params.nextEl || params.prevEl)) return;\n let nextEl = getEl(params.nextEl);\n let prevEl = getEl(params.prevEl);\n Object.assign(swiper.navigation, {\n nextEl,\n prevEl\n });\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n const initButton = (el, dir) => {\n if (el) {\n el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);\n }\n if (!swiper.enabled && el) {\n el.classList.add(...params.lockClass.split(' '));\n }\n };\n nextEl.forEach(el => initButton(el, 'next'));\n prevEl.forEach(el => initButton(el, 'prev'));\n }\n function destroy() {\n let {\n nextEl,\n prevEl\n } = swiper.navigation;\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n const destroyButton = (el, dir) => {\n el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);\n el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));\n };\n nextEl.forEach(el => destroyButton(el, 'next'));\n prevEl.forEach(el => destroyButton(el, 'prev'));\n }\n on('init', () => {\n if (swiper.params.navigation.enabled === false) {\n // eslint-disable-next-line\n disable();\n } else {\n init();\n update();\n }\n });\n on('toEdge fromEdge lock unlock', () => {\n update();\n });\n on('destroy', () => {\n destroy();\n });\n on('enable disable', () => {\n let {\n nextEl,\n prevEl\n } = swiper.navigation;\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n if (swiper.enabled) {\n update();\n return;\n }\n [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass));\n });\n on('click', (_s, e) => {\n let {\n nextEl,\n prevEl\n } = swiper.navigation;\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n const targetEl = e.target;\n if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {\n if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;\n let isHidden;\n if (nextEl.length) {\n isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);\n } else if (prevEl.length) {\n isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);\n }\n if (isHidden === true) {\n emit('navigationShow');\n } else {\n emit('navigationHide');\n }\n [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));\n }\n });\n const enable = () => {\n swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));\n init();\n update();\n };\n const disable = () => {\n swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));\n destroy();\n };\n Object.assign(swiper.navigation, {\n enable,\n disable,\n update,\n init,\n destroy\n });\n}\n\nexport { Navigation as default };\n","function classesToSelector(classes) {\n if (classes === void 0) {\n classes = '';\n }\n return `.${classes.trim().replace(/([\\.:!+\\/])/g, '\\\\$1') // eslint-disable-line\n .replace(/ /g, '.')}`;\n}\n\nexport { classesToSelector as c };\n","import { c as classesToSelector } from '../shared/classes-to-selector.mjs';\nimport { c as createElementIfNotDefined } from '../shared/create-element-if-not-defined.mjs';\nimport { m as makeElementsArray, f as elementOuterSize, g as elementIndex, a as elementParents } from '../shared/utils.mjs';\n\nfunction Pagination(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const pfx = 'swiper-pagination';\n extendParams({\n pagination: {\n el: null,\n bulletElement: 'span',\n clickable: false,\n hideOnClick: false,\n renderBullet: null,\n renderProgressbar: null,\n renderFraction: null,\n renderCustom: null,\n progressbarOpposite: false,\n type: 'bullets',\n // 'bullets' or 'progressbar' or 'fraction' or 'custom'\n dynamicBullets: false,\n dynamicMainBullets: 1,\n formatFractionCurrent: number => number,\n formatFractionTotal: number => number,\n bulletClass: `${pfx}-bullet`,\n bulletActiveClass: `${pfx}-bullet-active`,\n modifierClass: `${pfx}-`,\n currentClass: `${pfx}-current`,\n totalClass: `${pfx}-total`,\n hiddenClass: `${pfx}-hidden`,\n progressbarFillClass: `${pfx}-progressbar-fill`,\n progressbarOppositeClass: `${pfx}-progressbar-opposite`,\n clickableClass: `${pfx}-clickable`,\n lockClass: `${pfx}-lock`,\n horizontalClass: `${pfx}-horizontal`,\n verticalClass: `${pfx}-vertical`,\n paginationDisabledClass: `${pfx}-disabled`\n }\n });\n swiper.pagination = {\n el: null,\n bullets: []\n };\n let bulletSize;\n let dynamicBulletIndex = 0;\n function isPaginationDisabled() {\n return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;\n }\n function setSideBullets(bulletEl, position) {\n const {\n bulletActiveClass\n } = swiper.params.pagination;\n if (!bulletEl) return;\n bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];\n if (bulletEl) {\n bulletEl.classList.add(`${bulletActiveClass}-${position}`);\n bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];\n if (bulletEl) {\n bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);\n }\n }\n }\n function onBulletClick(e) {\n const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));\n if (!bulletEl) {\n return;\n }\n e.preventDefault();\n const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;\n if (swiper.params.loop) {\n if (swiper.realIndex === index) return;\n swiper.slideToLoop(index);\n } else {\n swiper.slideTo(index);\n }\n }\n function update() {\n // Render || Update Pagination bullets/items\n const rtl = swiper.rtl;\n const params = swiper.params.pagination;\n if (isPaginationDisabled()) return;\n let el = swiper.pagination.el;\n el = makeElementsArray(el);\n // Current/Total\n let current;\n let previousIndex;\n const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;\n const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;\n if (swiper.params.loop) {\n previousIndex = swiper.previousRealIndex || 0;\n current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;\n } else if (typeof swiper.snapIndex !== 'undefined') {\n current = swiper.snapIndex;\n previousIndex = swiper.previousSnapIndex;\n } else {\n previousIndex = swiper.previousIndex || 0;\n current = swiper.activeIndex || 0;\n }\n // Types\n if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {\n const bullets = swiper.pagination.bullets;\n let firstIndex;\n let lastIndex;\n let midIndex;\n if (params.dynamicBullets) {\n bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true);\n el.forEach(subEl => {\n subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;\n });\n if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {\n dynamicBulletIndex += current - (previousIndex || 0);\n if (dynamicBulletIndex > params.dynamicMainBullets - 1) {\n dynamicBulletIndex = params.dynamicMainBullets - 1;\n } else if (dynamicBulletIndex < 0) {\n dynamicBulletIndex = 0;\n }\n }\n firstIndex = Math.max(current - dynamicBulletIndex, 0);\n lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);\n midIndex = (lastIndex + firstIndex) / 2;\n }\n bullets.forEach(bulletEl => {\n const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();\n bulletEl.classList.remove(...classesToRemove);\n });\n if (el.length > 1) {\n bullets.forEach(bullet => {\n const bulletIndex = elementIndex(bullet);\n if (bulletIndex === current) {\n bullet.classList.add(...params.bulletActiveClass.split(' '));\n } else if (swiper.isElement) {\n bullet.setAttribute('part', 'bullet');\n }\n if (params.dynamicBullets) {\n if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {\n bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));\n }\n if (bulletIndex === firstIndex) {\n setSideBullets(bullet, 'prev');\n }\n if (bulletIndex === lastIndex) {\n setSideBullets(bullet, 'next');\n }\n }\n });\n } else {\n const bullet = bullets[current];\n if (bullet) {\n bullet.classList.add(...params.bulletActiveClass.split(' '));\n }\n if (swiper.isElement) {\n bullets.forEach((bulletEl, bulletIndex) => {\n bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');\n });\n }\n if (params.dynamicBullets) {\n const firstDisplayedBullet = bullets[firstIndex];\n const lastDisplayedBullet = bullets[lastIndex];\n for (let i = firstIndex; i <= lastIndex; i += 1) {\n if (bullets[i]) {\n bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));\n }\n }\n setSideBullets(firstDisplayedBullet, 'prev');\n setSideBullets(lastDisplayedBullet, 'next');\n }\n }\n if (params.dynamicBullets) {\n const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);\n const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;\n const offsetProp = rtl ? 'right' : 'left';\n bullets.forEach(bullet => {\n bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;\n });\n }\n }\n el.forEach((subEl, subElIndex) => {\n if (params.type === 'fraction') {\n subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {\n fractionEl.textContent = params.formatFractionCurrent(current + 1);\n });\n subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {\n totalEl.textContent = params.formatFractionTotal(total);\n });\n }\n if (params.type === 'progressbar') {\n let progressbarDirection;\n if (params.progressbarOpposite) {\n progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';\n } else {\n progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';\n }\n const scale = (current + 1) / total;\n let scaleX = 1;\n let scaleY = 1;\n if (progressbarDirection === 'horizontal') {\n scaleX = scale;\n } else {\n scaleY = scale;\n }\n subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {\n progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;\n progressEl.style.transitionDuration = `${swiper.params.speed}ms`;\n });\n }\n if (params.type === 'custom' && params.renderCustom) {\n subEl.innerHTML = params.renderCustom(swiper, current + 1, total);\n if (subElIndex === 0) emit('paginationRender', subEl);\n } else {\n if (subElIndex === 0) emit('paginationRender', subEl);\n emit('paginationUpdate', subEl);\n }\n if (swiper.params.watchOverflow && swiper.enabled) {\n subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);\n }\n });\n }\n function render() {\n // Render Container\n const params = swiper.params.pagination;\n if (isPaginationDisabled()) return;\n const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length;\n let el = swiper.pagination.el;\n el = makeElementsArray(el);\n let paginationHTML = '';\n if (params.type === 'bullets') {\n let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;\n if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {\n numberOfBullets = slidesLength;\n }\n for (let i = 0; i < numberOfBullets; i += 1) {\n if (params.renderBullet) {\n paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);\n } else {\n // prettier-ignore\n paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part=\"bullet\"' : ''} class=\"${params.bulletClass}\">`;\n }\n }\n }\n if (params.type === 'fraction') {\n if (params.renderFraction) {\n paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);\n } else {\n paginationHTML = `` + ' / ' + ``;\n }\n }\n if (params.type === 'progressbar') {\n if (params.renderProgressbar) {\n paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);\n } else {\n paginationHTML = ``;\n }\n }\n swiper.pagination.bullets = [];\n el.forEach(subEl => {\n if (params.type !== 'custom') {\n subEl.innerHTML = paginationHTML || '';\n }\n if (params.type === 'bullets') {\n swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));\n }\n });\n if (params.type !== 'custom') {\n emit('paginationRender', el[0]);\n }\n }\n function init() {\n swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {\n el: 'swiper-pagination'\n });\n const params = swiper.params.pagination;\n if (!params.el) return;\n let el;\n if (typeof params.el === 'string' && swiper.isElement) {\n el = swiper.el.querySelector(params.el);\n }\n if (!el && typeof params.el === 'string') {\n el = [...document.querySelectorAll(params.el)];\n }\n if (!el) {\n el = params.el;\n }\n if (!el || el.length === 0) return;\n if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {\n el = [...swiper.el.querySelectorAll(params.el)];\n // check if it belongs to another nested Swiper\n if (el.length > 1) {\n el = el.filter(subEl => {\n if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;\n return true;\n })[0];\n }\n }\n if (Array.isArray(el) && el.length === 1) el = el[0];\n Object.assign(swiper.pagination, {\n el\n });\n el = makeElementsArray(el);\n el.forEach(subEl => {\n if (params.type === 'bullets' && params.clickable) {\n subEl.classList.add(...(params.clickableClass || '').split(' '));\n }\n subEl.classList.add(params.modifierClass + params.type);\n subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n if (params.type === 'bullets' && params.dynamicBullets) {\n subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);\n dynamicBulletIndex = 0;\n if (params.dynamicMainBullets < 1) {\n params.dynamicMainBullets = 1;\n }\n }\n if (params.type === 'progressbar' && params.progressbarOpposite) {\n subEl.classList.add(params.progressbarOppositeClass);\n }\n if (params.clickable) {\n subEl.addEventListener('click', onBulletClick);\n }\n if (!swiper.enabled) {\n subEl.classList.add(params.lockClass);\n }\n });\n }\n function destroy() {\n const params = swiper.params.pagination;\n if (isPaginationDisabled()) return;\n let el = swiper.pagination.el;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.classList.remove(params.hiddenClass);\n subEl.classList.remove(params.modifierClass + params.type);\n subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n if (params.clickable) {\n subEl.classList.remove(...(params.clickableClass || '').split(' '));\n subEl.removeEventListener('click', onBulletClick);\n }\n });\n }\n if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));\n }\n on('changeDirection', () => {\n if (!swiper.pagination || !swiper.pagination.el) return;\n const params = swiper.params.pagination;\n let {\n el\n } = swiper.pagination;\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.classList.remove(params.horizontalClass, params.verticalClass);\n subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n });\n });\n on('init', () => {\n if (swiper.params.pagination.enabled === false) {\n // eslint-disable-next-line\n disable();\n } else {\n init();\n render();\n update();\n }\n });\n on('activeIndexChange', () => {\n if (typeof swiper.snapIndex === 'undefined') {\n update();\n }\n });\n on('snapIndexChange', () => {\n update();\n });\n on('snapGridLengthChange', () => {\n render();\n update();\n });\n on('destroy', () => {\n destroy();\n });\n on('enable disable', () => {\n let {\n el\n } = swiper.pagination;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));\n }\n });\n on('lock unlock', () => {\n update();\n });\n on('click', (_s, e) => {\n const targetEl = e.target;\n const el = makeElementsArray(swiper.pagination.el);\n if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {\n if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;\n const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);\n if (isHidden === true) {\n emit('paginationShow');\n } else {\n emit('paginationHide');\n }\n el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));\n }\n });\n const enable = () => {\n swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);\n let {\n el\n } = swiper.pagination;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));\n }\n init();\n render();\n update();\n };\n const disable = () => {\n swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);\n let {\n el\n } = swiper.pagination;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));\n }\n destroy();\n };\n Object.assign(swiper.pagination, {\n enable,\n disable,\n render,\n update,\n init,\n destroy\n });\n}\n\nexport { Pagination as default };\n","import { g as getDocument } from '../shared/ssr-window.esm.mjs';\nimport { k as isObject, e as elementChildren } from '../shared/utils.mjs';\n\nfunction Thumb(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n thumbs: {\n swiper: null,\n multipleActiveThumbs: true,\n autoScrollOffset: 0,\n slideThumbActiveClass: 'swiper-slide-thumb-active',\n thumbsContainerClass: 'swiper-thumbs'\n }\n });\n let initialized = false;\n let swiperCreated = false;\n swiper.thumbs = {\n swiper: null\n };\n function onThumbClick() {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n const clickedIndex = thumbsSwiper.clickedIndex;\n const clickedSlide = thumbsSwiper.clickedSlide;\n if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return;\n if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;\n let slideToIndex;\n if (thumbsSwiper.params.loop) {\n slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);\n } else {\n slideToIndex = clickedIndex;\n }\n if (swiper.params.loop) {\n swiper.slideToLoop(slideToIndex);\n } else {\n swiper.slideTo(slideToIndex);\n }\n }\n function init() {\n const {\n thumbs: thumbsParams\n } = swiper.params;\n if (initialized) return false;\n initialized = true;\n const SwiperClass = swiper.constructor;\n if (thumbsParams.swiper instanceof SwiperClass) {\n swiper.thumbs.swiper = thumbsParams.swiper;\n Object.assign(swiper.thumbs.swiper.originalParams, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n Object.assign(swiper.thumbs.swiper.params, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n swiper.thumbs.swiper.update();\n } else if (isObject(thumbsParams.swiper)) {\n const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);\n Object.assign(thumbsSwiperParams, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);\n swiperCreated = true;\n }\n swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass);\n swiper.thumbs.swiper.on('tap', onThumbClick);\n return true;\n }\n function update(initial) {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;\n\n // Activate thumbs\n let thumbsToActivate = 1;\n const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;\n if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {\n thumbsToActivate = swiper.params.slidesPerView;\n }\n if (!swiper.params.thumbs.multipleActiveThumbs) {\n thumbsToActivate = 1;\n }\n thumbsToActivate = Math.floor(thumbsToActivate);\n thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass));\n if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {\n for (let i = 0; i < thumbsToActivate; i += 1) {\n elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index=\"${swiper.realIndex + i}\"]`).forEach(slideEl => {\n slideEl.classList.add(thumbActiveClass);\n });\n }\n } else {\n for (let i = 0; i < thumbsToActivate; i += 1) {\n if (thumbsSwiper.slides[swiper.realIndex + i]) {\n thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);\n }\n }\n }\n const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;\n const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;\n if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {\n const currentThumbsIndex = thumbsSwiper.activeIndex;\n let newThumbsIndex;\n let direction;\n if (thumbsSwiper.params.loop) {\n const newThumbsSlide = thumbsSwiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`)[0];\n newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide);\n direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';\n } else {\n newThumbsIndex = swiper.realIndex;\n direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';\n }\n if (useOffset) {\n newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;\n }\n if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {\n if (thumbsSwiper.params.centeredSlides) {\n if (newThumbsIndex > currentThumbsIndex) {\n newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;\n } else {\n newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;\n }\n } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;\n thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);\n }\n }\n }\n on('beforeInit', () => {\n const {\n thumbs\n } = swiper.params;\n if (!thumbs || !thumbs.swiper) return;\n if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) {\n const document = getDocument();\n const getThumbsElementAndInit = () => {\n const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper;\n if (thumbsElement && thumbsElement.swiper) {\n thumbs.swiper = thumbsElement.swiper;\n init();\n update(true);\n } else if (thumbsElement) {\n const onThumbsSwiper = e => {\n thumbs.swiper = e.detail[0];\n thumbsElement.removeEventListener('init', onThumbsSwiper);\n init();\n update(true);\n thumbs.swiper.update();\n swiper.update();\n };\n thumbsElement.addEventListener('init', onThumbsSwiper);\n }\n return thumbsElement;\n };\n const watchForThumbsToAppear = () => {\n if (swiper.destroyed) return;\n const thumbsElement = getThumbsElementAndInit();\n if (!thumbsElement) {\n requestAnimationFrame(watchForThumbsToAppear);\n }\n };\n requestAnimationFrame(watchForThumbsToAppear);\n } else {\n init();\n update(true);\n }\n });\n on('slideChange update resize observerUpdate', () => {\n update();\n });\n on('setTransition', (_s, duration) => {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n thumbsSwiper.setTransition(duration);\n });\n on('beforeDestroy', () => {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n if (swiperCreated) {\n thumbsSwiper.destroy();\n }\n });\n Object.assign(swiper.thumbs, {\n init,\n update\n });\n}\n\nexport { Thumb as default };\n","import Swiper from 'swiper';\r\nimport { Navigation, Pagination } from 'swiper/modules';\r\n//import FormDataWithToken from './FormDataWithToken'\r\nimport { lazyContent } from '../main'\r\n\r\nimport 'swiper/css';\r\nimport 'swiper/css/pagination';\r\n//import { SwiperOptions } from 'swiper/types';\r\nimport { numberformatter } from './formatters';\r\n\r\nexport default class Cars4SalePage {\r\n static filtersForm = document.getElementById('filters-form') as HTMLFormElement\r\n static totalCountEls = document.querySelectorAll('.total-count')\r\n static isFavoritePage = window.location.search.indexOf('ShowFavorites=true') > -1\r\n static isDesktop = window.innerWidth > 768\r\n static loading = false\r\n //static swiperCarsOptions: SwiperOptions = {\r\n // modules: [Navigation, Pagination, Manipulation],\r\n // slidesPerView: 1,\r\n // centeredSlides: true,\r\n // loop: false,\r\n // spaceBetween: 30,\r\n // init: false,\r\n // autoHeight: true,\r\n // updateOnWindowResize: true,\r\n // slideToClickedSlide: true,\r\n // breakpoints: {\r\n // 768: {\r\n // autoHeight: false,\r\n // slidesPerView: 2,\r\n // spaceBetween: 10,\r\n // },\r\n // 1024: {\r\n // autoHeight: false,\r\n // slidesPerView: 3,\r\n // spaceBetween: 0,\r\n // },\r\n // 1199: {\r\n // autoHeight: false,\r\n // slidesPerView: 3.5,\r\n // spaceBetween: 0,\r\n // },\r\n // 1399: {\r\n // autoHeight: false,\r\n // slidesPerView: 4,\r\n // spaceBetween: 0,\r\n // },\r\n // },\r\n // navigation: {\r\n // nextEl: '.js-hero-swiper .swiper-button-next',\r\n // prevEl: '.js-hero-swiper .swiper-button-prev',\r\n // },\r\n // on: {\r\n // slideChange: function (swiper: Swiper) {\r\n // Cars4SalePage.calculateSliderSlidesTransform(swiper);\r\n // Cars4SalePage.activeFavouriteButton(swiper);\r\n\r\n // let activeSlide = document.querySelector('.js-car-item.swiper-slide-active')\r\n // let invId = activeSlide?.getAttribute('data-inventoryvehicleid')\r\n // let isFavorite = activeSlide?.querySelector('.js-car-wrapper')?.classList.contains('is-favourite')\r\n // const data = new FormDataWithToken()\r\n // data.append('inventoryVehicleId', invId ?? '')\r\n // data.append('like', 'false')\r\n\r\n // // Save the skip if it is not a favorite\r\n // if (isFavorite === false)\r\n // fetch('?handler=SaveLikeDislike', { method: 'post', body: data })\r\n\r\n // // Load More Items\r\n // if (Cars4SalePage.loading === false && Cars4SalePage.isFavoritePage === false && swiper.realIndex >= (swiper.slides.length - 7)) {\r\n // Cars4SalePage.loadMoreCars()\r\n // }\r\n // },\r\n // init: function (swiper: Swiper) {\r\n // setTimeout(function () {\r\n // swiper.el.classList.add('is-initialized');\r\n\r\n // Cars4SalePage.calculateSliderSlidesTransform(swiper);\r\n\r\n // Cars4SalePage.activeFavouriteButton(swiper);\r\n // }, 300);\r\n // },\r\n // resize: function (swiper: Swiper) {\r\n // Cars4SalePage.calculateSliderSlidesTransform(swiper);\r\n // },\r\n // destroy: function (swiper: Swiper) {\r\n // swiper.el.classList.remove('is-initialized');\r\n // },\r\n // touchStart: function (swiper: Swiper, event: TouchEvent | MouseEvent | PointerEvent) {\r\n // const target = event.target as HTMLElement;\r\n\r\n // if (target.closest('.swiper-slide')?.classList.contains('js-car-image')) {\r\n // swiper.allowTouchMove = false;\r\n\r\n // return;\r\n // }\r\n\r\n // swiper.allowTouchMove = true;\r\n // }\r\n // }\r\n //}\r\n\r\n //static swiperCars = new Swiper('.js-swiper-cars', this.swiperCarsOptions);\r\n static carsWrapper = document.getElementById('loadcars')\r\n static gridToggleButtons = document.querySelectorAll('.js-toggle-grid-view') as NodeListOf\r\n\r\n static loadingMoreEl = document.getElementById('loading-more-div');\r\n static loadingMoreSubEl = document.getElementById('loading-more-subdiv')\r\n\r\n observer = new IntersectionObserver(this.handleVisibilityChange, {\r\n root: null, // observing changes to visibility in the viewport\r\n rootMargin: '750px',\r\n threshold: 0\r\n });\r\n\r\n static swiperImageOptions = {\r\n slidesPerView: 1,\r\n modules: [Navigation, Pagination],\r\n loop: true,\r\n spaceBetween: 10,\r\n pagination: {\r\n el: '.js-swiper-images .swiper-pagination',\r\n clickable: true,\r\n },\r\n navigation: {\r\n nextEl: \".sbn\",\r\n prevEl: \".sbp\",\r\n }\r\n }\r\n\r\n static swiperImages = new Swiper(\".js-swiper-images\", this.swiperImageOptions);\r\n\r\n constructor() {\r\n // Toggle Grid View\r\n if (Cars4SalePage.gridToggleButtons) {\r\n Cars4SalePage.gridToggleButtons.forEach(m => m.onclick = (event) => {\r\n event.preventDefault();\r\n\r\n if (document.body.classList.contains('grid-view') === true) {\r\n document.body.classList.remove('grid-view');\r\n document.body.classList.add('list-view');\r\n } else {\r\n document.body.classList.add('grid-view');\r\n document.body.classList.remove('list-view');\r\n }\r\n\r\n const enableGrid = document.body.classList.contains('grid-view');\r\n localStorage.setItem('enableGrid', String(enableGrid));\r\n })\r\n }\r\n\r\n let enableGrid = null\r\n if (localStorage.getItem('enableGrid') == null)\r\n enableGrid = true\r\n else\r\n enableGrid = localStorage.getItem('enableGrid') === 'true'\r\n\r\n if (enableGrid === true) {\r\n document.body.classList.add('grid-view');\r\n document.body.classList.remove('list-view');\r\n } else {\r\n document.body.classList.remove('grid-view');\r\n document.body.classList.add('list-view');\r\n }\r\n\r\n // Handle loading more when it comes into view\r\n if (Cars4SalePage.loadingMoreSubEl && Cars4SalePage.isFavoritePage === false)\r\n this.observer.observe(Cars4SalePage.loadingMoreSubEl);\r\n }\r\n\r\n handleVisibilityChange(entries: IntersectionObserverEntry[]) {\r\n entries.forEach(entry => {\r\n // Check if the target is intersecting (visible)\r\n if (entry.isIntersecting) {\r\n try {\r\n Cars4SalePage.loadMoreCars()\r\n }\r\n catch (ex) { }\r\n }\r\n });\r\n }\r\n\r\n static refreshSlides(data: any) {\r\n //if (document.body.classList.contains('grid-view') !== true) {\r\n // // Carousel View\r\n // Cars4SalePage.swiperCars.removeAllSlides()\r\n // data?.dataItemsHTML?.forEach((item: any) => Cars4SalePage.swiperCars.appendSlide(item))\r\n // Cars4SalePage.swiperCars.update()\r\n //}\r\n //else {\r\n // Grid View\r\n let html = ''\r\n Cars4SalePage.carsWrapper!.innerHTML = ''\r\n data?.dataItemsHTML?.forEach((item: any) => html += item)\r\n Cars4SalePage.carsWrapper?.insertAdjacentHTML('beforeend', html)\r\n //}\r\n\r\n // Refresh Lazy Load Image handler with new images\r\n lazyContent.update()\r\n\r\n // Update Swiper\r\n new Swiper('.js-swiper-images', this.swiperImageOptions)\r\n\r\n // Update Total Count\r\n if (Cars4SalePage.totalCountEls)\r\n Cars4SalePage.totalCountEls.forEach(item => item.innerHTML = numberformatter.format(data?.totalCount ?? 0))\r\n\r\n // Hide loading spinner if not many results\r\n Cars4SalePage.loadingMoreEl?.classList.toggle('inactive', (data?.totalCount ?? 0) <= 21)\r\n }\r\n\r\n static async loadMoreCars() {\r\n Cars4SalePage.loading = true\r\n\r\n //const enableGrid = localStorage.getItem('enableGrid') === 'true';\r\n\r\n let parms = new FormData(Cars4SalePage.filtersForm)\r\n parms.append('IdCSV', this.getInventoryVehicleIdCSV()) // Prevent loading items that are already visible\r\n const response = await fetch('/cars-for-sale?handler=LoadPage', { method: 'POST', body: parms })\r\n let data = await response.json()\r\n\r\n //if (enableGrid) {\r\n let html = ''\r\n data.dataItemsHTML.forEach((item: string) => html += item)\r\n this.carsWrapper?.insertAdjacentHTML('beforeend', html)\r\n //}\r\n //else {\r\n // Cars4SalePage.swiperCars.appendSlide(data.dataItemsHTML)\r\n //}\r\n\r\n lazyContent.update();\r\n\r\n // Update Swiper\r\n new Swiper('.js-swiper-images', this.swiperImageOptions)\r\n\r\n // Hide loading spinner if not many results\r\n Cars4SalePage.loadingMoreEl?.classList.toggle('inactive', data.totalCount <= 21)\r\n\r\n Cars4SalePage.loading = false\r\n }\r\n\r\n static getInventoryVehicleIdCSV() {\r\n let ids = ''\r\n\r\n document.querySelectorAll('.swiper-slide[data-inventoryvehicleid]')?.forEach(item => {\r\n ids += item.getAttribute('data-inventoryvehicleid') + ','\r\n })\r\n\r\n return ids\r\n }\r\n\r\n //static handleKeyboard() {\r\n // document.addEventListener('keyup', function (event) {\r\n // const currentKeyCode = event.key;\r\n\r\n // if (!document.body.classList.contains('grid-view')) {\r\n // switch (currentKeyCode) {\r\n // case 'ArrowRight':\r\n // Cars4SalePage.swiperCars.slideNext();\r\n // break;\r\n // case 'ArrowLeft':\r\n // Cars4SalePage.swiperCars.slidePrev();\r\n // break;\r\n // case 'ArrowUp':\r\n // const upElements = document.querySelectorAll('.js-car-toggle-favourite-swiper');\r\n // if (upElements.length > 0) upElements[0].click();\r\n // break;\r\n // }\r\n // }\r\n // });\r\n //}\r\n\r\n static activeFavouriteButton(swiper: Swiper) {\r\n if (swiper.slides[swiper.activeIndex].querySelector('.js-car-wrapper')?.classList.contains('is-favourite') === true) {\r\n document.querySelector('.js-car-toggle-favourite-swiper')?.classList.add('is-favourite')\r\n } else {\r\n document.querySelector('.js-car-toggle-favourite-swiper')?.classList.remove('is-favourite')\r\n }\r\n }\r\n\r\n static calculateSliderSlidesTransform(swiper: Swiper) {\r\n const activeSlideIndex = swiper.activeIndex\r\n const nextSlidesArray = swiper.slides.slice(activeSlideIndex);\r\n const prevSlidesArray = swiper.slides.slice(0, activeSlideIndex);\r\n\r\n //const slideWidth = $(swiper.slides[0]).outerWidth();\r\n //const numberOfVisibleSlides = swiper.params.slidesPerView;\r\n\r\n let slideScale = .6;\r\n\r\n if (window.outerHeight > 1249) {\r\n slideScale = 1 - .78;\r\n }\r\n\r\n nextSlidesArray.map(function (nextSlide, index) {\r\n nextSlide.classList.remove('prev-element');\r\n nextSlide.classList.add('next-element');\r\n\r\n if (nextSlide.classList.contains('next-element')) {\r\n nextSlide.style.transform = `translateX(-${nextSlide.clientWidth * slideScale / 2 * (index - 1)}px)`\r\n }\r\n })\r\n\r\n prevSlidesArray.map(function (prevSlide, index) {\r\n prevSlide.classList.add('prev-element');\r\n\r\n if (prevSlide.classList.contains('prev-element')) {\r\n prevSlide.style.transform = `translateX(${prevSlide.clientWidth * slideScale / 2 * (prevSlidesArray.length - index - 1)}px)`\r\n }\r\n })\r\n }\r\n}\r\n\r\nif (window.location.href.indexOf('/cars-for-sale') > -1) {\r\n new Cars4SalePage()\r\n}\r\n\r\ndocument.addEventListener('click', function (e: MouseEvent) {\r\n let el = e.target as HTMLFormElement\r\n let c = el.closest('.has-tooltip')\r\n\r\n if (c) {\r\n // Toggle tooltip visibility\r\n let tooltip = c.querySelector('.tooltip') as HTMLElement;\r\n tooltip.classList.toggle('hidden');\r\n } else {\r\n // Hide the tooltip if clicking outside\r\n document.querySelector('.tooltip')?.classList.add('hidden');\r\n }\r\n});","import FormDataWithToken from './FormDataWithToken'\n\ndocument.addEventListener('click', (event) => {\n // Carousel View\n let el1 = (event.target as HTMLElement).closest('.js-car-toggle-favourite-swiper')\n if (el1) {\n event.preventDefault();\n \n document.querySelector('.js-swiper-cars .swiper-slide-active .js-car-wrapper')?.classList.toggle('is-favourite');\n el1.classList.toggle('is-favourite');\n\n let activeSlide = document.querySelector('.js-car-item.swiper-slide-active')\n let isFav = activeSlide?.querySelector('.js-car-wrapper.is-favourite') != undefined\n let invId = document.querySelector('.js-car-item.swiper-slide-active')?.getAttribute('data-inventoryvehicleid')\n const data = new FormDataWithToken()\n data.append('inventoryVehicleId', invId ?? '')\n data.append('like', String(isFav))\n\n fetch('?handler=SaveLikeDislike', { method: 'post', body: data })\n }\n\n // Grid View and other favorite buttons not in carousel view\n let el2 = (event.target as HTMLElement).closest('.js-car-toggle-favourite')\n if (el2) {\n event.preventDefault();\n\n el2.closest('.js-car-wrapper')?.classList.toggle('is-favourite');\n el2.classList.toggle('is-favourite');\n\n let invId = el2.closest('.js-car-item')?.getAttribute('data-inventoryvehicleid')\n let isFav = el2.closest('.js-car-wrapper.is-favourite') != undefined\n \n const data = new FormDataWithToken()\n data.append('inventoryVehicleId', invId ?? '')\n data.append('like', String(isFav))\n\n fetch('/cars-for-sale/?handler=SaveLikeDislike', { method: 'post', body: data })\n }\n})","document.querySelector('[submit-loan-button]')?.addEventListener('click', async event => {\n event.preventDefault();\n\n const target = event.target as HTMLFormElement\n const targetForm = target.closest('form')\n const spinner = document.getElementById('loading-spinner')\n\n if (targetForm) {\n spinner?.classList.remove('hidden')\n\n const formData = new FormData(targetForm);\r\n const errorDiv = document.querySelector('.error-text')\r\n\r\n let response = await fetch('?', { method: 'POST', body: formData })\r\n let data = await response.json()\r\n console.log(data)\r\n\r\n if (data.success) {\r\n window.location.href = `/loan/credit-app-success?CreditAppDealJacketId=${data.creditAppDealJacketId}`\r\n }\r\n else {\r\n spinner?.classList.add('hidden')\r\n\r\n if (errorDiv)\r\n errorDiv.innerHTML = \"An error occurred: \" + data.error\r\n else\r\n alert(\"An error occurred: \" + data.error)\r\n\r\n // Scroll to top\r\n window.scrollTo({\r\n top: 0,\r\n behavior: 'smooth'\r\n });\r\n }\r\n }\r\n})\n","import Swiper from 'swiper';\r\nimport { Navigation, Pagination, Thumbs } from 'swiper/modules';\r\n\r\nif (window.location.pathname.indexOf('/details/') > -1) {\r\n var swiper = new Swiper(\".mySwiper\", {\r\n modules: [Navigation, Pagination, Thumbs],\r\n loop: true,\r\n spaceBetween: 10,\r\n slidesPerView: 4,\r\n slidesPerGroup: 4,\r\n freeMode: true,\r\n watchSlidesProgress: true,\r\n navigation: {\r\n nextEl: \".sbn\",\r\n prevEl: \".sbp\",\r\n },\r\n });\r\n\r\n new Swiper(\".mySwiper2\", {\r\n modules: [Navigation, Pagination, Thumbs],\r\n loop: true,\r\n spaceBetween: 10,\r\n navigation: {\r\n nextEl: \".sbn\",\r\n prevEl: \".sbp\",\r\n },\r\n thumbs: {\r\n swiper: swiper,\r\n }\r\n })\r\n}","import Cars4SalePage from \"./Cars4SalePage\"\r\n\r\nconst filterTrimEl = document.getElementById('filter-trim')\r\nconst filterTrimMainEl = document.getElementById('filter-trim-main')\r\nconst yearSectionEl = document.getElementById('year-section')\r\nconst loanCalculatorApplyEl = document.getElementById('loan-calculator-apply')\r\nconst searchButton = document.querySelectorAll('.js-filters-search')\r\n\r\nif (window.location.pathname.indexOf('/cars-for-sale') > -1) {\r\n \r\n // Input Handlers\r\n document.addEventListener('change', async (event) => {\r\n let p = event.target\r\n let input = ((p as HTMLElement).closest('#filters-form input, #filters-form select') as HTMLInputElement)\r\n\r\n // If input in the filter form was changed\r\n if (input && input.disabled === false)\r\n await refreshData(input)\r\n })\r\n\r\n searchButton?.forEach(item => {\r\n item.addEventListener('click', async () => {\r\n await refreshData(null)\r\n })\r\n })\r\n\r\n loanCalculatorApplyEl?.addEventListener('click', async () => {\r\n await refreshData(null)\r\n })\r\n\r\n document.addEventListener('click', function (event) {\r\n let el = event.target as HTMLElement;\r\n const filters = document.querySelectorAll('.js-filters');\r\n \r\n // Check for clicks on filtersClose elements\r\n if (el.closest('.js-filters-close')) {\r\n event.preventDefault();\r\n\r\n const currentFilters = document.querySelector('.js-filters');\r\n currentFilters?.classList.remove('is-active');\r\n currentFilters?.classList.add('hidden');\r\n\r\n document.body.classList.remove('has-open-filters');\r\n\r\n window.scrollTo({\r\n top: 0,\r\n behavior: 'smooth'\r\n });\r\n }\r\n\r\n // Check for clicks on filtersTrigger elements\r\n if (el.closest('.js-filters-trigger')) {\r\n event.preventDefault();\r\n\r\n filters.forEach((filter) => {\r\n filter.classList.remove('hidden');\r\n });\r\n\r\n setTimeout(() => {\r\n filters.forEach((filter) => {\r\n filter.classList.add('is-active');\r\n });\r\n }, 0);\r\n\r\n document.body.classList.add('has-open-filters');\r\n }\r\n\r\n // Check for clicks on filtersClear elements\r\n if (el.closest('.js-filters-clear')) {\r\n event.preventDefault();\r\n\r\n const filtersElement = el.closest('.js-filters');\r\n if (filtersElement)\r\n clearFilters(filtersElement);\r\n\r\n refreshData(null)\r\n }\r\n\r\n // Handling click outside of .js-filters-content to close the filter\r\n //if (!el.closest('.js-filters-content')) {\r\n // filters.forEach((filter) => {\r\n // if (filter.classList.contains('is-active')) {\r\n // filter.classList.remove('is-active');\r\n // document.body.classList.remove('has-open-filters');\r\n // }\r\n // });\r\n //}\r\n });\r\n}\r\nfunction clearFilters(filtersElement: HTMLElement) {\r\n const checkboxes = filtersElement.querySelectorAll('input[type=\"checkbox\"]');\r\n checkboxes.forEach((checkbox) => {\r\n checkbox.checked = false;\r\n });\r\n}\r\n\r\nasync function refreshData(cb: HTMLInputElement | null) {\r\n let data = await getFilterData()\r\n console.log(data)\r\n\r\n // Load Models\r\n if (cb?.name == 'Make') {\r\n handleMakeChange(cb, data)\r\n }\r\n\r\n // Load Trims\r\n if (cb?.name == 'Model') {\r\n handleModelChange(cb, data)\r\n }\r\n\r\n Cars4SalePage.refreshSlides(data)\r\n\r\n toggleTrimSection()\r\n toggleYearSection()\r\n toggleNoResults(data.totalCount)\r\n\r\n updateCounts(data)\r\n}\r\n\r\nfunction updateCounts(data: any) {\r\n document.querySelectorAll(`[data-name]`)?.forEach(item => item.innerHTML = '')\r\n\r\n data.makes?.forEach((item: { value: string, count: number }) => {\r\n let el = document.querySelector(`[data-name=Make][data-value=\"${item.value}\"]`)\r\n if (el) el.innerHTML = '(' + item.count + ')'\r\n })\r\n\r\n data.models?.forEach((item: { value: string, count: number }) => {\r\n let el = document.querySelector(`[data-name=Model][data-value=\"${item.value}\"]`)\r\n if (el) el.innerHTML = '(' + item.count + ')'\r\n })\r\n\r\n data.colors?.forEach((item: { value: string, count: number }) => {\r\n let el = document.querySelector(`[data-name=Color][data-value=\"${item.value}\"]`)\r\n if (el) el.innerHTML = '(' + item.count + ')'\r\n })\r\n\r\n data.drivetrains?.forEach((item: { value: string, count: number }) => {\r\n let el = document.querySelector(`[data-name=Drivetrain][data-value=\"${item.value}\"]`)\r\n if (el) el.innerHTML = '(' + item.count + ')'\r\n })\r\n\r\n data.fuelTypes?.forEach((item: { value: string, count: number }) => {\r\n let el = document.querySelector(`[data-name=EngineFuelType][data-value=\"${item.value}\"]`)\r\n if (el) el.innerHTML = '(' + item.count + ')'\r\n })\r\n\r\n data.transmissions?.forEach((item: { value: string, count: number }) => {\r\n let el = document.querySelector(`[data-name=Transmission][data-value=\"${item.value}\"]`)\r\n if (el) el.innerHTML = '(' + item.count + ')'\r\n })\r\n}\r\n\r\nasync function getFilterData() {\r\n let parms = new FormData(Cars4SalePage.filtersForm)\r\n const response = await fetch('/cars-for-sale?handler=LoadPage', { method: 'POST', body: parms })\r\n let data = await response.json()\r\n\r\n return data;\r\n}\r\n\r\nasync function getModels(make: string) {\r\n const response = await fetch('/cars-for-sale?handler=Models&Make=' + make)\r\n let data = (await response.json()) as Array\r\n\r\n return data;\r\n}\r\n\r\nasync function getTrims(make: string, model: string) {\r\n const response = await fetch(`/cars-for-sale?handler=Trims&Make=${make}&Model=${model}`)\r\n let data = (await response.json()) as Array<{ make: string, model: string, trim: string }>\r\n\r\n return data;\r\n}\r\n\r\nasync function handleMakeChange(cb: HTMLInputElement, data: any) {\r\n if (cb.checked && data) {\r\n let make = cb.value\r\n let models = (await getModels(make)) as Array\r\n\r\n // Get model HTML\r\n let html = ``\r\n\r\n cb.parentElement?.insertAdjacentHTML('beforeend', html)\r\n }\r\n else {\r\n // Remove from DOM\r\n cb.parentElement?.querySelectorAll('.model-data')?.forEach(item => item.remove())\r\n }\r\n}\r\n\r\nasync function handleModelChange(cb: HTMLInputElement, data: any) {\r\n let make = cb.getAttribute('data-make') as string\r\n let model = cb.value\r\n\r\n if (cb.checked && data) {\r\n let trims = (await getTrims(make, model)) as Array<{ make: string, model: string, trim: string }>\r\n console.log(trims)\r\n\r\n let html = `
\r\n
${make} ${model}
\r\n
`\r\n\r\n for (let z = 0; z < trims?.length ; z++) {\r\n // Get matching data item\r\n let di = data.trims?.filter((m: { value: string, count: number }) => m.value == trims[z].trim)\r\n console.log(di)\r\n\r\n let uniqueId = trims[z].trim.replace(/\\W+/g, '')\r\n\r\n html += getLIItem('', trims[z].trim, uniqueId, di?.[0]?.count, 'Trim')\r\n }\r\n\r\n html += `
`\r\n\r\n filterTrimEl?.insertAdjacentHTML('beforeend', html)\r\n }\r\n else {\r\n // Remove from DOM\r\n document.querySelectorAll(`.trim-item[data-make=\"${make}\"][data-model=\"${model}\"]`)?.forEach(m => m.remove())\r\n }\r\n}\r\n\r\nconst getLIItem = (make: string, value: string, uniqueId: string, count: number, name: string) => {\r\n let html = `
\r\n \r\n \r\n
`\r\n\r\n return html\r\n}\r\n\r\nfunction toggleNoResults(count: number) {\r\n document.body.classList.toggle('no-cars', count == 0)\r\n}\r\n\r\nfunction toggleTrimSection() {\r\n let hasElements = document.querySelectorAll('input[name=Model]:checked')?.length > 0\r\n\r\n filterTrimMainEl?.classList.toggle('hidden', !hasElements)\r\n\r\n if (!hasElements && filterTrimEl)\r\n filterTrimEl.innerHTML = ''\r\n}\r\n\r\nfunction toggleYearSection() {\r\n let isNewChecked = document.querySelector('input[name=Condition][value=New]:checked') != null\r\n let isUsedChecked = document.querySelector('input[name=Condition][value=Used]:checked') != null\r\n\r\n yearSectionEl?.classList.toggle('hidden', isNewChecked && !isUsedChecked)\r\n}","document.addEventListener('click', async function (event) {\r\n let el = event.target as HTMLFormElement\r\n\r\n if (el.classList.contains('js-standard-lead-submission')) {\r\n let frmId = el.getAttribute('data-formid')\r\n let frm \r\n\r\n if (frmId)\r\n frm = document.getElementById(frmId) as HTMLFormElement\r\n else\r\n frm = document.getElementById('frm-standard-lead-modal') as HTMLFormElement\r\n\r\n if (!frm)\r\n frm = el.closest('form')\r\n\r\n if (frm) {\r\n let frmData = new FormData(frm);\r\n \r\n const response = await fetch('/?handler=StandardLeadSubmissionForm', {\r\n method: 'POST', body: frmData\r\n })\r\n let jsonData = await response.json()\r\n\r\n frm.innerHTML = jsonData.content\r\n\r\n document.getElementById('sl-modal-button-submit')?.classList.add('hidden')\r\n document.getElementById('sl-modal-button-cancel')?.classList.add('hidden')\r\n document.getElementById('sl-modal-button-close')?.classList.remove('hidden')\r\n }\r\n }\r\n})","document.addEventListener('DOMContentLoaded', function () {\r\n InputMask.Init()\r\n})\r\n\r\nexport class InputMask {\r\n public static Init(): void {\r\n document.querySelectorAll('[mask]')?.forEach(triggerElement => {\r\n triggerElement.addEventListener('keydown', (event) => {\r\n let evt = event as KeyboardEvent\r\n let el = event.target as HTMLInputElement\r\n let mask = el.getAttribute('mask')\r\n\r\n //const cursorPosition = el.selectionStart ?? 0;\r\n //const nextChar = el.value[cursorPosition];\r\n //const prevChar = el.value[cursorPosition - 1];\r\n\r\n // Allow arrow keys, home, and end keys\r\n if (evt.key == 'Backspace' || evt.key == 'Tab' || evt.key === 'ArrowLeft' || evt.key === 'ArrowRight' || evt.key === 'Home' || evt.key === 'End' || evt.key === 'ArrowUp' || evt.key === 'ArrowDown') {\r\n return; // Do nothing, allow the keypress\r\n }\r\n\r\n if (mask == 'phone' || mask == 'ssn') {\r\n if (evt.key?.match(/[0-9]|-/g)) {\r\n let startHyphenLoc = 3\r\n let endHyphenLoc = mask == 'phone' ? 7 : 6\r\n\r\n if (evt.key == '-') {\r\n if (el.selectionStart == startHyphenLoc || el.selectionStart == endHyphenLoc) {\r\n //allow hyphen\r\n\r\n }\r\n else {\r\n event.preventDefault()\r\n }\r\n }\r\n else {\r\n // any number\r\n if (el.selectionStart == startHyphenLoc || el.selectionStart == endHyphenLoc) {\r\n // you've typed a number so auto insert hyphen\r\n el.value += '-'\r\n }\r\n }\r\n }\r\n else {\r\n event.preventDefault()\r\n }\r\n }\r\n })\r\n })\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface Window {\r\n InputMask: typeof InputMask;\r\n }\r\n}\r\n\r\nwindow.InputMask = InputMask","import { currencyFormatter, numberformatter } from './formatters';\r\nimport '../css/range-slider.css'\r\n\r\nclass RangeSlider {\r\n el: HTMLElement\r\n min: number\r\n max: number\r\n start: number\r\n end: number | null\r\n step: number\r\n minLabelSelector: string\r\n maxLabelSelector: string\r\n sliderMinName: string\r\n sliderMaxName: string\r\n color: string | null\r\n labelFormat: string | null\r\n\r\n sliderMin: HTMLInputElement\r\n sliderMax: HTMLInputElement | null\r\n sliderDiv: HTMLElement\r\n inverseLeft: HTMLElement\r\n inverseRight: HTMLElement\r\n rangeDiv: HTMLElement\r\n thumbLeft: HTMLElement\r\n thumbRight: HTMLElement | null\r\n\r\n constructor(triggerElement: HTMLElement) {\r\n this.el = triggerElement\r\n this.min = Number(this.el.getAttribute('min') ?? 0)\r\n this.max = Number(this.el.getAttribute('max') ?? 100)\r\n this.start = Number(this.el.getAttribute('start') ?? 1)\r\n this.step = Number(this.el.getAttribute('step') ?? 1)\r\n this.minLabelSelector = this.el.getAttribute('min-label-selector') ?? ''\r\n this.maxLabelSelector = this.el.getAttribute('max-label-selector') ?? ''\r\n this.sliderMinName = this.el.getAttribute('min-input-name') ?? 'SliderMinName'\r\n this.sliderMaxName = this.el.getAttribute('max-input-name') ?? 'SliderMaxName'\r\n this.color = this.el.getAttribute('color') ?? null\r\n this.labelFormat = this.el.getAttribute('label-format') ?? 'currency'\r\n let endv = this.el.getAttribute('end')\r\n this.end = Number(endv)\r\n\r\n // Create divs\r\n this.sliderDiv = document.createElement('div')\r\n this.inverseLeft = document.createElement('div')\r\n this.inverseRight = document.createElement('div')\r\n this.rangeDiv = document.createElement('div')\r\n this.thumbLeft = document.createElement('span')\r\n this.inverseLeft.setAttribute('inverse-left', '')\r\n this.inverseRight.setAttribute('inverse-right', '')\r\n this.rangeDiv.setAttribute('range', '')\r\n this.thumbLeft.setAttribute('thumb-left', '')\r\n this.sliderDiv.appendChild(this.inverseLeft)\r\n this.sliderDiv.appendChild(this.inverseRight)\r\n this.sliderDiv.appendChild(this.rangeDiv)\r\n this.sliderDiv.appendChild(this.thumbLeft)\r\n\r\n // Set color\r\n if (this.color) {\r\n this.thumbLeft.style.backgroundColor = this.color\r\n this.rangeDiv.style.backgroundColor = this.color\r\n }\r\n\r\n // Multislider append second thumb\r\n this.thumbRight = null\r\n if (this.end) {\r\n this.thumbRight = document.createElement('span')\r\n this.thumbRight.setAttribute('thumb-right', '')\r\n this.sliderDiv.appendChild(this.thumbRight)\r\n if (this.color) this.thumbRight.style.backgroundColor = this.color\r\n }\r\n\r\n this.el.appendChild(this.sliderDiv)\r\n\r\n // Create sliders\r\n this.sliderMin = document.createElement('input')\r\n this.sliderMin.type = 'range'\r\n this.sliderMin.min = String(this.min)\r\n this.sliderMin.max = String(this.max)\r\n this.sliderMin.step = String(this.step)\r\n this.sliderMin.value = String(this.start)\r\n this.sliderMin.name = this.sliderMinName\r\n this.el.appendChild(this.sliderMin)\r\n \r\n this.sliderMax = null\r\n if (this.end) {\r\n this.sliderMax = document.createElement('input')\r\n this.sliderMax.type = 'range'\r\n this.sliderMax.min = String(this.min)\r\n this.sliderMax.max = String(this.max)\r\n this.sliderMax.step = String(this.step)\r\n this.sliderMax.value = String(this.end)\r\n this.sliderMax.name = this.sliderMaxName\r\n this.el.appendChild(this.sliderMax)\r\n }\r\n\r\n // Initialize values\r\n this.sliderMinChanged(true)\r\n if (this.sliderMax) this.sliderMaxChanged(true)\r\n\r\n // Events\r\n this.sliderMin.oninput = () => this.sliderMinChanged(false)\r\n if (this.sliderMax) this.sliderMax.oninput = () => this.sliderMaxChanged(false)\r\n }\r\n\r\n convertToNewRange(originalValue: number, newMin: number, newMax: number) {\r\n // Hardcoded original range min and max values\r\n const originalMin = 0\r\n const originalMax = 100\r\n\r\n // Calculate the ratio of the new range to the original range\r\n let scale = (newMax - newMin) / (originalMax - originalMin)\r\n \r\n // Apply the ratio to the original value, adjusting by the new minimum\r\n let newValue = (originalValue - originalMin) * scale + newMin\r\n\r\n return newValue\r\n }\r\n\r\n sliderMinChanged(isInit: boolean) {\r\n if (this.sliderMin && this.sliderMax)\r\n this.sliderMin.value = String(Math.min(Number(this.sliderMin.value), Number(this.sliderMax.value) - 1));\r\n\r\n var value = (100 / (this.max - this.min)) * Number(this.sliderMin.value) - (100 / (this.max - this.min)) * this.min;\r\n this.inverseLeft.style.width = value + '%';\r\n\r\n let newVal = this.convertToNewRange(value, 0, 95)\r\n\r\n this.thumbLeft.style.left = newVal + '%'\r\n \r\n // Adjust Range\r\n if (this.end) {\r\n this.rangeDiv.style.left = value + '%'\r\n }\r\n else {\r\n this.rangeDiv.style.left = '0';\r\n this.rangeDiv.style.right = (100 - value) + '%'\r\n }\r\n \r\n // If single slider this function should also update inverse right\r\n if (!this.sliderMax)\r\n this.inverseRight.style.width = (100 - value) + '%';\r\n\r\n const txt = document.querySelector(this.minLabelSelector) as HTMLInputElement\r\n if (txt) {\r\n txt.value = this.formatValue(Number(this.sliderMin.value))\r\n\r\n if (isInit === false) {\r\n txt.dispatchEvent(new Event('input', {\r\n 'bubbles': true,\r\n 'cancelable': true\r\n }))\r\n }\r\n }\r\n }\r\n\r\n sliderMaxChanged(isInit: boolean) {\r\n if (this.sliderMin && this.sliderMax)\r\n this.sliderMax.value = String(Math.max(Number(this.sliderMax.value), Number(this.sliderMin.value) - (-1)));\r\n\r\n var value = (100 / (this.max - this.min)) * Number(this.sliderMax?.value) - (100 / (this.max - this.min)) * this.min;\r\n this.inverseRight.style.width = (100 - value) + '%';\r\n this.rangeDiv.style.right = (100 - value) + '%';\r\n\r\n let newVal = this.convertToNewRange(value, 4, 100)\r\n\r\n if (this.thumbRight)\r\n this.thumbRight.style.left = newVal + '%'\r\n\r\n // Set Text Label\r\n const txt = document.querySelector(this.maxLabelSelector) as HTMLInputElement\r\n if (txt) {\r\n txt.value = this.formatValue(Number(this.sliderMax?.value))\r\n\r\n if (isInit === false) {\r\n txt.dispatchEvent(new Event('input', {\r\n 'bubbles': true,\r\n 'cancelable': true\r\n }))\r\n }\r\n }\r\n\r\n //children[13].style.left = value + '%';\r\n //children[13].childNodes[1].innerHTML = obj.value;\r\n }\r\n\r\n private formatValue(val: number) {\r\n if (this.labelFormat === 'number')\r\n return numberformatter.format(val)\r\n else if (this.labelFormat === 'currency')\r\n return currencyFormatter.format(val)\r\n\r\n return String(val)\r\n }\r\n}\r\n\r\ndocument.querySelectorAll('[range-slider]').forEach(el => new RangeSlider(el))\r\n","document.querySelectorAll('[toggle]').forEach(item => {\n item.addEventListener('click', event => {\n let el = event.target as HTMLInputElement;\n handleToggle(el, event)\n })\n \n item.addEventListener('change', event => {\n let el = event.target as HTMLInputElement;\n handleToggle(el, event)\n })\n})\n\nfunction handleToggle(el: HTMLElement, event: Event) {\n let al = el.closest('[toggle]') as HTMLInputElement\n \n if (al) {\n if (al.tagName == 'a')\n event.preventDefault()\n\n let toggleSelector = al.getAttribute('toggle')\n let targetEl = document.querySelector(toggleSelector ?? '') as HTMLElement\n let toggleClass = al.getAttribute('toggle-class')\n let toggleAddClass = al.getAttribute('toggle-add-class')\n let toggleRemoveClass = al.getAttribute('toggle-remove-class')\n let toggleBodyClass = al.getAttribute('toggle-body-class')\n \n if (toggleBodyClass) {\n document.body.classList.toggle(toggleBodyClass)\r\n }\n\n if (toggleAddClass) {\n targetEl.classList.add(toggleAddClass)\r\n targetEl.style.display = ''\r\n return\r\n }\n\n if (toggleRemoveClass) {\n targetEl.classList.remove(toggleRemoveClass)\r\n return\r\n }\n\n if (toggleClass) {\n targetEl.classList.toggle(toggleClass)\r\n }\n else if (targetEl) {\n targetEl.style.display = al.checked ? '' : 'none'\r\n }\r\n }\r\n}","import { SimpleValidate } from './SimpleValidate'\r\n\r\nclass SimpleWizard {\r\n el: HTMLElement\r\n nextButtonEls: NodeListOf\r\n prevButtonEls: NodeListOf\r\n stepsEls: NodeListOf\r\n navEl: HTMLElement | null\r\n\r\n constructor(triggerElement: HTMLElement) {\r\n this.el = triggerElement\r\n\r\n this.nextButtonEls = this.el.querySelectorAll('[simple-wizard-next]')\r\n this.prevButtonEls = this.el.querySelectorAll('[simple-wizard-previous]')\r\n this.stepsEls = this.el.querySelectorAll('[simple-wizard-step]')\r\n this.navEl = document.querySelector('[simple-wizard-nav-items]');\r\n \r\n this.nextButtonEls?.forEach(trigger => {\r\n trigger.addEventListener('click', () => this.next())\r\n })\r\n\r\n this.prevButtonEls?.forEach(trigger => {\r\n trigger.addEventListener('click', () => this.previous())\r\n })\r\n\r\n this.el.querySelectorAll('[simple-wizard-one-required]').forEach(trigger => {\r\n trigger.addEventListener('click', (event) => {\r\n let item = event.target as HTMLElement\r\n if (item) {\r\n let curNextBtn = item.closest('[simple-wizard-step]')?.querySelector('[simple-wizard-next]') as HTMLButtonElement\r\n if (curNextBtn) {\r\n curNextBtn.disabled = false\r\n curNextBtn.classList.add('is-active')\r\n }\r\n }\r\n })\r\n })\r\n\r\n this.el.querySelectorAll('[simple-wizard-goto-slide]').forEach(item => {\r\n item.addEventListener('click', (event) => {\r\n event.preventDefault()\r\n\r\n let goto = Number((event.target as HTMLElement).getAttribute('simple-wizard-goto-slide'))\r\n this.showStep(goto)\r\n })\r\n })\r\n }\r\n\r\n getCurrentStep() {\r\n for (let i = 0; i < this.stepsEls.length; i++) {\r\n if (this.stepsEls[i].matches('.is-active')) {\r\n return i\r\n }\r\n }\r\n\r\n return -1\r\n }\r\n\r\n showStep(stepToShow: number) {\r\n console.log(\"show step\")\r\n for (let i = 0; i < this.stepsEls.length; i++) {\r\n this.stepsEls[i].classList.toggle('is-active', i == stepToShow)\r\n }\r\n\r\n // Validate fields\r\n let curStep = this.stepsEls[stepToShow]\r\n let curNext = curStep.querySelector('[simple-wizard-next]')\r\n let flds = curStep.querySelectorAll('[simple-wizard-one-required]')\r\n\r\n if (curNext) {\r\n console.log(\"cur next\")\r\n if (flds.length > 0) {\r\n let cntChecked = curStep.querySelectorAll('[simple-wizard-one-required]:checked')?.length ?? 0\r\n\r\n if (curNext) {\r\n curNext.disabled = cntChecked == 0\r\n curNext.classList.toggle('is-active', cntChecked > 0)\r\n }\r\n }\r\n else {\r\n curNext.disabled = false\r\n curNext.classList.add('is-active')\r\n }\r\n }\r\n\r\n // Scroll to top\r\n window.scrollTo({\r\n top: 0,\r\n behavior: 'smooth'\r\n });\r\n\r\n // Update Nav\r\n this.updateNav(stepToShow);\r\n }\r\n\r\n updateNav(stepNumber: number) {\r\n const navItems = this.navEl?.querySelectorAll('li, div');\r\n \r\n navItems?.forEach((item, index) => {\r\n item.classList.remove('is-active');\r\n item.classList.toggle('is-done', index < stepNumber)\r\n });\r\n \r\n navItems?.[stepNumber].classList?.add('is-active');\r\n }\r\n\r\n next() {\r\n //el.preventDefault()\r\n let curStep = this.getCurrentStep()\r\n \r\n // Validate\r\n const frm = this.el.querySelector('form[simple-validate]') as HTMLFormElement\r\n\r\n if (frm) {\r\n let svf = SimpleValidate.getInstance(frm)\r\n\r\n if (svf.validate()) {\r\n this.showStep(curStep + 1)\r\n }\r\n }\r\n else {\r\n this.showStep(curStep + 1)\r\n }\r\n }\r\n\r\n previous() {\r\n //el.preventDefault()\r\n let curStep = this.getCurrentStep()\r\n this.showStep(curStep - 1)\r\n }\r\n}\r\n\r\n// Instantiation based on the HTML element with the `data-modal-trigger` attribute\r\ndocument.querySelectorAll('[simple-wizard]').forEach(triggerElement => {\r\n new SimpleWizard(triggerElement as HTMLElement);\r\n});","import '../css/simple-modal.css'\r\n\r\ndeclare global {\r\n interface HTMLElement {\r\n readonly SimpleModal: SimpleModal | undefined;\r\n }\r\n\r\n}\r\n\r\nif (!HTMLElement.prototype.SimpleModal) {\r\n Object.defineProperty(HTMLElement.prototype, 'SimpleModal', {\r\n get: function () {\r\n // Use a data attribute to store and retrieve the modal ID\r\n const modalId = this.getAttribute('data-simple-modal-id');\r\n return SimpleModal.instances.get(modalId || '');\r\n }\r\n });\r\n}\r\n\r\nexport default class SimpleModal {\r\n static instances = new Map();\r\n\r\n modalId: string;\r\n modalJs: string;\r\n modalElement: HTMLElement | null;\r\n backdrop: HTMLElement | null;\r\n\r\n private constructor(triggerElement: HTMLElement) {\r\n this.modalId = triggerElement.getAttribute('data-simple-modal-trigger') ?? ''\r\n this.modalJs = triggerElement.getAttribute('data-simple-modal-js') ?? ''\r\n this.modalElement = null\r\n this.backdrop = null\r\n }\r\n\r\n static getInstance(triggerElement: HTMLElement): SimpleModal {\r\n const modalId = triggerElement.getAttribute('data-simple-modal-trigger') ?? ''\r\n let instance = SimpleModal.instances.get(modalId);\r\n\r\n if (!instance) {\r\n instance = new SimpleModal(triggerElement);\r\n SimpleModal.instances.set(modalId, instance);\r\n }\r\n\r\n return instance;\r\n }\r\n\r\n async init() {\r\n //if (!this.modalElement) {\r\n // Check if Ajax call\r\n if (this.modalId.indexOf('/') > -1) {\r\n let response = await fetch(this.modalId)\r\n let data = await response.text()\r\n\r\n this.modalElement = document.createElement('div')\r\n this.modalElement.classList.add('simple-modal')\r\n this.modalElement.classList.add('simple-modal-href')\r\n let subEl = document.createElement('div')\r\n subEl.classList.add('simple-modal-content')\r\n subEl.style.zIndex = '1000'\r\n subEl.innerHTML = data\r\n this.modalElement.appendChild(subEl)\r\n this.modalElement.style.display = 'block'\r\n\r\n let me = document.querySelector('.simple-modal-href')\r\n me?.remove()\r\n\r\n // Extract and execute any