import { cx as e } from "../../theme/tools.js";
import { useUiTranslation as t } from "../../i18n/useUiTranslation.js";
import { alignRecipe as n, body as r, cell as i, container as a, densityRecipe as o, emptyCell as s, emptyRow as c, header as l, headerCell as u, headerRow as d, hideBelowRecipe as f, primaryCell as p, primaryHeaderCell as m, row as h, rowEven as g, rowOdd as _, rowStateRecipe as v, stickyHeader as y } from "./DataTable.css.js";
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
//#region src/components/data-table/DataTable.tsx
var C = "minmax(0, 1fr)", w = (e) => e == null ? null : f({ minVisibleAt: e }), T = (e, t) => typeof t == "string" && t !== "" ? { gridTemplateColumns: t } : { gridTemplateColumns: `repeat(${e}, ${C})` }, E = ({ columns: f, rows: C, getRowId: E, emptyState: D, className: O, headerClassName: k, bodyClassName: A, rowClassName: j, gridTemplateClassName: M, gridTemplateColumns: N, kind: P, density: F, headerBehavior: I, rowState: L, classes: R, ariaLabel: z, ariaLabelledBy: B }) => {
	let { t: V } = t(), H = P ?? "default", U = z ?? V("common.table.label");
	B != null && (U = void 0);
	let W = /* @__PURE__ */ x("div", {
		className: e(s, R?.emptyCell),
		children: V("common.table.empty")
	}), G = D ?? W, K = C.length === 0, q;
	M ?? (q = T(f.length, N));
	let J = null;
	I?.sticky === !0 && (J = y);
	let Y;
	I?.offsetTop != null && (Y = { top: I.offsetTop });
	let X = [o({ density: F ?? "default" })];
	M != null && X.push(M);
	let Z;
	return Z = K ? /* @__PURE__ */ x("div", {
		className: e(c, R?.emptyRow),
		role: "row",
		children: /* @__PURE__ */ x("div", {
			role: "cell",
			children: G
		})
	}) : /* @__PURE__ */ x(b, { children: C.map((t, r) => {
		let a = E(t, r), o = [h({ kind: H }), R?.row], s = L?.(t, r);
		s != null && o.push(v({ state: s })), r % 2 == 0 ? o.push(g({ kind: H }), R?.rowEven) : o.push(_({ kind: H }), R?.rowOdd);
		for (let e of X) o.push(e);
		if (j != null) {
			let e = j(t, r);
			e != null && o.push(e);
		}
		return /* @__PURE__ */ x("div", {
			role: "row",
			className: e(...o),
			style: q,
			children: f.map((r) => {
				let a = [i({ kind: H }), R?.cell], o = w(r.minVisibleAt);
				o != null && a.push(o), r.className != null && a.push(r.className), r.isPrimary && a.push(p, R?.primaryCell), r.align != null && a.push(n({ align: r.align }));
				let s = r.cell(t);
				return /* @__PURE__ */ x("div", {
					role: "cell",
					className: e(...a),
					children: s
				}, r.id);
			})
		}, a);
	}) }), /* @__PURE__ */ S("div", {
		className: e(a({ kind: H }), R?.container, O),
		role: "table",
		"aria-label": U,
		"aria-labelledby": B,
		children: [/* @__PURE__ */ x("div", {
			className: e(l({ kind: H }), J, R?.header, k),
			style: Y,
			role: "rowgroup",
			children: /* @__PURE__ */ x("div", {
				className: e(d, R?.headerRow, ...X),
				role: "row",
				style: q,
				children: f.map((t) => {
					let r = [u({ kind: H }), R?.headerCell], i = w(t.minVisibleAt);
					return i != null && r.push(i), t.className != null && r.push(t.className), t.isPrimary && r.push(m, R?.primaryHeaderCell), t.align != null && r.push(n({ align: t.align })), /* @__PURE__ */ x("div", {
						role: "columnheader",
						className: e(...r),
						children: t.header
					}, t.id);
				})
			})
		}), /* @__PURE__ */ x("div", {
			className: e(r({ kind: H }), R?.body, A),
			role: "rowgroup",
			children: Z
		})]
	});
}, D = {
	getVisibilityClass: w,
	buildInlineTemplate: T
};
//#endregion
export { E as DataTable, D as __test };

//# sourceMappingURL=DataTable.js.map