{"version":3,"file":"466.41c76717f9171eac501f.js","mappings":"8KAGO,MAAMA,EAAQ,SAACC,GACrB,GAAIA,EAAQC,YACX,OAGDD,EAAQC,aAAc,EAMtB,MAAMC,EAAU,WACf,IAAIF,EAAUG,SAASC,cAAc,mBAEhCJ,IAELK,OAAOC,QAAU,IACdN,EAAQO,UAAUC,IAAI,WACtBR,EAAQO,UAAUE,OAAO,aAG7BP,IAEAQ,IAAAA,GAAY,0BAA0B,WACrCR,OAGDF,EAAQW,iBAAiB,SAAS,SAACC,GAClCA,EAAMC,iBAEN,IAAIC,EAAQT,OAAOC,QACfS,EAAc,KAElB,MAAMC,EAAgB,SAACC,GACjBF,IAAaA,EAAcE,GAChC,IAEuBC,EAAGC,EAAGC,EAFzBC,EAAWJ,EAAYF,EASvBO,EAAMC,KAAKC,KAPQN,EAOUG,EAPPF,EAOiBL,EAPdM,GAOsBN,GANlDI,GAAKO,KACG,EAAWL,EAAI,EAAKF,EAAIA,EAAIC,GAE3BC,EAAI,KADbF,GACwBA,EAAI,GAAK,GAAKC,GAGyB,GAEhEO,SAAS,EAAGJ,GAERD,EAAW,KACdM,sBAAsBX,IAIpBY,EAAAA,uBACHD,sBAAsBX,GAEtBU,SAAS,EAAG","sources":["webpack://ctFrontend/./static/js/frontend/back-to-top-link.js"],"sourcesContent":["import ctEvents from 'ct-events'\nimport { areWeDealingWithSafari } from '../main'\n\nexport const mount = (backTop) => {\n\tif (backTop.hasListener) {\n\t\treturn\n\t}\n\n\tbackTop.hasListener = true\n\n\t// browser window scroll (in pixels) after which the \"back to top\" link is shown\n\t// browser window scroll (in pixels) after which the \"back to top\" link opacity is reduced\n\tvar scrolling = false\n\n\tconst compute = () => {\n\t\tvar backTop = document.querySelector('.ct-back-to-top')\n\n\t\tif (!backTop) return\n\n\t\twindow.scrollY > 500\n\t\t\t? backTop.classList.add('ct-show')\n\t\t\t: backTop.classList.remove('ct-show')\n\t}\n\n\tcompute()\n\n\tctEvents.on('ct:scroll:render-frame', () => {\n\t\tcompute()\n\t})\n\n\tbackTop.addEventListener('click', (event) => {\n\t\tevent.preventDefault()\n\n\t\tvar start = window.scrollY\n\t\tvar currentTime = null\n\n\t\tconst animateScroll = (timestamp) => {\n\t\t\tif (!currentTime) currentTime = timestamp\n\t\t\tvar progress = timestamp - currentTime\n\n\t\t\tconst easeInOutQuad = (t, b, c, d) => {\n\t\t\t\tt /= d / 2\n\t\t\t\tif (t < 1) return (c / 2) * t * t + b\n\t\t\t\tt--\n\t\t\t\treturn (-c / 2) * (t * (t - 2) - 1) + b\n\t\t\t}\n\n\t\t\tvar val = Math.max(easeInOutQuad(progress, start, -start, 700), 0)\n\n\t\t\tscrollTo(0, val)\n\n\t\t\tif (progress < 700) {\n\t\t\t\trequestAnimationFrame(animateScroll)\n\t\t\t}\n\t\t}\n\n\t\tif (areWeDealingWithSafari) {\n\t\t\trequestAnimationFrame(animateScroll)\n\t\t} else {\n\t\t\tscrollTo(0, 0)\n\t\t}\n\t})\n}\n"],"names":["mount","backTop","hasListener","compute","document","querySelector","window","scrollY","classList","add","remove","ctEvents","addEventListener","event","preventDefault","start","currentTime","animateScroll","timestamp","t","b","c","progress","val","Math","max","d","scrollTo","requestAnimationFrame","areWeDealingWithSafari"],"sourceRoot":""}