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CT,GAER,GAAG,CAACK,KAGArD,EAAAA,EAAAA,GAAA,MAAIC,UAAS,mBAAAC,OAAqBuD,IAC7BhB,EAAS3C,MAAMK,KAAI,SAAAC,GAAI,OACpBJ,EAAAA,EAAAA,GAACY,GAAY4D,EAAAA,EAAAA,GAAA,GACLpE,EAAI,CACRtB,IAAKsB,EAAKC,GACVY,OAAQoC,GAAiBjD,EAAKM,SAC9BQ,mBAAoBA,EACpBC,cAAeA,EACfH,mBAAoB2C,IACtB,IAIlB,G","sources":["webpack://nop-theme-base/./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","webpack://nop-theme-base/./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","webpack://nop-theme-base/./src/components/megaMenu/MegaMenu.js"],"sourcesContent":["import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","import { h, render } from 'preact'\nimport { useState, useEffect } from 'preact/hooks'\nimport { memo } from 'preact/compat'\nimport { useSize } from 'utils/dom'\n\nfunction MegaDropdown({ items, cssClass }) {\n return (\n
\n
\n {items.map(item => (\n \n ))}\n
\n
\n )\n}\n\nfunction MegaMenuItem({\n id,\n openInNewWindow,\n subItems,\n title,\n type,\n seName,\n url,\n cssClass,\n active,\n\n onClearActiveItems,\n onSetDropdownItems,\n onSetCssClass,\n ...rest\n}) { \n const handleClick = (e) => {\n // follow link \n if (!subItems.length > 0) {\n return; \n }\n\n e.preventDefault();\n\n // Unset active on other items\n onClearActiveItems()\n\n // Tilt the chevron down for this item\n e.target.parentElement.classList.add('active')\n\n // Add css classes from menu builder\n onSetCssClass(cssClass)\n\n // Swap out sub categories\n onSetDropdownItems(subItems.length > 0 ? subItems : [])\n\n // Close other drawers\n window._drawerManager.closeAllExcept('menu')\n }\n\n return (
  • \n {(url || seName) ? (\n \n {title}\n\n {subItems?.length > 0 && (\n \n )}\n \n ) : (\n \n {title}\n \n {subItems?.length > 0 && (\n \n )}\n \n )}\n
  • )\n}\n\nfunction MegaMenu() {\n // initial data from server side render\n const megaMenu = window.CRITICAL_STATE.menu.megaMenus[0]\n\n // elements to use\n const backdrop = document.querySelector('.modal-overlay')\n const modalMenu = document.querySelector('#modal-menu');\n\n // component state\n const [dropdownItems, setDropdownItems] = useState([])\n const [currentCssClass, setCurrentCssClass] = useState('')\n\n // sets current css class, from admin ui for each menu\n const onSetCssClass = cssClass => setCurrentCssClass(cssClass)\n\n // remove chevron rotations\n const clearActiveLinks = () => {\n const topLevelMenuItems = Array.from(document.querySelectorAll('.menu-categories > li'))\n\n if (topLevelMenuItems.length > 0) {\n topLevelMenuItems.map(li => li.classList.toggle('active', false))\n }\n }\n\n // update dropdown items\n const onSetDropdownItems = (items) => {\n // The user clicked the same menu item twice\n if (items === dropdownItems) {\n setDropdownItems([])\n clearActiveLinks()\n window._drawerManager.closeAll()\n return; \n }\n\n setDropdownItems(items)\n }\n\n // clear state\n const clear = () => {\n setDropdownItems([])\n clearActiveLinks()\n }\n\n // on mount interactions\n useEffect(() => {\n backdrop.addEventListener('click', clear);\n\n // reset state when user presses the back button in the browser\n window.addEventListener(\"pageshow\", () => {\n clear();\n });\n }, [])\n\n // listen to new dropdown items\n useEffect(() => {\n // dont do anything \n if (!dropdownItems.length) return; \n\n // Disable other modals with app instance\n window._drawerManager.open('menu')\n\n // re-render the dropdown menu with new items & possibly a new css class\n render(\n ,\n modalMenu,\n );\n }, [dropdownItems])\n\n return (\n \n );\n}\n\nexport default memo(MegaMenu);"],"names":["_objectWithoutProperties","source","excluded","key","i","target","Object","getOwnPropertySymbols","sourceSymbolKeys","length","indexOf","prototype","propertyIsEnumerable","call","_objectWithoutPropertiesLoose","sourceKeys","keys","MegaDropdown","_ref","items","cssClass","h","className","concat","map","item","id","url","seName","href","title","subItems","subItem","MegaMenuItem","_ref2","openInNewWindow","type","onClearActiveItems","active","onSetDropdownItems","onSetCssClass","handleClick","_excluded","e","preventDefault","parentElement","classList","add","window","_drawerManager","closeAllExcept","onClick","rel","width","height","viewBox","fill","xmlns","d","role","tabIndex","memo","megaMenu","CRITICAL_STATE","menu","megaMenus","backdrop","document","querySelector","modalMenu","_useState","useState","_useState2","_slicedToArray","dropdownItems","setDropdownItems","_useState3","_useState4","currentCssClass","setCurrentCssClass","clearActiveLinks","topLevelMenuItems","Array","from","querySelectorAll","li","toggle","closeAll","clear","useEffect","addEventListener","open","render","_extends"],"sourceRoot":""}