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AAA;EAAA;AACL,CAAC,CAAC;AAEFnB,qBAAqB,CAACoB,OAAO,CAACzB,OAAO,CAAC","sources":["webpack://WebpackConfig.Web/./app/src/js/viewport-size.js"],"sourcesContent":["import { ResizeObserver as Polyfill } from '@juggle/resize-observer';\r\nconst ResizeObserver = window.ResizeObserver || Polyfill;\r\n\r\n// add element to body for accurately reporting viewport size\r\n\r\nlet $body = document.querySelector('body'),\r\n vh = 0,\r\n vw = 0,\r\n vih = 0,\r\n vihChangeThreshold = 90, // value larger than IOS Safari viewport height change on scroll\r\n timeoutDelay = 0;\r\n\r\nconst evt = new CustomEvent(\"window-resize\", {detail: {w: () => vw, h: () => vh}});\r\n\r\nconst vpSizeCheck = (w,h) => {\r\n if(w != vw || h != vh) {\r\n window.requestAnimationFrame(() => {\r\n // only change --vpInitialHeight if the width has changed or the height difference > 40px;\r\n if(w != vw || (w == vw && Math.abs(h - vih) > vihChangeThreshold)) {\r\n vih = h;\r\n document.documentElement.style.setProperty('--vpInitialHeight', `${vih}px`);\r\n }\r\n // vw\r\n if(w != vw) {\r\n vw = w;\r\n document.documentElement.style.setProperty('--vpWidth', `${vw}px`);\r\n }\r\n // vh\r\n if(h != vh) {\r\n vh = h;\r\n document.documentElement.style.setProperty('--vpHeight', `${vh}px`);\r\n }\r\n window.dispatchEvent(evt);\r\n });\r\n }\r\n};\r\n\r\n// add element to body\r\n\r\nconst vpSizer = document.createElement('div');\r\nvpSizer.setAttribute('id','vp-sizer');\r\nvpSizer.setAttribute('aria-hidden','true');\r\nvpSizer.setAttribute('style','position:fixed;z-index:-1;top:0;left:0;bottom:0;right:0;pointer-events:none');\r\n$body.appendChild(vpSizer);\r\n\r\nlet t = null;\r\n\r\n// add resize observer\r\n\r\nconst vpSizerResizeObserver = new ResizeObserver(entries => {\r\n for (let entry of entries) {\r\n const cr = entry.contentRect;\r\n clearTimeout(t);\r\n t = setTimeout(() => {\r\n vpSizeCheck(cr.width,cr.height);\r\n }, timeoutDelay);\r\n timeoutDelay = 20;\r\n }\r\n});\r\n\r\nvpSizerResizeObserver.observe(vpSizer);"],"names":["ResizeObserver","Polyfill","window","$body","document","querySelector","vh","vw","vih","vihChangeThreshold","timeoutDelay","evt","CustomEvent","detail","w","h","vpSizeCheck","requestAnimationFrame","Math","abs","documentElement","style","setProperty","concat","dispatchEvent","vpSizer","createElement","setAttribute","appendChild","t","vpSizerResizeObserver","entries","_iterator","_createForOfIteratorHelper","_step","_loop","entry","value","cr","contentRect","clearTimeout","setTimeout","width","height","s","n","done","err","e","f","observe"],"sourceRoot":""}