File size: 1,513 Bytes
39e315a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 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;
}
|