{"version":3,"sources":["webpack:///./src/js/modules/jump-links-gas-properties.js"],"names":["jumpLinksGasProperties","Component","setupDefaults","this","dom","$jumpLinks","el","querySelector","$navWrapper","$alphabet","dataset","alphabet","setObserver","createSections","createJumpLinks","handleObserveSections","document","querySelectorAll","forEach","section","observer","observe","container","cardsTitle","firtsLetters","Array","from","map","title","info","charAt","cleanRepeated","filter","c","index","indexOf","sort","sectionTag","createElement","setAttribute","classList","add","appendChild","parentNode","IntersectionObserver","entries","handleOnIntersect","root","treshold","rootMargin","innerHTML","cloneJumpLinks","cloneNode","alphabetObj","JSON","parse","disabled","find","x","navJumpLink","addListeners","addEventListener","e","handleClick","cleanActiveState","item","remove","entry","isIntersecting","id","target","getAttribute","preventDefault","link","contains","alphabetSections","substring","offsetTop","window","scroll","top","behavior"],"mappings":"2FAAA,kBAEA,MAAMA,UAA+BC,YACnCC,gBACEC,KAAKC,IAAM,CACTC,WAAYF,KAAKG,GAAGC,cAAc,eAClCC,YAAaL,KAAKG,GAAGC,cAAc,wBACnCE,UAAWN,KAAKG,GAAGI,QAAQC,UAG7BR,KAAKS,cACDT,KAAKC,IAAIK,WAAWN,KAAKU,iBAC7BV,KAAKW,kBACLX,KAAKY,wBAGPA,wBAC2BC,SAASC,iBAAiB,0BAClCC,QAASC,IACxBhB,KAAKiB,SAASC,QAAQF,KAI1BN,iBACE,MAAMS,EAAYN,SAAST,cAAc,oCACnCgB,EAAaP,SAASC,iBAAiB,2BACvCO,EAAeC,MAAMC,KAAKH,GAAYI,IAAKC,GAAUA,EAAMlB,QAAQmB,KAAKC,OAAO,IACrF3B,KAAK4B,cAAgBP,EAAaQ,OAAO,CAACC,EAAGC,IAAUV,EAAaW,QAAQF,KAAOC,GAAOE,OAC1FjC,KAAK4B,cAAcJ,IAAKR,IACtB,MAAMkB,EAAarB,SAASsB,cAAc,WAC1CD,EAAWE,aAAa,KAAO,qBAAoBpB,GACnDkB,EAAWG,UAAUC,IAAI,yBACzBhB,MAAMC,KAAKH,GA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AU0B,OAAO,+BAI1BJ,EAAEQ,OAAO9B,UAAUC,IAAI,6BAEvB,MAAMkC,EAAmB3D,SAASC,iBAAiB,0BAC7CoD,EAAKP,EAAEQ,OAAOC,aAAa,QAAQK,UAAU,GAE7CN,GACJ,UAAA7C,MAAMC,KAAKiD,GAAkBlB,KAAMC,GAAMA,EAAEa,aAAa,QAAUF,UAAlE,eAAuEQ,WAF1D,GAGfC,OAAOC,OAAO,CACZC,IAAKV,EACLW,SAAU,YAKDjF","file":"93.bundle.js","sourcesContent":["import { Component } from '@verndale/core'\n\nclass jumpLinksGasProperties extends Component {\n setupDefaults() {\n this.dom = {\n $jumpLinks: this.el.querySelector('.jump-links'),\n $navWrapper: this.el.querySelector('.jump-links__wrapper'),\n $alphabet: this.el.dataset.alphabet\n }\n\n this.setObserver()\n if (this.dom.$alphabet) this.createSections()\n this.createJumpLinks()\n this.handleObserveSections()\n }\n\n handleObserveSections() {\n const observedSections = document.querySelectorAll('.gas-listing__sections')\n observedSections.forEach((section) => {\n this.observer.observe(section)\n })\n }\n\n createSections() {\n const container = document.querySelector('.gas-listing__sections-container')\n const cardsTitle = document.querySelectorAll('.gas-properties-card h3')\n const firtsLetters = Array.from(cardsTitle).map((title) => title.dataset.info.charAt(0))\n this.cleanRepeated = firtsLetters.filter((c, index) => firtsLetters.indexOf(c) === index).sort()\n this.cleanRepeated.map((section) => {\n const sectionTag = document.createElement('section')\n sectionTag.setAttribute('id', `jump-link-section-${section}`)\n sectionTag.classList.add('gas-listing__sections')\n Array.from(cardsTitle).map((title) =>\n title.dataset.info.charAt(0) === section ? sectionTag.appendChild(title.parentNode) : null\n )\n container.appendChild(sectionTag)\n })\n container.classList.add('gas-listing__sections-container--show')\n }\n\n setObserver() {\n const options = {\n root: null,\n treshold: 0,\n rootMargin: '-12% 0% -85%'\n }\n this.observer = new IntersectionObserver((entries) => this.handleOnIntersect(entries), options)\n }\n\n createJumpLinks() {\n this.dom.$jumpLinks.innerHTML = ''\n this.cloneJumpLinks = this.dom.$jumpLinks.cloneNode(true)\n if (this.dom.$alphabet) {\n this.alphabetObj = JSON.parse(this.dom.$alphabet).sort()\n this.alphabetObj.forEach((section) => {\n const disabled = this.cleanRepeated.find((x) => x === section)\n this.cloneJumpLinks.innerHTML += `${section}`\n })\n }\n this.dom.$jumpLinks.innerHTML = this.cloneJumpLinks.innerHTML\n this.navJumpLink = document.querySelectorAll('.jump-links__link')\n }\n\n addListeners() {\n this.dom.$jumpLinks.addEventListener('click', (e) => this.handleClick(e))\n }\n\n cleanActiveState() {\n this.navJumpLink.forEach((item) => item.classList.remove('gas-listing__item--scroll-active'))\n }\n\n handleOnIntersect(entries) {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n this.cleanActiveState()\n const id = `#${entry.target.id}`\n Array.from(this.navJumpLink)\n .find((x) => x.getAttribute('href') === id)\n ?.classList.add('gas-listing__item--scroll-active')\n }\n })\n }\n\n handleClick(e) {\n e.preventDefault()\n const jumpLinks = this.el.querySelectorAll('.jump-links__link')\n\n jumpLinks.forEach((link) => {\n if (link.classList.contains('gas-listing__item--active')) {\n link.classList.remove('gas-listing__item--active')\n }\n })\n\n e.target.classList.add('gas-listing__item--active')\n\n const alphabetSections = document.querySelectorAll('.gas-listing__sections')\n const id = e.target.getAttribute('href').substring(1)\n const offset = 65\n const target =\n Array.from(alphabetSections).find((x) => x.getAttribute('id') === id)?.offsetTop - offset\n window.scroll({\n top: target,\n behavior: 'smooth'\n })\n }\n}\n\nexport default jumpLinksGasProperties\n"],"sourceRoot":""}