{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-cru/components/gallery-video-carousel/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/gallery-video-carousel/client/js/store/actions.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/gallery-video-carousel/client/js/config.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/gallery-video-carousel/client/js/gallery/index.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/gallery-video-carousel/client/js/store/reducer.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/gallery-video-carousel/client/js/prototype.js"],"names":["elementExist","require","Image","Carousel","config","prototype","module","exports","selector","arguments","length","undefined","configuration","instance","Object","create","element","document","querySelector","_objectSpread","dataset","result","JSON","parse","image","_toConsumableArray","querySelectorAll","concat","map","item","index","type","carousel","swiper","hooks","gallery","init","DESTROY","types","DISPLAY_GALLERY","HIDE_GALLERY","SELECTED_THUMB","actions","destroy","displayGallery","hideGallery","selectedThumb","thumb","payload","component","widths","hasBreakpoints","hasNavigation","hasPagination","slidesPerView","slidesPerGroup","spaceBetween","breakpoints","html","toNode","sanitizeObject","GalActions","GalleryTemplate","Gallery","addGallery","panel","node","_instance$config","items","context","template","createGallery","body","appendChild","photoswipe","store","select","reactions","subscribe","state","action","initialState","reducer","Store","fromEvent","_require3","setupStore","this","galleryVideoCarousel","setupActions","_this","dispatch","setupReactions","_this2","unsubscribe","parentNode","removeChild","keys","forEach","key","_this3","subscriptions","clickImage","wrapperEl","clickedIndex","_this4"],"mappings":";qwBAKA,IAAQA,EAAiBC,EAAQ,QAAzBD,aACFE,EAAQD,EAAQ,QAChBE,EAAWF,EAAQ,QACnBG,EAASH,EAAQ,QACjBI,EAAYJ,EAAQ,QAM1BK,EAAOC,QAAU,WAAsG,IAAxEC,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,wCAAyCG,EAAaH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAA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MG,WAAU,SAACC,EAAOC,GACrCA,EAAOjD,OAASO,EAAMC,iBAG1ByB,EAAW6B,QAnBQN,MA0B/BT,UAAS,WAAG,IAAAsB,EAAA,KAgBR,OAfIb,KAAKc,eAAed,KAAKO,cAE7BP,KAAKc,cAAgB,GAEjBd,KAAKnF,OAAOgE,QACZmB,KAAKc,cAAalF,IAAA,GACXoE,KAAKc,eAAa,IACrBC,WAAYlB,EAAUG,KAAKvD,SAASC,OAAOsE,UAAW,SAASzB,WAAU,WACrEsB,EAAK1D,QAAQI,cAAcsD,EAAKpE,SAASC,OAAOuE,cAEhDJ,EAAK1D,QAAQE,uBAKlB2C,MAGXO,YAAW,WAAG,IAAAW,EAAA,KACV,OAAKlB,KAAKc,eAEV5E,EAAIX,OAAOmF,KAAKV,KAAKc,gBAAgBH,SAAQ,SAAAC,GAAG,OAAIM,EAAKJ,cAAcF,GAAKL,iBAErEP,MAJyBA,MAOpCnD,KAAI,WAEAmD,KAAKD,aAGLC,KAAKE,eAGLF,KAAKK,iBAGLL,KAAKT,cAKbxE,EAAOC,QAAUF","file":"gallery-video-carousel.c2a07b61b8e5b36ade7e.bundle.js","sourcesContent":["/* ==========================================================================\n GalleryVideoCarousel > Client\n ========================================================================== */\n\n/* Import modules */\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst Image = require('@bluekiri/alexandria-contrib-components/components/image-rxjs/client/js');\nconst Carousel = require('@bluekiri/alexandria-contrib-components/components/carousel-rxjs/client/js');\nconst config = require('./config');\nconst prototype = require('./prototype');\n\n/**\n * GalleryVideoCarousel component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function GalleryVideoCarousel(selector = '[data-component=GalleryVideoCarousel]', configuration = {}) {\n if (elementExist(selector)) {\n // Instance\n const instance = Object.create(prototype);\n\n // Element\n instance.element = document.querySelector(selector);\n\n // Config\n instance.config = {\n ...config(),\n ...configuration,\n ...(function getConfig() {\n if (!instance.element.dataset.config) return '';\n\n const result = JSON.parse(instance.element.dataset.config);\n instance.element.dataset.config = '';\n return result;\n })()\n };\n\n // Image\n instance.image = [\n ...instance.element.querySelectorAll(`${selector} [data-component='ImageRxjs']`)\n ].map((item, index) =>\n Image(\n `${selector} [data-component='ImageRxjs'][data-type=${instance.config.type.image}-${index}]`,\n instance.config.image\n )\n );\n\n // Carousel\n instance.carousel = Carousel(`${selector} [data-component='CarouselRxjs']`, {\n ...instance.config.carousel,\n swiper: instance.config.carousel.swiper\n });\n\n /* Hooks */\n instance.hooks = {\n gallery: instance.element.querySelector(`${selector} [data-trigger-gallery]`)\n };\n\n /* Init */\n if (instance.config.init) instance.init();\n\n // Return\n return instance;\n }\n};\n","/* ==========================================================================\n GalleryVideoCarousel > Client > Store > Actions\n ========================================================================== */\n\n/* Types */\nconst DESTROY = 'GALLERY_VIDEO_CAROUSEL::DESTROY';\n\nconst DISPLAY_GALLERY = 'GALLERY_VIDEO_CAROUSEL::DISPLAY_GALLERY';\nconst HIDE_GALLERY = 'GALLERY_VIDEO_CAROUSEL::HIDE_GALLERY';\nconst SELECTED_THUMB = 'GALLERY_VIDEO_CAROUSEL::SELECTED_THUMB';\n\n/* Actions */\nconst destroy = () => ({ type: DESTROY });\nconst displayGallery = () => ({ type: DISPLAY_GALLERY });\nconst hideGallery = () => ({ type: HIDE_GALLERY });\nconst selectedThumb = thumb => ({ type: SELECTED_THUMB, payload: thumb });\n\n/* Exports */\nmodule.exports = {\n types: {\n DESTROY,\n DISPLAY_GALLERY,\n HIDE_GALLERY,\n SELECTED_THUMB\n },\n actions: {\n destroy,\n displayGallery,\n hideGallery,\n selectedThumb\n }\n};\n","/* ==========================================================================\n GalleryVideoCarousel > Client > Config\n ========================================================================== */\n\n/* Import modules */\n\n/* Config */\nconst config = {\n component: 'GalleryVideoCarousel',\n init: true,\n type: {\n image: 'carousel-image'\n },\n widths: [475, 325, 600, 520, 400],\n carousel: {\n hasBreakpoints: false,\n hasNavigation: true,\n hasPagination: false,\n swiper: {\n init: true,\n // Default parameters\n slidesPerView: 'auto',\n slidesPerGroup: 1,\n spaceBetween: 0,\n breakpoints: {}\n }\n }\n};\n\nmodule.exports = () => config;\n","/* ==========================================================================\n GalleryVideoCarousel > Client > Gallery\n ========================================================================== */\n\n/* Modules */\nconst { html } = require('common-tags');\nconst { toNode } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst { sanitizeObject } = require('@bluekiri/alexandria/helpers/sanitize');\n\nconst GalActions = require('@bluekiri/alexandria-contrib-components/components/gallery-rxjs/client/js/store/actions');\nconst GalleryTemplate = require('@bluekiri/alexandria-contrib-components/components/gallery-rxjs/template');\nconst Gallery = require('@bluekiri/alexandria-contrib-components/components/gallery-rxjs/client/js');\n\n/* Create gallery */\nfunction createGallery(instance) {\n /* Data */\n const { items, context } = instance.config;\n\n /* Template */\n const template = html(GalleryTemplate(sanitizeObject({ items }), context));\n\n /* Node */\n const node = toNode(template)[0];\n\n /* Return */\n return node;\n}\n\n/* Add gallery */\nfunction addGallery(instance) {\n const panel = instance;\n\n /* Node */\n const node = createGallery(instance);\n\n /* Add to DOM */\n document.body.appendChild(node);\n\n /* Update reference */\n panel.gallery = Gallery('[data-component=\"GalleryRxjs\"]', {\n photoswipe: {\n index: panel.store.select('galleryVideoCarousel').selectedThumb\n }\n });\n\n /* Update */\n panel.reactions = {\n ...panel.reactions,\n hideGallery: panel.gallery.store.subscribe((state, action) => {\n if (action.type !== GalActions.types.DESTROY) return;\n delete panel.gallery;\n instance.actions.hideGallery();\n })\n };\n}\n\n/* Exports */\nmodule.exports = {\n addGallery\n};\n","/* ==========================================================================\n GalleryVideoCarousel > Client > Store > Reducer\n ========================================================================== */\n\n/* Modules */\nconst { types } = require('./actions');\n\n/* Initial state */\nconst initialState = {\n gallery: false,\n selectedThumb: -1\n};\n\n/* Reducer */\nfunction reducer(state = initialState, action) {\n switch (action.type) {\n case types.DESTROY:\n return null;\n case types.DISPLAY_GALLERY:\n return {\n ...state,\n gallery: true\n };\n case types.HIDE_GALLERY:\n return {\n ...state,\n gallery: false\n };\n case types.SELECTED_THUMB:\n return {\n ...state,\n selectedThumb: action.payload\n };\n default:\n return state;\n }\n}\n\n/* Exports */\nmodule.exports = {\n reducer\n};\n","/* ==========================================================================\n GalleryVideoCarousel > Client > Prototype\n ========================================================================= */\n\n/* Modules */\nconst { Store } = require('@bluekiri/alexandria/helpers/state');\n\nconst { fromEvent } = require('rxjs');\n\nconst { actions, types } = require('./store/actions');\nconst { reducer } = require('./store/reducer');\n\nconst { addGallery } = require('./gallery');\n\nconst prototype = {\n /* Setup store */\n setupStore() {\n if (this.store) return this;\n\n this.store = new Store({\n galleryVideoCarousel: reducer\n });\n\n return this;\n },\n /* Setup actions */\n setupActions() {\n if (this.actions) return this;\n\n this.actions = {\n destroy: () => {\n return this.store.dispatch(actions.destroy());\n },\n displayGallery: () => {\n return this.store.dispatch(actions.displayGallery());\n },\n hideGallery: () => {\n return this.store.dispatch(actions.hideGallery());\n },\n selectedThumb: payload => {\n return this.store.dispatch(actions.selectedThumb(payload));\n }\n };\n\n return this;\n },\n /* Setup reactions */\n setupReactions() {\n if (this.reactions) return this;\n\n this.reactions = {\n destroy: this.store.subscribe((state, action) => {\n if (action.type !== types.DESTROY) return;\n\n /* Unsubscribe */\n this.unsubscribe();\n\n /* Remove from DOM */\n this.element.parentNode.removeChild(this.element);\n\n /* Clean instance */\n [...Object.keys(this)].forEach(key => delete this[key]);\n }),\n displayGallery: this.store.subscribe((state, action) => {\n if (action.type !== types.DISPLAY_GALLERY) return;\n\n /* Add gallery */\n addGallery(this);\n })\n };\n\n return this;\n },\n /* Subscribe */\n subscribe() {\n if (this.subscriptions) this.unsubscribe();\n\n this.subscriptions = {};\n\n if (this.config.items) {\n this.subscriptions = {\n ...this.subscriptions,\n clickImage: fromEvent(this.carousel.swiper.wrapperEl, 'click').subscribe(() => {\n this.actions.selectedThumb(this.carousel.swiper.clickedIndex);\n\n this.actions.displayGallery();\n })\n };\n }\n\n return this;\n },\n /* Unsubscribe */\n unsubscribe() {\n if (!this.subscriptions) return this;\n\n [...Object.keys(this.subscriptions)].forEach(key => this.subscriptions[key].unsubscribe());\n\n return this;\n },\n /* Init */\n init() {\n /* Setup store */\n this.setupStore();\n\n /* Setup actions */\n this.setupActions();\n\n /* Setup reactions */\n this.setupReactions();\n\n /* Subscribe */\n this.subscribe();\n }\n};\n\n// Exports\nmodule.exports = prototype;\n"],"sourceRoot":""}