import WidgetCard from "../../WidgetCard.mjs";
import FluentStatsSnippet from "../../FluentComponents/atoms/FluentStatsSnippet.mjs";
import { c } from "react-compiler-runtime";
import React, { forwardRef } from "react";
import { Box, Grid } from "@material-ui/core";
import { MuiVegaLite } from "@material-vega/material-ui";
//#region src/UI/widgets/library/SparsePlotWidget/SparsePlotWidget.jsx
const layout = {
	w: {
		default: 2,
		min: 0,
		max: 4
	},
	h: {
		default: 2,
		min: 0,
		max: 4
	}
};
const params = { mode: { defaultValue: "chart" } };
const SparsePlotWidget = (props, ref) => {
	const $ = c(27);
	let children;
	let other;
	let params;
	if ($[0] !== props) {
		const { children: t0, params: t1, setParam, ...t2 } = props;
		children = t0;
		params = t1;
		other = t2;
		$[0] = props;
		$[1] = children;
		$[2] = other;
		$[3] = params;
	} else {
		children = $[1];
		other = $[2];
		params = $[3];
	}
	const { mockData, theme } = params;
	const t0 = mockData?.title;
	let t1;
	if ($[4] !== mockData?.stats) {
		t1 = mockData?.stats.map(_temp);
		$[4] = mockData?.stats;
		$[5] = t1;
	} else t1 = $[5];
	let t2;
	if ($[6] !== t1) {
		t2 = /* @__PURE__ */ React.createElement(Grid, { container: true }, t1);
		$[6] = t1;
		$[7] = t2;
	} else t2 = $[7];
	const t3 = mockData?.data;
	let t4;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = {
			type: "point",
			line: true,
			point: true
		};
		$[8] = t4;
	} else t4 = $[8];
	const t5 = mockData?.xAxisType;
	let t6;
	if ($[9] !== t5) {
		t6 = {
			field: "xAxis",
			type: t5
		};
		$[9] = t5;
		$[10] = t6;
	} else t6 = $[10];
	const t7 = mockData?.yAxisType;
	let t8;
	if ($[11] !== t7) {
		t8 = {
			field: "yAxis",
			type: t7
		};
		$[11] = t7;
		$[12] = t8;
	} else t8 = $[12];
	let t9;
	if ($[13] !== t6 || $[14] !== t8) {
		t9 = {
			x: t6,
			y: t8
		};
		$[13] = t6;
		$[14] = t8;
		$[15] = t9;
	} else t9 = $[15];
	let t10;
	if ($[16] !== t3 || $[17] !== t9) {
		t10 = /* @__PURE__ */ React.createElement(Box, {
			clone: true,
			flex: 1,
			mt: 1,
			overflow: "hidden"
		}, /* @__PURE__ */ React.createElement(MuiVegaLite, {
			spec: {
				$schema: "https://vega.github.io/schema/vega-lite/v4.json",
				width: "container",
				height: "container",
				data: t3,
				mark: t4,
				encoding: t9
			},
			variant: "scatterplotChart",
			autoResize: true,
			actions: false
		}));
		$[16] = t3;
		$[17] = t9;
		$[18] = t10;
	} else t10 = $[18];
	let t11;
	if ($[19] !== children || $[20] !== other || $[21] !== ref || $[22] !== t0 || $[23] !== t10 || $[24] !== t2 || $[25] !== theme) {
		t11 = /* @__PURE__ */ React.createElement(WidgetCard, {
			ref,
			...other,
			title: t0,
			theme
		}, t2, t10, children);
		$[19] = children;
		$[20] = other;
		$[21] = ref;
		$[22] = t0;
		$[23] = t10;
		$[24] = t2;
		$[25] = theme;
		$[26] = t11;
	} else t11 = $[26];
	return t11;
};
var SparsePlotWidget_default = forwardRef(SparsePlotWidget);
function _temp(stat) {
	return /* @__PURE__ */ React.createElement(Grid, {
		item: true,
		xs: 3,
		key: stat.label
	}, /* @__PURE__ */ React.createElement(FluentStatsSnippet, {
		label: stat.label,
		amount: stat.currentValue,
		prevAmount: stat.previousValue
	}));
}
//#endregion
export { SparsePlotWidget_default as default, layout, params };

//# sourceMappingURL=SparsePlotWidget.mjs.map