function isUsableItem(item, idsMenu) {
  const isItem = item instanceof IdsMenuItem;
  if (!isItem) {
    return false;
  }

  // The item is only usable if it's contained by the correct IdsMenu
  const menuHasItem = idsMenu.contains(item);

  // In some nested cases, we need to detect the item's Shadow Root containment to accurately
  // figure out if it's slotted inside the same menu.
  const closestItemRoot = IdsDOMUtils.getClosestRootNode(item.assignedSlot);
  const itemInMenuShadow = closestItemRoot?.menu?.isEqualNode(idsMenu);

  return (itemInMenuShadow || menuHasItem) && !item.disabled;
}
/**
 * @private
 * @param {IdsMenuItem} item the element to be checked
 * @param {HTMLElement} idsMenu the parent menu element
 * @returns {boolean} true if the provided element is a "currently-usable" IdsMenuItem type.
 */
@private
@param {IdsMenuItem} item the element to be checked
@param {HTMLElement} idsMenu the parent menu element
@returns {boolean} true if the provided element is a "currently-usable" IdsMenuItem type.
@private @param { IdsMenuItem } item the element to be checked @param { HTMLElement } idsMenu the parent menu element @returns { boolean } true if the provided element is a " currently - usable " IdsMenuItem type .
function isUsableItem(item, idsMenu) {
  const isItem = item instanceof IdsMenuItem;
  if (!isItem) {
    return false;
  }
  const menuHasItem = idsMenu.contains(item);
  const closestItemRoot = IdsDOMUtils.getClosestRootNode(item.assignedSlot);
  const itemInMenuShadow = closestItemRoot?.menu?.isEqualNode(idsMenu);
  return (itemInMenuShadow || menuHasItem) && !item.disabled;
}
function isUsableItem ( item , idsMenu ) { const isItem = item instanceof IdsMenuItem ; if ( ! isItem ) { return false ; } const menuHasItem = idsMenu . contains ( item ) ; const closestItemRoot = IdsDOMUtils . getClosestRootNode ( item . assignedSlot ) ; const itemInMenuShadow = closestItemRoot ?. menu ?. isEqualNode ( idsMenu ) ; return ( itemInMenuShadow || menuHasItem ) && ! item . disabled ; }
@private
 @param {IdsMenuItem} item the element to be checked
 @param {HTMLElement} idsMenu the parent menu element
 @returns {boolean} true if the provided element is a "currently-usable" IdsMenuItem type.
@private @param { IdsMenuItem } item the element to be checked @param { HTMLElement } idsMenu the parent menu element @returns { boolean } true if the provided element is a " currently - usable " IdsMenuItem type .
// The item is only usable if it's contained by the correct IdsMenu // In some nested cases, we need to detect the item's Shadow Root containment to accurately // figure out if it's slotted inside the same menu.