import { FluentTextField } from "./FluentTextField.mjs";
import { c } from "react-compiler-runtime";
import React, { forwardRef } from "react";
import { Checkbox, makeStyles } from "@material-ui/core";
import { Autocomplete } from "@material-ui/lab";
//#region src/UI/inputs/textField/FluentTagField.jsx
const useStyles = makeStyles((theme) => ({ root: { "&[class*=\"MuiOutlinedInput-root\"][class*=\"MuiOutlinedInput-marginDense\"]": {
	padding: "4px 8px",
	height: "auto"
} } }));
const FluentTagFieldComponent = (props, ref) => {
	const $ = c(35);
	const classes = useStyles(props);
	let autoCompleteProps;
	let data;
	let displayProperty;
	let id;
	let onChangeProp;
	let otherProps;
	let t0;
	let t1;
	if ($[0] !== props) {
		const { id: t2, data: t3, startAdornment, endAdornment, onChange: t4, autoCompleteProps: t5, displayProperty: t6, width: t7, height: t8, ...t9 } = props;
		id = t2;
		data = t3;
		onChangeProp = t4;
		autoCompleteProps = t5;
		displayProperty = t6;
		t0 = t7;
		t1 = t8;
		otherProps = t9;
		$[0] = props;
		$[1] = autoCompleteProps;
		$[2] = data;
		$[3] = displayProperty;
		$[4] = id;
		$[5] = onChangeProp;
		$[6] = otherProps;
		$[7] = t0;
		$[8] = t1;
	} else {
		autoCompleteProps = $[1];
		data = $[2];
		displayProperty = $[3];
		id = $[4];
		onChangeProp = $[5];
		otherProps = $[6];
		t0 = $[7];
		t1 = $[8];
	}
	const width = t0 === void 0 ? 300 : t0;
	const height = t1 === void 0 ? "auto" : t1;
	let t2;
	if ($[9] !== onChangeProp) {
		t2 = (e, value) => onChangeProp?.(value);
		$[9] = onChangeProp;
		$[10] = t2;
	} else t2 = $[10];
	const onChange = t2;
	let t3;
	if ($[11] !== displayProperty) {
		t3 = (option) => {
			if (displayProperty) return option[displayProperty] || "";
			return option;
		};
		$[11] = displayProperty;
		$[12] = t3;
	} else t3 = $[12];
	const getOptionLabel = t3;
	let t4;
	if ($[13] !== classes.root) {
		t4 = { inputRoot: classes.root };
		$[13] = classes.root;
		$[14] = t4;
	} else t4 = $[14];
	let t5;
	if ($[15] !== height || $[16] !== width) {
		t5 = {
			width,
			height
		};
		$[15] = height;
		$[16] = width;
		$[17] = t5;
	} else t5 = $[17];
	let t6;
	if ($[18] !== otherProps) {
		t6 = (params) => /* @__PURE__ */ React.createElement(FluentTextField, {
			...otherProps,
			...params
		});
		$[18] = otherProps;
		$[19] = t6;
	} else t6 = $[19];
	let t7;
	if ($[20] !== autoCompleteProps?.value || $[21] !== displayProperty || $[22] !== getOptionLabel || $[23] !== otherProps) {
		t7 = (option_0, t8) => {
			const { selected } = t8;
			const isSelectedValue = displayProperty && autoCompleteProps?.value?.some((item) => item[displayProperty] === option_0[displayProperty]);
			return /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(Checkbox, {
				...otherProps,
				style: { marginRight: 8 },
				checked: selected || isSelectedValue
			}), getOptionLabel(option_0));
		};
		$[20] = autoCompleteProps?.value;
		$[21] = displayProperty;
		$[22] = getOptionLabel;
		$[23] = otherProps;
		$[24] = t7;
	} else t7 = $[24];
	let t8;
	if ($[25] !== autoCompleteProps || $[26] !== data || $[27] !== getOptionLabel || $[28] !== id || $[29] !== onChange || $[30] !== t4 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7) {
		t8 = /* @__PURE__ */ React.createElement(Autocomplete, {
			classes: t4,
			multiple: true,
			id,
			onChange,
			options: data,
			getOptionLabel,
			style: t5,
			...autoCompleteProps,
			renderInput: t6,
			renderOption: t7
		});
		$[25] = autoCompleteProps;
		$[26] = data;
		$[27] = getOptionLabel;
		$[28] = id;
		$[29] = onChange;
		$[30] = t4;
		$[31] = t5;
		$[32] = t6;
		$[33] = t7;
		$[34] = t8;
	} else t8 = $[34];
	return t8;
};
const FluentTagField = forwardRef(FluentTagFieldComponent);
//#endregion
export { FluentTagField, FluentTagFieldComponent };

//# sourceMappingURL=FluentTagField.mjs.map