import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../../../../components/ui/accordion.js";
import { Badge } from "../../../../components/ui/badge.js";
import { Card, CardContent } from "../../../../components/ui/card.js";
import { c } from "react/compiler-runtime";
import React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import { Code, FileText, Tag } from "lucide-react";
var formatDate = (e) => {
	try {
		return new Date(e).toLocaleString();
	} catch {
		return e;
	}
}, DocumentDetails_default = (he) => {
	let n = c(101), { data: r } = he;
	if (!r) return null;
	let i;
	n[0] === r.schema ? i = n[1] : (i = typeof r.schema == "string" ? r.schema : JSON.stringify(r.schema, null, 2), n[0] = r.schema, n[1] = i);
	let ge = i, a;
	n[2] === r.content ? a = n[3] : (a = typeof r.content == "string" ? r.content : JSON.stringify(r.content, null, 2), n[2] = r.content, n[3] = a);
	let _e = a, o;
	n[4] === Symbol.for("react.memo_cache_sentinel") ? (o = [
		"document-info",
		"content",
		"schema"
	], n[4] = o) : o = n[4];
	let s;
	n[5] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ jsx(AccordionTrigger, {
		className: "text-base font-semibold",
		children: /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }), "Document Information"]
		})
	}), n[5] = s) : s = n[5];
	let l;
	n[6] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "ID:"
	}), n[6] = l) : l = n[6];
	let u;
	n[7] === r.id ? u = n[8] : (u = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			l,
			" ",
			r.id
		]
	}), n[7] = r.id, n[8] = u);
	let d;
	n[9] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Name:"
	}), n[9] = d) : d = n[9];
	let f;
	n[10] === r.name ? f = n[11] : (f = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			d,
			" ",
			r.name
		]
	}), n[10] = r.name, n[11] = f);
	let p;
	n[12] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Version:"
	}), n[12] = p) : p = n[12];
	let m;
	n[13] === r.version ? m = n[14] : (m = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			p,
			" ",
			r.version
		]
	}), n[13] = r.version, n[14] = m);
	let h;
	n[15] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Index:"
	}), n[15] = h) : h = n[15];
	let g;
	n[16] === r.index ? g = n[17] : (g = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			h,
			" ",
			r.index
		]
	}), n[16] = r.index, n[17] = g);
	let _;
	n[18] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ jsx("div", {
		className: "mb-2 text-sm font-medium",
		children: "Labels:"
	}), n[18] = _) : _ = n[18];
	let v;
	n[19] === r.labels ? v = n[20] : (v = r.labels && r.labels.length > 0 ? r.labels.map(_temp) : /* @__PURE__ */ jsx("span", {
		className: "text-muted-foreground text-sm",
		children: "None"
	}), n[19] = r.labels, n[20] = v);
	let y;
	n[21] === v ? y = n[22] : (y = /* @__PURE__ */ jsxs("div", {
		className: "pt-2",
		children: [_, /* @__PURE__ */ jsx("div", {
			className: "flex flex-wrap gap-2",
			children: v
		})]
	}), n[21] = v, n[22] = y);
	let b;
	n[23] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ jsx("div", {
		className: "mb-2 text-sm font-medium",
		children: "Tags:"
	}), n[23] = b) : b = n[23];
	let x;
	n[24] === r.tags ? x = n[25] : (x = r.tags && r.tags.length > 0 ? r.tags.map(_temp2) : /* @__PURE__ */ jsx("span", {
		className: "text-muted-foreground text-sm",
		children: "None"
	}), n[24] = r.tags, n[25] = x);
	let S;
	n[26] === x ? S = n[27] : (S = /* @__PURE__ */ jsxs("div", {
		className: "pt-2",
		children: [b, /* @__PURE__ */ jsx("div", {
			className: "flex flex-wrap gap-2",
			children: x
		})]
	}), n[26] = x, n[27] = S);
	let C;
	n[28] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Created:"
	}), n[28] = C) : C = n[28];
	let w;
	n[29] === r.createdAt ? w = n[30] : (w = formatDate(r.createdAt), n[29] = r.createdAt, n[30] = w);
	let T;
	n[31] === w ? T = n[32] : (T = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			C,
			" ",
			w
		]
	}), n[31] = w, n[32] = T);
	let E;
	n[33] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Updated:"
	}), n[33] = E) : E = n[33];
	let D;
	n[34] === r.updatedAt ? D = n[35] : (D = formatDate(r.updatedAt), n[34] = r.updatedAt, n[35] = D);
	let O;
	n[36] === D ? O = n[37] : (O = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			E,
			" ",
			D
		]
	}), n[36] = D, n[37] = O);
	let k;
	n[38] !== T || n[39] !== O ? (k = /* @__PURE__ */ jsxs("div", {
		className: "space-y-1 pt-2",
		children: [T, O]
	}), n[38] = T, n[39] = O, n[40] = k) : k = n[40];
	let A;
	n[41] === Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Workspace ID:"
	}), n[41] = A) : A = n[41];
	let j;
	n[42] === r.workspaceId ? j = n[43] : (j = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			A,
			" ",
			r.workspaceId
		]
	}), n[42] = r.workspaceId, n[43] = j);
	let M;
	n[44] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Pipeline ID:"
	}), n[44] = M) : M = n[44];
	let N;
	n[45] === r.pipelineId ? N = n[46] : (N = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			M,
			" ",
			r.pipelineId
		]
	}), n[45] = r.pipelineId, n[46] = N);
	let P;
	n[47] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Workflow ID:"
	}), n[47] = P) : P = n[47];
	let F;
	n[48] === r.workflowId ? F = n[49] : (F = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			P,
			" ",
			r.workflowId
		]
	}), n[48] = r.workflowId, n[49] = F);
	let I;
	n[50] !== j || n[51] !== N || n[52] !== F ? (I = /* @__PURE__ */ jsxs("div", {
		className: "space-y-1 pt-2",
		children: [
			j,
			N,
			F
		]
	}), n[50] = j, n[51] = N, n[52] = F, n[53] = I) : I = n[53];
	let L;
	n[54] === r.meta ? L = n[55] : (L = r.meta?.mimeType && /* @__PURE__ */ jsxs("div", {
		className: "pt-2 text-sm",
		children: [
			/* @__PURE__ */ jsx("span", {
				className: "font-medium",
				children: "MIME Type:"
			}),
			" ",
			r.meta.mimeType
		]
	}), n[54] = r.meta, n[55] = L);
	let R;
	n[56] === r.meta ? R = n[57] : (R = r.meta?.enableAtPlaces && /* @__PURE__ */ jsxs("div", {
		className: "pt-2",
		children: [/* @__PURE__ */ jsx("div", {
			className: "mb-2 text-sm font-medium",
			children: "Enable At Places:"
		}), /* @__PURE__ */ jsx("div", {
			className: "flex flex-wrap gap-2",
			children: r.meta.enableAtPlaces.map(_temp3)
		})]
	}), n[56] = r.meta, n[57] = R);
	let z;
	n[58] === r.meta ? z = n[59] : (z = r.meta && Object.entries(r.meta).filter(_temp4).map(_temp5), n[58] = r.meta, n[59] = z);
	let B;
	n[60] === Symbol.for("react.memo_cache_sentinel") ? (B = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Invalidated:"
	}), n[60] = B) : B = n[60];
	let ve = r.isInvalidated ? "Yes" : "No", V;
	n[61] === ve ? V = n[62] : (V = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			B,
			" ",
			ve
		]
	}), n[61] = ve, n[62] = V);
	let H;
	n[63] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Pending Removal:"
	}), n[63] = H) : H = n[63];
	let ye = r.isPendingRemoval ? "Yes" : "No", U;
	n[64] === ye ? U = n[65] : (U = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			H,
			" ",
			ye
		]
	}), n[64] = ye, n[65] = U);
	let W;
	n[66] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Transition:"
	}), n[66] = W) : W = n[66];
	let G;
	n[67] === r.transition ? G = n[68] : (G = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			W,
			" ",
			r.transition
		]
	}), n[67] = r.transition, n[68] = G);
	let K;
	n[69] === Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ jsx("span", {
		className: "font-medium",
		children: "Place:"
	}), n[69] = K) : K = n[69];
	let q;
	n[70] === r.place ? q = n[71] : (q = /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			K,
			" ",
			r.place
		]
	}), n[70] = r.place, n[71] = q);
	let J;
	n[72] !== V || n[73] !== U || n[74] !== G || n[75] !== q ? (J = /* @__PURE__ */ jsxs("div", {
		className: "space-y-1 pt-2",
		children: [
			V,
			U,
			G,
			q
		]
	}), n[72] = V, n[73] = U, n[74] = G, n[75] = q, n[76] = J) : J = n[76];
	let Y;
	n[77] !== m || n[78] !== g || n[79] !== y || n[80] !== S || n[81] !== k || n[82] !== I || n[83] !== L || n[84] !== R || n[85] !== z || n[86] !== J || n[87] !== u || n[88] !== f ? (Y = /* @__PURE__ */ jsxs(AccordionItem, {
		value: "document-info",
		children: [s, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsxs("div", {
			className: "ml-6 space-y-2",
			children: [
				u,
				f,
				m,
				g,
				y,
				S,
				k,
				I,
				L,
				R,
				z,
				J
			]
		}) })]
	}), n[77] = m, n[78] = g, n[79] = y, n[80] = S, n[81] = k, n[82] = I, n[83] = L, n[84] = R, n[85] = z, n[86] = J, n[87] = u, n[88] = f, n[89] = Y) : Y = n[89];
	let X;
	n[90] === Symbol.for("react.memo_cache_sentinel") ? (X = /* @__PURE__ */ jsx(AccordionTrigger, {
		className: "text-base font-semibold",
		children: /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }), "Content"]
		})
	}), n[90] = X) : X = n[90];
	let be = `max-h-96 overflow-auto rounded bg-gray-100 p-2 text-xs wrap-break-word whitespace-pre-wrap ${r.meta?.mimeType === "text/markdown" ? "font-sans" : "font-mono"}`, Z;
	n[91] !== _e || n[92] !== be ? (Z = /* @__PURE__ */ jsxs(AccordionItem, {
		value: "content",
		children: [X, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx(Card, {
			className: "bg-gray-50",
			children: /* @__PURE__ */ jsx(CardContent, {
				className: "p-4",
				children: /* @__PURE__ */ jsx("pre", {
					className: be,
					children: _e
				})
			})
		}) })]
	}), n[91] = _e, n[92] = be, n[93] = Z) : Z = n[93];
	let Q;
	n[94] === Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ jsx(AccordionTrigger, {
		className: "text-base font-semibold",
		children: /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }), "Schema"]
		})
	}), n[94] = Q) : Q = n[94];
	let $;
	n[95] === ge ? $ = n[96] : ($ = /* @__PURE__ */ jsxs(AccordionItem, {
		value: "schema",
		children: [Q, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx(Card, {
			className: "bg-gray-50",
			children: /* @__PURE__ */ jsx(CardContent, {
				className: "p-4",
				children: /* @__PURE__ */ jsx("pre", {
					className: "rounded bg-gray-100 p-2 font-mono text-xs wrap-break-word whitespace-pre-wrap",
					children: ge
				})
			})
		}) })]
	}), n[95] = ge, n[96] = $);
	let xe;
	return n[97] !== Y || n[98] !== Z || n[99] !== $ ? (xe = /* @__PURE__ */ jsx("div", {
		className: "mt-4",
		children: /* @__PURE__ */ jsxs(Accordion, {
			type: "multiple",
			defaultValue: o,
			className: "space-y-2",
			children: [
				Y,
				Z,
				$
			]
		})
	}), n[97] = Y, n[98] = Z, n[99] = $, n[100] = xe) : xe = n[100], xe;
};
function _temp(e, t) {
	return /* @__PURE__ */ jsx(Badge, {
		variant: "outline",
		className: "text-xs",
		children: e
	}, t);
}
function _temp2(e, t) {
	return /* @__PURE__ */ jsxs(Badge, {
		variant: "secondary",
		className: "text-xs",
		children: [/* @__PURE__ */ jsx(Tag, { className: "mr-1 h-3 w-3" }), e]
	}, t);
}
function _temp3(e, t) {
	return /* @__PURE__ */ jsx(Badge, {
		variant: "outline",
		className: "bg-blue-50 text-xs",
		children: e
	}, t);
}
function _temp4(e) {
	let [t] = e;
	return !["mimeType", "enableAtPlaces"].includes(t);
}
function _temp5(e) {
	let [t, me] = e;
	return /* @__PURE__ */ jsxs("div", {
		className: "text-sm",
		children: [
			/* @__PURE__ */ jsxs("span", {
				className: "font-medium",
				children: [t, ":"]
			}),
			" ",
			typeof me == "object" ? JSON.stringify(me) : String(me)
		]
	}, t);
}
export { DocumentDetails_default as default };
