{"version":3,"sources":["webpack:///./Scripts/slider.js"],"names":["__webpack_exports__","element","sliders","classNames","mouseHover","document","getSelected","slider","value","arguments","length","undefined","current","selected","Math","floor","currentSelected","slides","positionSlide","array","slide","diff","width","left","a","b","right","top","bottom","aabb","visible","infinite","i","clones","clone","cloneNode","wasVisible","autoimage","check","slideContainer","appendChild","push","getSlide","positionSlides","j","style","updateSlider","resize","fullWidth","body","clientWidth","marginLeft","marginRight","rewindOnResize","maxHeight","containerRect","getBoundingClientRect","rect","height","frame","visibleCount","prevCtrl","classList","add","remove","nextCtrl","indicatorContainer","slidesToScrollAuto","slidesToScroll","oldSlidesToScroll","addIndicatorClick","index","item","addEventListener","e","gotoSelectedSlide","indicators","display","createElement","indicatorImage","backgroundImage","querySelector","selectedIndicator","ceil","round","initialized","animating","timerId","setInterval","changed","v0","v1","t","lerp","clearInterval","window","requestAnimationFrame","animateSlider","intervalTime","nextSlide","previusSlide","addSlide","position","addSlider","_defineProperty","hasAttribute","parseInt","getAttribute","interval","keyboard","pause","swipe","indicator","getElementsByClassName","intervalTimerId","children","onclick","pauseInterval","which","preventDefault","manager","Hammer","Manager","touchAction","inputClass","TouchMouseInput","event","Swipe","on","type","slideRect","checkSize","update","handle"],"mappings":"uyBAEeA,EAAA,iBAAAC,GACX,IAAIC,KAEAC,EACa,SADbA,EAEkB,WAFlBA,EAGkB,WAHlBA,EAIO,WAJPA,EAKgB,iBALhBA,EAMU,wBANVA,EAOU,wBAPVA,EAQY,sBAEZC,EAAc,iBAAkBC,UAAa,aAAc,eAAiB,YAAa,YAUzFC,EAAc,SAAUC,GAAmC,IAA3BC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,EAAGG,IAAOH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GAC9CI,EAAWC,KAAKC,OAAOH,EAAUL,EAAOS,gBAAkBT,EAAOM,UAAYL,GAASD,EAAOU,OAAOP,OACxG,OAAIG,EAAW,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,GAAG,uBAAwB,SAAUtD,GACtD,OAAQA,EAAEuD,MACN,IAAK,YACD9B,EAAU5F,GACV,MACJ,IAAK,aACD6F,EAAa7F,OAM7BoE,EAAkBpE,GAAQ,GAE1BL,EAAQuC,KAAKlC,GAEbiF,YAAY,YA9KA,SAAUjF,GAEtB,IADA,IAAIkF,GAAU,EACLzD,EAAI,EAAGA,EAAIzB,EAAOU,OAAOP,SAAW+E,EAASzD,IAAK,CACvD,IAAIkG,EAAY3H,EAAOU,OAAOe,GAAG/B,QAAQuD,wBACrCjD,EAAOU,OAAOe,GAAG0B,QAAUwE,EAAUtG,OAASsG,EAAUvG,MACxD8D,GAAU,GAEdA,GACA3C,EAAavC,GAAQ,GAsKA4H,CAAU5H,IAAY,OAcnDwF,OAAOtB,iBAAiB,SAAU,SAAUC,IAL/B,SAAU3B,GACnB,IAAK,IAAIf,EAAI,EAAGA,EAAI9B,EAAQQ,OAAQsB,IAChCc,EAAa5C,EAAQ8B,GAAIe,GAI7BqF,EAAO,KAXP7B,EAAUtG,GAEhBI,SAASgC,UAAUgG","file":"8.js","sourcesContent":["import Hammer from 'hammerjs';\n\nexport default element => {\n let sliders = [];\n \n let classNames = {\n activeSlide: 'active',\n disabledNextCtrl: 'disabled',\n disabledPrevCtrl: 'disabled',\n frame: 'carousel',\n slideContainer: 'carousel-inner',\n prevCtrl: 'carousel-control-prev',\n nextCtrl: 'carousel-control-next',\n indicators: 'carousel-indicators'\n };\n let mouseHover = ('onmouseleave' in document) ? ['mouseenter', 'mouseleave'] : ['mouseover', 'mouseout'];\n\n let lerp = function (v0, v1, t) {\n return v0 * (1 - t) + v1 * t\n };\n\n let aabb = function (a, b) {\n return (a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top);\n };\n\n let getSelected = function (slider, value = 0, current = true) {\n var selected = Math.floor((current ? slider.currentSelected : slider.selected) + value) % slider.slides.length;\n if (selected < 0)\n return selected == 0 ? 0 : slider.slides.length + selected;\n else\n return selected;\n };\n\n let getSlide = function (slider, selected) {\n if (slider.slides[selected].visible) {\n if (!slider.infinite)\n return null;\n for (var i = 0; i < slider.slides[selected].clones.length; i++) {\n if (!slider.slides[selected].clones[i].visible)\n return slider.slides[selected].clones[i];\n }\n var clone = {\n element: slider.slides[selected].element.cloneNode(true),\n visible: true,\n wasVisible: false,\n left: 0,\n width: slider.slides[selected].width\n };\n document.autoimage.check(clone.element);\n slider.slideContainer.appendChild(clone.element);\n slider.slides[selected].clones.push(clone);\n return clone;\n } else {\n return slider.slides[selected];\n }\n };\n\n let positionSlide = function (slider, value, array) {\n var selected = getSelected(slider, value);\n var slide = slider.slides[selected];\n var diff = ((slider.currentSelected - Math.floor(slider.currentSelected))) * slide.width;\n\n var left = slider.left;\n if (value < 0) {\n slider.left -= slide.width;\n left = slider.left;\n } else {\n slider.left += slide.width;\n }\n left -= diff;\n\n var test = aabb({left: 0, top: 0, right: slider.width, bottom: 1}, {left: left, top: 0, right: left + slide.width, bottom: 1});\n if (!test)\n return false;\n\n slide = getSlide(slider, selected);\n if (slide == null)\n return false;\n slide.left = left;\n slide.visible = true;\n array.push(slide);\n\n return true;\n };\n\n let positionSlides = function (slider) {\n for (var i = 0; i < slider.slides.length; i++) {\n slider.slides[i].wasVisible = slider.slides[i].visible; \n slider.slides[i].visible = false;\n for (var j = 0; j < slider.slides[i].clones.length; j++) {\n slider.slides[i].clones[j].wasVisible = slider.slides[i].clones[j].visible; \n slider.slides[i].clones[j].visible = false;\n }\n }\n var array = [];\n slider.left = 0;\n for (var i = -1; i > -100 && positionSlide(slider, i, array); i--)\n continue;\n slider.left = 0; \n for (var i = 0; i < 100 && positionSlide(slider, i, array); i++)\n continue;\n\n for (var i = 0; i < slider.slides.length; i++) {\n if (!slider.slides[i].visible && slider.slides[i].visible != slider.slides[i].wasVisible)\n slider.slides[i].element.style.left = (-(slider.width * 2)) + \"px\";\n for (var j = 0; j < slider.slides[i].clones.length; j++)\n if (!slider.slides[i].clones[j].visible && slider.slides[i].clones[j].visible != slider.slides[i].clones[j].wasVisible)\n slider.slides[i].clones[j].element.style.left = (-(slider.width * 2)) + \"px\";\n } \n for (var i = 0; i < array.length; i++)\n array[i].element.style.left = array[i].left + \"px\";\n };\n\n let animateSlider = function (slider, resize = false) {\n if (resize && !slider.animating) {\n slider.currentSelected = slider.selected;\n positionSlides(slider);\n return;\n }\n\n if (slider.timerId != 0)\n return;\n\n slider.timerId = setInterval( function () {\n var changed = false;\n\n if (slider.selected != slider.currentSelected) {\n slider.currentSelected = lerp(slider.selected, slider.currentSelected, 0.9);\n if (slider.currentSelected > slider.selected - 0.0001 && slider.currentSelected < slider.selected + 0.0001)\n slider.currentSelected = slider.selected;\n changed = true; \n }\n\n if (!changed) {\n clearInterval(slider.timerId);\n slider.timerId = 0;\n positionSlides(slider);\n return;\n }\n\n if (slider.animating)\n return;\n\n slider.animating = true;\n\n window.requestAnimationFrame(function () { \n slider.animating = false;\n positionSlides(slider);\n });\n }, 1000 / 60);\n };\n\n let updateSlider = function (slider, resize = false) {\n if (resize) {\n if (slider.fullWidth) {\n slider.element.style.width = document.body.clientWidth + \"px\";\n slider.element.style.marginLeft = (-(document.body.clientWidth / 2)) + \"px\";\n slider.element.style.marginRight = (-(document.body.clientWidth / 2)) + \"px\";\n }\n\n if (slider.rewindOnResize)\n slider.selected = 0;\n var maxHeight = 0;\n var left = 0;\n var containerRect = slider.slideContainer.getBoundingClientRect();\n slider.width = containerRect.right - containerRect.left;\n for (var i = 0; i < slider.slides.length; i++) {\n var rect = slider.slides[i].element.getBoundingClientRect();\n var width = rect.right - rect.left;\n var height = rect.bottom - rect.top;\n if (height > maxHeight)\n maxHeight = height;\n slider.slides[i].left = left; \n slider.slides[i].width = width;\n slider.slides[i].height = height;\n left += width;\n }\n slider.frame.style.height = maxHeight + \"px\";\n\n var width = 0;\n slider.visibleCount = 0;\n do {\n slider.visibleCount++;\n width += slider.slides[0].width;\n } while (width > 0 && (width + slider.slides[0].width * 0.9) <= slider.width);\n }\n\n if (!slider.infinite) {\n if (slider.selected > slider.slides.length - slider.visibleCount)\n slider.selected = slider.slides.length - slider.visibleCount;\n else if (slider.selected < 0)\n slider.selected = 0;\n\n if (slider.prevCtrl) {\n if (slider.selected == 0)\n slider.prevCtrl.classList.add(classNames.disabledPrevCtrl);\n else\n slider.prevCtrl.classList.remove(classNames.disabledPrevCtrl);\n }\n\n if (slider.nextCtrl) {\n if (slider.selected >= slider.slides.length - slider.visibleCount)\n slider.nextCtrl.classList.add(classNames.disabledNextCtrl);\n else\n slider.nextCtrl.classList.remove(classNames.disabledNextCtrl);\n }\n }\n\n /*for (var i = 0; i < slider.slides.length; i++)\n slider.slides[i].element.classList.remove(classNames.activeSlide);\n\n var selected = getSelected(slider, 0, false);\n slider.slides[selected].element.classList.add(classNames.activeSlide); */\n\n if (slider.indicatorContainer) {\n if (slider.slidesToScrollAuto && resize) {\n slider.slidesToScroll = slider.visibleCount;\n }\n\n if (slider.slidesToScroll != slider.oldSlidesToScroll) {\n var addIndicatorClick = function (index, slider, item) {\n item.addEventListener('click', function (e) {\n var selected = getSelected(slider, 0, false);\n if (index * slider.slidesToScroll < selected) {\n slider.selected -= selected - index * slider.slidesToScroll;\n } else {\n slider.selected += index * slider.slidesToScroll - selected;\n }\n gotoSelectedSlide(slider);\n });\n }\n for (var i = 0; i < slider.indicators.length; i++)\n slider.indicators[i].style.display = \"none\";\n for (var i = 0; i < slider.slides.length / slider.slidesToScroll; i++) {\n if (i < slider.indicators.length) {\n slider.indicators[i].style.display = \"\";\n continue;\n }\n\n var item = document.createElement('li');\n if (slider.indicatorImage) {\n item.style.backgroundImage = slider.slides[i].element.querySelector('.carousel-image').style.backgroundImage;\n }\n\n slider.indicators.push(item);\n slider.indicatorContainer.appendChild(item);\n addIndicatorClick(i, slider, item);\n }\n slider.indicatorContainer.style.display = (slider.slides.length / slider.slidesToScroll) <= 1 ? \"none\" : \"\";\n slider.oldSlidesToScroll = slider.slidesToScroll;\n }\n }\n\n if (slider.indicators.length > 0) {\n var selected = getSelected(slider, 0, false);\n var selectedIndicator = (selected / slider.slidesToScroll) % slider.indicators.length;\n if (!slider.infinite && selected + slider.slidesToScroll >= slider.indicators.length)\n selectedIndicator = Math.ceil(selectedIndicator);\n else\n selectedIndicator = Math.round(selectedIndicator);\n \n for (var i = 0; i < slider.indicators.length; i++)\n if (i == selectedIndicator)\n slider.indicators[i].classList.add(classNames.activeSlide);\n else\n slider.indicators[i].classList.remove(classNames.activeSlide);\n }\n\n if (slider.initialized) {\n animateSlider(slider, resize);\n } else {\n positionSlides(slider);\n slider.initialized = true;\n }\n };\n\n let checkSize = function (slider) {\n var changed = false;\n for (var i = 0; i < slider.slides.length && !changed; i++) {\n var slideRect = slider.slides[i].element.getBoundingClientRect(); \n if (slider.slides[i].height != slideRect.bottom - slideRect.top)\n changed = true;\n }\n if (changed)\n updateSlider(slider, true);\n };\n\n let gotoSelectedSlide = function (slider, resize = false) {\n slider.intervalTime = 0;\n\n updateSlider(slider, resize);\n };\n\n let nextSlide = function (slider, resize = false) {\n if (slider.slides.length == slider.visibleCount)\n return;\n\n slider.selected += slider.slidesToScroll;\n\n gotoSelectedSlide(slider, resize);\n };\n\n let previusSlide = function (slider, resize = false) {\n if (slider.slides.length == slider.visibleCount)\n return;\n\n slider.selected -= slider.slidesToScroll;\n\n gotoSelectedSlide(slider, resize);\n };\n\n let addSlide = function (slider, element) {\n element.style.position = \"absolute\";\n var slide = {\n element: element,\n left: 0,\n visible: true,\n wasVisible: false,\n width: 0,\n height: 0,\n clones: [],\n\n };\n slider.slides.push(slide);\n };\n\n let addSlider = function (element) {\n var slider = {\n element: element,\n slidesToScroll: element.hasAttribute('data-slides-to-scroll') ? parseInt(element.getAttribute('data-slides-to-scroll')) : 1,\n infinite: element.hasAttribute('data-infinite') ? parseInt(element.getAttribute('data-infinite')) != 0 : false,\n interval: element.hasAttribute('data-interval') ? parseInt(element.getAttribute('data-interval')) : 0,\n keyboard: element.hasAttribute('data-keyboard') ? parseInt(element.getAttribute('data-keyboard')) != 0 : false,\n pause: element.hasAttribute('data-pause') ? parseInt(element.getAttribute('data-pause')) != 0 : false,\n swipe: element.hasAttribute('data-swipe') ? parseInt(element.getAttribute('data-swipe')) != 0 : false,\n indicator: element.hasAttribute('data-indicator') ? parseInt(element.getAttribute('data-indicator')) != 0 : false,\n indicatorImage: element.hasAttribute('data-indicator-image') ? parseInt(element.getAttribute('data-indicator-image')) != 0 : false,\n rewindOnResize: element.hasAttribute('data-rewind-on-resize') ? parseInt(element.getAttribute('data-rewind-on-resize')) != 0 : false,\n fullWidth: element.hasAttribute('data-fullwidth') ? parseInt(element.getAttribute('data-fullwidth')) != 0 : false,\n frame: element.getElementsByClassName(classNames.frame)[0],\n slideContainer: null,\n prevCtrl: element.getElementsByClassName(classNames.prevCtrl)[0],\n nextCtrl: element.getElementsByClassName(classNames.nextCtrl)[0],\n indicatorContainer: element.getElementsByClassName(classNames.indicators)[0],\n slides: [],\n indicators: [],\n left: 0,\n width: 0,\n selected: 0,\n currentSelected: 0,\n timerId: 0,\n intervalTimerId: 0,\n animating: false,\n initialized: false,\n swipe: { },\n oldSlidesToScroll: 0,\n slidesToScrollAuto: false,\n visibleCount: 0,\n intervalTime: 0,\n pauseInterval: false\n };\n slider.slideContainer = slider.frame.getElementsByClassName(classNames.slideContainer)[0];\n slider.slidesToScrollAuto = slider.slidesToScroll == 0;\n\n if (slider.fullWidth) {\n /*\n width: 99.5vw;\n position: relative;\n left: 50%;\n right: 50%;\n margin-left: -50vw;\n margin-right: -50vw;\n */\n slider.element.style.position = \"relative\";\n slider.element.style.left = \"50%\";\n slider.element.style.right = \"50%\";\n }\n\n for (var i = 0; i < slider.slideContainer.children.length; i++)\n addSlide(slider, slider.slideContainer.children[i]);\n\n if (slider.slides.length == 0)\n return;\n\n if (slider.prevCtrl)\n slider.prevCtrl.onclick = function () { previusSlide(slider); return false; }\n\n if (slider.nextCtrl)\n slider.nextCtrl.onclick = function () { nextSlide(slider); return false; }\n\n if (slider.interval) {\n if (slider.pause) {\n element.addEventListener(mouseHover[0], function() { slider.pauseInterval = true; }, false);\n element.addEventListener(mouseHover[1], function() { slider.pauseInterval = false; }, false);\n element.addEventListener('touchstart', function() { slider.pauseInterval = true; }, false);\n element.addEventListener('touchend', function() { slider.pauseInterval = false; }, false);\n }\n slider.intervalTimerId = setInterval(function() { \n if (slider.pauseInterval)\n return;\n slider.intervalTime++;\n if (slider.intervalTime >= slider.interval * 10) {\n //nextSlide(slider); \n //slider.intervalTime = 0;\n slider.selected += slider.slidesToScroll;\n if (slider.selected > slider.slides.length - slider.visibleCount)\n slider.selected = slider.selected - slider.slides.length;\n\n gotoSelectedSlide(slider);\n }\n }, 100);\n }\n\n if (slider.keyboard) {\n window.addEventListener('keydown', function (e) {\n switch (e.which) {\n case 39:\n nextSlide(slider);\n break;\n case 37:\n previusSlide(slider);\n break;\n }\n }, false);\n }\n\n if (slider.swipe) {\n slider.element.addEventListener(\"mousedown\", function (e) { e.preventDefault(); });\n slider.swipe.manager = new Hammer.Manager(slider.slideContainer, {\n 'touchAction': 'pan-y',\n 'inputClass': Hammer.TouchMouseInput\n });\n slider.swipe.event = new Hammer.Swipe();\n slider.swipe.manager.add(slider.swipe.event);\n slider.swipe.manager.on('swipeleft swiperight', function (e) {\n switch (e.type) {\n case \"swipeleft\":\n nextSlide(slider);\n break;\n case \"swiperight\":\n previusSlide(slider);\n break;\n }\n }); \n }\n\n gotoSelectedSlide(slider, true);\n\n sliders.push(slider);\n\n setInterval(function() { checkSize(slider); }, 100);\n };\n\n let init = function () {\n addSlider(element);\n\n\t\tdocument.autoimage.handle();\n };\n\n let update = function (resize) {\n for (var i = 0; i < sliders.length; i++)\n updateSlider(sliders[i], resize);\n };\n\n window.addEventListener(\"resize\", function (e) {\n update(true);\n });\n\n init();\n};"],"sourceRoot":""}