{"version":3,"file":"elements-timeline.d2272e1de3463f7d46b1.js","mappings":"yJAGAA,EAAAA,GAAAA,eAAoBC,EAAAA,GAEpBC,SAASC,iBAAiB,qBAAqBC,SAASC,IACtD,GAAIC,OAAOC,WAAW,sBAAsBC,QAC1C,OAGF,MAAMC,EAAQJ,EAAGK,cAAc,mBAE/BL,EAAGF,iBAAiB,kBAAkBC,SAASO,IAC7CV,EAAAA,EAAAA,OAAqB,CACnBW,QAASD,EACTE,SAAS,EACTC,MAAOA,KACL,MAAMC,EAAqBC,SACzBC,iBAAiBf,SAASgB,iBAAiBC,iBAAiB,+BAExDC,EAAeJ,SACnBC,iBAAiBf,SAASgB,iBAAiBC,iBAAiB,yBAK9D,MAAQ,OAFOE,KAAKC,KAAKP,EAAqBK,EAAmC,IAApBd,OAAOiB,aAE9C,EAExBC,QAASA,KACP,MAAMC,EAAQd,EAAKe,QAAQD,MAE3BhB,EAAMN,iBAAkB,sBAAqBC,SAASuB,GAAMA,EAAEC,UAAUC,OAAO,eAC/EpB,EAAMC,cAAe,sBAAqBe,MAAUG,UAAUE,IAAI,YAAY,EAEhFC,YAAaA,KACX,MAAMN,EAAQT,SAASL,EAAKe,QAAQD,OAEtB,IAAVA,IACFhB,EAAMC,cAAe,sBAAqBe,EAAQ,MAAMG,UAAUE,IAAI,aACtErB,EAAMC,cAAe,sBAAqBe,MAAUG,UAAUC,OAAO,aACvE,GAEF,GACF,G","sources":["webpack://silverstripe-base/./themes/app/src/elements/timeline.js"],"sourcesContent":["import { gsap } from 'gsap'\nimport { ScrollTrigger } from 'gsap/ScrollTrigger'\n\ngsap.registerPlugin(ScrollTrigger)\n\ndocument.querySelectorAll('.element-timeline').forEach((el) => {\n if (window.matchMedia('(max-width: 767px)').matches) {\n return\n }\n\n const image = el.querySelector('.timeline-image')\n\n el.querySelectorAll('.timeline-item').forEach((item) => {\n ScrollTrigger.create({\n trigger: item,\n markers: false,\n start: () => {\n const announcementHeight = parseInt(\n getComputedStyle(document.documentElement).getPropertyValue('--site-announcement-height')\n )\n const headerHeight = parseInt(\n getComputedStyle(document.documentElement).getPropertyValue('--site-header-height')\n )\n\n const offset = Math.ceil(announcementHeight + headerHeight + window.innerWidth * 0.25)\n\n return `top ${offset}`\n },\n onEnter: () => {\n const index = item.dataset.index\n\n image.querySelectorAll(`[data-image-index]`).forEach((x) => x.classList.remove('is-active'))\n image.querySelector(`[data-image-index=\"${index}\"`).classList.add('is-active')\n },\n onLeaveBack: () => {\n const index = parseInt(item.dataset.index)\n\n if (index !== 1) {\n image.querySelector(`[data-image-index=\"${index - 1}\"`).classList.add('is-active')\n image.querySelector(`[data-image-index=\"${index}\"`).classList.remove('is-active')\n }\n },\n })\n })\n})\n"],"names":["gsap","ScrollTrigger","document","querySelectorAll","forEach","el","window","matchMedia","matches","image","querySelector","item","trigger","markers","start","announcementHeight","parseInt","getComputedStyle","documentElement","getPropertyValue","headerHeight","Math","ceil","innerWidth","onEnter","index","dataset","x","classList","remove","add","onLeaveBack"],"sourceRoot":""}