import { SideSheetHeader } from "../dataDisplay/typography/SideSheetHeader.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { CardContent, Drawer, LinearProgress, makeStyles } from "@material-ui/core";
import PropTypes from "prop-types";
//#region src/UI/surfaces/SideSheet.jsx
const useStyles = makeStyles((theme) => ({
	paper: {
		width: "100%",
		[theme.breakpoints.up("sm")]: { width: (props) => props.width || 320 },
		background: theme?.getThemeData()?.mode === "dark" ? theme.palette.grey[700] : "#f4f4f4"
	},
	container: {
		height: (props) => props.contentHeight ? props.contentHeight : "",
		overflowY: (props) => props.contentHeight ? "auto" : "",
		padding: (props) => props.noPadding ? 0 : ""
	}
}));
/**
* Base right hand side sheet with no contents
*/
const BaseSideSheet = (props) => {
	const $ = c(17);
	const classes = useStyles(props);
	let children;
	let drawerProps;
	let noBackdrop;
	let onClose;
	let t0;
	if ($[0] !== props) {
		const { anchor: t1, width, children: t2, onClose: t3, noBackdrop: t4, buttonLabel, ...t5 } = props;
		t0 = t1;
		children = t2;
		onClose = t3;
		noBackdrop = t4;
		drawerProps = t5;
		$[0] = props;
		$[1] = children;
		$[2] = drawerProps;
		$[3] = noBackdrop;
		$[4] = onClose;
		$[5] = t0;
	} else {
		children = $[1];
		drawerProps = $[2];
		noBackdrop = $[3];
		onClose = $[4];
		t0 = $[5];
	}
	const anchor = t0 === void 0 ? "right" : t0;
	let t1;
	if ($[6] !== classes.paper) {
		t1 = { paper: classes.paper };
		$[6] = classes.paper;
		$[7] = t1;
	} else t1 = $[7];
	let t2;
	if ($[8] !== noBackdrop) {
		t2 = { invisible: noBackdrop };
		$[8] = noBackdrop;
		$[9] = t2;
	} else t2 = $[9];
	let t3;
	if ($[10] !== anchor || $[11] !== children || $[12] !== drawerProps || $[13] !== onClose || $[14] !== t1 || $[15] !== t2) {
		t3 = /* @__PURE__ */ React.createElement(Drawer, {
			classes: t1,
			variant: "temporary",
			anchor,
			onClose,
			...drawerProps,
			BackdropProps: t2
		}, children);
		$[10] = anchor;
		$[11] = children;
		$[12] = drawerProps;
		$[13] = onClose;
		$[14] = t1;
		$[15] = t2;
		$[16] = t3;
	} else t3 = $[16];
	return t3;
};
/**
* A right hand material side sheet
*/
const SideSheet = (props) => {
	const $ = c(47);
	const classes = useStyles(props);
	let buttonLabel;
	let buttonOneDisabled;
	let buttonTwoAction;
	let buttonTwoDisabled;
	let buttonTwoIcon;
	let buttonTwoLabel;
	let buttonTwoProgress;
	let children;
	let id;
	let onSubmit;
	let otherProps;
	let progress;
	let t0;
	let t1;
	let t2;
	let title;
	let udprecordid;
	if ($[0] !== props) {
		const { children: t3, title: t4, progress: t5, progressColor: t6, buttonLabel: t7, noPadding, onSubmit: t8, variant: t9, buttonTwoLabel: t10, buttonTwoIcon: t11, buttonTwoAction: t12, buttonTwoProgress: t13, buttonOneDisabled: t14, buttonTwoDisabled: t15, id: t16, udprecordid: t17, anchor: t18, ...t19 } = props;
		children = t3;
		title = t4;
		progress = t5;
		t0 = t6;
		buttonLabel = t7;
		onSubmit = t8;
		t1 = t9;
		buttonTwoLabel = t10;
		buttonTwoIcon = t11;
		buttonTwoAction = t12;
		buttonTwoProgress = t13;
		buttonOneDisabled = t14;
		buttonTwoDisabled = t15;
		id = t16;
		udprecordid = t17;
		t2 = t18;
		otherProps = t19;
		$[0] = props;
		$[1] = buttonLabel;
		$[2] = buttonOneDisabled;
		$[3] = buttonTwoAction;
		$[4] = buttonTwoDisabled;
		$[5] = buttonTwoIcon;
		$[6] = buttonTwoLabel;
		$[7] = buttonTwoProgress;
		$[8] = children;
		$[9] = id;
		$[10] = onSubmit;
		$[11] = otherProps;
		$[12] = progress;
		$[13] = t0;
		$[14] = t1;
		$[15] = t2;
		$[16] = title;
		$[17] = udprecordid;
	} else {
		buttonLabel = $[1];
		buttonOneDisabled = $[2];
		buttonTwoAction = $[3];
		buttonTwoDisabled = $[4];
		buttonTwoIcon = $[5];
		buttonTwoLabel = $[6];
		buttonTwoProgress = $[7];
		children = $[8];
		id = $[9];
		onSubmit = $[10];
		otherProps = $[11];
		progress = $[12];
		t0 = $[13];
		t1 = $[14];
		t2 = $[15];
		title = $[16];
		udprecordid = $[17];
	}
	const progressColor = t0 === void 0 ? "secondary" : t0;
	const variant = t1 === void 0 ? "determinate" : t1;
	const anchor = t2 === void 0 ? "right" : t2;
	const { onClose } = props;
	let t3;
	if ($[18] !== buttonLabel || $[19] !== buttonOneDisabled || $[20] !== buttonTwoAction || $[21] !== buttonTwoDisabled || $[22] !== buttonTwoIcon || $[23] !== buttonTwoLabel || $[24] !== buttonTwoProgress || $[25] !== id || $[26] !== onClose || $[27] !== onSubmit || $[28] !== otherProps || $[29] !== title || $[30] !== udprecordid) {
		t3 = /* @__PURE__ */ React.createElement(SideSheetHeader, {
			id,
			udprecordid,
			onClose,
			title,
			buttonLabel,
			onSubmit,
			buttonTwoLabel,
			buttonTwoIcon,
			buttonTwoAction,
			buttonTwoProgress,
			isSticky: true,
			buttonOneDisabled,
			buttonTwoDisabled,
			...otherProps
		});
		$[18] = buttonLabel;
		$[19] = buttonOneDisabled;
		$[20] = buttonTwoAction;
		$[21] = buttonTwoDisabled;
		$[22] = buttonTwoIcon;
		$[23] = buttonTwoLabel;
		$[24] = buttonTwoProgress;
		$[25] = id;
		$[26] = onClose;
		$[27] = onSubmit;
		$[28] = otherProps;
		$[29] = title;
		$[30] = udprecordid;
		$[31] = t3;
	} else t3 = $[31];
	let t4;
	if ($[32] !== progress || $[33] !== progressColor || $[34] !== variant) {
		t4 = progress && /* @__PURE__ */ React.createElement(LinearProgress, {
			variant,
			color: progressColor,
			value: progress
		});
		$[32] = progress;
		$[33] = progressColor;
		$[34] = variant;
		$[35] = t4;
	} else t4 = $[35];
	let t5;
	if ($[36] !== classes.container) {
		t5 = { root: classes.container };
		$[36] = classes.container;
		$[37] = t5;
	} else t5 = $[37];
	let t6;
	if ($[38] !== children || $[39] !== t5) {
		t6 = /* @__PURE__ */ React.createElement(CardContent, { classes: t5 }, children);
		$[38] = children;
		$[39] = t5;
		$[40] = t6;
	} else t6 = $[40];
	let t7;
	if ($[41] !== anchor || $[42] !== otherProps || $[43] !== t3 || $[44] !== t4 || $[45] !== t6) {
		t7 = /* @__PURE__ */ React.createElement(BaseSideSheet, {
			anchor,
			...otherProps
		}, t3, t4, t6);
		$[41] = anchor;
		$[42] = otherProps;
		$[43] = t3;
		$[44] = t4;
		$[45] = t6;
		$[46] = t7;
	} else t7 = $[46];
	return t7;
};
SideSheet.propTypes = {
	children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
	title: PropTypes.string.isRequired,
	onClose: PropTypes.func,
	open: PropTypes.bool,
	progress: PropTypes.any,
	progressColor: PropTypes.string,
	width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
	anchor: PropTypes.string,
	buttonLabel: PropTypes.string,
	noPadding: PropTypes.string,
	contentHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};
//#endregion
export { BaseSideSheet, SideSheet };

//# sourceMappingURL=SideSheet.mjs.map