import { t as e } from "./interactive-C6OMqZhG.js";
import { defaultColors as t } from "./charts/utils.js";
//#region src/charts/series.ts
var n = class extends e {
	series;
	hiddenSeries;
	constructor(e) {
		if (e.legend?.visible === !1) {
			let { legend: t, ...n } = e;
			super(n);
		} else super({
			...e,
			legend: e.legend ?? { visible: !0 }
		});
		this.hiddenSeries = /* @__PURE__ */ new Set(), this.series = this.resolveSeries(e.series), this.legend !== null && this.legend.onToggle((e, t) => {
			let n = this.series[e];
			n !== void 0 && (this.hiddenSeries.has(n.name) ? this.hiddenSeries.delete(n.name) : this.hiddenSeries.add(n.name), this.render());
		});
	}
	resolveSeries(e) {
		let n = t();
		return e.map((e, t) => ({
			name: e.name,
			data: e.data,
			color: e.color ?? n[t % n.length] ?? "#3b82f6"
		}));
	}
	getVisibleSeries() {
		return this.series.filter((e) => !this.hiddenSeries.has(e.name));
	}
	updateSeriesLegend() {
		if (this.legend === null) return;
		let e = this.series.map((e) => ({
			label: e.name,
			color: e.color,
			active: !this.hiddenSeries.has(e.name)
		}));
		this.legend.update(e);
	}
};
//#endregion
export { n as t };

//# sourceMappingURL=series-DMc2ZYyj.js.map