{"version":3,"file":"utils-f63516d3.js","sources":["../../../client/src/javascripts/customer_pages/_megamenu/utils.jsx"],"sourcesContent":["const href = (link) => {\n if (link.url === '@custom' || link.url === '@media') {\n return link.otherUrl;\n }\n\n return link.url || '#';\n}\n\nconst media_link = (link) => !!link.src;\n\nconst link_classes = (link) => {\n if (!!link.tag) {\n return link.tag;\n }\n}\n\nconst megamenu_wrapper = (link) => link.url === '@wrapper';\n\nconst megamenu_link_dropdown = (link) => {\n return typeof link.sublinks != 'undefined';\n}\n\nconst megamenu_link_flyout = (link) => {\n if (!!link.sublinks) {\n return link.sublinks.some(element => typeof element.sublinks != 'undefined');\n }\n}\n\nconst handleFlyoutMoreClick = (event, props) => {\n event.preventDefault();\n\n props.active ? props.onMouseLeave() : props.onMouseEnter();\n}\n\nconst handleTopLevelKeyPress = (event, props) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n\n props.onMouseEnter();\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n\n props.onMouseLeave();\n }\n};\n\nconst handleFlyoutKeypress = (event, props) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n\n props.onMouseLeave();\n }\n}\n\nexport { href, media_link,\n link_classes, megamenu_wrapper,\n megamenu_link_dropdown,\n megamenu_link_flyout,\n handleFlyoutKeypress,\n handleTopLevelKeyPress,\n handleFlyoutMoreClick\n };\n"],"names":["href","link","media_link","link_classes","megamenu_wrapper","megamenu_link_dropdown","megamenu_link_flyout","element","handleFlyoutMoreClick","event","props","handleTopLevelKeyPress","handleFlyoutKeypress"],"mappings":"AAAM,MAAAA,EAAQC,GACRA,EAAK,MAAQ,WAAaA,EAAK,MAAQ,SAClCA,EAAK,SAGPA,EAAK,KAAO,IAGfC,EAAcD,GAAS,CAAC,CAACA,EAAK,IAE9BE,EAAgBF,GAAS,CACzB,GAAEA,EAAK,IACT,OAAOA,EAAK,GAEhB,EAEMG,EAAoBH,GAASA,EAAK,MAAQ,WAE1CI,EAA0BJ,GACvB,OAAOA,EAAK,SAAY,IAG3BK,EAAwBL,GAAS,CACjC,GAAEA,EAAK,SACT,OAAOA,EAAK,SAAS,QAAgB,OAAOM,EAAQ,SAAY,GAAW,CAE/E,EAEMC,EAAwB,CAACC,EAAOC,IAAU,CAC9CD,EAAM,eAAe,EAErBC,EAAM,OAASA,EAAM,aAAa,EAAIA,EAAM,cAC9C,EAEMC,EAAyB,CAACF,EAAOC,IAAU,EAC3CD,EAAM,MAAQ,SAAWA,EAAM,MAAQ,OACzCA,EAAM,eAAe,EAErBC,EAAM,aAAa,GAGjBD,EAAM,MAAQ,WAChBA,EAAM,eAAe,EAErBC,EAAM,aAAa,EAEvB,EAEME,EAAuB,CAACH,EAAOC,IAAU,CACzCD,EAAM,MAAQ,WAChBA,EAAM,eAAe,EAErBC,EAAM,aAAa,EAEvB"}