{"version":3,"file":"slides-CQUkqtdJ.js","sources":["../../../app/javascript/modules/slides.js"],"sourcesContent":["import { on } from \"../utils/listeners\";\n\nconst slides = () => {\n on(\"click\", \".pw-slides-next, .pw-slides-prev\", (el, e) => {\n e.preventDefault();\n\n const thisSlide = el.closest(\".pw-slide\");\n const allSlides = el.closest(\".pw-slides\").querySelectorAll(\".pw-slide\");\n\n thisSlide.classList.remove(\"active\");\n\n const index = [].indexOf.call(allSlides, thisSlide);\n\n let newIndex = el.classList.contains(\"pw-slides-next\")\n ? index + 1\n : index - 1;\n\n if (newIndex === -1) newIndex = allSlides.length - 1;\n if (newIndex === allSlides.length) newIndex = 0;\n\n allSlides[newIndex].classList.add(\"active\");\n });\n};\n\nexport default slides;\n"],"names":["slides","on","el","e","thisSlide","allSlides","index","newIndex"],"mappings":"4CAEK,MAACA,EAAS,IAAM,CACnBC,EAAG,QAAS,mCAAoC,CAACC,EAAIC,IAAM,CACzDA,EAAE,eAAgB,EAElB,MAAMC,EAAYF,EAAG,QAAQ,WAAW,EAClCG,EAAYH,EAAG,QAAQ,YAAY,EAAE,iBAAiB,WAAW,EAEvEE,EAAU,UAAU,OAAO,QAAQ,EAEnC,MAAME,EAAQ,CAAA,EAAG,QAAQ,KAAKD,EAAWD,CAAS,EAElD,IAAIG,EAAWL,EAAG,UAAU,SAAS,gBAAgB,EACjDI,EAAQ,EACRA,EAAQ,EAERC,IAAa,KAAIA,EAAWF,EAAU,OAAS,GAC/CE,IAAaF,EAAU,SAAQE,EAAW,GAE9CF,EAAUE,CAAQ,EAAE,UAAU,IAAI,QAAQ,CAC9C,CAAG,CACH"}