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aAAAc,GACJd,KAAK6B,QACT,CAEQ,MAAAA,GACJ7B,KAAK8B,yBACL9B,KAAKW,gBACT,CAEQ,sBAAAmB,GACJ9B,KAAKwB,YAAYC,MAAMC,SAAW,UAClC1B,KAAKwB,YAAYC,MAAME,IAAM,EACjC,E,gDC3EJ,Q,SAA0C,O","sources":["webpack:///./modules/ProductDetailPageTwoColumns/ProductDetailPageTwoColumns.ts","webpack:///./modules/ProductDetailPageTwoColumns/index.ts"],"sourcesContent":["/// \r\n\r\nimport { debounce } from \"../../helpers/helperFunctions\";\r\n\r\nconst moduleSelector = '[data-module=\"ProductDetailPageTwoColumns\"]';\r\n\r\nexport default class ProductDetailPageTwoColumns {\r\n leftColumn: HTMLElement;\r\n rightColumn: HTMLElement;\r\n\r\n shortColumn: HTMLElement;\r\n longColumn: HTMLElement;\r\n\r\n static setup(selector: string = moduleSelector): void {\r\n Array.from(document.querySelectorAll(selector)).filter((node: HTMLElement) => !node.dataset.moduleInitialized).forEach((element: HTMLElement) => {\r\n new ProductDetailPageTwoColumns(element);\r\n element.dataset.moduleInitialized = 'true';\r\n });\r\n }\r\n\r\n constructor(public element: HTMLElement) {\r\n this.leftColumn = this.element.querySelector('.nx-two-columns__half-col');\r\n this.rightColumn = this.element.querySelectorAll('.nx-two-columns__half-col')[1];\r\n\r\n this.init();\r\n }\r\n\r\n private adjustZIndex() {\r\n const halfColumns: NodeListOf = this.element.querySelectorAll('.nx-two-columns__half-col');\r\n halfColumns.forEach((column) => {\r\n const toolTip = column.querySelector('.nx-ingredients-section .nx-tooltip');\r\n const productDropdownSelector = column.querySelector('.nx-pas__button');\r\n (toolTip || productDropdownSelector) ? column.classList.add('nx-two-columns__half-col--higher-z-index') : ''\r\n });\r\n }\r\n\r\n private init() {\r\n this.initStickyness();\r\n this.adjustZIndex();\r\n NiveaX.addToEventStore('resize', debounce(() => this.onResizeEvent(), 250), window);\r\n }\r\n\r\n private initStickyness() {\r\n this.getColumns();\r\n if (this.isStickyNotApplicable()) return;\r\n this.setShortColumnSticky();\r\n }\r\n\r\n private isStickyNotApplicable() {\r\n return window.NiveaX.deviceType.isMobile || window.NiveaX.deviceType.isTablet || (this.longColumn.clientHeight <= this.shortColumn.clientHeight * 1.5);\r\n }\r\n\r\n private setShortColumnSticky() {\r\n this.shortColumn.style.position = \"sticky\";\r\n this.shortColumn.style.top = \"48px\";\r\n }\r\n\r\n private getColumns() {\r\n const isLeftColumnShort: boolean = this.leftColumn.clientHeight < this.rightColumn.clientHeight;\r\n this.shortColumn = isLeftColumnShort ? this.leftColumn : this.rightColumn;\r\n this.longColumn = isLeftColumnShort ? this.rightColumn : this.leftColumn;\r\n return this;\r\n }\r\n\r\n private onResizeEvent() {\r\n this.reinit();\r\n }\r\n\r\n private reinit() {\r\n this.unsetShortColumnSticky();\r\n this.initStickyness();\r\n }\r\n\r\n private unsetShortColumnSticky() {\r\n this.shortColumn.style.position = \"initial\";\r\n this.shortColumn.style.top = \"\";\r\n }\r\n}\r\n","import ProductDetailPageTwoColumns from './ProductDetailPageTwoColumns';\r\nexport default ProductDetailPageTwoColumns;"],"names":["ProductDetailPageTwoColumns","setup","selector","Array","from","document","querySelectorAll","filter","node","dataset","moduleInitialized","forEach","element","constructor","this","leftColumn","querySelector","rightColumn","init","adjustZIndex","column","toolTip","productDropdownSelector","classList","add","initStickyness","NiveaX","addToEventStore","onResizeEvent","window","getColumns","isStickyNotApplicable","setShortColumnSticky","deviceType","isMobile","isTablet","longColumn","clientHeight","shortColumn","style","position","top","isLeftColumnShort","reinit","unsetShortColumnSticky"],"sourceRoot":""}