{"version":3,"file":"692.aee36cb37c304c4bc891.js","mappings":"0HACA,MAAMA,EAAiBC,OAAOD,gBAAkBE,EAAAA,GAIhD,IAAIC,EAAQC,SAASC,cAAc,QAC/BC,EAAK,EACLC,EAAK,EACLC,EAAM,EAGV,MAAMC,EAAgB,IAAIC,MAAM,YAE1BC,EAAc,CAACC,EAAEC,KAChBD,GAAKL,GAAMM,GAAKP,GACfL,OAAOa,uBAAsB,MAEtBF,GAAKL,GAAOK,GAAKL,GAAMQ,KAAKC,IAAIH,EAAIL,GAR1B,MASTA,EAAMK,EACNT,SAASa,gBAAgBC,MAAMC,YAAY,oBAAsB,GAAEX,QAGpEI,GAAKL,IACJA,EAAKK,EACLR,SAASa,gBAAgBC,MAAMC,YAAY,YAAc,GAAEZ,QAG5DM,GAAKP,IACJA,EAAKO,EACLT,SAASa,gBAAgBC,MAAMC,YAAY,aAAe,GAAEb,QAGhEL,OAAOmB,cAAcX,OAO3BY,EAAUjB,SAASkB,cAAc,OACvCD,EAAQE,aAAa,KAAK,YAC1BF,EAAQE,aAAa,cAAc,QACnCF,EAAQE,aAAa,QAAQ,+EAC7BpB,EAAMqB,YAAYH,GAIY,IAAIrB,GAAeyB,IAC7C,IAAK,IAAIC,KAASD,EAAS,CACvB,MAAME,EAAKD,EAAME,YACjBjB,EAAYgB,EAAGE,MAAMF,EAAGG,YAIVC,QAAQV","sources":["webpack://dclt.web/./wwwroot/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\r\nconst vpResizeEvent = new Event('vpResize');\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 // event\r\n window.dispatchEvent(vpResizeEvent);\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\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 vpSizeCheck(cr.width,cr.height);\r\n }\r\n});\r\n\r\nvpSizerResizeObserver.observe(vpSizer);"],"names":["ResizeObserver","window","Polyfill","$body","document","querySelector","vh","vw","vih","vpResizeEvent","Event","vpSizeCheck","w","h","requestAnimationFrame","Math","abs","documentElement","style","setProperty","dispatchEvent","vpSizer","createElement","setAttribute","appendChild","entries","entry","cr","contentRect","width","height","observe"],"sourceRoot":""}