UNPKG

@eledah/parto

Version:

Framework-agnostic argument map sunburst charts with light/dark themes

3,618 lines 124 kB
var Parto = (function(exports) {
	Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
	//#region src/config.ts
	var DEFAULT_LABELS = {
		legend: "Argument types",
		center: "Center",
		support: "Agree",
		attack: "Disagree",
		claim: "Claim",
		unknownSpeaker: "Unknown",
		intensity: "Intensity",
		confidence: "Confidence",
		statusLoading: "Loading map…",
		statusEmpty: "No map data yet.",
		statusError: "Could not load this argument map."
	};
	var DEFAULT_COLORS = {
		center: "#b08a3e",
		support: "#3f7652",
		attack: "#9f4f4f",
		border: "#ffffff"
	};
	var chartConfig = {
		colors: { ...DEFAULT_COLORS },
		chart: {
			maxCenterRadius: .4,
			radiusPadding: 5,
			minRadius: 10,
			cornerRadius: 3,
			strokeWidth: .5
		},
		spacing: {
			verticalGap: .01,
			padAngle: {
				inner: .025,
				outer: .012
			},
			radiusExponent: {
				base: 1.2,
				perLevel: .2
			},
			exponentDepthThreshold: 3
		}
	};
	var CSS_COLOR_VARS = {
		center: "--pam-center",
		support: "--pam-support",
		attack: "--pam-attack",
		border: "--pam-border"
	};
	function isUsableCssColor(value) {
		return Boolean(value && (value.startsWith("#") || value.startsWith("rgb")));
	}
	function syncColorsFromCss(element) {
		const style = getComputedStyle(element);
		for (const [key, cssVar] of Object.entries(CSS_COLOR_VARS)) {
			const value = style.getPropertyValue(cssVar).trim();
			if (isUsableCssColor(value)) chartConfig.colors[key] = value;
		}
	}
	function applyColorOverrides(element, colors) {
		for (const [key, cssVar] of Object.entries({
			center: "--pam-center",
			support: "--pam-support",
			attack: "--pam-attack",
			border: "--pam-border"
		})) {
			const value = colors[key];
			if (value) element.style.setProperty(cssVar, value);
		}
		syncColorsFromCss(element);
	}
	//#endregion
	//#region src/core/buildTree.ts
	/**
	* Build a nested tree from flat nodes. Uses adjacency indexing for O(n + edges).
	* Multi-parent nodes appear under each parent as separate copies with unique pathKeys.
	*/
	function buildTree(nodes) {
		const warnings = [];
		const nodeMap = /* @__PURE__ */ new Map();
		for (const node of nodes) nodeMap.set(node.id, node);
		const thesisNode = nodes.find((n) => n.type === "thesis");
		if (!thesisNode) return {
			tree: null,
			warnings: ["No thesis node found"]
		};
		/** parentId -> list of { childId, relation } */
		const childrenOf = /* @__PURE__ */ new Map();
		for (const node of nodes) for (const rel of node.relations) {
			if (!nodeMap.has(rel.target_node_id)) continue;
			const list = childrenOf.get(rel.target_node_id) ?? [];
			list.push({
				childId: node.id,
				relationType: rel.relation_type,
				reasoning: rel.reasoning
			});
			childrenOf.set(rel.target_node_id, list);
		}
		const buildRecursive = (source, parentId, relationType, relationReasoning, ancestorIds, pathSegments) => {
			const pathKey = pathSegments.join("/");
			const treeNode = {
				...source,
				children: [],
				value: 1,
				relationType,
				relationReasoning,
				parentId,
				pathKey
			};
			if (ancestorIds.has(source.id)) {
				warnings.push(`Cycle detected at node ${source.id}; branch skipped`);
				return treeNode;
			}
			const nextAncestors = new Set(ancestorIds);
			nextAncestors.add(source.id);
			const childEntries = childrenOf.get(source.id) ?? [];
			for (const entry of childEntries) {
				const childSource = nodeMap.get(entry.childId);
				if (!childSource) continue;
				const childCopy = buildRecursive(childSource, source.id, entry.relationType, entry.reasoning, nextAncestors, [...pathSegments, entry.childId]);
				treeNode.children.push(childCopy);
			}
			return treeNode;
		};
		return {
			tree: buildRecursive(thesisNode, void 0, void 0, void 0, /* @__PURE__ */ new Set(), [thesisNode.id]),
			warnings
		};
	}
	function findNodeById(root, id) {
		if (!root) return null;
		if (root.id === id) return root;
		for (const child of root.children) {
			const found = findNodeById(child, id);
			if (found) return found;
		}
		return null;
	}
	function findNodeByPath(root, nodeIds) {
		if (!root || nodeIds.length === 0) return null;
		let current = root;
		for (let i = 1; i < nodeIds.length; i++) {
			const targetId = nodeIds[i];
			current = current?.children.find((c) => c.id === targetId) ?? null;
			if (!current) return null;
		}
		return current;
	}
	function pathToNode(root, targetId) {
		const path = [];
		const walk = (node, ancestors) => {
			const chain = [...ancestors, node];
			if (node.id === targetId) {
				path.push(...chain);
				return true;
			}
			for (const child of node.children) if (walk(child, chain)) return true;
			return false;
		};
		walk(root, []);
		return path;
	}
	function getNodeArcClass(node, currentRoot) {
		if (currentRoot && node.id === currentRoot.id) return "pam-arc--center";
		if (node.relationType === "attack") return "pam-arc--attack";
		return "pam-arc--support";
	}
	function getNodeColor(node, currentRoot, colors) {
		if (currentRoot && node.id === currentRoot.id) return colors.center;
		return node.relationType === "attack" ? colors.attack : colors.support;
	}
	//#endregion
	//#region src/errors.ts
	var ArgumentMapError = class extends Error {
		constructor(message) {
			super(message);
			this.name = "ArgumentMapError";
		}
	};
	var ValidationError = class extends ArgumentMapError {
		issues;
		constructor(issues) {
			super(issues.join("; "));
			this.name = "ValidationError";
			this.issues = issues;
		}
	};
	//#endregion
	//#region src/core/validateMapData.ts
	function validateMapData(input) {
		const issues = [];
		const warnings = [];
		if (!input || typeof input !== "object") throw new ValidationError(["Map data must be an object"]);
		const record = input;
		if (!Array.isArray(record.new_nodes)) throw new ValidationError(["Map data must include a new_nodes array"]);
		const nodes = [];
		const seenIds = /* @__PURE__ */ new Set();
		let thesisCount = 0;
		for (const raw of record.new_nodes) {
			if (!raw || typeof raw !== "object") {
				issues.push("Each node must be an object");
				continue;
			}
			const node = raw;
			const id = String(node.id ?? "");
			if (!id) {
				issues.push("Node is missing id");
				continue;
			}
			if (seenIds.has(id)) {
				issues.push(`Duplicate node id: ${id}`);
				continue;
			}
			seenIds.add(id);
			const type = String(node.type ?? "");
			if (type === "thesis") thesisCount += 1;
			const normalizedRelations = (Array.isArray(node.relations) ? node.relations : []).map((rel) => {
				const r = rel;
				const relationType = String(r.relation_type ?? "");
				if (relationType !== "support" && relationType !== "attack") issues.push(`Node ${id} has unsupported relation_type: ${relationType}`);
				return {
					target_node_id: String(r.target_node_id ?? ""),
					relation_type: relationType,
					reasoning: String(r.reasoning ?? "")
				};
			});
			const normalized = {
				id,
				type,
				title: String(node.title ?? ""),
				description: String(node.description ?? ""),
				quote: String(node.quote ?? ""),
				speaker: String(node.speaker ?? ""),
				relations: normalizedRelations
			};
			if (node.score && typeof node.score === "object") {
				const score = node.score;
				normalized.score = {
					intensity: Number(score.intensity ?? 0),
					confidence: Number(score.confidence ?? 0)
				};
			}
			nodes.push(normalized);
		}
		if (issues.length > 0) throw new ValidationError(issues);
		if (thesisCount === 0) throw new ValidationError(["Map must include exactly one thesis node"]);
		if (thesisCount > 1) throw new ValidationError(["Map must include exactly one thesis node"]);
		const idSet = new Set(nodes.map((n) => n.id));
		for (const node of nodes) for (const rel of node.relations) if (!idSet.has(rel.target_node_id)) warnings.push(`Node ${node.id} references missing target ${rel.target_node_id}`);
		return {
			data: { new_nodes: nodes },
			warnings
		};
	}
	//#endregion
	//#region src/core/ZoomController.ts
	var ZoomController = class {
		fullTree = null;
		zoomStack = [];
		setTree(tree) {
			this.fullTree = tree;
			this.zoomStack = tree ? [tree] : [];
		}
		getFocusRoot() {
			if (this.zoomStack.length === 0) return null;
			return this.zoomStack[this.zoomStack.length - 1] ?? null;
		}
		getFullTree() {
			return this.fullTree;
		}
		getZoomPath() {
			return this.zoomStack.map((n) => ({
				id: n.id,
				title: n.title,
				type: n.type,
				relationType: n.relationType
			}));
		}
		resetZoom() {
			if (this.fullTree) this.zoomStack = [this.fullTree];
		}
		zoomTo(nodeId) {
			if (!this.fullTree) return false;
			const path = pathToNode(this.fullTree, nodeId);
			if (path.length === 0) return false;
			if (!path[path.length - 1]) return false;
			this.zoomStack = path;
			return true;
		}
		zoomToPath(nodeIds) {
			if (!this.fullTree || nodeIds.length === 0) return false;
			if (!findNodeByPath(this.fullTree, nodeIds)) return false;
			const path = [];
			let current = this.fullTree;
			path.push(current);
			for (let i = 1; i < nodeIds.length; i++) {
				const id = nodeIds[i];
				const child = current.children.find((c) => c.id === id);
				if (!child) return false;
				path.push(child);
				current = child;
			}
			this.zoomStack = path;
			return true;
		}
		zoomIn(node) {
			if ((node.children?.length ?? 0) === 0) return false;
			this.zoomStack.push(node);
			return true;
		}
		zoomOut() {
			if (this.zoomStack.length <= 1) return false;
			this.zoomStack.pop();
			return true;
		}
		handleClick(node, depth, hasChildren) {
			if (depth === 0) {
				this.zoomOut();
				return;
			}
			if (hasChildren) {
				const found = findNodeById(this.getFocusRoot(), node.id);
				if (found) this.zoomIn(found);
			}
		}
	};
	//#endregion
	//#region node_modules/d3-dispatch/src/dispatch.js
	var noop = { value: () => {} };
	function dispatch() {
		for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
			if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
			_[t] = [];
		}
		return new Dispatch(_);
	}
	function Dispatch(_) {
		this._ = _;
	}
	function parseTypenames$1(typenames, types) {
		return typenames.trim().split(/^|\s+/).map(function(t) {
			var name = "", i = t.indexOf(".");
			if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
			if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
			return {
				type: t,
				name
			};
		});
	}
	Dispatch.prototype = dispatch.prototype = {
		constructor: Dispatch,
		on: function(typename, callback) {
			var _ = this._, T = parseTypenames$1(typename + "", _), t, i = -1, n = T.length;
			if (arguments.length < 2) {
				while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
				return;
			}
			if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
			while (++i < n) if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);
			else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
			return this;
		},
		copy: function() {
			var copy = {}, _ = this._;
			for (var t in _) copy[t] = _[t].slice();
			return new Dispatch(copy);
		},
		call: function(type, that) {
			if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
			if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
			for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
		},
		apply: function(type, that, args) {
			if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
			for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
		}
	};
	function get$1(type, name) {
		for (var i = 0, n = type.length, c; i < n; ++i) if ((c = type[i]).name === name) return c.value;
	}
	function set$1(type, name, callback) {
		for (var i = 0, n = type.length; i < n; ++i) if (type[i].name === name) {
			type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
			break;
		}
		if (callback != null) type.push({
			name,
			value: callback
		});
		return type;
	}
	var namespaces_default = {
		svg: "http://www.w3.org/2000/svg",
		xhtml: "http://www.w3.org/1999/xhtml",
		xlink: "http://www.w3.org/1999/xlink",
		xml: "http://www.w3.org/XML/1998/namespace",
		xmlns: "http://www.w3.org/2000/xmlns/"
	};
	//#endregion
	//#region node_modules/d3-selection/src/namespace.js
	function namespace_default(name) {
		var prefix = name += "", i = prefix.indexOf(":");
		if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
		return namespaces_default.hasOwnProperty(prefix) ? {
			space: namespaces_default[prefix],
			local: name
		} : name;
	}
	//#endregion
	//#region node_modules/d3-selection/src/creator.js
	function creatorInherit(name) {
		return function() {
			var document = this.ownerDocument, uri = this.namespaceURI;
			return uri === "http://www.w3.org/1999/xhtml" && document.documentElement.namespaceURI === "http://www.w3.org/1999/xhtml" ? document.createElement(name) : document.createElementNS(uri, name);
		};
	}
	function creatorFixed(fullname) {
		return function() {
			return this.ownerDocument.createElementNS(fullname.space, fullname.local);
		};
	}
	function creator_default(name) {
		var fullname = namespace_default(name);
		return (fullname.local ? creatorFixed : creatorInherit)(fullname);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selector.js
	function none() {}
	function selector_default(selector) {
		return selector == null ? none : function() {
			return this.querySelector(selector);
		};
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/select.js
	function select_default$2(select) {
		if (typeof select !== "function") select = selector_default(select);
		for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
			if ("__data__" in node) subnode.__data__ = node.__data__;
			subgroup[i] = subnode;
		}
		return new Selection$1(subgroups, this._parents);
	}
	//#endregion
	//#region node_modules/d3-selection/src/array.js
	function array(x) {
		return x == null ? [] : Array.isArray(x) ? x : Array.from(x);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selectorAll.js
	function empty() {
		return [];
	}
	function selectorAll_default(selector) {
		return selector == null ? empty : function() {
			return this.querySelectorAll(selector);
		};
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/selectAll.js
	function arrayAll(select) {
		return function() {
			return array(select.apply(this, arguments));
		};
	}
	function selectAll_default$1(select) {
		if (typeof select === "function") select = arrayAll(select);
		else select = selectorAll_default(select);
		for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) if (node = group[i]) {
			subgroups.push(select.call(node, node.__data__, i, group));
			parents.push(node);
		}
		return new Selection$1(subgroups, parents);
	}
	//#endregion
	//#region node_modules/d3-selection/src/matcher.js
	function matcher_default(selector) {
		return function() {
			return this.matches(selector);
		};
	}
	function childMatcher(selector) {
		return function(node) {
			return node.matches(selector);
		};
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/selectChild.js
	var find = Array.prototype.find;
	function childFind(match) {
		return function() {
			return find.call(this.children, match);
		};
	}
	function childFirst() {
		return this.firstElementChild;
	}
	function selectChild_default(match) {
		return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/selectChildren.js
	var filter = Array.prototype.filter;
	function children() {
		return Array.from(this.children);
	}
	function childrenFilter(match) {
		return function() {
			return filter.call(this.children, match);
		};
	}
	function selectChildren_default(match) {
		return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/filter.js
	function filter_default$1(match) {
		if (typeof match !== "function") match = matcher_default(match);
		for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) if ((node = group[i]) && match.call(node, node.__data__, i, group)) subgroup.push(node);
		return new Selection$1(subgroups, this._parents);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/sparse.js
	function sparse_default(update) {
		return new Array(update.length);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/enter.js
	function enter_default() {
		return new Selection$1(this._enter || this._groups.map(sparse_default), this._parents);
	}
	function EnterNode(parent, datum) {
		this.ownerDocument = parent.ownerDocument;
		this.namespaceURI = parent.namespaceURI;
		this._next = null;
		this._parent = parent;
		this.__data__ = datum;
	}
	EnterNode.prototype = {
		constructor: EnterNode,
		appendChild: function(child) {
			return this._parent.insertBefore(child, this._next);
		},
		insertBefore: function(child, next) {
			return this._parent.insertBefore(child, next);
		},
		querySelector: function(selector) {
			return this._parent.querySelector(selector);
		},
		querySelectorAll: function(selector) {
			return this._parent.querySelectorAll(selector);
		}
	};
	//#endregion
	//#region node_modules/d3-selection/src/constant.js
	function constant_default$2(x) {
		return function() {
			return x;
		};
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/data.js
	function bindIndex(parent, group, enter, update, exit, data) {
		var i = 0, node, groupLength = group.length, dataLength = data.length;
		for (; i < dataLength; ++i) if (node = group[i]) {
			node.__data__ = data[i];
			update[i] = node;
		} else enter[i] = new EnterNode(parent, data[i]);
		for (; i < groupLength; ++i) if (node = group[i]) exit[i] = node;
	}
	function bindKey(parent, group, enter, update, exit, data, key) {
		var i, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
		for (i = 0; i < groupLength; ++i) if (node = group[i]) {
			keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + "";
			if (nodeByKeyValue.has(keyValue)) exit[i] = node;
			else nodeByKeyValue.set(keyValue, node);
		}
		for (i = 0; i < dataLength; ++i) {
			keyValue = key.call(parent, data[i], i, data) + "";
			if (node = nodeByKeyValue.get(keyValue)) {
				update[i] = node;
				node.__data__ = data[i];
				nodeByKeyValue.delete(keyValue);
			} else enter[i] = new EnterNode(parent, data[i]);
		}
		for (i = 0; i < groupLength; ++i) if ((node = group[i]) && nodeByKeyValue.get(keyValues[i]) === node) exit[i] = node;
	}
	function datum(node) {
		return node.__data__;
	}
	function data_default(value, key) {
		if (!arguments.length) return Array.from(this, datum);
		var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
		if (typeof value !== "function") value = constant_default$2(value);
		for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
			var parent = parents[j], group = groups[j], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength);
			bind(parent, group, enterGroup, updateGroup, exit[j] = new Array(groupLength), data, key);
			for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) if (previous = enterGroup[i0]) {
				if (i0 >= i1) i1 = i0 + 1;
				while (!(next = updateGroup[i1]) && ++i1 < dataLength);
				previous._next = next || null;
			}
		}
		update = new Selection$1(update, parents);
		update._enter = enter;
		update._exit = exit;
		return update;
	}
	function arraylike(data) {
		return typeof data === "object" && "length" in data ? data : Array.from(data);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/exit.js
	function exit_default() {
		return new Selection$1(this._exit || this._groups.map(sparse_default), this._parents);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/join.js
	function join_default(onenter, onupdate, onexit) {
		var enter = this.enter(), update = this, exit = this.exit();
		if (typeof onenter === "function") {
			enter = onenter(enter);
			if (enter) enter = enter.selection();
		} else enter = enter.append(onenter + "");
		if (onupdate != null) {
			update = onupdate(update);
			if (update) update = update.selection();
		}
		if (onexit == null) exit.remove();
		else onexit(exit);
		return enter && update ? enter.merge(update).order() : update;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/merge.js
	function merge_default$1(context) {
		var selection = context.selection ? context.selection() : context;
		for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) if (node = group0[i] || group1[i]) merge[i] = node;
		for (; j < m0; ++j) merges[j] = groups0[j];
		return new Selection$1(merges, this._parents);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/order.js
	function order_default() {
		for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) if (node = group[i]) {
			if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
			next = node;
		}
		return this;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/sort.js
	function sort_default$1(compare) {
		if (!compare) compare = ascending;
		function compareNode(a, b) {
			return a && b ? compare(a.__data__, b.__data__) : !a - !b;
		}
		for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
			for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) if (node = group[i]) sortgroup[i] = node;
			sortgroup.sort(compareNode);
		}
		return new Selection$1(sortgroups, this._parents).order();
	}
	function ascending(a, b) {
		return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/call.js
	function call_default() {
		var callback = arguments[0];
		arguments[0] = this;
		callback.apply(null, arguments);
		return this;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/nodes.js
	function nodes_default() {
		return Array.from(this);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/node.js
	function node_default() {
		for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
			var node = group[i];
			if (node) return node;
		}
		return null;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/size.js
	function size_default() {
		let size = 0;
		for (const node of this) ++size;
		return size;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/empty.js
	function empty_default() {
		return !this.node();
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/each.js
	function each_default$1(callback) {
		for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) if (node = group[i]) callback.call(node, node.__data__, i, group);
		return this;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/attr.js
	function attrRemove$1(name) {
		return function() {
			this.removeAttribute(name);
		};
	}
	function attrRemoveNS$1(fullname) {
		return function() {
			this.removeAttributeNS(fullname.space, fullname.local);
		};
	}
	function attrConstant$1(name, value) {
		return function() {
			this.setAttribute(name, value);
		};
	}
	function attrConstantNS$1(fullname, value) {
		return function() {
			this.setAttributeNS(fullname.space, fullname.local, value);
		};
	}
	function attrFunction$1(name, value) {
		return function() {
			var v = value.apply(this, arguments);
			if (v == null) this.removeAttribute(name);
			else this.setAttribute(name, v);
		};
	}
	function attrFunctionNS$1(fullname, value) {
		return function() {
			var v = value.apply(this, arguments);
			if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
			else this.setAttributeNS(fullname.space, fullname.local, v);
		};
	}
	function attr_default$1(name, value) {
		var fullname = namespace_default(name);
		if (arguments.length < 2) {
			var node = this.node();
			return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
		}
		return this.each((value == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value));
	}
	//#endregion
	//#region node_modules/d3-selection/src/window.js
	function window_default(node) {
		return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/style.js
	function styleRemove$1(name) {
		return function() {
			this.style.removeProperty(name);
		};
	}
	function styleConstant$1(name, value, priority) {
		return function() {
			this.style.setProperty(name, value, priority);
		};
	}
	function styleFunction$1(name, value, priority) {
		return function() {
			var v = value.apply(this, arguments);
			if (v == null) this.style.removeProperty(name);
			else this.style.setProperty(name, v, priority);
		};
	}
	function style_default$1(name, value, priority) {
		return arguments.length > 1 ? this.each((value == null ? styleRemove$1 : typeof value === "function" ? styleFunction$1 : styleConstant$1)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
	}
	function styleValue(node, name) {
		return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/property.js
	function propertyRemove(name) {
		return function() {
			delete this[name];
		};
	}
	function propertyConstant(name, value) {
		return function() {
			this[name] = value;
		};
	}
	function propertyFunction(name, value) {
		return function() {
			var v = value.apply(this, arguments);
			if (v == null) delete this[name];
			else this[name] = v;
		};
	}
	function property_default(name, value) {
		return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/classed.js
	function classArray(string) {
		return string.trim().split(/^|\s+/);
	}
	function classList(node) {
		return node.classList || new ClassList(node);
	}
	function ClassList(node) {
		this._node = node;
		this._names = classArray(node.getAttribute("class") || "");
	}
	ClassList.prototype = {
		add: function(name) {
			if (this._names.indexOf(name) < 0) {
				this._names.push(name);
				this._node.setAttribute("class", this._names.join(" "));
			}
		},
		remove: function(name) {
			var i = this._names.indexOf(name);
			if (i >= 0) {
				this._names.splice(i, 1);
				this._node.setAttribute("class", this._names.join(" "));
			}
		},
		contains: function(name) {
			return this._names.indexOf(name) >= 0;
		}
	};
	function classedAdd(node, names) {
		var list = classList(node), i = -1, n = names.length;
		while (++i < n) list.add(names[i]);
	}
	function classedRemove(node, names) {
		var list = classList(node), i = -1, n = names.length;
		while (++i < n) list.remove(names[i]);
	}
	function classedTrue(names) {
		return function() {
			classedAdd(this, names);
		};
	}
	function classedFalse(names) {
		return function() {
			classedRemove(this, names);
		};
	}
	function classedFunction(names, value) {
		return function() {
			(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
		};
	}
	function classed_default(name, value) {
		var names = classArray(name + "");
		if (arguments.length < 2) {
			var list = classList(this.node()), i = -1, n = names.length;
			while (++i < n) if (!list.contains(names[i])) return false;
			return true;
		}
		return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/text.js
	function textRemove() {
		this.textContent = "";
	}
	function textConstant$1(value) {
		return function() {
			this.textContent = value;
		};
	}
	function textFunction$1(value) {
		return function() {
			var v = value.apply(this, arguments);
			this.textContent = v == null ? "" : v;
		};
	}
	function text_default$1(value) {
		return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction$1 : textConstant$1)(value)) : this.node().textContent;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/html.js
	function htmlRemove() {
		this.innerHTML = "";
	}
	function htmlConstant(value) {
		return function() {
			this.innerHTML = value;
		};
	}
	function htmlFunction(value) {
		return function() {
			var v = value.apply(this, arguments);
			this.innerHTML = v == null ? "" : v;
		};
	}
	function html_default(value) {
		return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/raise.js
	function raise() {
		if (this.nextSibling) this.parentNode.appendChild(this);
	}
	function raise_default() {
		return this.each(raise);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/lower.js
	function lower() {
		if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
	}
	function lower_default() {
		return this.each(lower);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/append.js
	function append_default(name) {
		var create = typeof name === "function" ? name : creator_default(name);
		return this.select(function() {
			return this.appendChild(create.apply(this, arguments));
		});
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/insert.js
	function constantNull() {
		return null;
	}
	function insert_default(name, before) {
		var create = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
		return this.select(function() {
			return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
		});
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/remove.js
	function remove() {
		var parent = this.parentNode;
		if (parent) parent.removeChild(this);
	}
	function remove_default$1() {
		return this.each(remove);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/clone.js
	function selection_cloneShallow() {
		var clone = this.cloneNode(false), parent = this.parentNode;
		return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
	}
	function selection_cloneDeep() {
		var clone = this.cloneNode(true), parent = this.parentNode;
		return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
	}
	function clone_default(deep) {
		return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/datum.js
	function datum_default(value) {
		return arguments.length ? this.property("__data__", value) : this.node().__data__;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/on.js
	function contextListener(listener) {
		return function(event) {
			listener.call(this, event, this.__data__);
		};
	}
	function parseTypenames(typenames) {
		return typenames.trim().split(/^|\s+/).map(function(t) {
			var name = "", i = t.indexOf(".");
			if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
			return {
				type: t,
				name
			};
		});
	}
	function onRemove(typename) {
		return function() {
			var on = this.__on;
			if (!on) return;
			for (var j = 0, i = -1, m = on.length, o; j < m; ++j) if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) this.removeEventListener(o.type, o.listener, o.options);
			else on[++i] = o;
			if (++i) on.length = i;
			else delete this.__on;
		};
	}
	function onAdd(typename, value, options) {
		return function() {
			var on = this.__on, o, listener = contextListener(value);
			if (on) {
				for (var j = 0, m = on.length; j < m; ++j) if ((o = on[j]).type === typename.type && o.name === typename.name) {
					this.removeEventListener(o.type, o.listener, o.options);
					this.addEventListener(o.type, o.listener = listener, o.options = options);
					o.value = value;
					return;
				}
			}
			this.addEventListener(typename.type, listener, options);
			o = {
				type: typename.type,
				name: typename.name,
				value,
				listener,
				options
			};
			if (!on) this.__on = [o];
			else on.push(o);
		};
	}
	function on_default$1(typename, value, options) {
		var typenames = parseTypenames(typename + ""), i, n = typenames.length, t;
		if (arguments.length < 2) {
			var on = this.node().__on;
			if (on) {
				for (var j = 0, m = on.length, o; j < m; ++j) for (i = 0, o = on[j]; i < n; ++i) if ((t = typenames[i]).type === o.type && t.name === o.name) return o.value;
			}
			return;
		}
		on = value ? onAdd : onRemove;
		for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));
		return this;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/dispatch.js
	function dispatchEvent(node, type, params) {
		var window = window_default(node), event = window.CustomEvent;
		if (typeof event === "function") event = new event(type, params);
		else {
			event = window.document.createEvent("Event");
			if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;
			else event.initEvent(type, false, false);
		}
		node.dispatchEvent(event);
	}
	function dispatchConstant(type, params) {
		return function() {
			return dispatchEvent(this, type, params);
		};
	}
	function dispatchFunction(type, params) {
		return function() {
			return dispatchEvent(this, type, params.apply(this, arguments));
		};
	}
	function dispatch_default(type, params) {
		return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params));
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/iterator.js
	function* iterator_default$1() {
		for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) if (node = group[i]) yield node;
	}
	//#endregion
	//#region node_modules/d3-selection/src/selection/index.js
	var root = [null];
	function Selection$1(groups, parents) {
		this._groups = groups;
		this._parents = parents;
	}
	function selection() {
		return new Selection$1([[document.documentElement]], root);
	}
	function selection_selection() {
		return this;
	}
	Selection$1.prototype = selection.prototype = {
		constructor: Selection$1,
		select: select_default$2,
		selectAll: selectAll_default$1,
		selectChild: selectChild_default,
		selectChildren: selectChildren_default,
		filter: filter_default$1,
		data: data_default,
		enter: enter_default,
		exit: exit_default,
		join: join_default,
		merge: merge_default$1,
		selection: selection_selection,
		order: order_default,
		sort: sort_default$1,
		call: call_default,
		nodes: nodes_default,
		node: node_default,
		size: size_default,
		empty: empty_default,
		each: each_default$1,
		attr: attr_default$1,
		style: style_default$1,
		property: property_default,
		classed: classed_default,
		text: text_default$1,
		html: html_default,
		raise: raise_default,
		lower: lower_default,
		append: append_default,
		insert: insert_default,
		remove: remove_default$1,
		clone: clone_default,
		datum: datum_default,
		on: on_default$1,
		dispatch: dispatch_default,
		[Symbol.iterator]: iterator_default$1
	};
	//#endregion
	//#region node_modules/d3-selection/src/select.js
	function select_default$1(selector) {
		return typeof selector === "string" ? new Selection$1([[document.querySelector(selector)]], [document.documentElement]) : new Selection$1([[selector]], root);
	}
	//#endregion
	//#region node_modules/d3-color/src/define.js
	function define_default(constructor, factory, prototype) {
		constructor.prototype = factory.prototype = prototype;
		prototype.constructor = constructor;
	}
	function extend(parent, definition) {
		var prototype = Object.create(parent.prototype);
		for (var key in definition) prototype[key] = definition[key];
		return prototype;
	}
	//#endregion
	//#region node_modules/d3-color/src/color.js
	function Color() {}
	var darker = .7;
	var brighter = 1 / darker;
	var reI = "\\s*([+-]?\\d+)\\s*";
	var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
	var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
	var reHex = /^#([0-9a-f]{3,8})$/;
	var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
	var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
	var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
	var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
	var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
	var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
	var named = {
		aliceblue: 15792383,
		antiquewhite: 16444375,
		aqua: 65535,
		aquamarine: 8388564,
		azure: 15794175,
		beige: 16119260,
		bisque: 16770244,
		black: 0,
		blanchedalmond: 16772045,
		blue: 255,
		blueviolet: 9055202,
		brown: 10824234,
		burlywood: 14596231,
		cadetblue: 6266528,
		chartreuse: 8388352,
		chocolate: 13789470,
		coral: 16744272,
		cornflowerblue: 6591981,
		cornsilk: 16775388,
		crimson: 14423100,
		cyan: 65535,
		darkblue: 139,
		darkcyan: 35723,
		darkgoldenrod: 12092939,
		darkgray: 11119017,
		darkgreen: 25600,
		darkgrey: 11119017,
		darkkhaki: 12433259,
		darkmagenta: 9109643,
		darkolivegreen: 5597999,
		darkorange: 16747520,
		darkorchid: 10040012,
		darkred: 9109504,
		darksalmon: 15308410,
		darkseagreen: 9419919,
		darkslateblue: 4734347,
		darkslategray: 3100495,
		darkslategrey: 3100495,
		darkturquoise: 52945,
		darkviolet: 9699539,
		deeppink: 16716947,
		deepskyblue: 49151,
		dimgray: 6908265,
		dimgrey: 6908265,
		dodgerblue: 2003199,
		firebrick: 11674146,
		floralwhite: 16775920,
		forestgreen: 2263842,
		fuchsia: 16711935,
		gainsboro: 14474460,
		ghostwhite: 16316671,
		gold: 16766720,
		goldenrod: 14329120,
		gray: 8421504,
		green: 32768,
		greenyellow: 11403055,
		grey: 8421504,
		honeydew: 15794160,
		hotpink: 16738740,
		indianred: 13458524,
		indigo: 4915330,
		ivory: 16777200,
		khaki: 15787660,
		lavender: 15132410,
		lavenderblush: 16773365,
		lawngreen: 8190976,
		lemonchiffon: 16775885,
		lightblue: 11393254,
		lightcoral: 15761536,
		lightcyan: 14745599,
		lightgoldenrodyellow: 16448210,
		lightgray: 13882323,
		lightgreen: 9498256,
		lightgrey: 13882323,
		lightpink: 16758465,
		lightsalmon: 16752762,
		lightseagreen: 2142890,
		lightskyblue: 8900346,
		lightslategray: 7833753,
		lightslategrey: 7833753,
		lightsteelblue: 11584734,
		lightyellow: 16777184,
		lime: 65280,
		limegreen: 3329330,
		linen: 16445670,
		magenta: 16711935,
		maroon: 8388608,
		mediumaquamarine: 6737322,
		mediumblue: 205,
		mediumorchid: 12211667,
		mediumpurple: 9662683,
		mediumseagreen: 3978097,
		mediumslateblue: 8087790,
		mediumspringgreen: 64154,
		mediumturquoise: 4772300,
		mediumvioletred: 13047173,
		midnightblue: 1644912,
		mintcream: 16121850,
		mistyrose: 16770273,
		moccasin: 16770229,
		navajowhite: 16768685,
		navy: 128,
		oldlace: 16643558,
		olive: 8421376,
		olivedrab: 7048739,
		orange: 16753920,
		orangered: 16729344,
		orchid: 14315734,
		palegoldenrod: 15657130,
		palegreen: 10025880,
		paleturquoise: 11529966,
		palevioletred: 14381203,
		papayawhip: 16773077,
		peachpuff: 16767673,
		peru: 13468991,
		pink: 16761035,
		plum: 14524637,
		powderblue: 11591910,
		purple: 8388736,
		rebeccapurple: 6697881,
		red: 16711680,
		rosybrown: 12357519,
		royalblue: 4286945,
		saddlebrown: 9127187,
		salmon: 16416882,
		sandybrown: 16032864,
		seagreen: 3050327,
		seashell: 16774638,
		sienna: 10506797,
		silver: 12632256,
		skyblue: 8900331,
		slateblue: 6970061,
		slategray: 7372944,
		slategrey: 7372944,
		snow: 16775930,
		springgreen: 65407,
		steelblue: 4620980,
		tan: 13808780,
		teal: 32896,
		thistle: 14204888,
		tomato: 16737095,
		turquoise: 4251856,
		violet: 15631086,
		wheat: 16113331,
		white: 16777215,
		whitesmoke: 16119285,
		yellow: 16776960,
		yellowgreen: 10145074
	};
	define_default(Color, color, {
		copy(channels) {
			return Object.assign(new this.constructor(), this, channels);
		},
		displayable() {
			return this.rgb().displayable();
		},
		hex: color_formatHex,
		formatHex: color_formatHex,
		formatHex8: color_formatHex8,
		formatHsl: color_formatHsl,
		formatRgb: color_formatRgb,
		toString: color_formatRgb
	});
	function color_formatHex() {
		return this.rgb().formatHex();
	}
	function color_formatHex8() {
		return this.rgb().formatHex8();
	}
	function color_formatHsl() {
		return hslConvert(this).formatHsl();
	}
	function color_formatRgb() {
		return this.rgb().formatRgb();
	}
	function color(format) {
		var m, l;
		format = (format + "").trim().toLowerCase();
		return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
	}
	function rgbn(n) {
		return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
	}
	function rgba(r, g, b, a) {
		if (a <= 0) r = g = b = NaN;
		return new Rgb(r, g, b, a);
	}
	function rgbConvert(o) {
		if (!(o instanceof Color)) o = color(o);
		if (!o) return new Rgb();
		o = o.rgb();
		return new Rgb(o.r, o.g, o.b, o.opacity);
	}
	function rgb(r, g, b, opacity) {
		return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
	}
	function Rgb(r, g, b, opacity) {
		this.r = +r;
		this.g = +g;
		this.b = +b;
		this.opacity = +opacity;
	}
	define_default(Rgb, rgb, extend(Color, {
		brighter(k) {
			k = k == null ? brighter : Math.pow(brighter, k);
			return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
		},
		darker(k) {
			k = k == null ? darker : Math.pow(darker, k);
			return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
		},
		rgb() {
			return this;
		},
		clamp() {
			return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
		},
		displayable() {
			return -.5 <= this.r && this.r < 255.5 && -.5 <= this.g && this.g < 255.5 && -.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
		},
		hex: rgb_formatHex,
		formatHex: rgb_formatHex,
		formatHex8: rgb_formatHex8,
		formatRgb: rgb_formatRgb,
		toString: rgb_formatRgb
	}));
	function rgb_formatHex() {
		return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
	}
	function rgb_formatHex8() {
		return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
	}
	function rgb_formatRgb() {
		const a = clampa(this.opacity);
		return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
	}
	function clampa(opacity) {
		return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
	}
	function clampi(value) {
		return Math.max(0, Math.min(255, Math.round(value) || 0));
	}
	function hex(value) {
		value = clampi(value);
		return (value < 16 ? "0" : "") + value.toString(16);
	}
	function hsla(h, s, l, a) {
		if (a <= 0) h = s = l = NaN;
		else if (l <= 0 || l >= 1) h = s = NaN;
		else if (s <= 0) h = NaN;
		return new Hsl(h, s, l, a);
	}
	function hslConvert(o) {
		if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
		if (!(o instanceof Color)) o = color(o);
		if (!o) return new Hsl();
		if (o instanceof Hsl) return o;
		o = o.rgb();
		var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
		if (s) {
			if (r === max) h = (g - b) / s + (g < b) * 6;
			else if (g === max) h = (b - r) / s + 2;
			else h = (r - g) / s + 4;
			s /= l < .5 ? max + min : 2 - max - min;
			h *= 60;
		} else s = l > 0 && l < 1 ? 0 : h;
		return new Hsl(h, s, l, o.opacity);
	}
	function hsl(h, s, l, opacity) {
		return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
	}
	function Hsl(h, s, l, opacity) {
		this.h = +h;
		this.s = +s;
		this.l = +l;
		this.opacity = +opacity;
	}
	define_default(Hsl, hsl, extend(Color, {
		brighter(k) {
			k = k == null ? brighter : Math.pow(brighter, k);
			return new Hsl(this.h, this.s, this.l * k, this.opacity);
		},
		darker(k) {
			k = k == null ? darker : Math.pow(darker, k);
			return new Hsl(this.h, this.s, this.l * k, this.opacity);
		},
		rgb() {
			var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < .5 ? l : 1 - l) * s, m1 = 2 * l - m2;
			return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
		},
		clamp() {
			return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
		},
		displayable() {
			return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
		},
		formatHsl() {
			const a = clampa(this.opacity);
			return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
		}
	}));
	function clamph(value) {
		value = (value || 0) % 360;
		return value < 0 ? value + 360 : value;
	}
	function clampt(value) {
		return Math.max(0, Math.min(1, value || 0));
	}
	function hsl2rgb(h, m1, m2) {
		return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
	}
	//#endregion
	//#region node_modules/d3-interpolate/src/constant.js
	var constant_default$1 = (x) => () => x;
	//#endregion
	//#region node_modules/d3-interpolate/src/color.js
	function linear(a, d) {
		return function(t) {
			return a + t * d;
		};
	}
	function exponential(a, b, y) {
		return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
			return Math.pow(a + t * b, y);
		};
	}
	function gamma(y) {
		return (y = +y) === 1 ? nogamma : function(a, b) {
			return b - a ? exponential(a, b, y) : constant_default$1(isNaN(a) ? b : a);
		};
	}
	function nogamma(a, b) {
		var d = b - a;
		return d ? linear(a, d) : constant_default$1(isNaN(a) ? b : a);
	}
	//#endregion
	//#region node_modules/d3-interpolate/src/rgb.js
	var rgb_default = (function rgbGamma(y) {
		var color = gamma(y);
		function rgb$1(start, end) {
			var r = color((start = rgb(start)).r, (end = rgb(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
			return function(t) {
				start.r = r(t);
				start.g = g(t);
				start.b = b(t);
				start.opacity = opacity(t);
				return start + "";
			};
		}
		rgb$1.gamma = rgbGamma;
		return rgb$1;
	})(1);
	//#endregion
	//#region node_modules/d3-interpolate/src/number.js
	function number_default(a, b) {
		return a = +a, b = +b, function(t) {
			return a * (1 - t) + b * t;
		};
	}
	//#endregion
	//#region node_modules/d3-interpolate/src/string.js
	var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
	var reB = new RegExp(reA.source, "g");
	function zero(b) {
		return function() {
			return b;
		};
	}
	function one(b) {
		return function(t) {
			return b(t) + "";
		};
	}
	function string_default(a, b) {
		var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = [];
		a = a + "", b = b + "";
		while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
			if ((bs = bm.index) > bi) {
				bs = b.slice(bi, bs);
				if (s[i]) s[i] += bs;
				else s[++i] = bs;
			}
			if ((am = am[0]) === (bm = bm[0])) {
				if (s[i]) s[i] += bm;
				else s[++i] = bm;
			} else {
				s[++i] = null;
				q.push({
					i,
					x: number_default(am, bm)
				});
			}
			bi = reB.lastIndex;
		}
		if (bi < b.length) {
			bs = b.slice(bi);
			if (s[i]) s[i] += bs;
			else s[++i] = bs;
		}
		return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) {
			for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
			return s.join("");
		});
	}
	//#endregion
	//#region node_modules/d3-interpolate/src/transform/decompose.js
	var degrees = 180 / Math.PI;
	var identity$1 = {
		translateX: 0,
		translateY: 0,
		rotate: 0,
		skewX: 0,
		scaleX: 1,
		scaleY: 1
	};
	function decompose_default(a, b, c, d, e, f) {
		var scaleX, scaleY, skewX;
		if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
		if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
		if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
		if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
		return {
			translateX: e,
			translateY: f,
			rotate: Math.atan2(b, a) * degrees,
			skewX: Math.atan(skewX) * degrees,
			scaleX,
			scaleY
		};
	}
	//#endregion
	//#region node_modules/d3-interpolate/src/transform/parse.js
	var svgNode;
	function parseCss(value) {
		const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
		return m.isIdentity ? identity$1 : decompose_default(m.a, m.b, m.c, m.d, m.e, m.f);
	}
	function parseSvg(value) {
		if (value == null) return identity$1;
		if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
		svgNode.setAttribute("transform", value);
		if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1;
		value = value.matrix;
		return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
	}
	//#endregion
	//#region node_modules/d3-interpolate/src/transform/index.js
	function interpolateTransform(parse, pxComma, pxParen, degParen) {
		function pop(s) {
			return s.length ? s.pop() + " " : "";
		}
		function translate(xa, ya, xb, yb, s, q) {
			if (xa !== xb || ya !== yb) {
				var i = s.push("translate(", null, pxComma, null, pxParen);
				q.push({
					i: i - 4,
					x: number_default(xa, xb)
				}, {
					i: i - 2,
					x: number_default(ya, yb)
				});
			} else if (xb || yb) s.push("translate(" + xb + pxComma + yb + pxParen);
		}
		function rotate(a, b, s, q) {
			if (a !== b) {
				if (a - b > 180) b += 360;
				else if (b - a > 180) a += 360;
				q.push({
					i: s.push(pop(s) + "rotate(", null, degParen) - 2,
					x: number_default(a, b)
				});
			} else if (b) s.push(pop(s) + "rotate(" + b + degParen);
		}
		function skewX(a, b, s, q) {
			if (a !== b) q.push({
				i: s.push(pop(s) + "skewX(", null, degParen) - 2,
				x: number_default(a, b)
			});
			else if (b) s.push(pop(s) + "skewX(" + b + degParen);
		}
		function scale(xa, ya, xb, yb, s, q) {
			if (xa !== xb || ya !== yb) {
				var i = s.push(pop(s) + "scale(", null, ",", null, ")");
				q.push({
					i: i - 4,
					x: number_default(xa, xb)
				}, {
					i: i - 2,
					x: number_default(ya, yb)
				});
			} else if (xb !== 1 || yb !== 1) s.push(pop(s) + "scale(" + xb + "," + yb + ")");
		}
		return function(a, b) {
			var s = [], q = [];
			a = parse(a), b = parse(b);
			translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
			rotate(a.rotate, b.rotate, s, q);
			skewX(a.skewX, b.skewX, s, q);
			scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
			a = b = null;
			return function(t) {
				var i = -1, n = q.length, o;
				while (++i < n) s[(o = q[i]).i] = o.x(t);
				return s.join("");
			};
		};
	}
	var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
	var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
	//#endregion
	//#region node_modules/d3-timer/src/timer.js
	var frame = 0;
	var timeout = 0;
	var interval = 0;
	var pokeDelay = 1e3;
	var taskHead;
	var taskTail;
	var clockLast = 0;
	var clockNow = 0;
	var clockSkew = 0;
	var clock = typeof performance === "object" && performance.now ? performance : Date;
	var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
		setTimeout(f, 17);
	};
	function now() {
		return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
	}
	function clearNow() {
		clockNow = 0;
	}
	function Timer() {
		this._call = this._time = this._next = null;
	}
	Timer.prototype = timer.prototype = {
		constructor: Timer,
		restart: function(callback, delay, time) {
			if (typeof callback !== "function") throw new TypeError("callback is not a function");
			time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
			if (!this._next && taskTail !== this) {
				if (taskTail) taskTail._next = this;
				else taskHead = this;
				taskTail = this;
			}
			this._call = callback;
			this._time = time;
			sleep();
		},
		stop: function() {
			if (this._call) {
				this._call = null;
				this._time = Infinity;
				sleep();
			}
		}
	};
	function timer(callback, delay, time) {
		var t = new Timer();
		t.restart(callback, delay, time);
		return t;
	}
	function timerFlush() {
		now();
		++frame;
		var t = taskHead, e;
		while (t) {
			if ((e = clockNow - t._time) >= 0) t._call.call(void 0, e);
			t = t._next;
		}
		--frame;
	}
	function wake() {
		clockNow = (clockLast = clock.now()) + clockSkew;
		frame = timeout = 0;
		try {
			timerFlush();
		} finally {
			frame = 0;
			nap();
			clockNow = 0;
		}
	}
	function poke() {
		var now = clock.now(), delay = now - clockLast;
		if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
	}
	function nap() {
		var t0, t1 = taskHead, t2, time = Infinity;
		while (t1) if (t1._call) {
			if (time > t1._time) time = t1._time;
			t0 = t1, t1 = t1._next;
		} else {
			t2 = t1._next, t1._next = null;
			t1 = t0 ? t0._next = t2 : taskHead = t2;
		}
		taskTail = t0;
		sleep(time);
	}
	function sleep(time) {
		if (frame) return;
		if (timeout) timeout = clearTimeout(timeout);
		if (time - clockNow > 24) {
			if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
			if (interval) interval = clearInterval(interval);
		} else {
			if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
			frame = 1, setFrame(wake);
		}
	}
	//#endregion
	//#region node_modules/d3-timer/src/timeout.js
	function timeout_default(callback, delay, time) {
		var t = new Timer();
		delay = delay == null ? 0 : +delay;
		t.restart((elapsed) => {
			t.stop();
			callback(elapsed + delay);
		}, delay, time);
		return t;
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/schedule.js
	var emptyOn = dispatch("start", "end", "cancel", "interrupt");
	var emptyTween = [];
	function schedule_default(node, name, id, index, group, timing) {
		var schedules = node.__transition;
		if (!schedules) node.__transition = {};
		else if (id in schedules) return;
		create(node, id, {
			name,
			index,
			group,
			on: emptyOn,
			tween: emptyTween,
			time: timing.time,
			delay: timing.delay,
			duration: timing.duration,
			ease: timing.ease,
			timer: null,
			state: 0
		});
	}
	function init(node, id) {
		var schedule = get(node, id);
		if (schedule.state > 0) throw new Error("too late; already scheduled");
		return schedule;
	}
	function set(node, id) {
		var schedule = get(node, id);
		if (schedule.state > 3) throw new Error("too late; already running");
		return schedule;
	}
	function get(node, id) {
		var schedule = node.__transition;
		if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
		return schedule;
	}
	function create(node, id, self) {
		var schedules = node.__transition, tween;
		schedules[id] = self;
		self.timer = timer(schedule, 0, self.time);
		function schedule(elapsed) {
			self.state = 1;
			self.timer.restart(start, self.delay, self.time);
			if (self.delay <= elapsed) start(elapsed - self.delay);
		}
		function start(elapsed) {
			var i, j, n, o;
			if (self.state !== 1) return stop();
			for (i in schedules) {
				o = schedules[i];
				if (o.name !== self.name) continue;
				if (o.state === 3) return timeout_default(start);
				if (o.state === 4) {
					o.state = 6;
					o.timer.stop();
					o.on.call("interrupt", node, node.__data__, o.index, o.group);
					delete schedules[i];
				} else if (+i < id) {
					o.state = 6;
					o.timer.stop();
					o.on.call("cancel", node, node.__data__, o.index, o.group);
					delete schedules[i];
				}
			}
			timeout_default(function() {
				if (self.state === 3) {
					self.state = 4;
					self.timer.restart(tick, self.delay, self.time);
					tick(elapsed);
				}
			});
			self.state = 2;
			self.on.call("start", node, node.__data__, self.index, self.group);
			if (self.state !== 2) return;
			self.state = 3;
			tween = new Array(n = self.tween.length);
			for (i = 0, j = -1; i < n; ++i) if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) tween[++j] = o;
			tween.length = j + 1;
		}
		function tick(elapsed) {
			var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = 5, 1), i = -1, n = tween.length;
			while (++i < n) tween[i].call(node, t);
			if (self.state === 5) {
				self.on.call("end", node, node.__data__, self.index, self.group);
				stop();
			}
		}
		function stop() {
			self.state = 6;
			self.timer.stop();
			delete schedules[id];
			for (var i in schedules) return;
			delete node.__transition;
		}
	}
	//#endregion
	//#region node_modules/d3-transition/src/interrupt.js
	function interrupt_default$1(node, name) {
		var schedules = node.__transition, schedule, active, empty = true, i;
		if (!schedules) return;
		name = name == null ? null : name + "";
		for (i in schedules) {
			if ((schedule = schedules[i]).name !== name) {
				empty = false;
				continue;
			}
			active = schedule.state > 2 && schedule.state < 5;
			schedule.state = 6;
			schedule.timer.stop();
			schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
			delete schedules[i];
		}
		if (empty) delete node.__transition;
	}
	//#endregion
	//#region node_modules/d3-transition/src/selection/interrupt.js
	function interrupt_default(name) {
		return this.each(function() {
			interrupt_default$1(this, name);
		});
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/tween.js
	function tweenRemove(id, name) {
		var tween0, tween1;
		return function() {
			var schedule = set(this, id), tween = schedule.tween;
			if (tween !== tween0) {
				tween1 = tween0 = tween;
				for (var i = 0, n = tween1.length; i < n; ++i) if (tween1[i].name === name) {
					tween1 = tween1.slice();
					tween1.splice(i, 1);
					break;
				}
			}
			schedule.tween = tween1;
		};
	}
	function tweenFunction(id, name, value) {
		var tween0, tween1;
		if (typeof value !== "function") throw new Error();
		return function() {
			var schedule = set(this, id), tween = schedule.tween;
			if (tween !== tween0) {
				tween1 = (tween0 = tween).slice();
				for (var t = {
					name,
					value
				}, i = 0, n = tween1.length; i < n; ++i) if (tween1[i].name === name) {
					tween1[i] = t;
					break;
				}
				if (i === n) tween1.push(t);
			}
			schedule.tween = tween1;
		};
	}
	function tween_default(name, value) {
		var id = this._id;
		name += "";
		if (arguments.length < 2) {
			var tween = get(this.node(), id).tween;
			for (var i = 0, n = tween.length, t; i < n; ++i) if ((t = tween[i]).name === name) return t.value;
			return null;
		}
		return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
	}
	function tweenValue(transition, name, value) {
		var id = transition._id;
		transition.each(function() {
			var schedule = set(this, id);
			(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
		});
		return function(node) {
			return get(node, id).value[name];
		};
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/interpolate.js
	function interpolate_default(a, b) {
		var c;
		return (typeof b === "number" ? number_default : b instanceof color ? rgb_default : (c = color(b)) ? (b = c, rgb_default) : string_default)(a, b);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/attr.js
	function attrRemove(name) {
		return function() {
			this.removeAttribute(name);
		};
	}
	function attrRemoveNS(fullname) {
		return function() {
			this.removeAttributeNS(fullname.space, fullname.local);
		};
	}
	function attrConstant(name, interpolate, value1) {
		var string00, string1 = value1 + "", interpolate0;
		return function() {
			var string0 = this.getAttribute(name);
			return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
		};
	}
	function attrConstantNS(fullname, interpolate, value1) {
		var string00, string1 = value1 + "", interpolate0;
		return function() {
			var string0 = this.getAttributeNS(fullname.space, fullname.local);
			return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
		};
	}
	function attrFunction(name, interpolate, value) {
		var string00, string10, interpolate0;
		return function() {
			var string0, value1 = value(this), string1;
			if (value1 == null) return void this.removeAttribute(name);
			string0 = this.getAttribute(name);
			string1 = value1 + "";
			return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
		};
	}
	function attrFunctionNS(fullname, interpolate, value) {
		var string00, string10, interpolate0;
		return function() {
			var string0, value1 = value(this), string1;
			if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
			string0 = this.getAttributeNS(fullname.space, fullname.local);
			string1 = value1 + "";
			return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
		};
	}
	function attr_default(name, value) {
		var fullname = namespace_default(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
		return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/attrTween.js
	function attrInterpolate(name, i) {
		return function(t) {
			this.setAttribute(name, i.call(this, t));
		};
	}
	function attrInterpolateNS(fullname, i) {
		return function(t) {
			this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));
		};
	}
	function attrTweenNS(fullname, value) {
		var t0, i0;
		function tween() {
			var i = value.apply(this, arguments);
			if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);
			return t0;
		}
		tween._value = value;
		return tween;
	}
	function attrTween(name, value) {
		var t0, i0;
		function tween() {
			var i = value.apply(this, arguments);
			if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);
			return t0;
		}
		tween._value = value;
		return tween;
	}
	function attrTween_default(name, value) {
		var key = "attr." + name;
		if (arguments.length < 2) return (key = this.tween(key)) && key._value;
		if (value == null) return this.tween(key, null);
		if (typeof value !== "function") throw new Error();
		var fullname = namespace_default(name);
		return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/delay.js
	function delayFunction(id, value) {
		return function() {
			init(this, id).delay = +value.apply(this, arguments);
		};
	}
	function delayConstant(id, value) {
		return value = +value, function() {
			init(this, id).delay = value;
		};
	}
	function delay_default(value) {
		var id = this._id;
		return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get(this.node(), id).delay;
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/duration.js
	function durationFunction(id, value) {
		return function() {
			set(this, id).duration = +value.apply(this, arguments);
		};
	}
	function durationConstant(id, value) {
		return value = +value, function() {
			set(this, id).duration = value;
		};
	}
	function duration_default(value) {
		var id = this._id;
		return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get(this.node(), id).duration;
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/ease.js
	function easeConstant(id, value) {
		if (typeof value !== "function") throw new Error();
		return function() {
			set(this, id).ease = value;
		};
	}
	function ease_default(value) {
		var id = this._id;
		return arguments.length ? this.each(easeConstant(id, value)) : get(this.node(), id).ease;
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/easeVarying.js
	function easeVarying(id, value) {
		return function() {
			var v = value.apply(this, arguments);
			if (typeof v !== "function") throw new Error();
			set(this, id).ease = v;
		};
	}
	function easeVarying_default(value) {
		if (typeof value !== "function") throw new Error();
		return this.each(easeVarying(this._id, value));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/filter.js
	function filter_default(match) {
		if (typeof match !== "function") match = matcher_default(match);
		for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) if ((node = group[i]) && match.call(node, node.__data__, i, group)) subgroup.push(node);
		return new Transition(subgroups, this._parents, this._name, this._id);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/merge.js
	function merge_default(transition) {
		if (transition._id !== this._id) throw new Error();
		for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) if (node = group0[i] || group1[i]) merge[i] = node;
		for (; j < m0; ++j) merges[j] = groups0[j];
		return new Transition(merges, this._parents, this._name, this._id);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/on.js
	function start(name) {
		return (name + "").trim().split(/^|\s+/).every(function(t) {
			var i = t.indexOf(".");
			if (i >= 0) t = t.slice(0, i);
			return !t || t === "start";
		});
	}
	function onFunction(id, name, listener) {
		var on0, on1, sit = start(name) ? init : set;
		return function() {
			var schedule = sit(this, id), on = schedule.on;
			if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
			schedule.on = on1;
		};
	}
	function on_default(name, listener) {
		var id = this._id;
		return arguments.length < 2 ? get(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/remove.js
	function removeFunction(id) {
		return function() {
			var parent = this.parentNode;
			for (var i in this.__transition) if (+i !== id) return;
			if (parent) parent.removeChild(this);
		};
	}
	function remove_default() {
		return this.on("end.remove", removeFunction(this._id));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/select.js
	function select_default(select) {
		var name = this._name, id = this._id;
		if (typeof select !== "function") select = selector_default(select);
		for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
			if ("__data__" in node) subnode.__data__ = node.__data__;
			subgroup[i] = subnode;
			schedule_default(subgroup[i], name, id, i, subgroup, get(node, id));
		}
		return new Transition(subgroups, this._parents, name, id);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/selectAll.js
	function selectAll_default(select) {
		var name = this._name, id = this._id;
		if (typeof select !== "function") select = selectorAll_default(select);
		for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) if (node = group[i]) {
			for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) if (child = children[k]) schedule_default(child, name, id, k, children, inherit);
			subgroups.push(children);
			parents.push(node);
		}
		return new Transition(subgroups, parents, name, id);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/selection.js
	var Selection = selection.prototype.constructor;
	function selection_default() {
		return new Selection(this._groups, this._parents);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/style.js
	function styleNull(name, interpolate) {
		var string00, string10, interpolate0;
		return function() {
			var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
			return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
		};
	}
	function styleRemove(name) {
		return function() {
			this.style.removeProperty(name);
		};
	}
	function styleConstant(name, interpolate, value1) {
		var string00, string1 = value1 + "", interpolate0;
		return function() {
			var string0 = styleValue(this, name);
			return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
		};
	}
	function styleFunction(name, interpolate, value) {
		var string00, string10, interpolate0;
		return function() {
			var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
			if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
			return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
		};
	}
	function styleMaybeRemove(id, name) {
		var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
		return function() {
			var schedule = set(this, id), on = schedule.on, listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : void 0;
			if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
			schedule.on = on1;
		};
	}
	function style_default(name, value, priority) {
		var i = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
		return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove(name)) : typeof value === "function" ? this.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant(name, i, value), priority).on("end.style." + name, null);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/styleTween.js
	function styleInterpolate(name, i, priority) {
		return function(t) {
			this.style.setProperty(name, i.call(this, t), priority);
		};
	}
	function styleTween(name, value, priority) {
		var t, i0;
		function tween() {
			var i = value.apply(this, arguments);
			if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);
			return t;
		}
		tween._value = value;
		return tween;
	}
	function styleTween_default(name, value, priority) {
		var key = "style." + (name += "");
		if (arguments.length < 2) return (key = this.tween(key)) && key._value;
		if (value == null) return this.tween(key, null);
		if (typeof value !== "function") throw new Error();
		return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/text.js
	function textConstant(value) {
		return function() {
			this.textContent = value;
		};
	}
	function textFunction(value) {
		return function() {
			var value1 = value(this);
			this.textContent = value1 == null ? "" : value1;
		};
	}
	function text_default(value) {
		return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + ""));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/textTween.js
	function textInterpolate(i) {
		return function(t) {
			this.textContent = i.call(this, t);
		};
	}
	function textTween(value) {
		var t0, i0;
		function tween() {
			var i = value.apply(this, arguments);
			if (i !== i0) t0 = (i0 = i) && textInterpolate(i);
			return t0;
		}
		tween._value = value;
		return tween;
	}
	function textTween_default(value) {
		var key = "text";
		if (arguments.length < 1) return (key = this.tween(key)) && key._value;
		if (value == null) return this.tween(key, null);
		if (typeof value !== "function") throw new Error();
		return this.tween(key, textTween(value));
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/transition.js
	function transition_default$1() {
		var name = this._name, id0 = this._id, id1 = newId();
		for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) if (node = group[i]) {
			var inherit = get(node, id0);
			schedule_default(node, name, id1, i, group, {
				time: inherit.time + inherit.delay + inherit.duration,
				delay: 0,
				duration: inherit.duration,
				ease: inherit.ease
			});
		}
		return new Transition(groups, this._parents, name, id1);
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/end.js
	function end_default() {
		var on0, on1, that = this, id = that._id, size = that.size();
		return new Promise(function(resolve, reject) {
			var cancel = { value: reject }, end = { value: function() {
				if (--size === 0) resolve();
			} };
			that.each(function() {
				var schedule = set(this, id), on = schedule.on;
				if (on !== on0) {
					on1 = (on0 = on).copy();
					on1._.cancel.push(cancel);
					on1._.interrupt.push(cancel);
					on1._.end.push(end);
				}
				schedule.on = on1;
			});
			if (size === 0) resolve();
		});
	}
	//#endregion
	//#region node_modules/d3-transition/src/transition/index.js
	var id = 0;
	function Transition(groups, parents, name, id) {
		this._groups = groups;
		this._parents = parents;
		this._name = name;
		this._id = id;
	}
	function transition(name) {
		return selection().transition(name);
	}
	function newId() {
		return ++id;
	}
	var selection_prototype = selection.prototype;
	Transition.prototype = transition.prototype = {
		constructor: Transition,
		select: select_default,
		selectAll: selectAll_default,
		selectChild: selection_prototype.selectChild,
		selectChildren: selection_prototype.selectChildren,
		filter: filter_default,
		merge: merge_default,
		selection: selection_default,
		transition: transition_default$1,
		call: selection_prototype.call,
		nodes: selection_prototype.nodes,
		node: selection_prototype.node,
		size: selection_prototype.size,
		empty: selection_prototype.empty,
		each: selection_prototype.each,
		on: on_default,
		attr: attr_default,
		attrTween: attrTween_default,
		style: style_default,
		styleTween: styleTween_default,
		text: text_default,
		textTween: textTween_default,
		remove: remove_default,
		tween: tween_default,
		delay: delay_default,
		duration: duration_default,
		ease: ease_default,
		easeVarying: easeVarying_default,
		end: end_default,
		[Symbol.iterator]: selection_prototype[Symbol.iterator]
	};
	//#endregion
	//#region node_modules/d3-ease/src/cubic.js
	function cubicInOut(t) {
		return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
	}
	//#endregion
	//#region node_modules/d3-transition/src/selection/transition.js
	var defaultTiming = {
		time: null,
		delay: 0,
		duration: 250,
		ease: cubicInOut
	};
	function inherit(node, id) {
		var timing;
		while (!(timing = node.__transition) || !(timing = timing[id])) if (!(node = node.parentNode)) throw new Error(`transition ${id} not found`);
		return timing;
	}
	function transition_default(name) {
		var id, timing;
		if (name instanceof Transition) id = name._id, name = name._name;
		else id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
		for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) if (node = group[i]) schedule_default(node, name, id, i, group, timing || inherit(node, id));
		return new Transition(groups, this._parents, name, id);
	}
	//#endregion
	//#region node_modules/d3-transition/src/selection/index.js
	selection.prototype.interrupt = interrupt_default;
	selection.prototype.transition = transition_default;
	//#endregion
	//#region node_modules/d3-brush/src/brush.js
	var { abs: abs$1, max: max$1, min: min$1 } = Math;
	["w", "e"].map(type);
	["n", "s"].map(type);
	[
		"n",
		"w",
		"e",
		"s",
		"nw",
		"ne",
		"sw",
		"se"
	].map(type);
	function type(t) {
		return { type: t };
	}
	//#endregion
	//#region node_modules/d3-path/src/path.js
	var pi$1 = Math.PI;
	var tau$1 = 2 * pi$1;
	var epsilon$1 = 1e-6;
	var tauEpsilon = tau$1 - epsilon$1;
	function append(strings) {
		this._ += strings[0];
		for (let i = 1, n = strings.length; i < n; ++i) this._ += arguments[i] + strings[i];
	}
	function appendRound(digits) {
		let d = Math.floor(digits);
		if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
		if (d > 15) return append;
		const k = 10 ** d;
		return function(strings) {
			this._ += strings[0];
			for (let i = 1, n = strings.length; i < n; ++i) this._ += Math.round(arguments[i] * k) / k + strings[i];
		};
	}
	var Path = class {
		constructor(digits) {
			this._x0 = this._y0 = this._x1 = this._y1 = null;
			this._ = "";
			this._append = digits == null ? append : appendRound(digits);
		}
		moveTo(x, y) {
			this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
		}
		closePath() {
			if (this._x1 !== null) {
				this._x1 = this._x0, this._y1 = this._y0;
				this._append`Z`;
			}
		}
		lineTo(x, y) {
			this._append`L${this._x1 = +x},${this._y1 = +y}`;
		}
		quadraticCurveTo(x1, y1, x, y) {
			this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
		}
		bezierCurveTo(x1, y1, x2, y2, x, y) {
			this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
		}
		arcTo(x1, y1, x2, y2, r) {
			x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
			if (r < 0) throw new Error(`negative radius: ${r}`);
			let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
			if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`;
			else if (!(l01_2 > epsilon$1));
			else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`;
			else {
				let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$1 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
				if (Math.abs(t01 - 1) > epsilon$1) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
				this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
			}
		}
		arc(x, y, r, a0, a1, ccw) {
			x = +x, y = +y, r = +r, ccw = !!ccw;
			if (r < 0) throw new Error(`negative radius: ${r}`);
			let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
			if (this._x1 === null) this._append`M${x0},${y0}`;
			else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) this._append`L${x0},${y0}`;
			if (!r) return;
			if (da < 0) da = da % tau$1 + tau$1;
			if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
			else if (da > epsilon$1) this._append`A${r},${r},0,${+(da >= pi$1)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
		}
		rect(x, y, w, h) {
			this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
		}
		toString() {
			return this._;
		}
	};
	function path() {
		return new Path();
	}
	path.prototype = Path.prototype;
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/count.js
	function count(node) {
		var sum = 0, children = node.children, i = children && children.length;
		if (!i) sum = 1;
		else while (--i >= 0) sum += children[i].value;
		node.value = sum;
	}
	function count_default() {
		return this.eachAfter(count);
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/each.js
	function each_default(callback, that) {
		let index = -1;
		for (const node of this) callback.call(that, node, ++index, this);
		return this;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
	function eachBefore_default(callback, that) {
		var node = this, nodes = [node], children, i, index = -1;
		while (node = nodes.pop()) {
			callback.call(that, node, ++index, this);
			if (children = node.children) for (i = children.length - 1; i >= 0; --i) nodes.push(children[i]);
		}
		return this;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
	function eachAfter_default(callback, that) {
		var node = this, nodes = [node], next = [], children, i, n, index = -1;
		while (node = nodes.pop()) {
			next.push(node);
			if (children = node.children) for (i = 0, n = children.length; i < n; ++i) nodes.push(children[i]);
		}
		while (node = next.pop()) callback.call(that, node, ++index, this);
		return this;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/find.js
	function find_default(callback, that) {
		let index = -1;
		for (const node of this) if (callback.call(that, node, ++index, this)) return node;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/sum.js
	function sum_default(value) {
		return this.eachAfter(function(node) {
			var sum = +value(node.data) || 0, children = node.children, i = children && children.length;
			while (--i >= 0) sum += children[i].value;
			node.value = sum;
		});
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/sort.js
	function sort_default(compare) {
		return this.eachBefore(function(node) {
			if (node.children) node.children.sort(compare);
		});
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/path.js
	function path_default(end) {
		var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start];
		while (start !== ancestor) {
			start = start.parent;
			nodes.push(start);
		}
		var k = nodes.length;
		while (end !== ancestor) {
			nodes.splice(k, 0, end);
			end = end.parent;
		}
		return nodes;
	}
	function leastCommonAncestor(a, b) {
		if (a === b) return a;
		var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;
		a = aNodes.pop();
		b = bNodes.pop();
		while (a === b) {
			c = a;
			a = aNodes.pop();
			b = bNodes.pop();
		}
		return c;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/ancestors.js
	function ancestors_default() {
		var node = this, nodes = [node];
		while (node = node.parent) nodes.push(node);
		return nodes;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/descendants.js
	function descendants_default() {
		return Array.from(this);
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/leaves.js
	function leaves_default() {
		var leaves = [];
		this.eachBefore(function(node) {
			if (!node.children) leaves.push(node);
		});
		return leaves;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/links.js
	function links_default() {
		var root = this, links = [];
		root.each(function(node) {
			if (node !== root) links.push({
				source: node.parent,
				target: node
			});
		});
		return links;
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/iterator.js
	function* iterator_default() {
		var node = this, current, next = [node], children, i, n;
		do {
			current = next.reverse(), next = [];
			while (node = current.pop()) {
				yield node;
				if (children = node.children) for (i = 0, n = children.length; i < n; ++i) next.push(children[i]);
			}
		} while (next.length);
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/hierarchy/index.js
	function hierarchy(data, children) {
		if (data instanceof Map) {
			data = [void 0, data];
			if (children === void 0) children = mapChildren;
		} else if (children === void 0) children = objectChildren;
		var root = new Node(data), node, nodes = [root], child, childs, i, n;
		while (node = nodes.pop()) if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
			node.children = childs;
			for (i = n - 1; i >= 0; --i) {
				nodes.push(child = childs[i] = new Node(childs[i]));
				child.parent = node;
				child.depth = node.depth + 1;
			}
		}
		return root.eachBefore(computeHeight);
	}
	function node_copy() {
		return hierarchy(this).eachBefore(copyData);
	}
	function objectChildren(d) {
		return d.children;
	}
	function mapChildren(d) {
		return Array.isArray(d) ? d[1] : null;
	}
	function copyData(node) {
		if (node.data.value !== void 0) node.value = node.data.value;
		node.data = node.data.data;
	}
	function computeHeight(node) {
		var height = 0;
		do
			node.height = height;
		while ((node = node.parent) && node.height < ++height);
	}
	function Node(data) {
		this.data = data;
		this.depth = this.height = 0;
		this.parent = null;
	}
	Node.prototype = hierarchy.prototype = {
		constructor: Node,
		count: count_default,
		each: each_default,
		eachAfter: eachAfter_default,
		eachBefore: eachBefore_default,
		find: find_default,
		sum: sum_default,
		sort: sort_default,
		path: path_default,
		ancestors: ancestors_default,
		descendants: descendants_default,
		leaves: leaves_default,
		links: links_default,
		copy: node_copy,
		[Symbol.iterator]: iterator_default
	};
	//#endregion
	//#region node_modules/d3-hierarchy/src/treemap/round.js
	function round_default(node) {
		node.x0 = Math.round(node.x0);
		node.y0 = Math.round(node.y0);
		node.x1 = Math.round(node.x1);
		node.y1 = Math.round(node.y1);
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/treemap/dice.js
	function dice_default(parent, x0, y0, x1, y1) {
		var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;
		while (++i < n) {
			node = nodes[i], node.y0 = y0, node.y1 = y1;
			node.x0 = x0, node.x1 = x0 += node.value * k;
		}
	}
	//#endregion
	//#region node_modules/d3-hierarchy/src/partition.js
	function partition_default() {
		var dx = 1, dy = 1, padding = 0, round = false;
		function partition(root) {
			var n = root.height + 1;
			root.x0 = root.y0 = padding;
			root.x1 = dx;
			root.y1 = dy / n;
			root.eachBefore(positionNode(dy, n));
			if (round) root.eachBefore(round_default);
			return root;
		}
		function positionNode(dy, n) {
			return function(node) {
				if (node.children) dice_default(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);
				var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding;
				if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
				if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
				node.x0 = x0;
				node.y0 = y0;
				node.x1 = x1;
				node.y1 = y1;
			};
		}
		partition.round = function(x) {
			return arguments.length ? (round = !!x, partition) : round;
		};
		partition.size = function(x) {
			return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];
		};
		partition.padding = function(x) {
			return arguments.length ? (padding = +x, partition) : padding;
		};
		return partition;
	}
	//#endregion
	//#region node_modules/d3-shape/src/constant.js
	function constant_default(x) {
		return function constant() {
			return x;
		};
	}
	//#endregion
	//#region node_modules/d3-shape/src/math.js
	var abs = Math.abs;
	var atan2 = Math.atan2;
	var cos = Math.cos;
	var max = Math.max;
	var min = Math.min;
	var sin = Math.sin;
	var sqrt = Math.sqrt;
	var pi = Math.PI;
	var halfPi = pi / 2;
	var tau = 2 * pi;
	function acos(x) {
		return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
	}
	function asin(x) {
		return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
	}
	//#endregion
	//#region node_modules/d3-shape/src/path.js
	function withPath(shape) {
		let digits = 3;
		shape.digits = function(_) {
			if (!arguments.length) return digits;
			if (_ == null) digits = null;
			else {
				const d = Math.floor(_);
				if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
				digits = d;
			}
			return shape;
		};
		return () => new Path(digits);
	}
	//#endregion
	//#region node_modules/d3-shape/src/arc.js
	function arcInnerRadius(d) {
		return d.innerRadius;
	}
	function arcOuterRadius(d) {
		return d.outerRadius;
	}
	function arcStartAngle(d) {
		return d.startAngle;
	}
	function arcEndAngle(d) {
		return d.endAngle;
	}
	function arcPadAngle(d) {
		return d && d.padAngle;
	}
	function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
		var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
		if (t * t < 1e-12) return;
		t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
		return [x0 + t * x10, y0 + t * y10];
	}
	function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
		var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
		if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
		return {
			cx: cx0,
			cy: cy0,
			x01: -ox,
			y01: -oy,
			x11: cx0 * (r1 / r - 1),
			y11: cy0 * (r1 / r - 1)
		};
	}
	function arc_default() {
		var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant_default(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = withPath(arc);
		function arc() {
			var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
			if (!context) context = buffer = path();
			if (r1 < r0) r = r1, r1 = r0, r0 = r;
			if (!(r1 > 1e-12)) context.moveTo(0, 0);
			else if (da > tau - 1e-12) {
				context.moveTo(r1 * cos(a0), r1 * sin(a0));
				context.arc(0, 0, r1, a0, a1, !cw);
				if (r0 > 1e-12) {
					context.moveTo(r0 * cos(a1), r0 * sin(a1));
					context.arc(0, 0, r0, a1, a0, cw);
				}
			} else {
				var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > 1e-12 && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
				if (rp > 1e-12) {
					var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
					if ((da0 -= p0 * 2) > 1e-12) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
					else da0 = 0, a00 = a10 = (a0 + a1) / 2;
					if ((da1 -= p1 * 2) > 1e-12) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
					else da1 = 0, a01 = a11 = (a0 + a1) / 2;
				}
				var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
				if (rc > 1e-12) {
					var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
					if (da < pi) {
						if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
							var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
							rc0 = min(rc, (r0 - lc) / (kc - 1));
							rc1 = min(rc, (r1 - lc) / (kc + 1));
						} else rc0 = rc1 = 0;
					}
				}
				if (!(da1 > 1e-12)) context.moveTo(x01, y01);
				else if (rc1 > 1e-12) {
					t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
					t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
					context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
					if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
					else {
						context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
						context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
						context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
					}
				} else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
				if (!(r0 > 1e-12) || !(da0 > 1e-12)) context.lineTo(x10, y10);
				else if (rc0 > 1e-12) {
					t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
					t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
					context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
					if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
					else {
						context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
						context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
						context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
					}
				} else context.arc(0, 0, r0, a10, a00, cw);
			}
			context.closePath();
			if (buffer) return context = null, buffer + "" || null;
		}
		arc.centroid = function() {
			var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
			return [cos(a) * r, sin(a) * r];
		};
		arc.innerRadius = function(_) {
			return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant_default(+_), arc) : innerRadius;
		};
		arc.outerRadius = function(_) {
			return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant_default(+_), arc) : outerRadius;
		};
		arc.cornerRadius = function(_) {
			return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant_default(+_), arc) : cornerRadius;
		};
		arc.padRadius = function(_) {
			return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant_default(+_), arc) : padRadius;
		};
		arc.startAngle = function(_) {
			return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default(+_), arc) : startAngle;
		};
		arc.endAngle = function(_) {
			return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default(+_), arc) : endAngle;
		};
		arc.padAngle = function(_) {
			return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default(+_), arc) : padAngle;
		};
		arc.context = function(_) {
			return arguments.length ? (context = _ == null ? null : _, arc) : context;
		};
		return arc;
	}
	//#endregion
	//#region node_modules/d3-zoom/src/transform.js
	function Transform(k, x, y) {
		this.k = k;
		this.x = x;
		this.y = y;
	}
	Transform.prototype = {
		constructor: Transform,
		scale: function(k) {
			return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
		},
		translate: function(x, y) {
			return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
		},
		apply: function(point) {
			return [point[0] * this.k + this.x, point[1] * this.k + this.y];
		},
		applyX: function(x) {
			return x * this.k + this.x;
		},
		applyY: function(y) {
			return y * this.k + this.y;
		},
		invert: function(location) {
			return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
		},
		invertX: function(x) {
			return (x - this.x) / this.k;
		},
		invertY: function(y) {
			return (y - this.y) / this.k;
		},
		rescaleX: function(x) {
			return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
		},
		rescaleY: function(y) {
			return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
		},
		toString: function() {
			return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
		}
	};
	var identity = new Transform(1, 0, 0);
	transform.prototype = Transform.prototype;
	function transform(node) {
		while (!node.__zoom) if (!(node = node.parentNode)) return identity;
		return node.__zoom;
	}
	//#endregion
	//#region src/render/SunburstRenderer.ts
	var SunburstRenderer = class {
		container;
		chartRoot;
		width = 0;
		height = 0;
		radius = 0;
		svg;
		g;
		partition = partition_default();
		arc;
		legend = null;
		currentRoot = null;
		highlightId = null;
		resizeObserver = null;
		options;
		tooltipId;
		/** First touch tap shows tooltip; second tap on same arc triggers zoom. */
		touchZoomPathKey = null;
		touchOutsideHandler = null;
		constructor(container, options) {
			this.container = container;
			this.options = options;
			this.tooltipId = `pam-tooltip-${Math.random().toString(36).slice(2, 9)}`;
			this.chartRoot = document.createElement("div");
			this.chartRoot.className = "pam-chart__canvas";
			container.appendChild(this.chartRoot);
			syncColorsFromCss(container);
			this.svg = select_default$1(this.chartRoot).append("svg").attr("width", "100%").attr("height", "100%").attr("preserveAspectRatio", "xMidYMid meet").attr("role", "img").attr("aria-label", options.ariaLabel);
			this.g = this.svg.append("g");
			if (options.legend ?? true) {
				this.legend = this.createLegend(options.labels ?? DEFAULT_LABELS);
				this.chartRoot.appendChild(this.legend);
			}
			this.partition = partition_default().size([2 * Math.PI, this.radius]);
			this.arc = arc_default().startAngle((d) => d.x0).endAngle((d) => d.x1).padAngle(chartConfig.spacing.padAngle.inner).innerRadius((d) => d.y0).outerRadius((d) => d.y1);
			this.resizeObserver = new ResizeObserver(() => this.resize());
			this.resizeObserver.observe(container);
			this.resize();
		}
		destroy() {
			this.unbindTouchOutsideDismiss();
			if (this.resizeObserver) {
				this.resizeObserver.disconnect();
				this.resizeObserver = null;
			}
			this.chartRoot.remove();
		}
		resize() {
			const rect = this.chartRoot.getBoundingClientRect();
			this.width = rect.width;
			this.height = rect.height;
			const measuredLegendHeight = this.legend?.getBoundingClientRect().height ?? 0;
			const legendInset = this.legend ? Math.max(56, measuredLegendHeight + 28) : 0;
			const plotHeight = Math.max(0, this.height - legendInset);
			this.radius = Math.min(this.width, plotHeight) / 2 - chartConfig.chart.radiusPadding;
			if (this.radius < chartConfig.chart.minRadius) return;
			this.partition.size([2 * Math.PI, this.radius]);
			this.svg.attr("viewBox", `0 0 ${this.width} ${this.height}`);
			this.g.attr("transform", `translate(${this.width / 2}, ${plotHeight / 2})`);
			if (this.currentRoot) this.render(this.currentRoot);
		}
		setHighlight(nodeId) {
			this.highlightId = nodeId;
			this.g.selectAll("path").classed("pam-arc--highlighted", (d) => nodeId === d.data.id).classed("pam-arc--dimmed", (d) => nodeId != null && nodeId !== d.data.id);
		}
		render(rootNode) {
			this.touchZoomPathKey = null;
			this.unbindTouchOutsideDismiss();
			this.currentRoot = rootNode;
			syncColorsFromCss(this.container);
			const colors = chartConfig.colors;
			const hierarchyRoot = hierarchy(rootNode);
			let maxDepth = 0;
			hierarchyRoot.each((d) => {
				maxDepth = Math.max(maxDepth, d.depth);
			});
			const safeMaxDepth = Math.max(maxDepth, 1);
			this.partition(hierarchyRoot);
			const root = hierarchyRoot;
			const setEqualAngles = (node, x0, x1) => {
				node.x0 = x0;
				node.x1 = x1;
				if (node.children?.length) {
					const childSpan = (x1 - x0) / node.children.length;
					node.children.forEach((child, i) => {
						setEqualAngles(child, x0 + i * childSpan, x0 + (i + 1) * childSpan);
					});
				}
			};
			setEqualAngles(root, 0, 2 * Math.PI);
			const getRadius = (y) => {
				const normalized = y / this.radius;
				const exponent = chartConfig.spacing.radiusExponent.base + (safeMaxDepth - chartConfig.spacing.exponentDepthThreshold) * chartConfig.spacing.radiusExponent.perLevel;
				return Math.pow(normalized, exponent) * this.radius;
			};
			const verticalGap = this.radius * chartConfig.spacing.verticalGap;
			const getPadAngle = (d) => {
				const depthFraction = d.depth / safeMaxDepth;
				return chartConfig.spacing.padAngle.inner - depthFraction * (chartConfig.spacing.padAngle.inner - chartConfig.spacing.padAngle.outer);
			};
			this.arc.innerRadius((d) => getRadius(d.y0) + verticalGap).outerRadius((d) => d.depth === 0 ? Math.min(getRadius(d.y1) - verticalGap, this.radius * chartConfig.chart.maxCenterRadius) : getRadius(d.y1) - verticalGap).padAngle(getPadAngle).cornerRadius(chartConfig.chart.cornerRadius);
			this.g.selectAll("*").remove();
			const paths = this.g.selectAll("path").data(root.descendants()).enter().append("path").attr("d", this.arc).attr("data-node-id", (d) => d.data.id).attr("data-path-key", (d) => d.data.pathKey).attr("class", (d) => getNodeArcClass(d.data, rootNode)).attr("tabindex", "0").attr("role", "button").attr("aria-label", (d) => d.data.title).attr("aria-describedby", this.tooltipId).style("stroke", colors.border).style("stroke-width", chartConfig.chart.strokeWidth).style("stroke-linejoin", "round").style("cursor", this.options.zoomEnabled ? "pointer" : "default").classed("pam-arc--highlighted", (d) => this.highlightId === d.data.id).classed("pam-arc--dimmed", (d) => this.highlightId != null && this.highlightId !== d.data.id);
			const showHover = (event, d) => {
				paths.classed("pam-arc--dimmed", (n) => n.data.id !== d.data.id);
				paths.classed("pam-arc--highlighted", (n) => n.data.id === d.data.id);
				try {
					const nodeColor = getNodeColor(d.data, rootNode, colors);
					const shadowColor = color(nodeColor);
					if (shadowColor) shadowColor.opacity = .28;
					select_default$1(event.currentTarget).style("filter", `brightness(${d.depth === 0 ? 1.02 : 1.06}) drop-shadow(0 2px 5px ${shadowColor?.formatRgb() ?? nodeColor})`);
				} catch {}
				this.options.onHover?.(d.data, event);
			};
			const clearHover = () => {
				paths.classed("pam-arc--dimmed", false).classed("pam-arc--highlighted", false).style("filter", "none");
				if (this.highlightId) this.setHighlight(this.highlightId);
				this.options.onLeave?.();
			};
			const handlePointerClick = (event, d) => {
				event.stopPropagation();
				if (event.pointerType === "touch") {
					if (this.touchZoomPathKey === d.data.pathKey) {
						this.touchZoomPathKey = null;
						this.unbindTouchOutsideDismiss();
						if (this.options.zoomEnabled) this.options.onClick?.(d.data, d.depth, (d.data.children?.length ?? 0) > 0);
					} else {
						this.touchZoomPathKey = d.data.pathKey;
						showHover(event, d);
						this.bindTouchOutsideDismiss(clearHover);
					}
					return;
				}
				if (this.options.zoomEnabled) this.options.onClick?.(d.data, d.depth, (d.data.children?.length ?? 0) > 0);
			};
			paths.on("pointerenter", (event, d) => {
				if (event.pointerType === "touch") return;
				showHover(event, d);
			}).on("pointermove", (event, d) => {
				if (event.pointerType === "touch") return;
				showHover(event, d);
			}).on("pointerleave", (event) => {
				if (event.pointerType === "touch") return;
				clearHover();
			}).on("focus", (event, d) => showHover(event, d)).on("blur", () => clearHover()).on("click", (event, d) => handlePointerClick(event, d)).on("keydown", (event, d) => {
				if (event.key === "Enter" || event.key === " ") {
					event.preventDefault();
					if (this.options.zoomEnabled) this.options.onClick?.(d.data, d.depth, (d.data.children?.length ?? 0) > 0);
				}
			});
		}
		getTooltipElementId() {
			return this.tooltipId;
		}
		createLegend(labels) {
			const legend = document.createElement("div");
			legend.className = "pam-chart__legend";
			legend.setAttribute("role", "list");
			legend.setAttribute("aria-label", labels.legend ?? "Argument types");
			const items = [
				{
					type: "center",
					label: labels.center
				},
				{
					type: "support",
					label: labels.support
				},
				{
					type: "attack",
					label: labels.attack
				}
			];
			for (const item of items) {
				const entry = document.createElement("span");
				entry.className = "pam-chart__legend-item";
				entry.setAttribute("role", "listitem");
				const swatch = document.createElement("span");
				swatch.className = `pam-chart__legend-swatch pam-chart__legend-swatch--${item.type}`;
				swatch.setAttribute("aria-hidden", "true");
				const text = document.createElement("span");
				text.textContent = item.label;
				entry.append(swatch, text);
				legend.appendChild(entry);
			}
			return legend;
		}
		bindTouchOutsideDismiss(onDismiss) {
			this.unbindTouchOutsideDismiss();
			this.touchOutsideHandler = (event) => {
				const target = event.target;
				if (target && this.container.contains(target)) return;
				this.touchZoomPathKey = null;
				onDismiss();
				this.unbindTouchOutsideDismiss();
			};
			window.setTimeout(() => {
				if (this.touchOutsideHandler) document.addEventListener("pointerdown", this.touchOutsideHandler, true);
			}, 0);
		}
		unbindTouchOutsideDismiss() {
			if (this.touchOutsideHandler) {
				document.removeEventListener("pointerdown", this.touchOutsideHandler, true);
				this.touchOutsideHandler = null;
			}
		}
	};
	/**
	* Viewport-aware tooltip placement.
	* Touch: centered above the contact point so content is not hidden under the thumb.
	*/
	function clampTooltipPosition(position, card, pointerType) {
		const rect = card.getBoundingClientRect();
		const cardWidth = rect.width || 320;
		const cardHeight = rect.height || 200;
		const pad = 12;
		if (pointerType === "touch") {
			let posX = position.x - cardWidth / 2;
			let posY = position.y - cardHeight - 56;
			posX = Math.max(pad, Math.min(posX, window.innerWidth - cardWidth - pad));
			posY = Math.max(pad, Math.min(posY, window.innerHeight - cardHeight - pad));
			return {
				x: posX,
				y: posY
			};
		}
		let posX = position.x + 20;
		let posY = position.y + 20;
		if (posX + cardWidth > window.innerWidth) posX = position.x - cardWidth - 20;
		if (posY + cardHeight > window.innerHeight) posY = position.y - cardHeight - 20;
		return {
			x: posX,
			y: posY
		};
	}
	//#endregion
	//#region src/ui/TooltipController.ts
	function typeLabel(node, labels) {
		if (node.type === "thesis") return {
			text: labels.center,
			className: "center"
		};
		if (node.relationType === "attack") return {
			text: labels.attack,
			className: "attack"
		};
		if (node.relationType === "support") return {
			text: labels.support,
			className: "support"
		};
		return {
			text: labels.claim,
			className: "claim"
		};
	}
	function createDefaultTooltip(node, labels = DEFAULT_LABELS) {
		const card = document.createElement("div");
		card.className = "pam-tooltip";
		const header = document.createElement("div");
		header.className = "pam-tooltip__header";
		const type = typeLabel(node, labels);
		const typeEl = document.createElement("span");
		typeEl.className = `pam-tooltip__type pam-tooltip__type--${type.className}`;
		typeEl.textContent = type.text;
		const speakerEl = document.createElement("span");
		speakerEl.className = "pam-tooltip__speaker";
		speakerEl.textContent = node.speaker || labels.unknownSpeaker;
		header.append(typeEl, speakerEl);
		const title = document.createElement("h3");
		title.className = "pam-tooltip__title";
		title.textContent = node.title;
		card.append(header, title);
		if (node.description) {
			const desc = document.createElement("p");
			desc.className = "pam-tooltip__description";
			desc.textContent = node.description;
			card.append(desc);
		}
		if (node.relationType && node.relationReasoning) {
			const reasoning = document.createElement("p");
			reasoning.className = "pam-tooltip__reasoning";
			reasoning.textContent = node.relationReasoning;
			card.append(reasoning);
		}
		if (node.quote) {
			const quote = document.createElement("blockquote");
			quote.className = "pam-tooltip__quote";
			quote.textContent = `"${node.quote}"`;
			card.append(quote);
		}
		if (node.score) {
			const scores = document.createElement("div");
			scores.className = "pam-tooltip__scores";
			const intensity = document.createElement("span");
			intensity.textContent = `${labels.intensity}: ${Math.round(node.score.intensity * 100)}%`;
			const confidence = document.createElement("span");
			confidence.textContent = `${labels.confidence}: ${Math.round(node.score.confidence * 100)}%`;
			scores.append(intensity, confidence);
			card.append(scores);
		}
		return card;
	}
	function readPointer(event) {
		if ("clientX" in event && typeof event.clientX === "number") {
			const pointerType = "pointerType" in event ? event.pointerType : void 0;
			return {
				x: event.clientX,
				y: event.clientY,
				pointerType
			};
		}
		return {
			x: 0,
			y: 0
		};
	}
	var TooltipController = class {
		element;
		rafId = null;
		position = {
			x: 0,
			y: 0
		};
		pointerType;
		renderer;
		labels;
		visible = false;
		constructor(parent, id, renderer, labels) {
			this.renderer = renderer;
			this.labels = labels;
			this.element = document.createElement("div");
			this.element.id = id;
			this.element.className = "pam-tooltip-host";
			this.element.setAttribute("role", "region");
			this.element.setAttribute("aria-live", "polite");
			parent.appendChild(this.element);
		}
		show(node, event) {
			const pointer = readPointer(event);
			this.position = {
				x: pointer.x,
				y: pointer.y
			};
			this.pointerType = pointer.pointerType;
			this.element.replaceChildren(this.renderer(node, this.labels));
			this.element.classList.toggle("pam-tooltip-host--touch", pointer.pointerType === "touch");
			this.element.classList.add("pam-tooltip-host--visible");
			this.visible = true;
			this.schedulePosition();
		}
		move(event) {
			if (!this.visible) return;
			this.position = {
				x: event.clientX,
				y: event.clientY
			};
			this.pointerType = event.pointerType;
			this.element.classList.toggle("pam-tooltip-host--touch", event.pointerType === "touch");
			this.schedulePosition();
		}
		hide() {
			this.visible = false;
			this.pointerType = void 0;
			this.element.classList.remove("pam-tooltip-host--visible", "pam-tooltip-host--touch");
			this.element.replaceChildren();
			if (this.rafId != null) {
				cancelAnimationFrame(this.rafId);
				this.rafId = null;
			}
		}
		setLabels(labels) {
			this.labels = labels;
		}
		destroy() {
			this.hide();
			this.element.remove();
		}
		schedulePosition() {
			if (this.rafId != null) cancelAnimationFrame(this.rafId);
			this.rafId = requestAnimationFrame(() => {
				const tooltip = this.element.firstElementChild;
				if (!tooltip) return;
				const { x, y } = clampTooltipPosition(this.position, tooltip, this.pointerType);
				this.element.style.left = `${x}px`;
				this.element.style.top = `${y}px`;
			});
		}
	};
	//#endregion
	//#region src/ui/ChartStatus.ts
	var ChartStatusOverlay = class {
		element;
		messages;
		state = null;
		constructor(parent, messages) {
			this.messages = messages;
			this.element = document.createElement("div");
			this.element.className = "pam-chart__status";
			this.element.setAttribute("role", "status");
			this.element.setAttribute("aria-live", "polite");
			this.element.hidden = true;
			parent.appendChild(this.element);
		}
		show(state, message) {
			this.state = state;
			this.element.hidden = false;
			this.element.className = `pam-chart__status pam-chart__status--${state}`;
			const text = message ?? this.messages[state];
			this.element.replaceChildren();
			const label = document.createElement("p");
			label.className = "pam-chart__status-text";
			label.textContent = text;
			this.element.append(label);
			if (state === "loading") {
				const spinner = document.createElement("span");
				spinner.className = "pam-chart__status-spinner";
				spinner.setAttribute("aria-hidden", "true");
				this.element.prepend(spinner);
			}
		}
		hide() {
			this.state = null;
			this.element.hidden = true;
			this.element.replaceChildren();
			this.element.className = "pam-chart__status";
		}
		isVisible() {
			return this.state !== null;
		}
		getState() {
			return this.state;
		}
		destroy() {
			this.element.remove();
		}
	};
	//#endregion
	//#region src/ArgumentMapChart.ts
	function resolveContainer(target) {
		if (typeof target === "string") {
			const el = document.querySelector(target);
			if (!el) throw new Error(`Container not found: ${target}`);
			return el;
		}
		return target;
	}
	function mergeLabels(partial) {
		return {
			...DEFAULT_LABELS,
			...partial
		};
	}
	var ArgumentMapChartImpl = class {
		container;
		zoom = new ZoomController();
		renderer;
		tooltip = null;
		options;
		themeMedia = null;
		themeListener = null;
		keydownHandler = null;
		status;
		constructor(target, data, options = {}) {
			this.container = resolveContainer(target);
			this.container.classList.add("pam-chart");
			const direction = options.direction ?? "inherit";
			if (direction !== "inherit") this.container.setAttribute("dir", direction);
			if (options.lang) this.container.setAttribute("lang", options.lang);
			this.options = {
				theme: options.theme ?? "auto",
				legend: options.legend ?? true,
				zoom: options.zoom ?? true,
				direction,
				lang: options.lang ?? "en",
				ariaLabel: options.ariaLabel ?? "Argument map chart",
				tooltip: options.tooltip ?? true,
				labels: mergeLabels(options.labels),
				onNodeHover: options.onNodeHover,
				onNodeLeave: options.onNodeLeave,
				onNodeClick: options.onNodeClick,
				onZoomChange: options.onZoomChange,
				onWarning: options.onWarning
			};
			if (options.colors) applyColorOverrides(this.container, options.colors);
			this.status = new ChartStatusOverlay(this.container, {
				loading: this.options.labels.statusLoading,
				empty: this.options.labels.statusEmpty,
				error: this.options.labels.statusError
			});
			this.renderer = new SunburstRenderer(this.container, {
				ariaLabel: this.options.ariaLabel,
				legend: this.options.legend,
				labels: this.options.labels,
				zoomEnabled: this.options.zoom,
				onHover: (node, event) => this.handleHover(node, event),
				onLeave: () => this.handleLeave(),
				onClick: (node, depth, hasChildren) => this.handleClick(node, depth, hasChildren)
			});
			if (this.options.tooltip !== false) {
				const renderer = typeof this.options.tooltip === "function" ? this.options.tooltip : createDefaultTooltip;
				this.tooltip = new TooltipController(document.body, this.renderer.getTooltipElementId(), renderer, this.options.labels);
			}
			this.applyTheme(this.options.theme);
			this.bindKeyboard();
			if (data) this.setData(data);
			else this.status.show("empty");
		}
		setData(data) {
			try {
				const { data: validated, warnings } = validateMapData(data);
				for (const w of warnings) this.options.onWarning?.(w);
				const { tree, warnings: treeWarnings } = buildTree(validated.new_nodes);
				for (const w of treeWarnings) this.options.onWarning?.(w);
				if (!tree) {
					this.options.onWarning?.("Could not build tree from map data");
					this.status.show("error", this.options.labels.statusError);
					return;
				}
				this.status.hide();
				this.zoom.setTree(tree);
				this.render();
				this.emitZoomChange();
			} catch (err) {
				const message = err instanceof ValidationError ? err.issues.join("; ") : err instanceof Error ? err.message : this.options.labels.statusError;
				this.options.onWarning?.(message);
				this.status.show("error", message);
			}
		}
		setLoading(loading) {
			if (loading) {
				this.status.show("loading");
				this.tooltip?.hide();
			} else if (this.status.getState() === "loading") this.status.hide();
		}
		showError(message) {
			this.options.onWarning?.(message ?? this.options.labels.statusError);
			this.status.show("error", message);
			this.tooltip?.hide();
		}
		setTheme(theme) {
			this.options.theme = theme;
			this.applyTheme(theme);
		}
		setColors(colors) {
			applyColorOverrides(this.container, {
				center: colors.center,
				support: colors.support,
				attack: colors.attack,
				border: colors.border
			});
			syncColorsFromCss(this.container);
			const focus = this.zoom.getFocusRoot();
			if (focus) this.renderer.render(focus);
		}
		highlight(nodeId) {
			this.renderer.setHighlight(nodeId);
		}
		zoomTo(nodeId) {
			if (this.zoom.zoomTo(nodeId)) {
				this.render();
				this.emitZoomChange();
			}
		}
		zoomToPath(nodeIds) {
			if (this.zoom.zoomToPath(nodeIds)) {
				this.render();
				this.emitZoomChange();
			}
		}
		zoomOut() {
			if (this.zoom.zoomOut()) {
				this.render();
				this.emitZoomChange();
			}
		}
		resetZoom() {
			this.zoom.resetZoom();
			this.render();
			this.emitZoomChange();
		}
		resize() {
			this.renderer.resize();
		}
		getZoomPath() {
			return this.zoom.getZoomPath();
		}
		destroy() {
			if (this.themeMedia && this.themeListener) this.themeMedia.removeEventListener("change", this.themeListener);
			if (this.keydownHandler) document.removeEventListener("keydown", this.keydownHandler);
			this.tooltip?.destroy();
			this.status.destroy();
			this.renderer.destroy();
			this.container.classList.remove("pam-chart", "pam-chart--light", "pam-chart--dark");
			if (this.options.direction !== "inherit") this.container.removeAttribute("dir");
		}
		render() {
			const focus = this.zoom.getFocusRoot();
			if (focus) this.renderer.render(focus);
		}
		emitZoomChange() {
			this.options.onZoomChange?.(this.zoom.getZoomPath());
		}
		handleHover(node, event) {
			this.tooltip?.show(node, event);
			this.options.onNodeHover?.(node, event);
		}
		handleLeave() {
			this.tooltip?.hide();
			this.options.onNodeLeave?.();
		}
		handleClick(node, depth, hasChildren) {
			if (this.options.zoom) {
				this.zoom.handleClick(node, depth, hasChildren);
				this.render();
				this.emitZoomChange();
			}
			this.options.onNodeClick?.(node, depth, hasChildren);
		}
		applyTheme(theme) {
			this.container.classList.remove("pam-chart--light", "pam-chart--dark");
			const setResolved = (resolved) => {
				this.container.classList.add(resolved === "light" ? "pam-chart--light" : "pam-chart--dark");
				chartConfig.colors.center = DEFAULT_COLORS.center;
				chartConfig.colors.support = DEFAULT_COLORS.support;
				chartConfig.colors.attack = DEFAULT_COLORS.attack;
				chartConfig.colors.border = DEFAULT_COLORS.border;
				syncColorsFromCss(this.container);
				const focus = this.zoom.getFocusRoot();
				if (focus) this.renderer.render(focus);
			};
			if (this.themeMedia && this.themeListener) {
				this.themeMedia.removeEventListener("change", this.themeListener);
				this.themeMedia = null;
				this.themeListener = null;
			}
			if (theme === "light" || theme === "dark") {
				setResolved(theme);
				return;
			}
			this.themeMedia = window.matchMedia("(prefers-color-scheme: dark)");
			setResolved(this.themeMedia.matches ? "dark" : "light");
			this.themeListener = (e) => setResolved(e.matches ? "dark" : "light");
			this.themeMedia.addEventListener("change", this.themeListener);
		}
		bindKeyboard() {
			this.keydownHandler = (e) => {
				if (!this.options.zoom) return;
				if (e.key === "Escape" || e.key === "Backspace") {
					if (this.zoom.zoomOut()) {
						e.preventDefault();
						this.render();
						this.emitZoomChange();
					}
				}
			};
			document.addEventListener("keydown", this.keydownHandler);
		}
	};
	function createArgumentMap(target, data, options) {
		return new ArgumentMapChartImpl(target, data, options);
	}
	//#endregion
	//#region src/global.ts
	if (typeof window !== "undefined") window.Parto = { createArgumentMap };
	//#endregion
	exports.createArgumentMap = createArgumentMap;
	return exports;
})({});

//# sourceMappingURL=parto.global.js.map