import { g as e, h as t, p as n } from "./src-CFVe5TPD.js";
import { B as r, C as i, E as a, V as o, W as s, _ as c, a as l, c as u, d, v as f, y as p } from "./chunk-ICPOFSXX-B9JXAgJU.js";
import { t as m } from "./ordinal-F3U6aXtP.js";
import { t as h } from "./defaultLocale-bckJcYh1.js";
import { r as g } from "./chunk-5PVQY5BW-BCjrVrWB.js";
import { t as _ } from "./chunk-426QAEUC-D_wKNd3w.js";
import { t as v } from "./chunk-4BX2VUAB-DKC_OBWg.js";
import { t as y } from "./mermaid-parser.core-Blz-Qy2h.js";
import { t as b } from "./chunk-EDXVE4YY-DE9KzYM-.js";
import { i as x, n as S } from "./chunk-X2U36JSP-DSzducJI.js";
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/count.js
function C(e) {
	var t = 0, n = e.children, r = n && n.length;
	if (!r) t = 1;
	else for (; --r >= 0;) t += n[r].value;
	e.value = t;
}
function w() {
	return this.eachAfter(C);
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/each.js
function T(e, t) {
	let n = -1;
	for (let r of this) e.call(t, r, ++n, this);
	return this;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
function E(e, t) {
	for (var n = this, r = [n], i, a, o = -1; n = r.pop();) if (e.call(t, n, ++o, this), i = n.children) for (a = i.length - 1; a >= 0; --a) r.push(i[a]);
	return this;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
function D(e, t) {
	for (var n = this, r = [n], i = [], a, o, s, c = -1; n = r.pop();) if (i.push(n), a = n.children) for (o = 0, s = a.length; o < s; ++o) r.push(a[o]);
	for (; n = i.pop();) e.call(t, n, ++c, this);
	return this;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/find.js
function O(e, t) {
	let n = -1;
	for (let r of this) if (e.call(t, r, ++n, this)) return r;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sum.js
function k(e) {
	return this.eachAfter(function(t) {
		for (var n = +e(t.data) || 0, r = t.children, i = r && r.length; --i >= 0;) n += r[i].value;
		t.value = n;
	});
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sort.js
function A(e) {
	return this.eachBefore(function(t) {
		t.children && t.children.sort(e);
	});
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/path.js
function j(e) {
	for (var t = this, n = M(t, e), r = [t]; t !== n;) t = t.parent, r.push(t);
	for (var i = r.length; e !== n;) r.splice(i, 0, e), e = e.parent;
	return r;
}
function M(e, t) {
	if (e === t) return e;
	var n = e.ancestors(), r = t.ancestors(), i = null;
	for (e = n.pop(), t = r.pop(); e === t;) i = e, e = n.pop(), t = r.pop();
	return i;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/ancestors.js
function N() {
	for (var e = this, t = [e]; e = e.parent;) t.push(e);
	return t;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/descendants.js
function P() {
	return Array.from(this);
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/leaves.js
function F() {
	var e = [];
	return this.eachBefore(function(t) {
		t.children || e.push(t);
	}), e;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/links.js
function I() {
	var e = this, t = [];
	return e.each(function(n) {
		n !== e && t.push({
			source: n.parent,
			target: n
		});
	}), t;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/iterator.js
function* L() {
	var e = this, t, n = [e], r, i, a;
	do
		for (t = n.reverse(), n = []; e = t.pop();) if (yield e, r = e.children) for (i = 0, a = r.length; i < a; ++i) n.push(r[i]);
	while (n.length);
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/index.js
function R(e, t) {
	e instanceof Map ? (e = [void 0, e], t === void 0 && (t = V)) : t === void 0 && (t = B);
	for (var n = new W(e), r, i = [n], a, o, s, c; r = i.pop();) if ((o = t(r.data)) && (c = (o = Array.from(o)).length)) for (r.children = o, s = c - 1; s >= 0; --s) i.push(a = o[s] = new W(o[s])), a.parent = r, a.depth = r.depth + 1;
	return n.eachBefore(U);
}
function z() {
	return R(this).eachBefore(H);
}
function B(e) {
	return e.children;
}
function V(e) {
	return Array.isArray(e) ? e[1] : null;
}
function H(e) {
	e.data.value !== void 0 && (e.value = e.data.value), e.data = e.data.data;
}
function U(e) {
	var t = 0;
	do
		e.height = t;
	while ((e = e.parent) && e.height < ++t);
}
function W(e) {
	this.data = e, this.depth = this.height = 0, this.parent = null;
}
W.prototype = R.prototype = {
	constructor: W,
	count: w,
	each: T,
	eachAfter: D,
	eachBefore: E,
	find: O,
	sum: k,
	sort: A,
	path: j,
	ancestors: N,
	descendants: P,
	leaves: F,
	links: I,
	copy: z,
	[Symbol.iterator]: L
};
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/accessors.js
function G(e) {
	if (typeof e != "function") throw Error();
	return e;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/constant.js
function K() {
	return 0;
}
function q(e) {
	return function() {
		return e;
	};
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/round.js
function J(e) {
	e.x0 = Math.round(e.x0), e.y0 = Math.round(e.y0), e.x1 = Math.round(e.x1), e.y1 = Math.round(e.y1);
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/dice.js
function ee(e, t, n, r, i) {
	for (var a = e.children, o, s = -1, c = a.length, l = e.value && (r - t) / e.value; ++s < c;) o = a[s], o.y0 = n, o.y1 = i, o.x0 = t, o.x1 = t += o.value * l;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/slice.js
function te(e, t, n, r, i) {
	for (var a = e.children, o, s = -1, c = a.length, l = e.value && (i - n) / e.value; ++s < c;) o = a[s], o.x0 = t, o.x1 = r, o.y0 = n, o.y1 = n += o.value * l;
}
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/squarify.js
var ne = (1 + Math.sqrt(5)) / 2;
function re(e, t, n, r, i, a) {
	for (var o = [], s = t.children, c, l, u = 0, d = 0, f = s.length, p, m, h = t.value, g, _, v, y, b, x, S; u < f;) {
		p = i - n, m = a - r;
		do
			g = s[d++].value;
		while (!g && d < f);
		for (_ = v = g, x = Math.max(m / p, p / m) / (h * e), S = g * g * x, b = Math.max(v / S, S / _); d < f; ++d) {
			if (g += l = s[d].value, l < _ && (_ = l), l > v && (v = l), S = g * g * x, y = Math.max(v / S, S / _), y > b) {
				g -= l;
				break;
			}
			b = y;
		}
		o.push(c = {
			value: g,
			dice: p < m,
			children: s.slice(u, d)
		}), c.dice ? ee(c, n, r, i, h ? r += m * g / h : a) : te(c, n, r, h ? n += p * g / h : i, a), h -= g, u = d;
	}
	return o;
}
var ie = (function e(t) {
	function n(e, n, r, i, a) {
		re(t, e, n, r, i, a);
	}
	return n.ratio = function(t) {
		return e((t = +t) > 1 ? t : 1);
	}, n;
})(ne);
//#endregion
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/index.js
function ae() {
	var e = ie, t = !1, n = 1, r = 1, i = [0], a = K, o = K, s = K, c = K, l = K;
	function u(e) {
		return e.x0 = e.y0 = 0, e.x1 = n, e.y1 = r, e.eachBefore(d), i = [0], t && e.eachBefore(J), e;
	}
	function d(t) {
		var n = i[t.depth], r = t.x0 + n, u = t.y0 + n, d = t.x1 - n, f = t.y1 - n;
		d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), t.x0 = r, t.y0 = u, t.x1 = d, t.y1 = f, t.children && (n = i[t.depth + 1] = a(t) / 2, r += l(t) - n, u += o(t) - n, d -= s(t) - n, f -= c(t) - n, d < r && (r = d = (r + d) / 2), f < u && (u = f = (u + f) / 2), e(t, r, u, d, f));
	}
	return u.round = function(e) {
		return arguments.length ? (t = !!e, u) : t;
	}, u.size = function(e) {
		return arguments.length ? (n = +e[0], r = +e[1], u) : [n, r];
	}, u.tile = function(t) {
		return arguments.length ? (e = G(t), u) : e;
	}, u.padding = function(e) {
		return arguments.length ? u.paddingInner(e).paddingOuter(e) : u.paddingInner();
	}, u.paddingInner = function(e) {
		return arguments.length ? (a = typeof e == "function" ? e : q(+e), u) : a;
	}, u.paddingOuter = function(e) {
		return arguments.length ? u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e) : u.paddingTop();
	}, u.paddingTop = function(e) {
		return arguments.length ? (o = typeof e == "function" ? e : q(+e), u) : o;
	}, u.paddingRight = function(e) {
		return arguments.length ? (s = typeof e == "function" ? e : q(+e), u) : s;
	}, u.paddingBottom = function(e) {
		return arguments.length ? (c = typeof e == "function" ? e : q(+e), u) : c;
	}, u.paddingLeft = function(e) {
		return arguments.length ? (l = typeof e == "function" ? e : q(+e), u) : l;
	}, u;
}
//#endregion
//#region ../../node_modules/.pnpm/mermaid@11.14.0/node_modules/mermaid/dist/chunks/mermaid.core/diagram-G4DWMVQ6.mjs
var Y = class {
	constructor() {
		this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = o, this.getAccTitle = f, this.setDiagramTitle = s, this.getDiagramTitle = i, this.getAccDescription = c, this.setAccDescription = r;
	}
	static {
		t(this, "TreeMapDB");
	}
	getNodes() {
		return this.nodes;
	}
	getConfig() {
		let e = d, t = p();
		return g({
			...e.treemap,
			...t.treemap ?? {}
		});
	}
	addNode(e, t) {
		this.nodes.push(e), this.levels.set(e, t), t === 0 && (this.outerNodes.push(e), this.root ??= e);
	}
	getRoot() {
		return {
			name: "",
			children: this.outerNodes
		};
	}
	addClass(e, t) {
		let n = this.classes.get(e) ?? {
			id: e,
			styles: [],
			textStyles: []
		}, r = t.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
		r && r.forEach((e) => {
			S(e) && (n?.textStyles ? n.textStyles.push(e) : n.textStyles = [e]), n?.styles ? n.styles.push(e) : n.styles = [e];
		}), this.classes.set(e, n);
	}
	getClasses() {
		return this.classes;
	}
	getStylesForClass(e) {
		return this.classes.get(e)?.styles ?? [];
	}
	clear() {
		l(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
	}
};
function X(e) {
	if (!e.length) return [];
	let t = [], n = [];
	return e.forEach((e) => {
		let r = {
			name: e.name,
			children: e.type === "Leaf" ? void 0 : []
		};
		for (r.classSelector = e?.classSelector, e?.cssCompiledStyles && (r.cssCompiledStyles = e.cssCompiledStyles), e.type === "Leaf" && e.value !== void 0 && (r.value = e.value); n.length > 0 && n[n.length - 1].level >= e.level;) n.pop();
		if (n.length === 0) t.push(r);
		else {
			let e = n[n.length - 1].node;
			e.children ? e.children.push(r) : e.children = [r];
		}
		e.type !== "Leaf" && n.push({
			node: r,
			level: e.level
		});
	}), t;
}
t(X, "buildHierarchy");
var oe = /* @__PURE__ */ t((e, n) => {
	v(e, n);
	let r = [];
	for (let t of e.TreemapRows ?? []) t.$type === "ClassDefStatement" && n.addClass(t.className ?? "", t.styleText ?? "");
	for (let t of e.TreemapRows ?? []) {
		let e = t.item;
		if (!e) continue;
		let i = t.indent ? parseInt(t.indent) : 0, a = se(e), o = e.classSelector ? n.getStylesForClass(e.classSelector) : [], s = o.length > 0 ? o : void 0, c = {
			level: i,
			name: a,
			type: e.$type,
			value: e.value,
			classSelector: e.classSelector,
			cssCompiledStyles: s
		};
		r.push(c);
	}
	let i = X(r), a = /* @__PURE__ */ t((e, t) => {
		for (let r of e) n.addNode(r, t), r.children && r.children.length > 0 && a(r.children, t + 1);
	}, "addNodesRecursively");
	a(i, 0);
}, "populate"), se = /* @__PURE__ */ t((e) => e.name ? String(e.name) : "", "getItemName"), Z = {
	parser: { yy: void 0 },
	parse: /* @__PURE__ */ t(async (t) => {
		try {
			let n = await y("treemap", t);
			e.debug("Treemap AST:", n);
			let r = Z.parser?.yy;
			if (!(r instanceof Y)) throw Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");
			oe(n, r);
		} catch (t) {
			throw e.error("Error parsing treemap:", t), t;
		}
	}, "parse")
}, ce = 10, Q = 10, $ = 25, le = {
	draw: /* @__PURE__ */ t((r, i, a, o) => {
		let s = o.db, c = s.getConfig(), l = c.padding ?? ce, d = s.getDiagramTitle(), f = s.getRoot(), { themeVariables: g } = p();
		if (!f) return;
		let v = d ? 30 : 0, y = _(i), S = c.nodeWidth ? c.nodeWidth * Q : 960, C = c.nodeHeight ? c.nodeHeight * Q : 500, w = S, T = C + v;
		y.attr("viewBox", `0 0 ${w} ${T}`), u(y, T, w, c.useMaxWidth);
		let E;
		try {
			let e = c.valueFormat || ",";
			if (e === "$0,0") E = /* @__PURE__ */ t((e) => "$" + h(",")(e), "valueFormat");
			else if (e.startsWith("$") && e.includes(",")) {
				let n = /\.\d+/.exec(e), r = n ? n[0] : "";
				E = /* @__PURE__ */ t((e) => "$" + h("," + r)(e), "valueFormat");
			} else if (e.startsWith("$")) {
				let n = e.substring(1);
				E = /* @__PURE__ */ t((e) => "$" + h(n || "")(e), "valueFormat");
			} else E = h(e);
		} catch (t) {
			e.error("Error creating format function:", t), E = h(",");
		}
		let D = m().range([
			"transparent",
			g.cScale0,
			g.cScale1,
			g.cScale2,
			g.cScale3,
			g.cScale4,
			g.cScale5,
			g.cScale6,
			g.cScale7,
			g.cScale8,
			g.cScale9,
			g.cScale10,
			g.cScale11
		]), O = m().range([
			"transparent",
			g.cScalePeer0,
			g.cScalePeer1,
			g.cScalePeer2,
			g.cScalePeer3,
			g.cScalePeer4,
			g.cScalePeer5,
			g.cScalePeer6,
			g.cScalePeer7,
			g.cScalePeer8,
			g.cScalePeer9,
			g.cScalePeer10,
			g.cScalePeer11
		]), k = m().range([
			g.cScaleLabel0,
			g.cScaleLabel1,
			g.cScaleLabel2,
			g.cScaleLabel3,
			g.cScaleLabel4,
			g.cScaleLabel5,
			g.cScaleLabel6,
			g.cScaleLabel7,
			g.cScaleLabel8,
			g.cScaleLabel9,
			g.cScaleLabel10,
			g.cScaleLabel11
		]);
		d && y.append("text").attr("x", w / 2).attr("y", v / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(d);
		let A = y.append("g").attr("transform", `translate(0, ${v})`).attr("class", "treemapContainer"), j = R(f).sum((e) => e.value ?? 0).sort((e, t) => (t.value ?? 0) - (e.value ?? 0)), M = ae().size([S, C]).paddingTop((e) => e.children && e.children.length > 0 ? $ + Q : 0).paddingInner(l).paddingLeft((e) => e.children && e.children.length > 0 ? Q : 0).paddingRight((e) => e.children && e.children.length > 0 ? Q : 0).paddingBottom((e) => e.children && e.children.length > 0 ? Q : 0).round(!0)(j), N = M.descendants().filter((e) => e.children && e.children.length > 0), P = A.selectAll(".treemapSection").data(N).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
		P.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", $).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", .6).attr("stroke-width", .6).attr("style", (e) => e.depth === 0 ? "display: none;" : ""), P.append("clipPath").attr("id", (e, t) => `clip-section-${i}-${t}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", $), P.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, t) => `treemapSection section${t}`).attr("fill", (e) => D(e.data.name)).attr("fill-opacity", .6).attr("stroke", (e) => O(e.data.name)).attr("stroke-width", 2).attr("stroke-opacity", .4).attr("style", (e) => {
			if (e.depth === 0) return "display: none;";
			let t = x({ cssCompiledStyles: e.data.cssCompiledStyles });
			return t.nodeStyles + ";" + t.borderStyles.join(";");
		}), P.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", $ / 2).attr("dominant-baseline", "middle").text((e) => e.depth === 0 ? "" : e.data.name).attr("font-weight", "bold").attr("style", (e) => e.depth === 0 ? "display: none;" : "dominant-baseline: middle; font-size: 12px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" + x({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:")).each(function(e) {
			if (e.depth === 0) return;
			let t = n(this), r = e.data.name;
			t.text(r);
			let i = e.x1 - e.x0, a;
			a = c.showValues !== !1 && e.value ? i - 10 - 30 - 10 - 6 : i - 6 - 6;
			let o = Math.max(15, a), s = t.node();
			if (s.getComputedTextLength() > o) {
				let e = r;
				for (; e.length > 0;) {
					if (e = r.substring(0, e.length - 1), e.length === 0) {
						t.text("..."), s.getComputedTextLength() > o && t.text("");
						break;
					}
					if (t.text(e + "..."), s.getComputedTextLength() <= o) break;
				}
			}
		}), c.showValues !== !1 && P.append("text").attr("class", "treemapSectionValue").attr("x", (e) => e.x1 - e.x0 - 10).attr("y", $ / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((e) => e.value ? E(e.value) : "").attr("font-style", "italic").attr("style", (e) => e.depth === 0 ? "display: none;" : "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" + x({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:"));
		let F = M.leaves(), I = A.selectAll(".treemapLeafGroup").data(F).enter().append("g").attr("class", (e, t) => `treemapNode treemapLeafGroup leaf${t}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
		I.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", "treemapLeaf").attr("fill", (e) => e.parent ? D(e.parent.data.name) : D(e.data.name)).attr("style", (e) => x({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", .3).attr("stroke", (e) => e.parent ? D(e.parent.data.name) : D(e.data.name)).attr("stroke-width", 3), I.append("clipPath").attr("id", (e, t) => `clip-${i}-${t}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), I.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + k(e.data.name) + ";" + x({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:")).attr("clip-path", (e, t) => `url(#clip-${i}-${t})`).text((e) => e.data.name).each(function(e) {
			let t = n(this), r = e.x1 - e.x0, i = e.y1 - e.y0, a = t.node(), o = r - 8, s = i - 8;
			if (o < 10 || s < 10) {
				t.style("display", "none");
				return;
			}
			let c = parseInt(t.style("font-size"), 10), l = .6;
			for (; a.getComputedTextLength() > o && c > 8;) c--, t.style("font-size", `${c}px`);
			let u = Math.max(6, Math.min(28, Math.round(c * l))), d = c + 2 + u;
			for (; d > s && c > 8 && (c--, u = Math.max(6, Math.min(28, Math.round(c * l))), !(u < 6 && c === 8));) t.style("font-size", `${c}px`), d = c + 2 + u;
			t.style("font-size", `${c}px`), (a.getComputedTextLength() > o || c < 8 || s < c) && t.style("display", "none");
		}), c.showValues !== !1 && I.append("text").attr("class", "treemapValue").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", function(e) {
			return (e.y1 - e.y0) / 2;
		}).attr("style", (e) => "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + k(e.data.name) + ";" + x({ cssCompiledStyles: e.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:")).attr("clip-path", (e, t) => `url(#clip-${i}-${t})`).text((e) => e.value ? E(e.value) : "").each(function(e) {
			let t = n(this), r = this.parentNode;
			if (!r) {
				t.style("display", "none");
				return;
			}
			let i = n(r).select(".treemapLabel");
			if (i.empty() || i.style("display") === "none") {
				t.style("display", "none");
				return;
			}
			let a = parseFloat(i.style("font-size")), o = Math.max(6, Math.min(28, Math.round(a * .6)));
			t.style("font-size", `${o}px`);
			let s = (e.y1 - e.y0) / 2 + a / 2 + 2;
			t.attr("y", s);
			let c = e.x1 - e.x0, l = e.y1 - e.y0 - 4, u = c - 8;
			t.node().getComputedTextLength() > u || s + o > l || o < 6 ? t.style("display", "none") : t.style("display", null);
		}), b(y, c.diagramPadding ?? 8, "flowchart", c?.useMaxWidth || !1);
	}, "draw"),
	getClasses: /* @__PURE__ */ t(function(e, t) {
		return t.db.getClasses();
	}, "getClasses")
}, ue = {
	sectionStrokeColor: "black",
	sectionStrokeWidth: "1",
	sectionFillColor: "#efefef",
	leafStrokeColor: "black",
	leafStrokeWidth: "1",
	leafFillColor: "#efefef",
	labelFontSize: "12px",
	valueFontSize: "10px",
	titleFontSize: "14px"
}, de = {
	parser: Z,
	get db() {
		return new Y();
	},
	renderer: le,
	styles: /* @__PURE__ */ t(({ treemap: e } = {}) => {
		let t = g(a(), p().themeVariables), n = g(ue, e), r = n.titleColor ?? t.titleColor, i = n.labelColor ?? t.textColor, o = n.valueColor ?? t.textColor;
		return `
  .treemapNode.section {
    stroke: ${n.sectionStrokeColor};
    stroke-width: ${n.sectionStrokeWidth};
    fill: ${n.sectionFillColor};
  }
  .treemapNode.leaf {
    stroke: ${n.leafStrokeColor};
    stroke-width: ${n.leafStrokeWidth};
    fill: ${n.leafFillColor};
  }
  .treemapLabel {
    fill: ${i};
    font-size: ${n.labelFontSize};
  }
  .treemapValue {
    fill: ${o};
    font-size: ${n.valueFontSize};
  }
  .treemapTitle {
    fill: ${r};
    font-size: ${n.titleFontSize};
  }
  `;
	}, "getStyles")
};
//#endregion
export { de as diagram };
