export function resolveProgressStepsForViewer(steps = [], options = {}) {
  const safeSteps = Array.isArray(steps) ? steps : []
  if (!options.isApplicationDocument || !options.isCurrentDirectManagerApprover) {
    return safeSteps
  }

  return safeSteps.map((step) => {
    if (!step?.current || step?.rawLabel !== '直属领导审批') {
      return step
    }
    const nextLabel = '等待批复'
    const currentLabel = String(step.label || '').trim()
    const title = String(step.title || '').trim()
    return {
      ...step,
      label: nextLabel,
      title: currentLabel && title.includes(currentLabel)
        ? title.replace(currentLabel, nextLabel)
        : title
    }
  })
}
