"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var StatsBox_exports = {};
__export(StatsBox_exports, {
  StatsBox: () => StatsBox
});
module.exports = __toCommonJS(StatsBox_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_StyledBox = require("./StyledBox.js");
function formatTokenCount(count) {
  if (count >= 1e6) {
    return `${(count / 1e6).toFixed(1)}M`;
  }
  if (count >= 1e3) {
    return `${(count / 1e3).toFixed(1)}K`;
  }
  return count.toString();
}
function formatCost(cost) {
  if (cost < 0.01) {
    return `$${cost.toFixed(4)}`;
  }
  if (cost < 1) {
    return `$${cost.toFixed(3)}`;
  }
  return `$${cost.toFixed(2)}`;
}
function StatsBox({ data }) {
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_StyledBox.StyledBox, { title: "System Statistics", children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_StyledBox.StyledSection, { title: "Sessions", children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledBox.StyledRow, { label: "Total Sessions", value: data.sessions.total.toString() }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledBox.StyledRow, { label: "In Memory", value: data.sessions.inMemory.toString() }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledBox.StyledRow, { label: "Max Allowed", value: data.sessions.maxAllowed.toString() })
    ] }),
    /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_StyledBox.StyledSection, { title: "MCP Servers", children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Connected",
          value: data.mcp.connected.toString(),
          valueColor: "green"
        }
      ),
      data.mcp.failed > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledBox.StyledRow, { label: "Failed", value: data.mcp.failed.toString(), valueColor: "red" }),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StyledBox.StyledRow, { label: "Available Tools", value: data.mcp.toolCount.toString() })
    ] }),
    data.tokenUsage && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_StyledBox.StyledSection, { title: "Token Usage (This Session)", children: [
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Input",
          value: formatTokenCount(data.tokenUsage.inputTokens)
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Output",
          value: formatTokenCount(data.tokenUsage.outputTokens)
        }
      ),
      data.tokenUsage.reasoningTokens > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Reasoning",
          value: formatTokenCount(data.tokenUsage.reasoningTokens)
        }
      ),
      data.tokenUsage.cacheReadTokens > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Cache Read",
          value: formatTokenCount(data.tokenUsage.cacheReadTokens),
          valueColor: "cyan"
        }
      ),
      data.tokenUsage.cacheWriteTokens > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Cache Write",
          value: formatTokenCount(data.tokenUsage.cacheWriteTokens),
          valueColor: "orange"
        }
      ),
      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Total",
          value: formatTokenCount(data.tokenUsage.totalTokens),
          valueColor: "blue"
        }
      ),
      data.estimatedCost !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
        import_StyledBox.StyledRow,
        {
          label: "Est. Cost",
          value: formatCost(data.estimatedCost),
          valueColor: "green"
        }
      )
    ] })
  ] });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  StatsBox
});
