import MapContext from "../Map/MapContext.mjs";
import { c } from "react-compiler-runtime";
import { useContext, useEffect } from "react";
import OLVectorLayer from "ol/layer/Vector";
//#region src/map-library/Layers/VectorLayer.js
const VectorLayer = (t0) => {
	const $ = c(14);
	let otherProps;
	let source;
	let style;
	let t1;
	if ($[0] !== t0) {
		({source, style, zIndex: t1, ...otherProps} = t0);
		$[0] = t0;
		$[1] = otherProps;
		$[2] = source;
		$[3] = style;
		$[4] = t1;
	} else {
		otherProps = $[1];
		source = $[2];
		style = $[3];
		t1 = $[4];
	}
	const zIndex = t1 === void 0 ? 0 : t1;
	const { map } = useContext(MapContext);
	let t2;
	if ($[5] !== map || $[6] !== otherProps || $[7] !== source || $[8] !== style || $[9] !== zIndex) {
		t2 = () => {
			if (!map) return;
			const vectorLayer = new OLVectorLayer({
				source,
				style,
				...otherProps
			});
			map.addLayer(vectorLayer);
			vectorLayer.setZIndex(zIndex);
			return () => {
				if (map) map.removeLayer(vectorLayer);
			};
		};
		$[5] = map;
		$[6] = otherProps;
		$[7] = source;
		$[8] = style;
		$[9] = zIndex;
		$[10] = t2;
	} else t2 = $[10];
	let t3;
	if ($[11] !== map || $[12] !== source) {
		t3 = [map, source];
		$[11] = map;
		$[12] = source;
		$[13] = t3;
	} else t3 = $[13];
	useEffect(t2, t3);
	return null;
};
//#endregion
export { VectorLayer };

//# sourceMappingURL=VectorLayer.mjs.map