{"version":3,"sources":["webpack:///./node_modules/@bluekiri/alexandria/helpers/domHelpers.js","webpack:///./components/layout-cars-home/client/js/index.js","webpack:///./template/js/index.js","webpack:///./template/js/components.js"],"names":["module","exports","elementExist","element","document","querySelector","toNode","html","DOMParser","parseFromString","body","childNodes","MainCarHome","require","LayoutTemplate","_require2","resolveComponents","getTopButton","getHeader","mainFunction","selector","arguments","length","undefined","config","_objectSpread","dataset","result","JSON","parse","__webpack_public_path__","publicPath","console","log","components","map","component","loader","concat","name","filter","then","mainComponent","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","unobserve","root","rootMargin","threshold","observe","COMPONENTS"],"mappings":";+HAQAA,EAAOC,QAAU,CACbC,aALiBC,KAAaC,SAASC,cAAcF,GAMrDG,OAJWC,IAAQ,IAAIC,WAAYC,gBAAgBF,EAAM,aAAaG,KAAKC,a,qBCN/E,IAAMC,EAAc,WAAH,OACb,sCAKmBC,EAAQ,OAGpBC,CAAeF,EAAa,sC,iwCCJvCC,EAAQ,QAER,IAAQX,EAAiBW,EAAQ,QAAzBX,aAERa,EAAuDF,EAAQ,QAAvDG,EAAiBD,EAAjBC,kBAAmBC,EAAYF,EAAZE,aAAcC,EAASH,EAATG,UAEzClB,EAAOC,QAAU,SAAwBkB,GAA8D,IAAhDC,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,oCAC9D,GAAInB,EAAakB,GAAW,CACxB,IAAMjB,EAAUC,SAASC,cAAce,GAEjCI,EAAMC,EAAA,GACJ,WACA,IAAKtB,EAAQuB,QAAQF,OAAQ,MAAO,GAEpC,IAAMG,EAASC,KAAKC,MAAM1B,EAAQuB,QAAQF,QAE1C,OADArB,EAAQuB,QAAQF,OAAS,GAClBG,EALP,IAaRG,IAA0BN,EAAOO,WAEjCC,QAAQC,IAAIT,GAEZ,IAAMU,EAAalB,IACdmB,KAAI,SAAAC,GAAS,MAAK,CACfC,OAAQD,EAAUC,OAClBlC,QAASC,SAASC,cAAc,oBAADiC,OAAqBF,EAAUG,KAAI,WAErEC,QAAO,SAAAJ,GAAS,OAAIA,EAAUjC,WAKnCgB,IAAesB,MAAK,SAAAzC,GAAM,OAAIA,EAAM,QAAS,oBAADsC,OAAqBd,EAAOkB,cAAa,UAMrF,IAAMC,EAAW,IAAIC,sBACjB,SAAAC,GACIA,EAAQC,SAAQ,SAAAC,GACRA,EAAMC,kBAAoB,IAW1BX,EAVmBH,EACdM,QAAO,SAAAJ,GAAS,OAAIA,EAAUjC,UAAY4C,EAAME,UAChDC,QAAO,SAAAC,GAAG,OAAIA,KAFXd,UAUCI,MAAK,SAAAzC,GACVA,EAAM,UAEN2C,EAASS,UAAUL,EAAME,gBAKzC,CACII,KAAM,KACNC,WAAY,MACZC,UAAW,MAInBrB,EAAWY,SAAQ,SAAAV,GACfO,EAASa,QAAQpB,EAAUjC,YAI/Bc,IAAewB,MAAK,SAAAzC,GAAM,OAAIA,EAAM,aAGpCkB,IAAYuB,MAAK,SAAAzC,GAAM,OAAIA,EAAM,c,qBC/EzC,IA8BMyD,EAAa,CACf,CACIpB,OAtBU,WACd,OAAO,4DAsBHE,KAAM,WAYdvC,EAAOC,QAAU,CACbgB,aA1BiB,WACjB,OAAO,uCA0BPC,UA/Cc,WACd,OAAO,oEA+CPF,kBARJ,WACI,OAAOyC,M","file":"index.1ed61121c09040ce1f3a.bundle.js","sourcesContent":["/* ==========================================================================\n Dom helpers\n ========================================================================== */\n\nconst elementExist = element => !!document.querySelector(element);\n\nconst toNode = html => new DOMParser().parseFromString(html, 'text/html').body.childNodes;\n\nmodule.exports = {\n elementExist,\n toNode\n};\n","const MainCarHome = () =>\n import(\n /* webpackChunkName: \"main-car-home\" */\n '@logitravel/alex-comp-trans/components/main-car-home/client/js'\n );\n\nconst LayoutTemplate = require('../../../../template/js');\n\n(function InitLayout() {\n return LayoutTemplate(MainCarHome, '[data-component=\"LayoutCarsHome\"]');\n})();\n","/* ==========================================================================\n LayoutTemplate > Client\n ========================================================================== */\n\n/* Modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getTopButton, getHeader } = require('./components');\n\nmodule.exports = function LayoutTemplate(mainFunction, selector = '[data-component=\"LayoutTemplate\"]') {\n if (elementExist(selector)) {\n const element = document.querySelector(selector);\n\n const config = {\n ...(function getConfig() {\n if (!element.dataset.config) return '';\n\n const result = JSON.parse(element.dataset.config);\n element.dataset.config = '';\n return result;\n })()\n };\n\n /**\n * Setting public path to the webpack exposed variable\n */\n /* eslint-disable */\n __webpack_public_path__ = config.publicPath;\n /* eslint-enable */\n console.log(config);\n\n const components = resolveComponents()\n .map(component => ({\n loader: component.loader,\n element: document.querySelector(`[data-component=\"${component.name}\"]`)\n }))\n .filter(component => component.element);\n\n /**\n * Execute main function\n */\n mainFunction().then(module => module.default(`[data-component=\"${config.mainComponent}\"]`));\n\n /**\n * Observer to lazy load modules based on\n * currently viewed components in the viewport\n */\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.intersectionRatio > 0) {\n const { loader } = components\n .filter(component => component.element === entry.target)\n .reduce(acc => acc);\n\n /**\n * Init component with its loader and then\n * unobserve from this entry so we dont\n * call the init of the component more\n * than once\n */\n loader().then(module => {\n module.default();\n\n observer.unobserve(entry.target);\n });\n }\n });\n },\n {\n root: null, // avoiding 'root' or setting it to 'null' sets it to default value: viewport\n rootMargin: '0px',\n threshold: 0.15\n }\n );\n\n components.forEach(component => {\n observer.observe(component.element);\n });\n\n /* TopButton */\n getTopButton().then(module => module.default());\n\n /* Header */\n getHeader().then(module => module.default);\n }\n};\n","/* ==========================================================================\n LayoutTemplate > Client > Components\n ========================================================================== */\n\n/**\n * Header\n */\nconst getHeader = () => {\n return import(\n /* webpackChunkName: \"header\" */\n '@bluekiri/alexandria-logitravel/components/header/client/js'\n );\n};\n\n/**\n * Footer\n */\nconst getFooter = () => {\n return import(\n /* webpackChunkName: \"footer\" */\n '@bluekiri/alexandria-logitravel/components/footer/client/js'\n );\n};\n\n/**\n * TopButton\n */\nconst getTopButton = () => {\n return import(\n /* webpackChunkName: \"top-button\" */\n '@bluekiri/alexandria-contrib-components/components/top-button/client/js'\n );\n};\n\n/**\n * Components\n */\nconst COMPONENTS = [\n {\n loader: getFooter,\n name: 'Footer'\n }\n];\n\n/**\n * Resolver components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\n/* Exports */\nmodule.exports = {\n getTopButton,\n getHeader,\n resolveComponents\n};\n"],"sourceRoot":""}