"use strict";

exports.__esModule = true;
exports.useBulkActionMobileGroups = useBulkActionMobileGroups;
/**
 * Hook to build mobile action groups for the bulk action toolbar.
 * Combines primary and secondary bulk actions into grouped sections for mobile view.
 */
function useBulkActionMobileGroups({
  primaryActionItems,
  secondaryActionItems,
  moreActionsLabel
}) {
  const primaryGroup = primaryActionItems.flatMap(actionItem => {
    if (!actionItem.subItems) {
      return [actionItem];
    }
    return [{
      sectionTitle: actionItem.label
    }, ...actionItem.subItems.flat()];
  });
  const secondaryFlat = [{
    sectionTitle: moreActionsLabel
  }, ...secondaryActionItems.flat()];
  const groups = [];
  if (primaryGroup.length > 0) {
    groups.push(primaryGroup);
  }
  // array is at least of size 1 because of the hardcoded moreActionsLabel
  if (secondaryFlat.length > 1) {
    groups.push(secondaryFlat);
  }
  return groups;
}
//# sourceMappingURL=useBulkActionMobileGroups.js.map