function use_navigation_tree_item_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function use_navigation_tree_item_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { use_navigation_tree_item_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { use_navigation_tree_item_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var use_navigation_tree_item_useNavigationTreeItem = function useNavigationTreeItem(itemId, props) {
var _useNavigationContext = context_useNavigationContext(),
activeMenu = _useNavigationContext.activeMenu,
_useNavigationContext2 = _useNavigationContext.navigationTree,
addItem = _useNavigationContext2.addItem,
removeItem = _useNavigationContext2.removeItem;
var _useNavigationGroupCo = context_useNavigationGroupContext(),
group = _useNavigationGroupCo.group;
var _useNavigationMenuCon = context_useNavigationMenuContext(),
menu = _useNavigationMenuCon.menu,
search = _useNavigationMenuCon.search;
Object(external_wp_element_["useEffect"])(function () {
var isMenuActive = activeMenu === menu;
var isItemVisible = !search || normalizedSearch(props.title, search);
addItem(itemId, use_navigation_tree_item_objectSpread(use_navigation_tree_item_objectSpread({}, props), {}, {
_isVisible: isMenuActive && isItemVisible
}, [activeMenu, search]);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base.js
function NavigationItemBase(props) {
var _navigationTree$getIt;
var children = props.children,
className = props.className,
restProps = Object(objectWithoutProperties["a" /* default */])(props, ["children", "className"]);
var _useState = Object(external_wp_element_["useState"])(Object(external_lodash_["uniqueId"])('item-')),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 1),
use_navigation_tree_item_useNavigationTreeItem(itemId, props);
var _useNavigationContext = context_useNavigationContext(),
navigationTree = _useNavigationContext.navigationTree;
if (!((_navigationTree$getIt = navigationTree.getItem(itemId)) !== null && _navigationTree$getIt !== void 0 && _navigationTree$getIt._isVisible)) {
var classes = classnames_default()('components-navigation__item', className);
return Object(external_wp_element_["createElement"])(ItemBaseUI, Object(esm_extends["a" /* default */])({
}, restProps), children);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/index.js
function item_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function item_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { item_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { item_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function NavigationItem(props) {
children = props.children,
className = props.className,
navigateToMenu = props.navigateToMenu,
_props$onClick = props.onClick,
onClick = _props$onClick === void 0 ? external_lodash_["noop"] : _props$onClick,
hideIfTargetMenuEmpty = props.hideIfTargetMenuEmpty,
restProps = Object(objectWithoutProperties["a" /* default */])(props, ["badge", "children", "className", "href", "item", "navigateToMenu", "onClick", "title", "hideIfTargetMenuEmpty", "isText"]);
var _useNavigationContext = context_useNavigationContext(),
activeItem = _useNavigationContext.activeItem,
setActiveMenu = _useNavigationContext.setActiveMenu,
isMenuEmpty = _useNavigationContext.navigationTree.isMenuEmpty; // If hideIfTargetMenuEmpty prop is true
// And the menu we are supposed to navigate to
// Is marked as empty, then we skip rendering the item
if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {
var classes = classnames_default()(className, {
'is-active': item && activeItem === item
var onItemClick = function onItemClick(event) {
setActiveMenu(navigateToMenu);
var icon = Object(external_wp_i18n_["isRTL"])() ? chevron_left["a" /* default */] : chevron_right["a" /* default */];
var baseProps = isText ? restProps : item_objectSpread({
as: build_module_button["a" /* default */],
return Object(external_wp_element_["createElement"])(NavigationItemBase, Object(esm_extends["a" /* default */])({}, props, {
}), children || Object(external_wp_element_["createElement"])(ItemUI, baseProps, Object(external_wp_element_["createElement"])(NavigationItemBaseContent, {
}), navigateToMenu && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/use-navigation-tree-menu.js
function use_navigation_tree_menu_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function use_navigation_tree_menu_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { use_navigation_tree_menu_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { use_navigation_tree_menu_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var use_navigation_tree_menu_useNavigationTreeMenu = function useNavigationTreeMenu(props) {
var _useNavigationContext = context_useNavigationContext(),
_useNavigationContext2 = _useNavigationContext.navigationTree,
addMenu = _useNavigationContext2.addMenu,
removeMenu = _useNavigationContext2.removeMenu;
var key = props.menu || ROOT_MENU;
Object(external_wp_element_["useEffect"])(function () {
addMenu(key, use_navigation_tree_menu_objectSpread(use_navigation_tree_menu_objectSpread({}, props), {}, {
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
var library_search = __webpack_require__("cGtP");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title-search.js
function MenuTitleSearch(_ref) {
var debouncedSpeak = _ref.debouncedSpeak,
onCloseSearch = _ref.onCloseSearch,
onSearch = _ref.onSearch,
var _useNavigationContext = context_useNavigationContext(),
items = _useNavigationContext.navigationTree.items;
var _useNavigationMenuCon = context_useNavigationMenuContext(),
menu = _useNavigationMenuCon.menu;
var inputRef = Object(external_wp_element_["useRef"])(); // Wait for the slide-in animation to complete before autofocusing the input.
// This prevents scrolling to the input during the animation.
Object(external_wp_element_["useEffect"])(function () {
var delayedFocus = setTimeout(function () {
inputRef.current.focus();
clearTimeout(delayedFocus);
Object(external_wp_element_["useEffect"])(function () {
var count = Object(external_lodash_["filter"])(items, '_isVisible').length;
var resultsFoundMessage = Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of results. */
Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', count), count);
debouncedSpeak(resultsFoundMessage);
var onClose = function onClose() {
function onKeyDown(event) {
if (event.keyCode === external_wp_keycodes_["ESCAPE"]) {
var menuTitleId = "components-navigation__menu-title-".concat(menu);
var inputId = "components-navigation__menu-title-search-".concat(menu);
/* translators: placeholder for menu search box. %s: menu title */
var placeholder = Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Search in %s'), title);
return Object(external_wp_element_["createElement"])(MenuTitleSearchUI, {
className: "components-navigation__menu-title-search"
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: library_search["a" /* default */]
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
}, placeholder), Object(external_wp_element_["createElement"])("input", {
className: "components-text-control__input",
onChange: function onChange(event) {
return onSearch(event.target.value);
placeholder: placeholder,
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
label: Object(external_wp_i18n_["__"])('Close search'),
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: close_small["a" /* default */]
/* harmony default export */ var menu_title_search = (with_spoken_messages(MenuTitleSearch));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title.js
function NavigationMenuTitle(_ref) {
var hasSearch = _ref.hasSearch,
onSearch = _ref.onSearch,
titleAction = _ref.titleAction;
var _useState = Object(external_wp_element_["useState"])(false),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
isSearching = _useState2[0],
setIsSearching = _useState2[1];
var _useNavigationMenuCon = context_useNavigationMenuContext(),
menu = _useNavigationMenuCon.menu;
var searchButtonRef = Object(external_wp_element_["useRef"])();
var onCloseSearch = function onCloseSearch() {
setIsSearching(false); // Wait for the slide-in animation to complete before focusing the search button.
// eslint-disable-next-line @wordpress/react-no-unsafe-timeout
searchButtonRef.current.focus();
var menuTitleId = "components-navigation__menu-title-".concat(menu);
/* translators: search button label for menu search box. %s: menu title */
var searchButtonLabel = Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Search in %s'), title);
return Object(external_wp_element_["createElement"])(MenuTitleUI, {
className: "components-navigation__menu-title"
}, !isSearching && Object(external_wp_element_["createElement"])(MenuTitleHeadingUI, {
className: "components-navigation__menu-title-heading",
}, Object(external_wp_element_["createElement"])("span", {
}, title), (hasSearch || titleAction) && Object(external_wp_element_["createElement"])(MenuTitleActionsUI, null, titleAction, hasSearch && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
label: searchButtonLabel,
onClick: function onClick() {
return setIsSearching(true);
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: library_search["a" /* default */]
})))), isSearching && Object(external_wp_element_["createElement"])("div", {
className: Object(animate["b" /* getAnimateClassName */])({
}, Object(external_wp_element_["createElement"])(menu_title_search, {
onCloseSearch: onCloseSearch,
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/search-no-results-found.js
function NavigationSearchNoResultsFound(_ref) {
var search = _ref.search;
var _useNavigationContext = context_useNavigationContext(),
items = _useNavigationContext.navigationTree.items;
var resultsCount = Object(external_lodash_["filter"])(items, '_isVisible').length;
if (!search || !!resultsCount) {
return Object(external_wp_element_["createElement"])(ItemBaseUI, null, Object(external_wp_element_["createElement"])(ItemUI, null, Object(external_wp_i18n_["__"])('No results found.'), " "));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/index.js
function NavigationMenu(props) {
var backButtonLabel = props.backButtonLabel,
children = props.children,
className = props.className,
hasSearch = props.hasSearch,
_props$menu = props.menu,
menu = _props$menu === void 0 ? ROOT_MENU : _props$menu,
onBackButtonClick = props.onBackButtonClick,
setControlledSearch = props.onSearch,
parentMenu = props.parentMenu,
controlledSearch = props.search,
isSearchDebouncing = props.isSearchDebouncing,
titleAction = props.titleAction;
var _useState = Object(external_wp_element_["useState"])(''),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
uncontrolledSearch = _useState2[0],
setUncontrolledSearch = _useState2[1];
use_navigation_tree_menu_useNavigationTreeMenu(props);
var _useNavigationContext = context_useNavigationContext(),
activeMenu = _useNavigationContext.activeMenu;
search: uncontrolledSearch
}; // Keep the children rendered to make sure invisible items are included in the navigation tree