{"version":3,"file":"navigation.48c7e5c1.js","sources":["../../node_modules/swiper/modules/navigation/navigation.js"],"sourcesContent":["import createElementIfNotDefined from '../../shared/create-element-if-not-defined.js';\nexport default function Navigation({\n swiper,\n extendParams,\n on,\n emit\n}) {\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 const makeElementsArray = el => {\n if (!Array.isArray(el)) el = [el].filter(e => !!e);\n return el;\n };\n function getEl(el) {\n let res;\n if (el && typeof el === 'string' && swiper.isElement) {\n res = swiper.el.shadowRoot.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 [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList[swiper.enabled ? 'remove' : '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}"],"names":["Navigation","swiper","extendParams","on","emit","makeElementsArray","el","e","getEl","res","toggleEl","disabled","params","subEl","update","nextEl","prevEl","onPrevClick","onNextClick","init","createElementIfNotDefined","initButton","dir","destroy","destroyButton","disable","_s","targetEl","isHidden","enable"],"mappings":"uXACe,SAASA,EAAW,CACjC,OAAAC,EACA,aAAAC,EACA,GAAAC,EACA,KAAAC,CACF,EAAG,CACDF,EAAa,CACX,WAAY,CACV,OAAQ,KACR,OAAQ,KACR,YAAa,GACb,cAAe,yBACf,YAAa,uBACb,UAAW,qBACX,wBAAyB,4BAC1B,CACL,CAAG,EACDD,EAAO,WAAa,CAClB,OAAQ,KACR,OAAQ,IACZ,EACE,MAAMI,EAAoBC,IACnB,MAAM,QAAQA,CAAE,IAAGA,EAAK,CAACA,CAAE,EAAE,OAAOC,GAAK,CAAC,CAACA,CAAC,G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