{"version":3,"sources":["webpack:///./LeLab.Web/src/js/category-group.entry.js"],"names":["DOMParser","PageComponent","constructor","node","this","container","querySelector","links","querySelectorAll","template","changeHandler","change","bind","forEach","x","addEventListener","e","url","target","dataset","imageUrl","picture","removeChild","newPicture","document","importNode","content","replace","srcset","src","append","destroy","removeEventListener"],"mappings":"2FAAA,kBAEe,IAAIA,UA6DnB,IAAIC,IAAc,kBA3DlB,MAEIC,aAAY,KAAEC,IACVC,KAAKD,KAAOA,EACZC,KAAKC,UAAYD,KAAKD,KAAKG,cAAc,8BACzCF,KAAKG,MAAQH,KAAKC,UAAUG,iBAAiB,8BAC7CJ,KAAKK,SAAWL,KAAKC,UAAUC,cAAc,YAE7CF,KAAKM,cAAgBN,KAAKO,OAAOC,KAAKR,MAEtCA,KAAKG,MAAMM,QAAQC,IACfA,EAAEC,iBAAiB,aAAcX,KAAKM,eACtCI,EAAEC,iBAAiB,UAAWX,KAAKM,iBAI3CC,OAAOK,GACH,MACMC,EAAMD,EAAEE,OAAOC,QAAQC,SACvBC,EAAUjB,KAAKC,UAAUC,cAAc,wBAE7C,GAAIe,GAAWA,EAAQF,QAAQC,WAAaH,EACxC,OAOJ,GAJII,GACAjB,KAAKC,UAAUiB,YAAYD,IAG1BJ,EACD,OAGJ,IAAIM,EAAaC,SAASC,WAAWrB,KAAKK,SAASiB,SAAS,GAE5DH,EAAWf,iBAAiB,oBAAoBK,QAAQC,GAAKA,EAAEK,QAAQC,SAAWN,EAAEK,QAAQC,SAASO,QAlBzF,QAkBsGV,IAClHM,EAAWf,iBAAiB,YAAYK,QAAQC,GAAKA,EAAEc,OAASd,EAAEc,OAAOD,QAnB7D,QAmB0EV,IACtFM,EAAWf,iBAAiB,SAASK,QAAQC,GAAKA,EAAEe,IAAMf,EAAEe,IAAIF,QApBpD,QAoBiEV,IAE7Eb,KAAKC,UAAUyB,OAAOP,GACtBA,EAAa,KAGjBQ,UACI3B,KAAKG,MAAMM,QAAQC,IACfA,EAAEkB,oBAAoB,aAAc5B,KAAKM,eACzCI,EAAEkB,oBAAoB,UAAW5B,KAAKM,wBAGnCN,KAAKD,YACLC,KAAKC,iBACLD,KAAKG,aACLH,KAAKK,gBAELL,KAAKM,mB","file":"category-group.js","sourcesContent":["import { PageComponent } from \"barba\"\r\n\r\nconst parser = new DOMParser()\r\n\r\nclass CategoryGroup {\r\n\r\n constructor({ node }) {\r\n this.node = node\r\n this.container = this.node.querySelector('.category-group__container')\r\n this.links = this.container.querySelectorAll('.category-group__bike-link')\r\n this.template = this.container.querySelector('template')\r\n\r\n this.changeHandler = this.change.bind(this)\r\n\r\n this.links.forEach(x => {\r\n x.addEventListener('mouseenter', this.changeHandler)\r\n x.addEventListener('focusin', this.changeHandler)\r\n })\r\n }\r\n\r\n change(e) {\r\n const key = \"%URL%\"\r\n const url = e.target.dataset.imageUrl\r\n const picture = this.container.querySelector('.category-group__pic')\r\n\r\n if (picture && picture.dataset.imageUrl === url) {\r\n return\r\n }\r\n\r\n if (picture) {\r\n this.container.removeChild(picture)\r\n }\r\n\r\n if (!url) {\r\n return\r\n }\r\n \r\n let newPicture = document.importNode(this.template.content, true)\r\n\r\n newPicture.querySelectorAll('[data-image-url]').forEach(x => x.dataset.imageUrl = x.dataset.imageUrl.replace(key, url))\r\n newPicture.querySelectorAll('[srcset]').forEach(x => x.srcset = x.srcset.replace(key, url))\r\n newPicture.querySelectorAll('[src]').forEach(x => x.src = x.src.replace(key, url))\r\n\r\n this.container.append(newPicture)\r\n newPicture = null\r\n }\r\n\r\n destroy() {\r\n this.links.forEach(x => {\r\n x.removeEventListener('mouseenter', this.changeHandler)\r\n x.removeEventListener('focusin', this.changeHandler)\r\n })\r\n\r\n delete this.node\r\n delete this.container\r\n delete this.links\r\n delete this.template\r\n\r\n delete this.changeHandler\r\n }\r\n\r\n}\r\n\r\nnew PageComponent(\".category-group\", CategoryGroup)"],"sourceRoot":""}