{"version":3,"sources":["preload.ts"],"names":["setGlobalSizes","bodyStyle","document","body","style","clientWidth","containerWidth","setProperty","Math","min","isTablet","calculateViewportHeight","_window$visualViewpor","documentElement","window","visualViewport","height","innerHeight","handleScroll","calculateIosFixedElementTop","fixedElement","getElementById","getBoundingClientRect","top","clearTimeout","timer","setTimeout","tabletBreakpoint","desktopBreakpoint","matchMedia","matches","addEventListener","getComputedStyle","getPropertyValue","Element","prototype","observeResize","callback","lastRect","_this","this","ResizeObserver","observe","setInterval","rect","floor","width"],"mappings":"CAAA,WAiByB,SAAjBA,IACJ,IAAMC,EAAYC,SAASC,KAAKC,MAE1BC,EAAcH,SAASC,KAAKE,YAG5BC,GAFNL,EAAUM,YAAY,eAAgBF,EAAc,MAE7BG,KAAKC,IAAI,KAAMJ,GArB9BK,IAqB+D,IAAL,MAClET,EAAUM,YAAY,oBAAqBD,EAAiB,MAG9B,SAA1BK,IAAgC,IAAAC,EACpCV,SAASW,gBAAgBT,MAAMG,YAAY,4BAA4B,OAAAK,EAAAE,OAAOC,qBAAP,EAAAH,EAAuBI,QAAS,MACvGd,SAASW,gBAAgBT,MAAMG,YAAY,oBAAqBO,OAAOG,YAAc,MACrFC,IAKkC,SAA9BC,IACJ,IAAMC,EAAelB,SAASmB,eAAe,eAC7CnB,SAASW,gBAAgBT,MAAMG,YAAY,sBAAuBa,EAAaE,wBAAwBC,IAAM,MAG1F,SAAfL,IACJM,aAAaC,GACbA,EAAQC,WAAWP,EAA6B,IAzClD,IAgCIM,EAuBIE,EACAC,EACA3B,EArDFS,EAAW,WACf,OAAOI,OAAOe,WAAW,qBAAqBC,SAuChDC,iBAAiB,SAAU,WACzB/B,MAGF+B,iBAAiB,SAAUb,GAEvBJ,OAAOC,gBACTD,OAAOC,eAAegB,iBAAiB,SAAUpB,GAI3CgB,EAAmBb,OAAOkB,iBAAiB9B,SAASC,MAAM8B,iBAAiB,uBAC3EL,EAAoBd,OAAOkB,iBAAiB9B,SAASC,MAAM8B,iBAAiB,yBAC5EhC,EAAYC,SAASC,KAAKC,OACtBG,YAAY,sBAAuBoB,GAC7C1B,EAAUM,YAAY,uBAAwBqB,GAGhD5B,IACAW,IACAQ,IAjEF,GAoEAe,QAAQC,UAAUC,cAChBF,QAAQC,UAAUC,eAClB,SAAyBC,GAAsB,IAQvCC,EARuCC,EAAAC,KACzC,mBAAoB1B,OAEC,IAAI2B,eAAeJ,GAG3BK,QAAQF,OAEnBF,EAAWE,KAAKlB,wBAEpBqB,YAAY,WACV,IAAMC,EAAOL,EAAKjB,wBACdd,KAAKqC,MAAMD,EAAKE,QAAUtC,KAAKqC,MAAMP,EAASQ,QAAUtC,KAAKqC,MAAMD,EAAK5B,SAAWR,KAAKqC,MAAMP,EAAStB,UACzGsB,EAAWM,EACXP,MAED","file":"preload.js","sourcesContent":["(() => {\n const isMobile = () => {\n return !isTablet();\n };\n\n const isTablet = () => {\n return window.matchMedia(\"(min-width:48rem)\").matches;\n };\n\n const isDesktop = () => {\n return window.matchMedia(\"(min-width:64rem)\").matches;\n };\n\n const isTabletOnly = () => {\n return isTablet() && !isDesktop();\n };\n\n const setGlobalSizes = () => {\n const bodyStyle = document.body.style;\n\n const clientWidth = document.body.clientWidth;\n bodyStyle.setProperty(\"--page-width\", clientWidth + \"px\");\n\n const containerWidth = Math.min(1252, clientWidth - (isMobile() ? 50 : 120));\n bodyStyle.setProperty(\"--container-width\", containerWidth + \"px\");\n };\n\n const calculateViewportHeight = () => {\n document.documentElement.style.setProperty(\"--visual-viewport-height\", window.visualViewport?.height + \"px\");\n document.documentElement.style.setProperty(\"--viewport-height\", window.innerHeight + \"px\");\n handleScroll();\n };\n\n let timer: NodeJS.Timeout;\n\n const calculateIosFixedElementTop = () => {\n const fixedElement = document.getElementById(\"fixedAnchor\")!;\n document.documentElement.style.setProperty(\"--fixed-element-top\", fixedElement.getBoundingClientRect().top + \"px\");\n };\n\n const handleScroll = () => {\n clearTimeout(timer);\n timer = setTimeout(calculateIosFixedElementTop, 30);\n };\n\n addEventListener(\"resize\", () => {\n setGlobalSizes();\n });\n\n addEventListener(\"scroll\", handleScroll);\n\n if (window.visualViewport) {\n window.visualViewport.addEventListener(\"resize\", calculateViewportHeight);\n }\n\n const setBreakpointReference = () => {\n const tabletBreakpoint = window.getComputedStyle(document.body).getPropertyValue(\"--breakpoint-tablet\");\n const desktopBreakpoint = window.getComputedStyle(document.body).getPropertyValue(\"--breakpoint-desktop\");\n const bodyStyle = document.body.style;\n bodyStyle.setProperty(\"--breakpoint-tablet\", tabletBreakpoint);\n bodyStyle.setProperty(\"--breakpoint-desktop\", desktopBreakpoint);\n };\n setBreakpointReference();\n setGlobalSizes();\n calculateViewportHeight();\n calculateIosFixedElementTop();\n})();\n\nElement.prototype.observeResize =\n Element.prototype.observeResize ||\n function (this: Element, callback: () => void) {\n if ('ResizeObserver' in window) {\n // create an Observer instance\n const resizeObserver = new ResizeObserver(callback);\n\n // start observing a DOM node\n resizeObserver.observe(this);\n } else {\n let lastRect = this.getBoundingClientRect();\n\n setInterval(() => {\n const rect = this.getBoundingClientRect();\n if (Math.floor(rect.width) != Math.floor(lastRect.width) || Math.floor(rect.height) != Math.floor(lastRect.height)) {\n lastRect = rect;\n callback();\n }\n }, 500);\n }\n };\n"]}