import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../../../../components/ui/accordion.js";
import { Card, CardContent, CardHeader, CardTitle } from "../../../../components/ui/card.js";
import CompletionMessagePaper_default from "../../../../components/messages/CompletionMessagePaper.js";
import { c } from "react/compiler-runtime";
import React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
var PromptDetails_default = (p) => {
	let m = c(40), { promptData: h } = p;
	if (!h) return null;
	let { messages: g, response: _, cache: v } = h, y;
	m[0] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ jsx(CardHeader, {
		className: "pb-3",
		children: /* @__PURE__ */ jsx(CardTitle, {
			className: "text-lg",
			children: "Cache"
		})
	}), m[0] = y) : y = m[0];
	let b = v?.hit ? "Yes" : "No", x;
	m[1] === b ? x = m[2] : (x = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: ["Hit: ", b]
	}), m[1] = b, m[2] = x);
	let S = v?.hash, C;
	m[3] === S ? C = m[4] : (C = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: ["Hash: ", S]
	}), m[3] = S, m[4] = C);
	let w;
	m[5] !== x || m[6] !== C ? (w = /* @__PURE__ */ jsxs(Card, { children: [y, /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", {
		className: "ml-4 space-y-1",
		children: [x, C]
	}) })] }), m[5] = x, m[6] = C, m[7] = w) : w = m[7];
	let T;
	m[8] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ jsx(AccordionTrigger, {
		className: "text-lg font-semibold",
		children: "Request Messages"
	}), m[8] = T) : T = m[8];
	let E;
	m[9] === g ? E = m[10] : (E = g?.map(_temp), m[9] = g, m[10] = E);
	let D;
	m[11] === E ? D = m[12] : (D = /* @__PURE__ */ jsx(Accordion, {
		type: "single",
		collapsible: !0,
		defaultValue: "messages",
		children: /* @__PURE__ */ jsxs(AccordionItem, {
			value: "messages",
			children: [T, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx("div", {
				className: "space-y-2",
				children: E
			}) })]
		})
	}), m[11] = E, m[12] = D);
	let O;
	m[13] === Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ jsx(AccordionTrigger, {
		className: "text-lg font-semibold",
		children: "Response"
	}), m[13] = O) : O = m[13];
	let k = _?.data, A;
	m[14] === k ? A = m[15] : (A = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, {
		className: "p-4",
		children: /* @__PURE__ */ jsx("pre", {
			className: "font-mono text-xs wrap-break-word whitespace-pre-wrap",
			children: k
		})
	}) }), m[14] = k, m[15] = A);
	let j;
	m[16] === Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ jsx(CardHeader, {
		className: "pb-3",
		children: /* @__PURE__ */ jsx(CardTitle, {
			className: "text-base",
			children: "Metadata"
		})
	}), m[16] = j) : j = m[16];
	let M = _?.metadata?.model, N;
	m[17] === M ? N = m[18] : (N = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: ["Model: ", M]
	}), m[17] = M, m[18] = N);
	let P = _?.metadata?.prompt_id, F;
	m[19] === P ? F = m[20] : (F = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: ["Prompt ID: ", P]
	}), m[19] = P, m[20] = F);
	let I = _?.metadata?.response_time, L;
	m[21] === I ? L = m[22] : (L = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: [
			"Response Time: ",
			I,
			" ms"
		]
	}), m[21] = I, m[22] = L);
	let R = _?.metadata?.prompt_token, z;
	m[23] === R ? z = m[24] : (z = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: ["Prompt Tokens: ", R]
	}), m[23] = R, m[24] = z);
	let B = _?.metadata?.completion_token, V;
	m[25] === B ? V = m[26] : (V = /* @__PURE__ */ jsxs("p", {
		className: "text-sm",
		children: ["Completion Tokens: ", B]
	}), m[25] = B, m[26] = V);
	let H;
	m[27] !== N || m[28] !== F || m[29] !== L || m[30] !== z || m[31] !== V ? (H = /* @__PURE__ */ jsxs(Card, {
		className: "bg-gray-50",
		children: [j, /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", {
			className: "ml-4 space-y-1",
			children: [
				N,
				F,
				L,
				z,
				V
			]
		}) })]
	}), m[27] = N, m[28] = F, m[29] = L, m[30] = z, m[31] = V, m[32] = H) : H = m[32];
	let U;
	m[33] !== A || m[34] !== H ? (U = /* @__PURE__ */ jsx(Accordion, {
		type: "single",
		collapsible: !0,
		defaultValue: "response",
		children: /* @__PURE__ */ jsxs(AccordionItem, {
			value: "response",
			children: [O, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsxs("div", {
				className: "space-y-4",
				children: [A, H]
			}) })]
		})
	}), m[33] = A, m[34] = H, m[35] = U) : U = m[35];
	let W;
	return m[36] !== U || m[37] !== w || m[38] !== D ? (W = /* @__PURE__ */ jsxs("div", {
		className: "mt-4 space-y-4",
		children: [
			w,
			D,
			U
		]
	}), m[36] = U, m[37] = w, m[38] = D, m[39] = W) : W = m[39], W;
};
function _temp(t, f) {
	return /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
		role: t.role,
		children: t.content
	}, f);
}
export { PromptDetails_default as default };
