import { c as _c } from "react/compiler-runtime";
import React from 'react';
import { Text } from '../../ink.js';
import { formatDuration } from '../../utils/format.js';
type Props = {
  elapsedTimeSeconds?: number;
  timeoutMs?: number;
};
export function ShellTimeDisplay(t0) {
  const $ = _c(10);
  const {
    elapsedTimeSeconds,
    timeoutMs
  } = t0;
  if (elapsedTimeSeconds === undefined && !timeoutMs) {
    return null;
  }
  let t1;
  if ($[0] !== timeoutMs) {
    t1 = timeoutMs ? formatDuration(timeoutMs, {
      hideTrailingZeros: true
    }) : undefined;
    $[0] = timeoutMs;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const timeout = t1;
  if (elapsedTimeSeconds === undefined) {
    const t2 = `(timeout ${timeout})`;
    let t3;
    if ($[2] !== t2) {
      t3 = <Text dimColor={true}>{t2}</Text>;
      $[2] = t2;
      $[3] = t3;
    } else {
      t3 = $[3];
    }
    return t3;
  }
  const t2 = elapsedTimeSeconds * 1000;
  let t3;
  if ($[4] !== t2) {
    t3 = formatDuration(t2);
    $[4] = t2;
    $[5] = t3;
  } else {
    t3 = $[5];
  }
  const elapsed = t3;
  if (timeout) {
    const t4 = `(${elapsed} · timeout ${timeout})`;
    let t5;
    if ($[6] !== t4) {
      t5 = <Text dimColor={true}>{t4}</Text>;
      $[6] = t4;
      $[7] = t5;
    } else {
      t5 = $[7];
    }
    return t5;
  }
  const t4 = `(${elapsed})`;
  let t5;
  if ($[8] !== t4) {
    t5 = <Text dimColor={true}>{t4}</Text>;
    $[8] = t4;
    $[9] = t5;
  } else {
    t5 = $[9];
  }
  return t5;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSZWFjdCIsIlRleHQiLCJmb3JtYXREdXJhdGlvbiIsIlByb3BzIiwiZWxhcHNlZFRpbWVTZWNvbmRzIiwidGltZW91dE1zIiwiU2hlbGxUaW1lRGlzcGxheSIsInQwIiwiJCIsIl9jIiwidW5kZWZpbmVkIiwidDEiLCJoaWRlV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