/* istanbul ignore next */

/*#__PURE__*/

/**
           * Do not `useEffect` here since `tryFocus` may trigger async
           * which makes React sync update the `activeKey`
           * that force render before `useRef` set the next activeKey
           */

/**
     * PopupTrigger is only used for vertical and horizontal types.
     * When collapsed is unfolded, the inline animation will destroy the vertical animation.
     */

/**
 * Cache callback function that always return same ref instead.
 * This is used for context optimization.
 */

/**
 * Find focused element within element set provided
 */

/**
 * Get `data-menu-id`
 */

/**
 * Get focusable elements from the element set under provided container
 */

/**
 * Menu modify after refactor:
 * ## Add
 * - disabled
 *
 * ## Remove
 * - openTransitionName
 * - openAnimation
 * - onDestroy
 * - siderCollapsed: Seems antd do not use this prop (Need test in antd)
 * - collapsedWidth: Seems this logic should be handle by antd Layout.Sider
 */

/**
 * Real Menu Item component
 */

/**
 * We simply convert `items` to ReactNode for reuse origin component logic. But we need move all the
 * logic from component into this hooks when in v5
 */

/**
 * `onClick` event return `info.item` which point to react node directly.
 * We should warning this since it will not work on FC.
 */

/***/

// ==================== Record KeyPath ====================

// ====================== Responsive ======================

// ======================= Context ========================

// ======================== Active ========================

// ======================== Context ==========================

// ======================== Effect ========================

// ======================== Render ========================

// ======================== Select ========================

// ========================= Open =========================

// ========================= Path =========================

// ========================= Path Register =========================

// ========================= Path Tracker ==========================

// ========================= Render ==========================

// ========================= Responsive =========================

// ========================== Click ==========================

// ========================== Mode ===========================

// ========================== Sibling ==========================

// =========================== Level ===========================

// =========================== Path User ===========================

// =========================== Render ===========================

// =========================== Visible ============================

// ============================ Render ============================

// ============================= Icon =============================

// ============================= Info =============================

// ================================ Icon ================================

// ================================= Effect =================================

// ================================= Render =================================

// >>>>> Children

// >>>>> List node

// >>>>> Render

// >>>>> Select keys

// >>>>> Trigger select

// Always wrap provider to avoid sub node re-mount

// Arrow prevent default to avoid page scroll

// Async should resync elements

// Cache

// Check the child if is undefined or null.

// Convert key to elements

// Delay to change visible

// FIXME: Move logic here in v5

// FIXME: hack with raf

// Fill map

// Find next focus index

// Find walkable focus menu element container

// Firefox Compatible

// First we should find current focused MenuItem/SubMenu element

// Fix for HOC usage like <FormatMessage />

// Fix radio button click twice

// Focus menu item

// Focus to link instead of menu item if possible

// Get wave color from target

// Hide inline list when mode changed and motion end

// Inline enter is special that we use unique operation

// Inline trigger no need switch to sub menu item

// Insert one space between two chinese characters automatically.

// Insert or Remove

// Key on the menu item will not get validate parent container

// Legacy convert key to array

// Legacy. Key will also trigger click event

// List current level menu item elements

// MenuItem & Divider

// MenuItemGroup & SubMenuItem

// Need wrap for overflow dropdown that do not response for open

// No need appear since nest inlineCollapse changed

// Normally should not reach this line

// Not white or transparent or grey

// Note: For legacy code is reversed which not like other antd component

// Pass origin key down event

// Pass to React.Children.map to auto fill key

// Patch for gap not support

// React 18 will merge mouse event which means we open key will not sync

// Register

// Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.

// Reset `open` to fix control mode tooltip display not correct

// Reset destroy state when mode change back

// Since Menu event provide the `info.item` which point to the MenuItem node instance.

// Skip if disabled

// Skip when disabled

// So we need render the element to check and pass back to rc-dropdown.

// Some mode do not have fully arrow operation like inline

// Still wrap with Trigger here since we need avoid react re-mount dom node

// Support call raf with delay specified frame

// Synchronously update MergedOpenKeys

// Tell dropdown that item clicked

// The inline list should remove when motion end.

// This should be removed from doc & api in future.

// Trigger event

// Trigger open by click when mode is `inline`

// Trigger open event in case its in control

// Util

// Warning for deprecated usage

// Warning if use other mode

// We do not really use this motionName

// We have to use class component here.

// We need find all related popup to close

// We record `destroy` mark here since when mode change from `inline` to others.

// We use origin list since wrapped list use context to prevent open

// Whatever selectable, always close it

// Where el is the DOM element you'd like to test for visibility

// Which makes motion failed

// [Legacy] Not sure why need this mark

// and clear timer after 'loadingOrDelay' updated.

// any transparent rgba color

// append to the DOM (needed to obtain scrollHeight)

// create flex container with row-gap set

// create two, elements inside it

// destruct to reduce minify size

// edge has bug on `removeAttribute` #14466

// eslint-disable-next-line consistent-return

// export this for test usage

// extracted by mini-css-extract-plugin

// flex container should be 1px high from the row-gap

// https://github.com/ant-design/ant-design/issues/30207

// in order to accept dynamic 'breakpoint' property, we need to add 'breakpoint' into dependency array.

// in order to not perform a React state update on an unmounted component

// inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性，则内部包裹一个 span

// optimize for render

// rc-dropdown already can process the function of overlay, but we have check logic here.

// ref: https://github.com/ant-design/ant-design/issues/16742

// ref: https://github.com/ant-design/ant-design/issues/38818

// ref: https://github.com/ant-design/ant-design/pull/23456

// restProps.expandIcon, Not mark as deps since this is a ReactNode

// strictNullChecks oops.
