import { c as _c } from "react/compiler-runtime";
import React from 'react';
import { Link, Text } from '../ink.js';
import type { PrReviewState } from '../utils/ghPrStatus.js';
type Props = {
  number: number;
  url: string;
  reviewState?: PrReviewState;
  bold?: boolean;
};
export function PrBadge(t0) {
  const $ = _c(21);
  const {
    number,
    url,
    reviewState,
    bold
  } = t0;
  let t1;
  if ($[0] !== reviewState) {
    t1 = getPrStatusColor(reviewState);
    $[0] = reviewState;
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const statusColor = t1;
  const t2 = !statusColor && !bold;
  let t3;
  if ($[2] !== bold || $[3] !== number || $[4] !== statusColor || $[5] !== t2) {
    t3 = <Text color={statusColor} dimColor={t2} bold={bold}>#{number}</Text>;
    $[2] = bold;
    $[3] = number;
    $[4] = statusColor;
    $[5] = t2;
    $[6] = t3;
  } else {
    t3 = $[6];
  }
  const label = t3;
  const t4 = !bold;
  let t5;
  if ($[7] !== t4) {
    t5 = <Text dimColor={t4}>PR</Text>;
    $[7] = t4;
    $[8] = t5;
  } else {
    t5 = $[8];
  }
  const t6 = !statusColor && !bold;
  let t7;
  if ($[9] !== bold || $[10] !== number || $[11] !== statusColor || $[12] !== t6) {
    t7 = <Text color={statusColor} dimColor={t6} underline={true} bold={bold}>#{number}</Text>;
    $[9] = bold;
    $[10] = number;
    $[11] = statusColor;
    $[12] = t6;
    $[13] = t7;
  } else {
    t7 = $[13];
  }
  let t8;
  if ($[14] !== label || $[15] !== t7 || $[16] !== url) {
    t8 = <Link url={url} fallback={label}>{t7}</Link>;
    $[14] = label;
    $[15] = t7;
    $[16] = url;
    $[17] = t8;
  } else {
    t8 = $[17];
  }
  let t9;
  if ($[18] !== t5 || $[19] !== t8) {
    t9 = <Text>{t5}{" "}{t8}</Text>;
    $[18] = t5;
    $[19] = t8;
    $[20] = t9;
  } else {
    t9 = $[20];
  }
  return t9;
}
function getPrStatusColor(state?: PrReviewState): 'success' | 'error' | 'warning' | 'merged' | undefined {
  switch (state) {
    case 'approved':
      return 'success';
    case 'changes_requested':
      return 'error';
    case 'pending':
      return 'warning';
    case 'merged':
      return 'merged';
    default:
      return undefined;
  }
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJSZWFjdCIsIkxpbmsiLCJUZXh0IiwiUHJSZXZpZXdTdGF0ZSIsIlByb3BzIiwibnVtYmVyIiwidXJsIiwicmV2aWV3U3RhdGUiLCJib2xkIiwiUHJCYWRnZSIsInQwIiwiJCIsIl9jIiwidDEiLCJnZXRQclN0YXR1c0NvbG9yIiwic3RhdHVzQ29sb3IiLCJ0MiIsInQzIiwibGFiZWwiLCJ0NCIsInQ1IiwidDYiLCJ0NyIsInQ4IiwidDkiLCJzdGF0ZSIsInVuZGVmaW5lZCJdLCJzb3VyY2VzIjpbIlByQmFkZ2UudHN4Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCdcbmltcG9ydCB7IExpbmssIFRleHQgfSBmcm9tICcuLi9pbmsuanMnXG5pbXBvcnQgdHlwZSB7IFByUmV2aWV3U3RhdGUgfSBmcm9tICcuLi91dGlscy9naFByU3RhdHVzLmpzJ1xuXG50eXBlIFByb3BzID0ge1xuICBudW1iZXI6IG51bWJlclxuICB1cmw6IHN0cmluZ1xuICByZXZpZXdTdGF0ZT86IFByUmV2aWV3U3RhdGVcbiAgYm9sZD86IGJvb2xlYW5cbn1cblxuZXhwb3J0IGZ1bmN0aW9uIFByQmFkZ2Uoe1xuICBudW1iZXIsXG4gIHVybCxcbiAgcmV2aWV3U3RhdGUsXG4gIGJvbGQsXG59OiBQcm9wcyk6IFJlYWN0LlJlYWN0Tm9kZSB7XG4gIGNvbnN0IHN0YXR1c0NvbG9yID0gZ2V0UHJTdGF0dXNDb2xvcihyZXZpZXdTdGF0ZSlcbiAgY29uc3QgbGFiZWwgPSAoXG4gICAgPFRleHQgY29sb3I9e3N0YXR1c0NvbG9yfSBkaW1Db2xvcj17IXN0YXR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