{"version":3,"sources":["webpack:///../node_modules/react-swipeable/es/index.js","webpack:///./Scripts/Components/ImageSlider.js"],"names":["defaultProps","delta","preventScrollOnSwipe","rotationAngle","trackMouse","trackTouch","swipeDuration","Infinity","touchEventOptions","passive","initialState","first","initial","start","swiping","xy","mouseMove","mouseUp","rotateXYByAngle","pos","angle","angleInRadians","Math","PI","cos","sin","getHandlers","set","handlerProps","onStart","event","isTouch","touches","length","state","props","document","addEventListener","onMove","onUp","clientX","clientY","onTouchStartOrOnMouseDown","Object","assign","slice","timeStamp","x","y","deltaX","deltaY","absX","abs","absY","time","velocity","sqrt","vxvy","dir","getDirection","toLowerCase","eventData","onSwipeStart","onSwiping","cancelablePageSwipe","onSwiped","cancelable","preventDefault","onEnd","onSwipedDir","onTap","onTouchEndOrOnMouseUp","e","removeEventListener","attachTouch","el","cleanup","baseOptions","tls","forEach","h","o","output","ref","addState","cleanUpTouch","onMouseDown","useSwipeable","options","transientState","transientProps","previousProps","current","defaultKey","handlers","stateSetter","undefined","updateTransientState","CategorySliderItem","images","tags","isFullScreen","setIsFullScreen","useState","currentImageIndex","setCurrentImageIndex","useEffect","image","Image","src","url","setChatDisplayValue","value","chatElement","getElementById","style","display","closeFullScreen","body","classList","remove","goToNextImage","prevIndex","goToPreviousImage","onSwipedLeft","onSwipedRight","Counter","imagesLength","className","Fragment","map","index","key","onClick","add","onOpen","dangerouslySetInnerHTML","__html","alt","href","ProductTags","slideCount","showMore","SliderContainer","isImageSlider","sliderItem"],"mappings":"sJAEA,MAMMA,EAAe,CACjBC,MAAO,GACPC,sBAAsB,EACtBC,cAAe,EACfC,YAAY,EACZC,YAAY,EACZC,cAAeC,IACfC,kBAAmB,CAAEC,SAAS,IAE5BC,EAAe,CACjBC,OAAO,EACPC,QAAS,CAAC,EAAG,GACbC,MAAO,EACPC,SAAS,EACTC,GAAI,CAAC,EAAG,IAENC,EAAY,YACZC,EAAU,UAgBhB,SAASC,EAAgBC,EAAKC,GAC1B,GAAc,IAAVA,E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C7C,2BACE,uBAAKkB,KAAK,kDAGd,wBAAMX,UAAU,qBAAqBK,QAASV,GAC5C,2BACE,uBAAKgB,KAAK,iDAGd,wBAAMX,UAAU,oBACdK,QAAShB,GAET,2BACE,uBAAKsB,KAAK,kDAIhB,uBAAKX,UAAU,4BACb,gBAACF,EAAD,CAASC,aAAc5B,EAAOlE,SAC9B,uBAAK+F,UAAU,oBACb,wBAAMA,UAAU,aAAaK,QAASV,GACpC,2BACE,uBAAKgB,KAAK,iDAGd,wBAAMX,UAAU,cAAcK,QAASZ,GACrC,2BACE,uBAAKkB,KAAK,mDAIhB,wBAAMX,UAAU,YACdK,QAAShB,GAET,2BACE,uBAAKsB,KAAK,mDAOpB,gBAACC,EAAA,EAAD,CAAaxC,KAAMA,MAKzB,EArIoB,EAAGD,SAAQC,OAAMyC,aAAa,MAChD,MAAMC,EAAW3C,GAAUA,EAAOlE,OAAS4G,EAE3C,OACE,gBAACE,EAAA,EAAD,CACED,SAAUA,EACVD,WAAYA,EACZG,eAAe,EACfC,WACE,gBAAC/C,EAAD,CAAoBC,OAAQA,EAAQC,KAAMA","file":"698.7f62aa32b940aac2f4c3.js","sourcesContent":["import * as React from 'react';\n\nconst LEFT = \"Left\";\nconst RIGHT = \"Right\";\nconst UP = \"Up\";\nconst DOWN = \"Down\";\n\n/* global document */\nconst defaultProps = {\n delta: 10,\n preventScrollOnSwipe: false,\n rotationAngle: 0,\n trackMouse: false,\n trackTouch: true,\n swipeDuration: Infinity,\n touchEventOptions: { passive: true },\n};\nconst initialState = {\n first: true,\n initial: [0, 0],\n start: 0,\n swiping: false,\n xy: [0, 0],\n};\nconst mouseMove = \"mousemove\";\nconst mouseUp = \"mouseup\";\nconst touchEnd = \"touchend\";\nconst touchMove = \"touchmove\";\nconst touchStart = \"touchstart\";\nfunction getDirection(absX, absY, deltaX, deltaY) {\n if (absX > absY) {\n if (deltaX > 0) {\n return RIGHT;\n }\n return LEFT;\n }\n else if (deltaY > 0) {\n return DOWN;\n }\n return UP;\n}\nfunction rotateXYByAngle(pos, angle) {\n if (angle === 0)\n return pos;\n const angleInRadians = (Math.PI / 180) * angle;\n const x = pos[0] * Math.cos(angleInRadians) + pos[1] * Math.sin(angleInRadians);\n const y = pos[1] * Math.cos(angleInRadians) - pos[0] * Math.sin(angleInRadians);\n return [x, y];\n}\nfunction getHandlers(set, handlerProps) {\n const onStart = (event) => {\n const isTouch = \"touches\" in event;\n // if more than a single touch don't track, for now...\n if (isTouch && event.touches.length > 1)\n return;\n set((state, props) => {\n // setup mouse listeners on document to track swipe since swipe can leave container\n if (props.trackMouse && !isTouch) {\n document.addEventListener(mouseMove, onMove);\n document.addEventListener(mouseUp, onUp);\n }\n const { clientX, clientY } = isTouch ? event.touches[0] : event;\n const xy = rotateXYByAngle([clientX, clientY], props.rotationAngle);\n props.onTouchStartOrOnMouseDown &&\n props.onTouchStartOrOnMouseDown({ event });\n return Object.assign(Object.assign(Object.assign({}, state), initialState), { initial: xy.slice(), xy, start: event.timeStamp || 0 });\n });\n };\n const onMove = (event) => {\n set((state, props) => {\n const isTouch = \"touches\" in event;\n // Discount a swipe if additional touches are present after\n // a swipe has started.\n if (isTouch && event.touches.length > 1) {\n return state;\n }\n // if swipe has exceeded duration stop tracking\n if (event.timeStamp - state.start > props.swipeDuration) {\n return state.swiping ? Object.assign(Object.assign({}, state), { swiping: false }) : state;\n }\n const { clientX, clientY } = isTouch ? event.touches[0] : event;\n const [x, y] = rotateXYByAngle([clientX, clientY], props.rotationAngle);\n const deltaX = x - state.xy[0];\n const deltaY = y - state.xy[1];\n const absX = Math.abs(deltaX);\n const absY = Math.abs(deltaY);\n const time = (event.timeStamp || 0) - state.start;\n const velocity = Math.sqrt(absX * absX + absY * absY) / (time || 1);\n const vxvy = [deltaX / (time || 1), deltaY / (time || 1)];\n const dir = getDirection(absX, absY, deltaX, deltaY);\n // if swipe is under delta and we have not started to track a swipe: skip update\n const delta = typeof props.delta === \"number\"\n ? props.delta\n : props.delta[dir.toLowerCase()] ||\n defaultProps.delta;\n if (absX < delta && absY < delta && !state.swiping)\n return state;\n const eventData = {\n absX,\n absY,\n deltaX,\n deltaY,\n dir,\n event,\n first: state.first,\n initial: state.initial,\n velocity,\n vxvy,\n };\n // call onSwipeStart if present and is first swipe event\n eventData.first && props.onSwipeStart && props.onSwipeStart(eventData);\n // call onSwiping if present\n props.onSwiping && props.onSwiping(eventData);\n // track if a swipe is cancelable (handler for swiping or swiped(dir) exists)\n // so we can call preventDefault if needed\n let cancelablePageSwipe = false;\n if (props.onSwiping ||\n props.onSwiped ||\n props[`onSwiped${dir}`]) {\n cancelablePageSwipe = true;\n }\n if (cancelablePageSwipe &&\n props.preventScrollOnSwipe &&\n props.trackTouch &&\n event.cancelable) {\n event.preventDefault();\n }\n return Object.assign(Object.assign({}, state), { \n // first is now always false\n first: false, eventData, swiping: true });\n });\n };\n const onEnd = (event) => {\n set((state, props) => {\n let eventData;\n if (state.swiping && state.eventData) {\n // if swipe is less than duration fire swiped callbacks\n if (event.timeStamp - state.start < props.swipeDuration) {\n eventData = Object.assign(Object.assign({}, state.eventData), { event });\n props.onSwiped && props.onSwiped(eventData);\n const onSwipedDir = props[`onSwiped${eventData.dir}`];\n onSwipedDir && onSwipedDir(eventData);\n }\n }\n else {\n props.onTap && props.onTap({ event });\n }\n props.onTouchEndOrOnMouseUp && props.onTouchEndOrOnMouseUp({ event });\n return Object.assign(Object.assign(Object.assign({}, state), initialState), { eventData });\n });\n };\n const cleanUpMouse = () => {\n // safe to just call removeEventListener\n document.removeEventListener(mouseMove, onMove);\n document.removeEventListener(mouseUp, onUp);\n };\n const onUp = (e) => {\n cleanUpMouse();\n onEnd(e);\n };\n /**\n * The value of passive on touchMove depends on `preventScrollOnSwipe`:\n * - true => { passive: false }\n * - false => { passive: true } // Default\n *\n * NOTE: When preventScrollOnSwipe is true, we attempt to call preventDefault to prevent scroll.\n *\n * props.touchEventOptions can also be set for all touch event listeners,\n * but for `touchmove` specifically when `preventScrollOnSwipe` it will\n * supersede and force passive to false.\n *\n */\n const attachTouch = (el, props) => {\n let cleanup = () => { };\n if (el && el.addEventListener) {\n const baseOptions = Object.assign(Object.assign({}, defaultProps.touchEventOptions), props.touchEventOptions);\n // attach touch event listeners and handlers\n const tls = [\n [touchStart, onStart, baseOptions],\n // preventScrollOnSwipe option supersedes touchEventOptions.passive\n [\n touchMove,\n onMove,\n Object.assign(Object.assign({}, baseOptions), (props.preventScrollOnSwipe ? { passive: false } : {})),\n ],\n [touchEnd, onEnd, baseOptions],\n ];\n tls.forEach(([e, h, o]) => el.addEventListener(e, h, o));\n // return properly scoped cleanup method for removing listeners, options not required\n cleanup = () => tls.forEach(([e, h]) => el.removeEventListener(e, h));\n }\n return cleanup;\n };\n const onRef = (el) => {\n // \"inline\" ref functions are called twice on render, once with null then again with DOM element\n // ignore null here\n if (el === null)\n return;\n set((state, props) => {\n // if the same DOM el as previous just return state\n if (state.el === el)\n return state;\n const addState = {};\n // if new DOM el clean up old DOM and reset cleanUpTouch\n if (state.el && state.el !== el && state.cleanUpTouch) {\n state.cleanUpTouch();\n addState.cleanUpTouch = void 0;\n }\n // only attach if we want to track touch\n if (props.trackTouch && el) {\n addState.cleanUpTouch = attachTouch(el, props);\n }\n // store event attached DOM el for comparison, clean up, and re-attachment\n return Object.assign(Object.assign(Object.assign({}, state), { el }), addState);\n });\n };\n // set ref callback to attach touch event listeners\n const output = {\n ref: onRef,\n };\n // if track mouse attach mouse down listener\n if (handlerProps.trackMouse) {\n output.onMouseDown = onStart;\n }\n return [output, attachTouch];\n}\nfunction updateTransientState(state, props, previousProps, attachTouch) {\n // if trackTouch is off or there is no el, then remove handlers if necessary and exit\n if (!props.trackTouch || !state.el) {\n if (state.cleanUpTouch) {\n state.cleanUpTouch();\n }\n return Object.assign(Object.assign({}, state), { cleanUpTouch: undefined });\n }\n // trackTouch is on, so if there are no handlers attached, attach them and exit\n if (!state.cleanUpTouch) {\n return Object.assign(Object.assign({}, state), { cleanUpTouch: attachTouch(state.el, props) });\n }\n // trackTouch is on and handlers are already attached, so if preventScrollOnSwipe changes value,\n // remove and reattach handlers (this is required to update the passive option when attaching\n // the handlers)\n if (props.preventScrollOnSwipe !== previousProps.preventScrollOnSwipe ||\n props.touchEventOptions.passive !== previousProps.touchEventOptions.passive) {\n state.cleanUpTouch();\n return Object.assign(Object.assign({}, state), { cleanUpTouch: attachTouch(state.el, props) });\n }\n return state;\n}\nfunction useSwipeable(options) {\n const { trackMouse } = options;\n const transientState = React.useRef(Object.assign({}, initialState));\n const transientProps = React.useRef(Object.assign({}, defaultProps));\n // track previous rendered props\n const previousProps = React.useRef(Object.assign({}, transientProps.current));\n previousProps.current = Object.assign({}, transientProps.current);\n // update current render props & defaults\n transientProps.current = Object.assign(Object.assign({}, defaultProps), options);\n // Force defaults for config properties\n let defaultKey;\n for (defaultKey in defaultProps) {\n if (transientProps.current[defaultKey] === void 0) {\n transientProps.current[defaultKey] = defaultProps[defaultKey];\n }\n }\n const [handlers, attachTouch] = React.useMemo(() => getHandlers((stateSetter) => (transientState.current = stateSetter(transientState.current, transientProps.current)), { trackMouse }), [trackMouse]);\n transientState.current = updateTransientState(transientState.current, transientProps.current, previousProps.current, attachTouch);\n return handlers;\n}\n\nexport { DOWN, LEFT, RIGHT, UP, useSwipeable };\n//# sourceMappingURL=index.js.map\n","import React, { Fragment, useState, useEffect } from 'react';\r\nimport ProductTags from './Product/ProductTags.js';\r\nimport SliderContainer from './SliderContainer';\r\nimport { useSwipeable } from 'react-swipeable';\r\nimport 'react-responsive-carousel/lib/styles/carousel.min.css';\r\n\r\nconst ImageSlider = ({ images, tags, slideCount = 1 }) => {\r\n const showMore = images && images.length > slideCount;\r\n\r\n return (\r\n <SliderContainer\r\n showMore={showMore}\r\n slideCount={slideCount}\r\n isImageSlider={true}\r\n sliderItem={\r\n <CategorySliderItem images={images} tags={tags} />\r\n }\r\n />\r\n );\r\n};\r\n\r\nconst CategorySliderItem = ({ images, tags }) => {\r\n\r\n const [isFullScreen, setIsFullScreen] = useState(false);\r\n const [currentImageIndex, setCurrentImageIndex] = useState(0);\r\n\r\n \r\n // Preload images so when entering fullscreen they show directly\r\n // Please change if you know a better solution\r\n useEffect(() => {\r\n images.forEach(image => {\r\n const img = new Image();\r\n img.src = image.url;\r\n });\r\n }, [images]);\r\n\r\n const setChatDisplayValue = (value) => {\r\n let chatElement = document.getElementById('itx-chat-frame')\r\n\r\n if (!chatElement) return;\r\n\r\n chatElement.style.display = value;\r\n }\r\n\r\n const onOpen = (currentImageIndex) => {\r\n document.body.classList.add('disable-scroll');\r\n setCurrentImageIndex(currentImageIndex);\r\n setChatDisplayValue('none')\r\n setIsFullScreen(true);\r\n };\r\n\r\n const closeFullScreen = () => {\r\n document.body.classList.remove('disable-scroll');\r\n setIsFullScreen(false);\r\n setChatDisplayValue('unset')\r\n };\r\n\r\n const goToNextImage = () => {\r\n setCurrentImageIndex((prevIndex) => (prevIndex + 1) % images.length);\r\n };\r\n\r\n const goToPreviousImage = () => {\r\n setCurrentImageIndex((prevIndex) => (prevIndex - 1 + images.length) % images.length);\r\n };\r\n\r\n const handlers = useSwipeable({\r\n onSwipedLeft: () => goToNextImage(),\r\n onSwipedRight: () => goToPreviousImage(),\r\n trackMouse: false\r\n });\r\n\r\n const Counter = ({ imagesLength }) => (\r\n <span className=\"counter\">{`${currentImageIndex + 1} av ${imagesLength}`}</span>\r\n )\r\n\r\n return (\r\n <Fragment>\r\n {images.map((image, index) => (\r\n <div key={`figure${index}`} onClick={() => onOpen(index)}>\r\n <div className='image-container'\r\n dangerouslySetInnerHTML={{ __html: image.image }}\r\n ></div>\r\n </div>\r\n ))}\r\n\r\n {isFullScreen && (\r\n <div {...handlers} className=\"fullscreen-view\">\r\n\r\n <div className=\"img-container\">\r\n <img src={images[currentImageIndex].url} alt={`Full screen product ${currentImageIndex + 1}`} />\r\n <Counter imagesLength={images.length} />\r\n <span className=\"desktop arrow right\" onClick={goToNextImage}>\r\n <svg>\r\n <use href=\"/ui/images/sprites/a-mobler.svg#right-arrow\"></use>\r\n </svg>\r\n </span>\r\n <span className=\"desktop arrow left\" onClick={goToPreviousImage}>\r\n <svg>\r\n <use href=\"/ui/images/sprites/a-mobler.svg#left-arrow\"></use>\r\n </svg>\r\n </span>\r\n <span className=\"desktop close-btn\"\r\n onClick={closeFullScreen}\r\n >\r\n <svg>\r\n <use href=\"/ui/images/sprites/a-mobler.svg#close-bold\"></use>\r\n </svg>\r\n </span>\r\n </div>\r\n <div className=\"mobile fullscreen-footer\">\r\n <Counter imagesLength={images.length} />\r\n <div className=\"arrows-container\">\r\n <span className=\"arrow left\" onClick={goToPreviousImage}>\r\n <svg>\r\n <use href=\"/ui/images/sprites/a-mobler.svg#left-arrow\"></use>\r\n </svg>\r\n </span>\r\n <span className=\"arrow right\" onClick={goToNextImage}>\r\n <svg>\r\n <use href=\"/ui/images/sprites/a-mobler.svg#right-arrow\"></use>\r\n </svg>\r\n </span>\r\n </div>\r\n <span className=\"close-btn\"\r\n onClick={closeFullScreen}\r\n >\r\n <svg>\r\n <use href=\"/ui/images/sprites/a-mobler.svg#close-bold\"></use>\r\n </svg>\r\n </span>\r\n </div>\r\n </div>\r\n )}\r\n\r\n <ProductTags tags={tags} />\r\n </Fragment>\r\n );\r\n};\r\n\r\nexport default ImageSlider;\r\n"],"sourceRoot":""}