import SvgIcon from "../utilities/iconLibrary/SvgIcon.mjs";
import { NodeLoader } from "../UI/feedback/NodeLoader.mjs";
import { InquiryTreeMenu } from "./InquiryTreeMenu.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Typography, makeStyles } from "@material-ui/core";
import clsx from "clsx";
import NoEntityOpenedUrl from "../assets/unityIcons/NoEntityOpened.svg";
//#region src/inquiry/NodeList.jsx
const useStyles = makeStyles((theme) => ({
	root: { overflowX: "auto" },
	nodeContainer: { width: "100%" },
	loader: {
		marginRight: theme.spacing(1),
		marginLeft: theme.spacing(1)
	},
	empty: {
		display: "flex",
		justifyContent: "center",
		alignItems: "center"
	},
	emptyIcon: { textAlign: "center" },
	emptyIconText: { color: theme.palette.secondary }
}));
const NodeList = (props) => {
	const $ = c(38);
	const { menuItemsList, onSelectNode, onDropNode, selectedNodeId, selectedNodeParentId, expandAllClicked, classes: classProps, menuLoading, nodesRequested, sidebarExpanded, executeQueryAdHoc, catalogObjects, promotedEntities, treeStructureArr, setMenuList, treeViewMode, onExpandedChange } = props;
	let t0;
	if ($[0] !== classProps) {
		t0 = classProps || {};
		$[0] = classProps;
		$[1] = t0;
	} else t0 = $[1];
	const { root } = t0;
	const classes = useStyles();
	let t1;
	if ($[2] !== onSelectNode) {
		t1 = (selectedNode, menuIndex, selectedTree) => {
			onSelectNode(selectedNode, menuIndex, selectedTree);
		};
		$[2] = onSelectNode;
		$[3] = t1;
	} else t1 = $[3];
	const handleSelectNode = t1;
	const t2 = !!!menuItemsList?.length && !menuLoading && classes.empty;
	let t3;
	if ($[4] !== classes.root || $[5] !== root || $[6] !== t2) {
		t3 = clsx(classes.root, root, t2);
		$[4] = classes.root;
		$[5] = root;
		$[6] = t2;
		$[7] = t3;
	} else t3 = $[7];
	let t4;
	if ($[8] !== classes.emptyIcon || $[9] !== classes.emptyIconText || $[10] !== menuItemsList?.length || $[11] !== menuLoading) {
		t4 = !!!menuItemsList?.length && !menuLoading && /* @__PURE__ */ React.createElement("div", { className: classes.emptyIcon }, /* @__PURE__ */ React.createElement(SvgIcon, {
			src: NoEntityOpenedUrl,
			size: 42
		}), /* @__PURE__ */ React.createElement(Typography, {
			variant: "subtitle1",
			className: classes.emptyIconText
		}, "No Entity Opened"));
		$[8] = classes.emptyIcon;
		$[9] = classes.emptyIconText;
		$[10] = menuItemsList?.length;
		$[11] = menuLoading;
		$[12] = t4;
	} else t4 = $[12];
	let t5;
	if ($[13] !== catalogObjects || $[14] !== classes.nodeContainer || $[15] !== executeQueryAdHoc || $[16] !== expandAllClicked || $[17] !== handleSelectNode || $[18] !== menuItemsList || $[19] !== onDropNode || $[20] !== onExpandedChange || $[21] !== promotedEntities || $[22] !== selectedNodeId || $[23] !== selectedNodeParentId || $[24] !== setMenuList || $[25] !== sidebarExpanded || $[26] !== treeStructureArr || $[27] !== treeViewMode) {
		t5 = menuItemsList?.length > 0 && menuItemsList.map((menuItems, index) => /* @__PURE__ */ React.createElement("div", {
			key: menuItems.id,
			className: classes.nodeContainer
		}, /* @__PURE__ */ React.createElement(InquiryTreeMenu, {
			menuItems,
			onSelectNode: handleSelectNode,
			onDropNode,
			menuIndex: index,
			selectedNodeId,
			selectedNodeParentId,
			expandAllClicked,
			sidebarExpanded,
			executeQueryAdHoc,
			catalogObjects,
			promotedEntities,
			treeStructureArr: treeStructureArr || [],
			setMenuList,
			treeViewMode,
			onExpandedChange
		})));
		$[13] = catalogObjects;
		$[14] = classes.nodeContainer;
		$[15] = executeQueryAdHoc;
		$[16] = expandAllClicked;
		$[17] = handleSelectNode;
		$[18] = menuItemsList;
		$[19] = onDropNode;
		$[20] = onExpandedChange;
		$[21] = promotedEntities;
		$[22] = selectedNodeId;
		$[23] = selectedNodeParentId;
		$[24] = setMenuList;
		$[25] = sidebarExpanded;
		$[26] = treeStructureArr;
		$[27] = treeViewMode;
		$[28] = t5;
	} else t5 = $[28];
	let t6;
	if ($[29] !== classes.loader || $[30] !== menuLoading || $[31] !== nodesRequested) {
		t6 = menuLoading && /* @__PURE__ */ React.createElement("div", { className: classes.loader }, /* @__PURE__ */ React.createElement(NodeLoader, {
			loading: menuLoading,
			nodesRequested
		}));
		$[29] = classes.loader;
		$[30] = menuLoading;
		$[31] = nodesRequested;
		$[32] = t6;
	} else t6 = $[32];
	let t7;
	if ($[33] !== t3 || $[34] !== t4 || $[35] !== t5 || $[36] !== t6) {
		t7 = /* @__PURE__ */ React.createElement("div", { className: t3 }, t4, t5, t6);
		$[33] = t3;
		$[34] = t4;
		$[35] = t5;
		$[36] = t6;
		$[37] = t7;
	} else t7 = $[37];
	return t7;
};
//#endregion
export { NodeList };

//# sourceMappingURL=NodeList.mjs.map