{"version":3,"sources":["webpack:///./node_modules/@bluekiri/alexandria/helpers/domHelpers.js","webpack:///./components/layout-company-port-cru/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","MainCompanyPortCru","require","LayoutTemplate","_require2","resolveComponents","getCookies","getTopButton","getHeader","mainFunction","selector","arguments","length","undefined","config","_objectSpread","dataset","result","JSON","parse","__webpack_public_path__","publicPath","components","map","component","loader","concat","name","filter","then","default","mainComponent","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","unobserve","root","rootMargin","threshold","observe","COMPONENTS"],"mappings":";iLAQAA,EAAOC,QAAU,CACbC,aALiB,SAAAC,GAAO,QAAMC,SAASC,cAAcF,IAMrDG,OAJW,SAAAC,GAAI,OAAI,IAAIC,WAAYC,gBAAgBF,EAAM,aAAaG,KAAKC,c,8FCN/E,IAAMC,EAAqB,WAAH,OACpB,sCAKmBC,EAAQ,OAGpBC,CAAeF,EAAoB,4C,wsBCJ9CC,EAAQ,QAER,IAAQX,EAAiBW,EAAQ,QAAzBX,aAERa,EAAmEF,EAAQ,QAAnEG,EAAiBD,EAAjBC,kBAAmBC,EAAUF,EAAVE,WAAYC,EAAYH,EAAZG,aAAcC,EAASJ,EAATI,UAErDnB,EAAOC,QAAU,SAAwBmB,GAA8D,IAAhDC,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,oCAC9D,GAAIpB,EAAamB,GAAW,CACxB,IAAMlB,EAAUC,SAASC,cAAcgB,GAEjCI,EAAMC,EAAA,GACJ,WACA,IAAKvB,EAAQwB,QAAQF,OAAQ,MAAO,GAEpC,IAAMG,EAASC,KAAKC,MAAM3B,EAAQwB,QAAQF,QAE1C,OADAtB,EAAQwB,QAAQF,OAAS,GAClBG,EALP,IAaRG,IAA0BN,EAAOO,WAGjC,IAAMC,EAAajB,IACdkB,KAAI,SAAAC,GAAS,MAAK,CACfC,OAAQD,EAAUC,OAClBjC,QAASC,SAASC,cAAc,oBAADgC,OAAqBF,EAAUG,KAAI,WAErEC,QAAO,SAAAJ,GAAS,OAAIA,EAAUhC,WAKnCiB,IAAeoB,MAAK,SAAAxC,GAAM,OAAIA,EAAOyC,QAAQ,oBAADJ,OAAqBZ,EAAOiB,cAAa,UAMrF,IAAMC,EAAW,IAAIC,sBACjB,SAAAC,GACIA,EAAQC,SAAQ,SAAAC,GACRA,EAAMC,kBAAoB,IAW1BZ,EAVmBH,EACdM,QAAO,SAAAJ,GAAS,OAAIA,EAAUhC,UAAY4C,EAAME,UAChDC,QAAO,SAAAC,GAAG,OAAIA,KAFXf,UAUCI,MAAK,SAAAxC,GACVA,EAAOyC,UAEPE,EAASS,UAAUL,EAAME,gBAKzC,CACII,KAAM,KACNC,WAAY,MACZC,UAAW,MAInBtB,EAAWa,SAAQ,SAAAX,GACfQ,EAASa,QAAQrB,EAAUhC,YAI/Bc,IAAauB,MAAK,SAAAxC,GAAM,OAAIA,EAAOyC,aAGnCvB,IAAesB,MAAK,SAAAxC,GAAM,OAAIA,EAAOyC,aAGrCtB,IAAYqB,MAAK,SAAAxC,GAAM,OAAIA,EAAOyC,c,uECjF1C,IAkDMgB,EAAa,CACf,CACIrB,OA1CU,WACd,OAAO,4DA0CHE,KAAM,UAEV,CACIF,OAhByB,WAC7B,OAAO,4DAgBHE,KAAM,0BAYdtC,EAAOC,QAAU,CACbgB,WAlDe,WACf,OAAO,4DAkDPC,aAzCiB,WACjB,OAAO,uCAyCPC,UAxEc,WACd,OAAO,6DAwEPH,kBATJ,WACI,OAAOyC,M","file":"index.0ab21deb26bca909e6f0.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 MainCompanyPortCru = () =>\n import(\n /* webpackChunkName: \"main-company-port-cru\" */\n '@logitravel/alex-comp-cru/components/main-company-port-cru/client/js'\n );\n\nconst LayoutTemplate = require('../../../../template/js');\n\n(function InitLayout() {\n return LayoutTemplate(MainCompanyPortCru, '[data-component=\"LayoutCompanyPortCru\"]');\n})();\n","/* ==========================================================================\n LayoutTemplate > Client\n ========================================================================== */\n\n/* Modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getCookies, 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\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 /* Cookies */\n getCookies().then(module => module.default());\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 * Cookies\n */\nconst getCookies = () => {\n return import(\n /* webpackChunkName: \"cookies\" */\n '@bluekiri/alexandria-contrib-components/components/cookies/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 * CruisesCertifications\n */\nconst getCruisesCertifications = () => {\n return import(\n /* webpackChunkName: \"cruises-certifications\" */\n '@logitravel/alex-comp-cru/components/cruises-certifications/client/js'\n );\n};\n\n/**\n * Components\n */\nconst COMPONENTS = [\n {\n loader: getFooter,\n name: 'Footer'\n },\n {\n loader: getCruisesCertifications,\n name: 'CruisesCertifications'\n }\n];\n\n/**\n * Resolver components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\n/* Exports */\nmodule.exports = {\n getCookies,\n getTopButton,\n getHeader,\n resolveComponents\n};\n"],"sourceRoot":""}