function findChildrenItem(nodes, targetValue, options = { valueKey: "value", childrenKey: "children" }) {
  const valueField = options?.valueKey;
  const childrenField = options?.childrenKey;
  for (const nodeItem of nodes) {
    const currentNode = nodeItem;
    if (currentNode[valueField] === targetValue) {
      return nodeItem;
    }
    if (currentNode[childrenField]) {
      const found = findChildrenItem(currentNode[childrenField], targetValue, options);
      if (found) {
        return found;
      }
    }
  }
  return void 0;
}

export { findChildrenItem };
//# sourceMappingURL=findChildrenItem.mjs.map
