{"version":3,"file":"2421.67bc067fea5e6f0c8643.js","mappings":"wLAIA,MAEaA,EAAe,CACxBC,kBAH4BC,OAAOC,WAAW,oCAGHC,SAGlCC,EAAW,CACpBC,GAAI,EACJC,GAAI,EACJC,MAAQC,IACJJ,EAASC,GAAKG,CAAG,EAErBC,MAAQD,IACJJ,EAASE,GAAKE,CAAG,GAIZE,EAAiB,CAC1BC,cAAc,EACdC,gBAAkBC,IACdH,EAAeC,aAAeE,CAAI,EAEtCC,eAAe,EACfC,iBAAmBF,IACfH,EAAeI,cAAgBD,CAAI,GAI9BG,EAAe,CACxBC,QAAQ,EACRC,UAAYL,IACRG,EAAaC,OAASJ,CAAI,E,mDCjClC,MAAMM,EAAiBlB,OAAOkB,gBAAkBC,EAAAA,GAIhD,IAAIC,EAAQC,SAASC,cAAc,QAEnC,MAAMC,EAAcA,CAACC,EAAEC,KAChBD,GAAKrB,EAAAA,GAASC,IAAMqB,GAAKtB,EAAAA,GAASE,IACjCL,OAAO0B,uBAAsB,KACtBF,GAAKrB,EAAAA,GAASC,KACbD,EAAAA,GAASG,MAAMkB,GACfH,SAASM,gBAAgBC,MAAMC,YAAY,YAAc,GAAE1B,EAAAA,GAASC,SAErEqB,GAAKtB,EAAAA,GAASE,KACbF,EAAAA,GAASK,MAAMiB,GACfJ,SAASM,gBAAgBC,MAAMC,YAAY,aAAe,GAAE1B,EAAAA,GAASE,QACzE,GAER,EAKEyB,EAAUT,SAASU,cAAc,OACvCD,EAAQE,aAAa,KAAK,YAC1BF,EAAQE,aAAa,cAAc,QACnCF,EAAQE,aAAa,QAAQ,+EAC7BZ,EAAMa,YAAYH,GAIY,IAAIZ,GAAegB,IAC7C,IAAK,IAAIC,KAASD,EAAS,CACvB,MAAME,EAAKD,EAAME,YACjBd,EAAYa,EAAGE,MAAMF,EAAGG,OAC5B,KAGkBC,QAAQV,E","sources":["webpack://National Motor Museum Trust/./wwwroot/app/src/js/global.js","webpack://National Motor Museum Trust/./wwwroot/app/src/js/viewport-size.js"],"sourcesContent":["// ***********************************\r\n// ***** global site variables *****\r\n// ***********************************\r\n\r\nconst detectReducedMotionPref = window.matchMedia('(prefers-reduced-motion: reduce)');\r\n\r\nexport const siteSettings = {\r\n reducedMotionPref: detectReducedMotionPref.matches\r\n}\r\n\r\nexport const viewport = {\r\n vw: 0,\r\n vh: 0,\r\n setVw: (val) => {\r\n viewport.vw = val;\r\n },\r\n setVh: (val) => {\r\n viewport.vh = val;\r\n }\r\n}\r\n\r\nexport const mainNavigation = {\r\n mobileActive: false,\r\n setMobileActive: (mode) => {\r\n mainNavigation.mobileActive = mode;\r\n },\r\n desktopActive: false,\r\n setDesktopActive: (mode) => {\r\n mainNavigation.desktopActive = mode;\r\n }\r\n};\r\n\r\nexport const headerSearch = {\r\n active: false,\r\n setActive: (mode) => {\r\n headerSearch.active = mode;\r\n }\r\n};","import { viewport } from './global';\r\nimport { 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\r\nconst vpSizeCheck = (w,h) => {\r\n if(w != viewport.vw || h != viewport.vh) {\r\n window.requestAnimationFrame(() => {\r\n if(w != viewport.vw) {\r\n viewport.setVw(w);\r\n document.documentElement.style.setProperty('--vpWidth', `${viewport.vw}px`);\r\n }\r\n if(h != viewport.vh) {\r\n viewport.setVh(h);\r\n document.documentElement.style.setProperty('--vpHeight', `${viewport.vh}px`);\r\n }\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":["siteSettings","reducedMotionPref","window","matchMedia","matches","viewport","vw","vh","setVw","val","setVh","mainNavigation","mobileActive","setMobileActive","mode","desktopActive","setDesktopActive","headerSearch","active","setActive","ResizeObserver","Polyfill","$body","document","querySelector","vpSizeCheck","w","h","requestAnimationFrame","documentElement","style","setProperty","vpSizer","createElement","setAttribute","appendChild","entries","entry","cr","contentRect","width","height","observe"],"sourceRoot":""}