{"version":3,"sources":["webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/gallery/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-mar/components/text-media/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-mar/components/text-media/client/js/config.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/video/client/js/config.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/video/client/js/prototype.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/gallery/client/js/prototype.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/video/client/js/index.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/gallery/client/js/config.js"],"names":["elementExist","config","prototype","module","exports","selector","configuration","instance","Object","create","element","document","querySelector","result","JSON","parse","dataset","init","Image","Gallery","image","seeVideo","media","gallery","type","video","triggers","component","css","imageMod","size","height","width","YTPlayer","VimeoPlayer","PROVIDER_TYPE","this","player","load","id","provider","toLowerCase","createPlayerYoutube","createPlayerVimeo","createPlayer","fromEvent","merge","mergeAll","PhotoSwipe","PhotoSwipeUI","toNode","ImageClient","VideoClient","DATA_TYPE","isVideo","addTriggers","map","item","factory","reduce","acc","val","autoDom","addToDom","data","items","index","html","createVideo","createImage","pswOptions","self","listen","getCurrentIndex","setVideo","setImage","src","img","getImageEl","onload","classList","add","isVertical","setVerticalImage","removeFromDom","parentNode","removeChild","body","appendChild","length","triggerSub","pipe","subscribe","createGallery","imageCfg","captionEl","fullscreenEl","preloaderEl","shareEl","zoomEl"],"mappings":";iFAKA,MAAM,aAAEA,GAAiB,EAAQ,QAC3BC,EAAS,EAAQ,QACjBC,EAAY,EAAQ,QAM1BC,EAAOC,QAAU,SAAiBC,EAAW,2BAA4BC,EAAgB,IACrF,GAAIN,EAAaK,GAAW,CAExB,MAAME,EAAWC,OAAOC,OAAOP,GAqB/B,OAlBAK,EAASG,QAAUC,SAASC,cAAcP,GAG1CE,EAASN,OAAS,CACdI,cACGJ,OACAK,KACA,WACC,M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B,IAAIR,MAAM8D,aAkFjEC,CAAiBZ,EAAKP,KAAKE,QAMvC9B,KAAKb,QAAQiD,OAAO,UAAW,KAC3BD,EAAKa,kBAIThD,KAAKb,QAAQN,QAGjB,gBACImB,KAAK1B,QAAQ2E,WAAWC,YAAYlD,KAAK1B,UAG7C,WACIC,SAAS4E,KAAKC,YAAYpD,KAAK1B,UAGnC,OAEQ0B,KAAKnC,OAAOyB,SAAS+D,OAAS,IAC9BrD,KAAKsD,WAAatD,KAAKmB,YAAYnB,KAAKnC,OAAOyB,UAC1CiE,KAAK5C,KACL6C,UAAU,IAAMxD,KAAKyD,kBAI1BzD,KAAKnC,OAAO6D,SAAS1B,KAAKgD,kBAKtCjF,EAAOC,QAAUF,G,qBC9IjB,MAAM,aAAEF,GAAiB,EAAQ,QAC3BC,EAAS,EAAQ,QACjBC,EAAY,EAAQ,QAM1BC,EAAOC,QAAU,SAAeC,EAAW,yBAA0BC,EAAgB,IACjF,GAAIN,EAAaK,GAAW,CAExB,MAAME,EAAWC,OAAOC,OAAOP,GAoB/B,OAjBAK,EAASG,QAAUC,SAASC,cAAcP,GAG1CE,EAASN,OAAS,IACXA,OACAK,KAEgBQ,KAAKC,MAAMR,EAASG,QAAQM,QAAQf,SAOvDM,EAASN,OAAOgB,MAAMV,EAASU,OAG5BV,K,uBC/Bf,MAGMN,EAAS,CACX0B,UAAW,UACXV,MAAM,EACN6C,SAAS,EACTpC,SAAU,GACVE,IAAK,CACDR,MAAO,IATE,EAAQ,OAUV0E,GAAWlE,MAGtBJ,KAAM,CACFJ,MAAO,gBACPK,MAAO,iBAEX6C,WAAY,CACRJ,MAAO,EACP6B,WAAW,EACXC,cAAc,EACdC,aAAa,EACbC,SAAS,EACTC,QAAQ,IAIhBhG,EAAOC,QAAU,IAAMH","file":"text-media.3e2a9ae5c63136b99cc2.bundle.js","sourcesContent":["/* ==========================================================================\n Gallery > Client\n ========================================================================== */\n\n/* Import modules */\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst config = require('./config');\nconst prototype = require('./prototype');\n\n/**\n * Gallery component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function Gallery(selector = '[data-component=Gallery]', 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 selector,\n ...config(),\n ...configuration,\n ...(function getConfig() {\n const result = JSON.parse(instance.element.dataset.config);\n instance.element.dataset.config = '';\n return result;\n })()\n };\n\n /* Init */\n if (instance.config.init) instance.init();\n\n /* Return */\n return instance;\n }\n};\n","/* ==========================================================================\n TextMedia > Client\n ========================================================================== */\n\n/* Import modules */\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst Image = require('@bluekiri/alexandria-contrib-components/components/image/client/js');\nconst Gallery = require('@bluekiri/alexandria-contrib-components/components/gallery/client/js');\nconst config = require('./config');\n\n/**\n * TextMedia component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function TextMedia(selector = '[data-component=TextMedia]', configuration = {}) {\n if (elementExist(selector)) {\n const instance = {};\n\n instance.element = document.querySelector(selector);\n\n instance.config = { ...configuration };\n\n instance.image = Image(`${selector} [data-component=\"Image\"]`);\n\n instance.seeVideo = instance.element.querySelector(`${selector} [data-trigger]`);\n\n instance.media = instance.element.querySelector(`${selector} [data-trigger-media]`);\n\n instance.gallery = Gallery(`${selector} [data-component=\"Gallery\"][data-type=\"${config().type.video}\"]`, {\n triggers: [instance.media, instance.seeVideo]\n });\n\n return instance;\n }\n};\n","/* ==========================================================================\n TextMedia > Client > Config\n ========================================================================== */\n\n/* Import modules */\n\n/* Config */\nconst config = {\n component: 'TextMedia',\n type: {\n video: 'gallery-video',\n image: 'text-media-image'\n },\n css: {\n gallery: 'text-media__gallery',\n image: 'text-media__image',\n imageMod: 'text-media__image--video'\n }\n};\n\nmodule.exports = () => config;\n","/* ==========================================================================\n Video > Client > Config\n ========================================================================== */\n\n/* Import modules */\n\n/* Config */\nconst config = {\n component: 'Video',\n init: true,\n size: {\n height: 432,\n width: 768\n }\n};\n\nmodule.exports = () => config;\n","/* ==========================================================================\n Video > Client > Prototype\n ========================================================================== */\n\n/* Modules */\nconst YTPlayer = require('yt-player');\nconst VimeoPlayer = require('@vimeo/player/dist/player.min');\n\n/* Providers */\nconst PROVIDER_TYPE = {\n youtube: 'youtube',\n vimeo: 'vimeo'\n};\n\n/* Prototype */\nconst prototype = {\n /* Create player youtube */\n createPlayerYoutube() {\n this.player = new YTPlayer(this.element.querySelector('[data-item]'), {\n height: this.config.size.height,\n width: this.config.size.width\n });\n this.player.load(this.config.id);\n\n return this;\n },\n /* Create player vimeo */\n createPlayerVimeo() {\n this.player = new VimeoPlayer(this.element.querySelector('[data-item]'), {\n id: this.config.id,\n height: this.config.size.height,\n width: this.config.size.width\n });\n\n return this;\n },\n /* Create player */\n createPlayer() {\n /* Exit without provider */\n if (!this.config.provider) return this;\n\n /* Player Youtube */\n if (this.config.provider.toLowerCase() === PROVIDER_TYPE.youtube) return this.createPlayerYoutube();\n\n /* Player Vimeo */\n if (this.config.provider.toLowerCase() === PROVIDER_TYPE.vimeo) return this.createPlayerVimeo();\n\n return this;\n },\n /* Set video */\n setVideo({ provider = '', id = '' } = {}) {\n /* Exit */\n if (!provider && !id) return this;\n\n this.config.provider = provider;\n this.config.id = id;\n\n return this;\n },\n /* Init */\n init() {\n /* Create player */\n if (this.config.id && this.config.provider) this.createPlayer();\n }\n};\n\n/* Exports */\nmodule.exports = prototype;\n","/* ==========================================================================\n Gallery > Client > Protoype\n ========================================================================== */\n\n/* Modules */\nconst { fromEvent, merge } = require('rxjs');\nconst { mergeAll } = require('rxjs/operators');\nconst PhotoSwipe = require('photoswipe');\nconst PhotoSwipeUI = require('photoswipe/dist/photoswipe-ui-default');\nconst { toNode } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst ImageClient = require('../../../image/client/js');\nconst VideoClient = require('../../../video/client/js');\nconst config = require('./config');\n\n/* Providers */\nconst DATA_TYPE = {\n image: 'image',\n video: 'video'\n};\n\n/* Helper type checkers */\nconst isVideo = type => type.toLowerCase() === DATA_TYPE.video;\nconst isImage = type => type.toLowerCase() === DATA_TYPE.image;\n\n/* Helper to set vertical image */\nfunction setVerticalImage(img) {\n const image = new Image();\n image.src = img.getImageEl().dataset.src;\n image.onload = function onLoad() {\n if (image.width < image.height) img.element.classList.add(config().css.image.isVertical);\n };\n}\n\n/* Prototype */\nconst prototype = {\n /* Add triggers */\n addTriggers: function Fn(triggers) {\n return merge(triggers.map(item => fromEvent(item, 'click')));\n },\n /* Create Image */\n createImage(type = '') {\n /* Create Image from factory */\n const image = [...toNode(this.config.factory.image)].reduce((acc, val) => acc + val);\n\n /* Add type */\n image.dataset.type = type;\n\n /* Return image */\n return image;\n },\n /* Create Video */\n createVideo(type = '') {\n /* Create Video from factory */\n const video = [...toNode(this.config.factory.video)].reduce((acc, val) => acc + val);\n\n /* Add type */\n video.dataset.type = type;\n\n /* Return video */\n return video;\n },\n /* Create gallery */\n createGallery() {\n /* Add to dom */\n if (this.config.autoDom) this.addToDom();\n\n /* Data */\n this.data = [];\n\n /* Gallery */\n this.gallery = new PhotoSwipe(\n this.element.querySelector('[data-gallery]'),\n PhotoSwipeUI,\n this.config.items.map((item, index) => ({\n html: isVideo(item.type || '')\n ? this.createVideo(`${this.config.type.video}-${index}`)\n : this.createImage(`${this.config.type.image}-${index}`)\n })),\n this.config.pswOptions\n );\n\n /* Self */\n const self = this;\n\n /* Adding dynamic image components */\n this.gallery.listen('afterChange', () => {\n /* Getting the index to init the image */\n const index = self.gallery.getCurrentIndex();\n\n /* Adding not already inited images */\n if (!self.data[index]) {\n /* Video */\n if (isVideo(self.config.items[index].type)) {\n self.data[index] = VideoClient(\n `[data-component=\"Video\"][data-type=\"${self.config.type.video}-${index}\"]`\n );\n\n /* Add video and create player */\n self.data[index].setVideo(self.config.items[index].config).createPlayer();\n }\n\n /* Image */\n if (isImage(self.config.items[index].type)) {\n self.data[index] = ImageClient(\n `[data-component=\"Image\"][data-type=\"${self.config.type.image}-${index}\"]`\n );\n\n /* Set the image */\n self.data[index].setImage(self.config.items[index].src);\n\n /* Vertical image addition modifier */\n setVerticalImage(self.data[index]);\n }\n }\n });\n\n /* Clean up from dom on full close */\n this.gallery.listen('destroy', () => {\n self.removeFromDom();\n });\n\n /* Init to show gallery */\n this.gallery.init();\n },\n /* Remove from dom */\n removeFromDom() {\n this.element.parentNode.removeChild(this.element);\n },\n /* Add to dom */\n addToDom() {\n document.body.appendChild(this.element);\n },\n /* Init */\n init() {\n /* Add triggers */\n if (this.config.triggers.length > 0) {\n this.triggerSub = this.addTriggers(this.config.triggers)\n .pipe(mergeAll())\n .subscribe(() => this.createGallery());\n }\n\n /* Autodom setup */\n if (this.config.autoDom) this.removeFromDom();\n }\n};\n\n/* Exports */\nmodule.exports = prototype;\n","/* ==========================================================================\n Video > Client\n ========================================================================== */\n\n/* Import modules */\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst config = require('./config');\nconst prototype = require('./prototype');\n\n/**\n * Video component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function Video(selector = '[data-component=Video]', 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 const result = JSON.parse(instance.element.dataset.config);\n // instance.element.dataset.config = '';\n return result;\n })()\n };\n\n /* Init */\n if (instance.config.init) instance.init();\n\n /* Return */\n return instance;\n }\n};\n","/* ==========================================================================\n Gallery > Client > Config\n ========================================================================== */\n\n/* Import modules */\nconst imageCfg = require('../../../image/client/js/config');\n\n/* Config */\nconst config = {\n component: 'Gallery',\n init: true,\n autoDom: true,\n triggers: [],\n css: {\n image: {\n ...imageCfg().css\n }\n },\n type: {\n image: 'gallery-image',\n video: 'gallery-video'\n },\n pswOptions: {\n index: 0,\n captionEl: false,\n fullscreenEl: false,\n preloaderEl: false,\n shareEl: false,\n zoomEl: false\n }\n};\n\nmodule.exports = () => config;\n"],"sourceRoot":""}