/**
 * Parses a measure-list string from the HubSpot pull pipeline.
 *
 * HubSpot's `proposed_measures` field is delivered as a semicolon-separated
 * list (its native multi-select format). Earlier records were sometimes stored
 * as comma-separated strings, and freeform text from contractors may use either
 * separator. To keep the UI tolerant we accept both `;` and `,` as delimiters.
 *
 * Empty / whitespace-only inputs return `[]`. Individual entries are trimmed
 * and any blank entries (e.g. from a trailing separator) are dropped.
 */
export function parseMeasures(raw: string | null | undefined): string[] {
  if (!raw) return [];
  // Tolerant strategy: split on either `;` or `,`. HubSpot's multi-select
  // exports use `;` natively; legacy values and ad-hoc text may use `,`.
  return raw
    .split(/[;,]/)
    .map((m) => m.trim())
    .filter(Boolean);
}
