import { FluentIconButton } from "../../inputs/buttons/FluentIconButton.mjs";
import { useShellStore } from "../../../stores/shellStore.mjs";
import PrimaryActionButton from "../../inputs/buttons/PrimaryActionButton.mjs";
import { ToolBarButton } from "../../inputs/buttons/ToolBarButton.mjs";
import { StandardTitle } from "../../dataDisplay/typography/StandardTitle.mjs";
import { PAHExport } from "./ui/PAHExport.mjs";
import { StatusChip } from "../../dataDisplay/status/StatusChip.mjs";
import { useAllTeleporters } from "./ui/teleporter.mjs";
import { c } from "react-compiler-runtime";
import React, { Suspense, lazy, useState } from "react";
import { Collapse, Divider, LinearProgress, Slide, Typography, lighten, makeStyles } from "@material-ui/core";
import clsx from "clsx";
import { ChevronFold10Icon, ChevronRightIcon, ChevronUnfold10Icon, ClearIcon, DeleteIcon, FilterIcon, GroupListIcon, MaximumValueIcon, MoreVerticalIcon, SaveIcon, SearchIcon } from "@fluentui/react-icons";
import PropTypes from "prop-types";
import ArrowBackIcon from "@material-ui/icons/esm/ArrowBack";
//#region src/UI/utilityDisplay/utilityHeader/PrimaryActionHeader.jsx
const UdpTablist = lazy(() => import("../../fluent-web-components/UdpTablist.mjs").then((m) => ({ default: m.UdpTablist })));
/** Matches legacy UdpTabs `{ id: index, ...tab }` id used in onChange. */
function legacyTabSelectionId(tab, index) {
	return tab?.id !== void 0 && tab?.id !== null ? tab.id : index;
}
function normalizeTabsForFluentTablist(tabList) {
	if (!Array.isArray(tabList) || tabList.length === 0) return [];
	return tabList.map((tab, index) => ({
		...tab,
		id: String(legacyTabSelectionId(tab, index)),
		label: tab?.label ?? ""
	}));
}
function resolveFluentActiveId(tabList, value, normalizedTabs) {
	if (!normalizedTabs.length) return "";
	if (value === false || value === void 0 || value === null) return normalizedTabs[0].id;
	const matchIndex = tabList.findIndex((t, i) => legacyTabSelectionId(t, i) === value);
	if (matchIndex >= 0) return normalizedTabs[matchIndex].id;
	if (typeof value === "number" && Number.isInteger(value) && value >= 0 && value < normalizedTabs.length) return normalizedTabs[value].id;
	return String(value);
}
function tabVariantToFluentDefaults(tabVariant) {
	switch (tabVariant) {
		case "block": return {
			appearance: "contained",
			size: "small",
			overflowStrategy: "collapse"
		};
		case "spread": return {
			appearance: "transparent",
			size: "medium",
			overflowStrategy: "collapse"
		};
		default: return {
			appearance: "transparent",
			size: "small",
			overflowStrategy: "collapse"
		};
	}
}
const useStyles = makeStyles((theme) => ({
	root: {
		display: "flex",
		[theme.breakpoints.between("xs", "sm")]: { height: 50 },
		minHeight: "48px"
	},
	title: { margin: theme.spacing(2) },
	titleWrapper: {
		paddingLeft: 12,
		paddingRight: (props) => props.single ? theme.spacing(2) : 0,
		display: "flex",
		alignItems: "center"
	},
	subHeaderWrapper: {
		width: "100%",
		minWidth: 0,
		marginTop: 0,
		[theme.breakpoints.down("xs")]: { justifyContent: "flex-start" }
	},
	subHeader: {
		minWidth: (props) => props.subheader && 320,
		marginLeft: theme.spacing(2),
		[theme.breakpoints.between("sm", "lg")]: { display: "none" },
		[theme.breakpoints.down("xs")]: { display: "none" }
	},
	denseSubtitle: {
		marginTop: theme.spacing(1.2),
		marginLeft: theme.spacing(2)
	},
	actionRowTrail: {
		display: "flex",
		alignItems: "center",
		marginLeft: "auto",
		flexShrink: 0
	},
	actionRow: {
		display: "flex",
		flex: 1,
		alignItems: "center",
		minWidth: 0,
		width: "100%"
	},
	secondaryButtons: {
		display: "flex",
		[theme.breakpoints.down("sm")]: { display: "none" },
		alignItems: "center"
	},
	secondaryButtonsMobile: {
		display: "flex",
		padding: theme.spacing(1),
		background: theme.palette.divider,
		[theme.breakpoints.up("sm")]: { display: "none" }
	},
	search: {
		marginRight: theme.spacing(2),
		marginTop: theme.spacing(3),
		flex: 1
	},
	close: { marginRight: theme.spacing(2) },
	pab: {
		display: "flex",
		alignItems: "center"
	},
	titleOnly: { paddingBottom: theme.spacing(1) },
	advancedOptions: {
		backgroundColor: "#EEEEEE",
		width: "100%"
	},
	tabPageButtons: {
		height: 50,
		borderTop: `1px solid ${theme.palette.divider}`,
		paddingLeft: theme.spacing(2),
		backgroundColor: "#EEEEEE"
	},
	divider: {
		height: 25,
		marginLeft: theme.spacing(1),
		marginRight: theme.spacing(2)
	},
	functionIcons: {
		fontSize: 18,
		color: theme.palette.secondary.main
	},
	tabRow: {
		flex: 1,
		minWidth: 0,
		minHeight: "48px",
		alignSelf: "stretch",
		contain: "inline-size"
	},
	fullTabs: {
		flex: 1,
		minWidth: 0,
		minHeight: "48px",
		alignSelf: "stretch",
		contain: "inline-size"
	},
	iconButton: {
		marginTop: 9,
		marginLeft: 4
	},
	titleWrapperBack: {
		display: "flex",
		flex: (props) => props.title && 1
	},
	buttomButtonRow: {
		display: "flex",
		width: "100%"
	},
	bottomButtonsLeft: {
		display: "flex",
		flex: 1,
		justifyContent: "flex-start"
	},
	bottomButtonsRigth: {
		display: "flex",
		justifyContent: "flex-end"
	},
	single: { display: "flex" },
	containerStyle: {
		background: lighten(theme.palette.secondary.light, .9),
		padding: theme.spacing(1),
		paddingLeft: theme.spacing(2),
		borderTop: `1px solid ${theme.palette.divider} `
	},
	gridControlLineUp: {
		display: "flex",
		alignItems: "center",
		marginRight: theme.spacing(2)
	},
	additionalTitleComponent: { marginLeft: theme.spacing(2) }
}));
const PrimaryActionHeader = (props) => {
	const $ = c(302);
	const classes = useStyles(props);
	let altInputs;
	let bottomRowSecondary;
	let bottomRowSecondaryRight;
	let buttonLabel;
	let clearGridConfig;
	let clickBack;
	let collapseGrid;
	let deleteGridConfig;
	let expand;
	let expandGrid;
	let expandOptions;
	let expandedContent;
	let exportCSV;
	let exportExcel;
	let exportGrid;
	let exportPDF;
	let grid;
	let gridApi;
	let groups;
	let handleChange;
	let handleClick;
	let handleMouseLeave;
	let loading;
	let loadingVal;
	let lowerTray;
	let lowerTrayGrid;
	let lowerTraySearch;
	let openFilter;
	let openGroups;
	let otherProps;
	let pabDisabled;
	let resizeGrid;
	let saveGridConfig;
	let search;
	let searchField;
	let secondaryButtons;
	let showGroups;
	let single;
	let stepper;
	let subheader;
	let t0;
	let t1;
	let t2;
	let t3;
	let t4;
	let t5;
	let t6;
	let t7;
	let tabList;
	let tabVariant;
	let tabs;
	let title;
	let topRowSecondary;
	let upperTrayGrid;
	let value;
	if ($[0] !== props) {
		const { buttonLabel: t8, title: t9, subheader: t10, handleClick: t11, secondaryButtons: t12, hidePAB: t13, search: t14, searchField: t15, expandOptions: t16, handleMouseLeave: t17, expandedContent: t18, handleChange: t19, value: t20, tabList: t21, tabs: t22, resizeGrid: t23, collapse, expandAllItems, groups: t24, showGroups: t25, grid: t26, clickBack: t27, topRowSecondary: t28, bottomRowSecondary: t29, bottomRowSecondaryRight: t30, loading: t31, openGroups: t32, openFilter: t33, altInputs: t34, loadingVal: t35, exportGrid: t36, openSearch: t37, styleSearch, stepper: t38, pabDisabled: t39, switcher, single: t40, lowerTray: t41, lowerTraySearch: t42, lowerTrayGrid: t43, upperTrayGrid: t44, exportCSV: t45, exportExcel: t46, exportPDF: t47, expand: t48, expandGrid: t49, collapseGrid: t50, resize, gridApi: t51, saveGridConfig: t52, deleteGridConfig: t53, clearGridConfig: t54, hideActionRow: t55, allowAdditionalTitleComponent: t56, allowAdditionalRightComponent: t57, StatusChipProps: t58, tabProps: t59, tabVariant: t60, additionalComponentId: t61, ...t62 } = props;
		buttonLabel = t8;
		title = t9;
		subheader = t10;
		handleClick = t11;
		secondaryButtons = t12;
		t0 = t13;
		search = t14;
		searchField = t15;
		expandOptions = t16;
		handleMouseLeave = t17;
		expandedContent = t18;
		handleChange = t19;
		value = t20;
		tabList = t21;
		tabs = t22;
		resizeGrid = t23;
		groups = t24;
		showGroups = t25;
		grid = t26;
		clickBack = t27;
		topRowSecondary = t28;
		bottomRowSecondary = t29;
		bottomRowSecondaryRight = t30;
		loading = t31;
		openGroups = t32;
		openFilter = t33;
		altInputs = t34;
		loadingVal = t35;
		exportGrid = t36;
		t1 = t37;
		stepper = t38;
		pabDisabled = t39;
		single = t40;
		lowerTray = t41;
		lowerTraySearch = t42;
		lowerTrayGrid = t43;
		upperTrayGrid = t44;
		exportCSV = t45;
		exportExcel = t46;
		exportPDF = t47;
		expand = t48;
		expandGrid = t49;
		collapseGrid = t50;
		gridApi = t51;
		saveGridConfig = t52;
		deleteGridConfig = t53;
		clearGridConfig = t54;
		t2 = t55;
		t3 = t56;
		t4 = t57;
		t5 = t58;
		t6 = t59;
		tabVariant = t60;
		t7 = t61;
		otherProps = t62;
		$[0] = props;
		$[1] = altInputs;
		$[2] = bottomRowSecondary;
		$[3] = bottomRowSecondaryRight;
		$[4] = buttonLabel;
		$[5] = clearGridConfig;
		$[6] = clickBack;
		$[7] = collapseGrid;
		$[8] = deleteGridConfig;
		$[9] = expand;
		$[10] = expandGrid;
		$[11] = expandOptions;
		$[12] = expandedContent;
		$[13] = exportCSV;
		$[14] = exportExcel;
		$[15] = exportGrid;
		$[16] = exportPDF;
		$[17] = grid;
		$[18] = gridApi;
		$[19] = groups;
		$[20] = handleChange;
		$[21] = handleClick;
		$[22] = handleMouseLeave;
		$[23] = loading;
		$[24] = loadingVal;
		$[25] = lowerTray;
		$[26] = lowerTrayGrid;
		$[27] = lowerTraySearch;
		$[28] = openFilter;
		$[29] = openGroups;
		$[30] = otherProps;
		$[31] = pabDisabled;
		$[32] = resizeGrid;
		$[33] = saveGridConfig;
		$[34] = search;
		$[35] = searchField;
		$[36] = secondaryButtons;
		$[37] = showGroups;
		$[38] = single;
		$[39] = stepper;
		$[40] = subheader;
		$[41] = t0;
		$[42] = t1;
		$[43] = t2;
		$[44] = t3;
		$[45] = t4;
		$[46] = t5;
		$[47] = t6;
		$[48] = t7;
		$[49] = tabList;
		$[50] = tabVariant;
		$[51] = tabs;
		$[52] = title;
		$[53] = topRowSecondary;
		$[54] = upperTrayGrid;
		$[55] = value;
	} else {
		altInputs = $[1];
		bottomRowSecondary = $[2];
		bottomRowSecondaryRight = $[3];
		buttonLabel = $[4];
		clearGridConfig = $[5];
		clickBack = $[6];
		collapseGrid = $[7];
		deleteGridConfig = $[8];
		expand = $[9];
		expandGrid = $[10];
		expandOptions = $[11];
		expandedContent = $[12];
		exportCSV = $[13];
		exportExcel = $[14];
		exportGrid = $[15];
		exportPDF = $[16];
		grid = $[17];
		gridApi = $[18];
		groups = $[19];
		handleChange = $[20];
		handleClick = $[21];
		handleMouseLeave = $[22];
		loading = $[23];
		loadingVal = $[24];
		lowerTray = $[25];
		lowerTrayGrid = $[26];
		lowerTraySearch = $[27];
		openFilter = $[28];
		openGroups = $[29];
		otherProps = $[30];
		pabDisabled = $[31];
		resizeGrid = $[32];
		saveGridConfig = $[33];
		search = $[34];
		searchField = $[35];
		secondaryButtons = $[36];
		showGroups = $[37];
		single = $[38];
		stepper = $[39];
		subheader = $[40];
		t0 = $[41];
		t1 = $[42];
		t2 = $[43];
		t3 = $[44];
		t4 = $[45];
		t5 = $[46];
		t6 = $[47];
		t7 = $[48];
		tabList = $[49];
		tabVariant = $[50];
		tabs = $[51];
		title = $[52];
		topRowSecondary = $[53];
		upperTrayGrid = $[54];
		value = $[55];
	}
	const hidePAB = t0 === void 0 ? false : t0;
	const openSearch = t1 === void 0 ? false : t1;
	const hideActionRow = t2 === void 0 ? false : t2;
	const allowAdditionalTitleComponent = t3 === void 0 ? false : t3;
	const allowAdditionalRightComponent = t4 === void 0 ? true : t4;
	const StatusChipProps = t5 === void 0 ? null : t5;
	let t8;
	if ($[56] !== t6) {
		t8 = t6 === void 0 ? {} : t6;
		$[56] = t6;
		$[57] = t8;
	} else t8 = $[57];
	const tabProps = t8;
	const additionalComponentId = t7 === void 0 ? "" : t7;
	const [searchExpanded, setSearchExpanded] = useState(openSearch);
	const currentContainerId = useShellStore(_temp);
	const allTeleporters = useAllTeleporters();
	let t9;
	if ($[58] !== searchExpanded) {
		t9 = () => {
			setSearchExpanded(!searchExpanded);
		};
		$[58] = searchExpanded;
		$[59] = t9;
	} else t9 = $[59];
	const expandSearch = t9;
	let t10;
	if ($[60] !== tabList) {
		t10 = normalizeTabsForFluentTablist(tabList);
		$[60] = tabList;
		$[61] = t10;
	} else t10 = $[61];
	const normalizedFluentTabs = t10;
	let t11;
	if ($[62] !== normalizedFluentTabs || $[63] !== tabList || $[64] !== value) {
		t11 = resolveFluentActiveId(tabList, value, normalizedFluentTabs);
		$[62] = normalizedFluentTabs;
		$[63] = tabList;
		$[64] = value;
		$[65] = t11;
	} else t11 = $[65];
	const fluentActiveId = t11;
	let t12;
	if ($[66] !== tabVariant) {
		t12 = tabVariantToFluentDefaults(tabVariant);
		$[66] = tabVariant;
		$[67] = t12;
	} else t12 = $[67];
	const fluentTablistDefaults = t12;
	let t13;
	if ($[68] !== handleChange || $[69] !== normalizedFluentTabs || $[70] !== tabList) {
		t13 = (e) => {
			if (!handleChange) return;
			const newFluentId = e.detail;
			const idx = normalizedFluentTabs.findIndex((t) => t.id === newFluentId);
			if (idx < 0) return;
			const legacySecondArg = legacyTabSelectionId(tabList[idx], idx);
			handleChange(e, legacySecondArg);
		};
		$[68] = handleChange;
		$[69] = normalizedFluentTabs;
		$[70] = tabList;
		$[71] = t13;
	} else t13 = $[71];
	const handleFluentTabChange = t13;
	let t14;
	if ($[72] !== expandGrid) {
		t14 = [{
			label: "",
			aria: "expand",
			component: ChevronUnfold10Icon,
			click: expandGrid,
			id: 1
		}];
		$[72] = expandGrid;
		$[73] = t14;
	} else t14 = $[73];
	const gridControlsExpand = t14;
	let t15;
	if ($[74] !== resizeGrid) {
		t15 = [{
			label: "",
			aria: "resize",
			component: MaximumValueIcon,
			click: resizeGrid,
			id: 2
		}];
		$[74] = resizeGrid;
		$[75] = t15;
	} else t15 = $[75];
	const gridControlsResize = t15;
	let t16;
	if ($[76] !== collapseGrid) {
		t16 = [{
			label: "",
			aria: "collapse",
			component: ChevronFold10Icon,
			click: collapseGrid,
			id: 3
		}];
		$[76] = collapseGrid;
		$[77] = t16;
	} else t16 = $[77];
	const gridControlsCollapse = t16;
	let t17;
	if ($[78] !== openGroups) {
		t17 = [{
			label: "Group",
			component: GroupListIcon,
			click: openGroups,
			id: 4
		}];
		$[78] = openGroups;
		$[79] = t17;
	} else t17 = $[79];
	const gridControlsGroup = t17;
	let t18;
	if ($[80] !== openFilter) {
		t18 = [{
			label: "Filter",
			component: FilterIcon,
			click: openFilter,
			id: 5
		}];
		$[80] = openFilter;
		$[81] = t18;
	} else t18 = $[81];
	const gridControlsFilter = t18;
	let t19;
	if ($[82] !== saveGridConfig) {
		t19 = [{
			label: "Save Grid Configuration",
			component: SaveIcon,
			click: saveGridConfig,
			id: 6
		}];
		$[82] = saveGridConfig;
		$[83] = t19;
	} else t19 = $[83];
	const gridControlsSave = t19;
	let t20;
	if ($[84] !== deleteGridConfig) {
		t20 = [{
			label: "Delete Grid Configuration",
			component: DeleteIcon,
			click: deleteGridConfig,
			id: 7
		}];
		$[84] = deleteGridConfig;
		$[85] = t20;
	} else t20 = $[85];
	const gridControlsDelete = t20;
	let t21;
	if ($[86] !== clearGridConfig) {
		t21 = [{
			label: "Clear Grid Configuration",
			component: ClearIcon,
			click: clearGridConfig,
			id: 8
		}];
		$[86] = clearGridConfig;
		$[87] = t21;
	} else t21 = $[87];
	const gridControlsClear = t21;
	let t22;
	if ($[88] !== exportCSV || $[89] !== gridApi) {
		t22 = exportCSV || (() => gridApi?.exportDataAsCsv());
		$[88] = exportCSV;
		$[89] = gridApi;
		$[90] = t22;
	} else t22 = $[90];
	let t23;
	if ($[91] !== exportExcel || $[92] !== gridApi) {
		t23 = exportExcel || (() => gridApi?.exportDataAsExcel());
		$[91] = exportExcel;
		$[92] = gridApi;
		$[93] = t23;
	} else t23 = $[93];
	let t24;
	if ($[94] !== exportPDF || $[95] !== t22 || $[96] !== t23) {
		t24 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(PAHExport, {
			exportCSV: t22,
			exportExcel: t23,
			exportPDF
		}));
		$[94] = exportPDF;
		$[95] = t22;
		$[96] = t23;
		$[97] = t24;
	} else t24 = $[97];
	const gridControlsExport = t24;
	let t25;
	if ($[98] !== gridControlsExpand) {
		t25 = gridControlsExpand && /* @__PURE__ */ React.createElement("div", null, gridControlsExpand.map(_temp2));
		$[98] = gridControlsExpand;
		$[99] = t25;
	} else t25 = $[99];
	const gridControlExpand = t25;
	let t26;
	if ($[100] !== gridControlsResize) {
		t26 = gridControlsResize && /* @__PURE__ */ React.createElement("div", null, gridControlsResize.map(_temp3));
		$[100] = gridControlsResize;
		$[101] = t26;
	} else t26 = $[101];
	const gridControlResize = t26;
	let t27;
	if ($[102] !== gridControlsCollapse) {
		t27 = gridControlsCollapse && /* @__PURE__ */ React.createElement("div", null, gridControlsCollapse.map(_temp4));
		$[102] = gridControlsCollapse;
		$[103] = t27;
	} else t27 = $[103];
	const gridControlCollapse = t27;
	let t28;
	if ($[104] !== gridControlsSave) {
		t28 = gridControlsSave && /* @__PURE__ */ React.createElement("div", null, gridControlsSave.map(_temp5));
		$[104] = gridControlsSave;
		$[105] = t28;
	} else t28 = $[105];
	const gridControlSave = t28;
	let t29;
	if ($[106] !== gridControlsDelete) {
		t29 = gridControlsDelete && /* @__PURE__ */ React.createElement("div", null, gridControlsDelete.map(_temp6));
		$[106] = gridControlsDelete;
		$[107] = t29;
	} else t29 = $[107];
	const gridControlDelete = t29;
	let t30;
	if ($[108] !== gridControlsClear) {
		t30 = gridControlsClear && /* @__PURE__ */ React.createElement("div", null, gridControlsClear.map(_temp7));
		$[108] = gridControlsClear;
		$[109] = t30;
	} else t30 = $[109];
	const gridControlClear = t30;
	let t31;
	if ($[110] === Symbol.for("react.memo_cache_sentinel")) {
		t31 = { display: "flex" };
		$[110] = t31;
	} else t31 = $[110];
	let t32;
	if ($[111] !== classes.close || $[112] !== expandSearch || $[113] !== searchExpanded) {
		t32 = searchExpanded && /* @__PURE__ */ React.createElement(FluentIconButton, {
			click: expandSearch,
			"aria-label": "close search",
			className: classes.close,
			icon: ChevronRightIcon,
			onClick: expandSearch,
			size: "small"
		});
		$[111] = classes.close;
		$[112] = expandSearch;
		$[113] = searchExpanded;
		$[114] = t32;
	} else t32 = $[114];
	let t33;
	if ($[115] !== t32) {
		t33 = /* @__PURE__ */ React.createElement("div", { style: t31 }, t32);
		$[115] = t32;
		$[116] = t33;
	} else t33 = $[116];
	let t34;
	if ($[117] === Symbol.for("react.memo_cache_sentinel")) {
		t34 = { flex: 1 };
		$[117] = t34;
	} else t34 = $[117];
	let t35;
	if ($[118] !== classes.searchWrapper || $[119] !== expandSearch || $[120] !== searchExpanded || $[121] !== searchField) {
		t35 = searchExpanded && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Slide, {
			direction: "left",
			in: expandSearch,
			mountOnEnter: true,
			unmountOnExit: true
		}, /* @__PURE__ */ React.createElement("div", { className: classes.searchWrapper }, searchField)));
		$[118] = classes.searchWrapper;
		$[119] = expandSearch;
		$[120] = searchExpanded;
		$[121] = searchField;
		$[122] = t35;
	} else t35 = $[122];
	let t36;
	if ($[123] !== t35) {
		t36 = /* @__PURE__ */ React.createElement("div", null, t35);
		$[123] = t35;
		$[124] = t36;
	} else t36 = $[124];
	let t37;
	if ($[125] !== classes.search || $[126] !== t36) {
		t37 = /* @__PURE__ */ React.createElement("div", {
			className: classes.search,
			style: t34
		}, t36);
		$[125] = classes.search;
		$[126] = t36;
		$[127] = t37;
	} else t37 = $[127];
	let t38;
	if ($[128] !== t33 || $[129] !== t37) {
		t38 = /* @__PURE__ */ React.createElement(React.Fragment, null, t33, t37);
		$[128] = t33;
		$[129] = t37;
		$[130] = t38;
	} else t38 = $[130];
	const searchToggle = t38;
	let t39;
	if ($[131] !== classes.containerStyle) {
		t39 = (t40) => {
			const { children } = t40;
			return /* @__PURE__ */ React.createElement("div", { className: classes.containerStyle }, children);
		};
		$[131] = classes.containerStyle;
		$[132] = t39;
	} else t39 = $[132];
	const LowerTrayShell = t39;
	let t40;
	if ($[133] !== classes.gridControlLineUp || $[134] !== clearGridConfig || $[135] !== collapseGrid || $[136] !== deleteGridConfig || $[137] !== expandGrid || $[138] !== exportGrid || $[139] !== gridControlClear || $[140] !== gridControlCollapse || $[141] !== gridControlDelete || $[142] !== gridControlExpand || $[143] !== gridControlResize || $[144] !== gridControlSave || $[145] !== gridControlsExport || $[146] !== resizeGrid || $[147] !== saveGridConfig) {
		t40 = () => /* @__PURE__ */ React.createElement("div", { className: classes.gridControlLineUp }, saveGridConfig && gridControlSave, deleteGridConfig && gridControlDelete, clearGridConfig && gridControlClear, expandGrid && gridControlExpand, resizeGrid && gridControlResize, collapseGrid && gridControlCollapse, exportGrid && gridControlsExport);
		$[133] = classes.gridControlLineUp;
		$[134] = clearGridConfig;
		$[135] = collapseGrid;
		$[136] = deleteGridConfig;
		$[137] = expandGrid;
		$[138] = exportGrid;
		$[139] = gridControlClear;
		$[140] = gridControlCollapse;
		$[141] = gridControlDelete;
		$[142] = gridControlExpand;
		$[143] = gridControlResize;
		$[144] = gridControlSave;
		$[145] = gridControlsExport;
		$[146] = resizeGrid;
		$[147] = saveGridConfig;
		$[148] = t40;
	} else t40 = $[148];
	const GridControlLineUp = t40;
	let components;
	if ($[149] !== additionalComponentId || $[150] !== allTeleporters) {
		components = [];
		allTeleporters.forEach((t41) => {
			const [targetId, location, teleporter] = t41;
			const Target = teleporter.Target;
			if (targetId === additionalComponentId && location === "title") components.push(/* @__PURE__ */ React.createElement("div", {
				key: targetId,
				className: "teleport-target"
			}, /* @__PURE__ */ React.createElement(Target, null)));
		});
		$[149] = additionalComponentId;
		$[150] = allTeleporters;
		$[151] = components;
	} else components = $[151];
	const additionalTitleTeleportedComponents = components;
	const t41 = single && classes.single;
	let t42;
	if ($[152] !== classes.iconButton || $[153] !== clickBack) {
		t42 = clickBack && /* @__PURE__ */ React.createElement("div", { className: classes.iconButton }, /* @__PURE__ */ React.createElement(FluentIconButton, {
			icon: ArrowBackIcon,
			onClick: clickBack
		}));
		$[152] = classes.iconButton;
		$[153] = clickBack;
		$[154] = t42;
	} else t42 = $[154];
	let t43;
	if ($[155] !== additionalTitleTeleportedComponents || $[156] !== allowAdditionalTitleComponent || $[157] !== classes.additionalTitleComponent || $[158] !== classes.denseSubtitle || $[159] !== classes.root || $[160] !== classes.titleWrapper || $[161] !== single || $[162] !== subheader || $[163] !== title) {
		t43 = title && /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement("div", { className: classes.titleWrapper }, /* @__PURE__ */ React.createElement(StandardTitle, { removeMarginTop: single }, title), single && subheader && /* @__PURE__ */ React.createElement(Typography, {
			className: classes.denseSubtitle,
			variant: "subtitle1",
			component: "h2"
		}, subheader), allowAdditionalTitleComponent && /* @__PURE__ */ React.createElement("div", { className: classes.additionalTitleComponent }, additionalTitleTeleportedComponents.map(_temp8))));
		$[155] = additionalTitleTeleportedComponents;
		$[156] = allowAdditionalTitleComponent;
		$[157] = classes.additionalTitleComponent;
		$[158] = classes.denseSubtitle;
		$[159] = classes.root;
		$[160] = classes.titleWrapper;
		$[161] = single;
		$[162] = subheader;
		$[163] = title;
		$[164] = t43;
	} else t43 = $[164];
	let t44;
	if ($[165] !== additionalTitleTeleportedComponents || $[166] !== allowAdditionalTitleComponent || $[167] !== classes.additionalTitleComponent || $[168] !== title) {
		t44 = !title && allowAdditionalTitleComponent && /* @__PURE__ */ React.createElement("div", { className: classes.additionalTitleComponent }, additionalTitleTeleportedComponents.map(_temp9));
		$[165] = additionalTitleTeleportedComponents;
		$[166] = allowAdditionalTitleComponent;
		$[167] = classes.additionalTitleComponent;
		$[168] = title;
		$[169] = t44;
	} else t44 = $[169];
	let t45;
	if ($[170] !== StatusChipProps || $[171] !== classes.root || $[172] !== classes.titleWrapper) {
		t45 = StatusChipProps && /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement("div", { className: classes.titleWrapper }, /* @__PURE__ */ React.createElement(StatusChip, {
			label: StatusChipProps?.label,
			status: StatusChipProps?.status
		})));
		$[170] = StatusChipProps;
		$[171] = classes.root;
		$[172] = classes.titleWrapper;
		$[173] = t45;
	} else t45 = $[173];
	let t46;
	if ($[174] !== classes.titleWrapperBack || $[175] !== t42 || $[176] !== t43 || $[177] !== t44 || $[178] !== t45) {
		t46 = /* @__PURE__ */ React.createElement("div", { className: classes.titleWrapperBack }, t42, t43, t44, t45);
		$[174] = classes.titleWrapperBack;
		$[175] = t42;
		$[176] = t43;
		$[177] = t44;
		$[178] = t45;
		$[179] = t46;
	} else t46 = $[179];
	let t47;
	if ($[180] !== GridControlLineUp || $[181] !== additionalComponentId || $[182] !== allTeleporters || $[183] !== allowAdditionalRightComponent || $[184] !== buttonLabel || $[185] !== classes.actionRow || $[186] !== classes.actionRowTrail || $[187] !== classes.denseSubtitle || $[188] !== classes.divider || $[189] !== classes.fullTabs || $[190] !== classes.pab || $[191] !== classes.secondaryButtons || $[192] !== classes.tabRow || $[193] !== clearGridConfig || $[194] !== collapseGrid || $[195] !== deleteGridConfig || $[196] !== expand || $[197] !== expandGrid || $[198] !== expandSearch || $[199] !== exportGrid || $[200] !== fluentActiveId || $[201] !== fluentTablistDefaults || $[202] !== grid || $[203] !== gridControlsFilter || $[204] !== gridControlsGroup || $[205] !== handleClick || $[206] !== handleFluentTabChange || $[207] !== hideActionRow || $[208] !== hidePAB || $[209] !== normalizedFluentTabs || $[210] !== openFilter || $[211] !== openGroups || $[212] !== otherProps || $[213] !== pabDisabled || $[214] !== resizeGrid || $[215] !== saveGridConfig || $[216] !== search || $[217] !== searchExpanded || $[218] !== searchToggle || $[219] !== secondaryButtons || $[220] !== single || $[221] !== subheader || $[222] !== tabProps || $[223] !== tabs || $[224] !== topRowSecondary || $[225] !== upperTrayGrid) {
		t47 = !hideActionRow && /* @__PURE__ */ React.createElement("div", { className: classes.actionRow }, !single && subheader && /* @__PURE__ */ React.createElement(Typography, {
			className: classes.denseSubtitle,
			variant: "subtitle1",
			component: "h2"
		}, subheader), /* @__PURE__ */ React.createElement("div", { className: grid ? classes.tabRow : classes.fullTabs }, normalizedFluentTabs.length > 0 && /* @__PURE__ */ React.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React.createElement(UdpTablist, {
			...fluentTablistDefaults,
			...tabProps && typeof tabProps === "object" ? tabProps : {},
			tabList: normalizedFluentTabs,
			activeId: fluentActiveId,
			onTabChange: handleFluentTabChange,
			style: {
				width: "100%",
				minWidth: 0
			}
		}))), /* @__PURE__ */ React.createElement("div", { className: classes.actionRowTrail }, search && searchToggle, /* @__PURE__ */ React.createElement("div", { className: classes.secondaryButtons }, !searchExpanded && search && /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: "Search",
			component: SearchIcon,
			click: expandSearch
		}), search && /* @__PURE__ */ React.createElement(Divider, {
			orientation: "vertical",
			className: classes.divider
		}), (expandGrid || resizeGrid || collapseGrid || exportGrid || saveGridConfig || deleteGridConfig || clearGridConfig) && upperTrayGrid && /* @__PURE__ */ React.createElement(GridControlLineUp, { expand }), grid && openFilter && gridControlsFilter.map(_temp0), grid && openGroups && gridControlsGroup.map(_temp1), grid && searchExpanded && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(FluentIconButton, {
			id: "udpRecord-PrimaryActionHeader-ClosePanel",
			udprecordid: "udpRecord-PrimaryActionHeader-ClosePanel",
			icon: MoreVerticalIcon,
			"aria-label": "Close Panel"
		})), secondaryButtons && !tabs && secondaryButtons.map((item_7, index) => /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: item_7.label,
			expanded: searchExpanded,
			component: item_7.component,
			click: item_7.click,
			key: item_7.id ?? index,
			aria: item_7.label,
			disabled: item_7.disabled
		}))), /* @__PURE__ */ React.createElement("div", null, allowAdditionalRightComponent && allTeleporters.map((t48) => {
			const [targetId_0, location_0, teleporter_0] = t48;
			const Target_0 = teleporter_0.Target;
			if (targetId_0 === additionalComponentId && location_0 === "right") return /* @__PURE__ */ React.createElement("div", {
				key: targetId_0,
				className: "teleport-target"
			}, /* @__PURE__ */ React.createElement(Target_0, null));
			else return null;
		})), !hidePAB && /* @__PURE__ */ React.createElement("div", { className: classes.pab }, topRowSecondary && topRowSecondary.map((item_8, index_0) => /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: item_8.label,
			expanded: searchExpanded,
			component: item_8.component,
			click: item_8.click,
			key: item_8.id ?? index_0,
			aria: item_8.label
		})), /* @__PURE__ */ React.createElement(PrimaryActionButton, {
			disabled: pabDisabled,
			onClick: handleClick,
			...otherProps
		}, buttonLabel))));
		$[180] = GridControlLineUp;
		$[181] = additionalComponentId;
		$[182] = allTeleporters;
		$[183] = allowAdditionalRightComponent;
		$[184] = buttonLabel;
		$[185] = classes.actionRow;
		$[186] = classes.actionRowTrail;
		$[187] = classes.denseSubtitle;
		$[188] = classes.divider;
		$[189] = classes.fullTabs;
		$[190] = classes.pab;
		$[191] = classes.secondaryButtons;
		$[192] = classes.tabRow;
		$[193] = clearGridConfig;
		$[194] = collapseGrid;
		$[195] = deleteGridConfig;
		$[196] = expand;
		$[197] = expandGrid;
		$[198] = expandSearch;
		$[199] = exportGrid;
		$[200] = fluentActiveId;
		$[201] = fluentTablistDefaults;
		$[202] = grid;
		$[203] = gridControlsFilter;
		$[204] = gridControlsGroup;
		$[205] = handleClick;
		$[206] = handleFluentTabChange;
		$[207] = hideActionRow;
		$[208] = hidePAB;
		$[209] = normalizedFluentTabs;
		$[210] = openFilter;
		$[211] = openGroups;
		$[212] = otherProps;
		$[213] = pabDisabled;
		$[214] = resizeGrid;
		$[215] = saveGridConfig;
		$[216] = search;
		$[217] = searchExpanded;
		$[218] = searchToggle;
		$[219] = secondaryButtons;
		$[220] = single;
		$[221] = subheader;
		$[222] = tabProps;
		$[223] = tabs;
		$[224] = topRowSecondary;
		$[225] = upperTrayGrid;
		$[226] = t47;
	} else t47 = $[226];
	let t48;
	if ($[227] !== classes.subHeaderWrapper || $[228] !== stepper || $[229] !== t47) {
		t48 = /* @__PURE__ */ React.createElement("div", { className: classes.subHeaderWrapper }, stepper, t47);
		$[227] = classes.subHeaderWrapper;
		$[228] = stepper;
		$[229] = t47;
		$[230] = t48;
	} else t48 = $[230];
	const t49 = (altInputs || bottomRowSecondary) && classes.tabPageButtons;
	let t50;
	if ($[231] !== classes.secondaryButtons || $[232] !== t49) {
		t50 = clsx(classes.secondaryButtons, t49);
		$[231] = classes.secondaryButtons;
		$[232] = t49;
		$[233] = t50;
	} else t50 = $[233];
	let t51;
	if ($[234] !== bottomRowSecondary || $[235] !== searchExpanded || $[236] !== tabs) {
		t51 = bottomRowSecondary && bottomRowSecondary.map((item_9, index_1) => /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: item_9.label,
			expanded: !tabs && searchExpanded,
			component: item_9.component,
			click: item_9.click,
			key: item_9.id ?? index_1
		}));
		$[234] = bottomRowSecondary;
		$[235] = searchExpanded;
		$[236] = tabs;
		$[237] = t51;
	} else t51 = $[237];
	let t52;
	if ($[238] !== classes.bottomButtonsLeft || $[239] !== t51) {
		t52 = /* @__PURE__ */ React.createElement("div", { className: classes.bottomButtonsLeft }, t51);
		$[238] = classes.bottomButtonsLeft;
		$[239] = t51;
		$[240] = t52;
	} else t52 = $[240];
	let t53;
	if ($[241] !== bottomRowSecondaryRight || $[242] !== searchExpanded || $[243] !== tabs) {
		t53 = bottomRowSecondaryRight && bottomRowSecondaryRight.map((item_10, index_2) => /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: item_10.label,
			expanded: !tabs && searchExpanded,
			component: item_10.component,
			click: item_10.click,
			key: item_10.id ?? index_2
		}));
		$[241] = bottomRowSecondaryRight;
		$[242] = searchExpanded;
		$[243] = tabs;
		$[244] = t53;
	} else t53 = $[244];
	let t54;
	if ($[245] !== classes.bottomButtonsRigth || $[246] !== t53) {
		t54 = /* @__PURE__ */ React.createElement("div", { className: classes.bottomButtonsRigth }, t53);
		$[245] = classes.bottomButtonsRigth;
		$[246] = t53;
		$[247] = t54;
	} else t54 = $[247];
	let t55;
	if ($[248] !== altInputs || $[249] !== classes.buttomButtonRow || $[250] !== t52 || $[251] !== t54) {
		t55 = /* @__PURE__ */ React.createElement("div", { className: classes.buttomButtonRow }, t52, t54, altInputs);
		$[248] = altInputs;
		$[249] = classes.buttomButtonRow;
		$[250] = t52;
		$[251] = t54;
		$[252] = t55;
	} else t55 = $[252];
	let t56;
	if ($[253] !== showGroups) {
		t56 = showGroups && /* @__PURE__ */ React.createElement(Divider, null);
		$[253] = showGroups;
		$[254] = t56;
	} else t56 = $[254];
	const t57 = showGroups && groups;
	let t58;
	if ($[255] !== t56 || $[256] !== t57) {
		t58 = /* @__PURE__ */ React.createElement("div", null, t56, t57);
		$[255] = t56;
		$[256] = t57;
		$[257] = t58;
	} else t58 = $[257];
	let t59;
	if ($[258] !== t50 || $[259] !== t55 || $[260] !== t58) {
		t59 = /* @__PURE__ */ React.createElement("div", { className: t50 }, t55, t58);
		$[258] = t50;
		$[259] = t55;
		$[260] = t58;
		$[261] = t59;
	} else t59 = $[261];
	let t60;
	if ($[262] !== classes.advancedOptions || $[263] !== expandedContent) {
		t60 = /* @__PURE__ */ React.createElement("div", { className: classes.advancedOptions }, expandedContent);
		$[262] = classes.advancedOptions;
		$[263] = expandedContent;
		$[264] = t60;
	} else t60 = $[264];
	let t61;
	if ($[265] !== handleMouseLeave || $[266] !== t60) {
		t61 = /* @__PURE__ */ React.createElement("div", { onMouseLeave: handleMouseLeave }, t60);
		$[265] = handleMouseLeave;
		$[266] = t60;
		$[267] = t61;
	} else t61 = $[267];
	let t62;
	if ($[268] !== expandOptions || $[269] !== t61) {
		t62 = /* @__PURE__ */ React.createElement(Collapse, {
			in: expandOptions,
			timeout: "auto"
		}, t61);
		$[268] = expandOptions;
		$[269] = t61;
		$[270] = t62;
	} else t62 = $[270];
	let t63;
	if ($[271] !== loading || $[272] !== loadingVal) {
		t63 = loading && /* @__PURE__ */ React.createElement(LinearProgress, { value: loadingVal });
		$[271] = loading;
		$[272] = loadingVal;
		$[273] = t63;
	} else t63 = $[273];
	let t64;
	if ($[274] !== t41 || $[275] !== t46 || $[276] !== t48 || $[277] !== t59 || $[278] !== t62 || $[279] !== t63) {
		t64 = /* @__PURE__ */ React.createElement("div", { className: t41 }, t46, t48, t59, t62, t63);
		$[274] = t41;
		$[275] = t46;
		$[276] = t48;
		$[277] = t59;
		$[278] = t62;
		$[279] = t63;
		$[280] = t64;
	} else t64 = $[280];
	let t65;
	if ($[281] !== GridControlLineUp || $[282] !== LowerTrayShell || $[283] !== expandSearch || $[284] !== lowerTray || $[285] !== lowerTrayGrid || $[286] !== lowerTraySearch || $[287] !== searchExpanded || $[288] !== searchToggle) {
		t65 = lowerTray && /* @__PURE__ */ React.createElement(LowerTrayShell, null, /* @__PURE__ */ React.createElement("div", { style: {
			display: "flex",
			justifyContent: "flex-end"
		} }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex" } }, !searchExpanded && lowerTraySearch && /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: "Search",
			component: SearchIcon,
			click: expandSearch
		}), searchToggle), lowerTrayGrid && /* @__PURE__ */ React.createElement(GridControlLineUp, null)));
		$[281] = GridControlLineUp;
		$[282] = LowerTrayShell;
		$[283] = expandSearch;
		$[284] = lowerTray;
		$[285] = lowerTrayGrid;
		$[286] = lowerTraySearch;
		$[287] = searchExpanded;
		$[288] = searchToggle;
		$[289] = t65;
	} else t65 = $[289];
	let t66;
	if ($[290] !== searchExpanded || $[291] !== secondaryButtons || $[292] !== tabs) {
		t66 = secondaryButtons && !tabs && secondaryButtons.map((item_11, index_3) => /* @__PURE__ */ React.createElement(ToolBarButton, {
			label: item_11.label,
			expanded: searchExpanded,
			component: item_11.component,
			click: item_11.click,
			key: item_11.id ?? index_3,
			aria: item_11.label,
			disabled: item_11.disabled
		}));
		$[290] = searchExpanded;
		$[291] = secondaryButtons;
		$[292] = tabs;
		$[293] = t66;
	} else t66 = $[293];
	let t67;
	if ($[294] !== classes.secondaryButtonsMobile || $[295] !== t66) {
		t67 = /* @__PURE__ */ React.createElement("div", { className: classes.secondaryButtonsMobile }, t66);
		$[294] = classes.secondaryButtonsMobile;
		$[295] = t66;
		$[296] = t67;
	} else t67 = $[296];
	let t68;
	if ($[297] !== currentContainerId || $[298] !== t64 || $[299] !== t65 || $[300] !== t67) {
		t68 = /* @__PURE__ */ React.createElement("div", { key: currentContainerId }, t64, t65, t67);
		$[297] = currentContainerId;
		$[298] = t64;
		$[299] = t65;
		$[300] = t67;
		$[301] = t68;
	} else t68 = $[301];
	return t68;
};
PrimaryActionHeader.propTypes = {
	buttonLabel: PropTypes.string,
	title: PropTypes.string.isRequired,
	subheader: PropTypes.string,
	handleClick: PropTypes.func,
	secondaryButtons: PropTypes.arrayOf(PropTypes.shape({
		label: PropTypes.string,
		component: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
		click: PropTypes.func,
		key: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
	})),
	hidePAB: PropTypes.bool,
	search: PropTypes.bool,
	searchField: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
	expandOptions: PropTypes.func,
	handleMouseLeave: PropTypes.string,
	expandedContent: PropTypes.node,
	handleChange: PropTypes.string,
	value: PropTypes.oneOfType([PropTypes.node, PropTypes.oneOf([false])]),
	tabList: PropTypes.node,
	tabs: PropTypes.bool,
	resizeGrid: PropTypes.func,
	collapse: PropTypes.func,
	expandAllItems: PropTypes.func,
	saveGridConfig: PropTypes.func,
	deleteGridConfig: PropTypes.func,
	clearGridConfig: PropTypes.func,
	groups: PropTypes.node,
	grid: PropTypes.bool,
	otherProps: PropTypes.any,
	bottomRowSecondary: PropTypes.array,
	topRowSecondary: PropTypes.array,
	clickBack: PropTypes.func,
	loading: PropTypes.bool,
	loadingVal: PropTypes.number,
	openGroups: PropTypes.func,
	openFilter: PropTypes.func,
	altInputs: PropTypes.node,
	hideActionRow: PropTypes.bool,
	tabProps: PropTypes.object,
	single: PropTypes.bool
};
PrimaryActionHeader.defaultProps = { hidePAB: false };
function _temp(state) {
	return state.currentContainerId;
}
function _temp2(item) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item.label,
		title: item.label,
		expanded: true,
		component: item.component,
		click: item.click,
		aria: item.aria,
		key: item.id
	});
}
function _temp3(item_0) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_0.label,
		title: item_0.label,
		expanded: true,
		component: item_0.component,
		click: item_0.click,
		aria: item_0.aria,
		key: item_0.id
	});
}
function _temp4(item_1) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_1.label,
		title: item_1.label,
		expanded: true,
		component: item_1.component,
		click: item_1.click,
		aria: item_1.aria,
		key: item_1.id
	});
}
function _temp5(item_2) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_2.label,
		title: item_2.label,
		expanded: true,
		component: item_2.component,
		click: item_2.click,
		aria: item_2.aria,
		key: item_2.id
	});
}
function _temp6(item_3) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_3.label,
		title: item_3.label,
		expanded: true,
		component: item_3.component,
		click: item_3.click,
		aria: item_3.aria,
		key: item_3.id
	});
}
function _temp7(item_4) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_4.label,
		title: item_4.label,
		expanded: true,
		component: item_4.component,
		click: item_4.click,
		aria: item_4.aria,
		key: item_4.id
	});
}
function _temp8(value_0) {
	return value_0;
}
function _temp9(value_1) {
	return value_1;
}
function _temp0(item_5) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_5.label,
		title: item_5.label,
		expanded: true,
		component: item_5.component,
		click: item_5.click,
		aria: item_5.aria,
		key: item_5.id
	});
}
function _temp1(item_6) {
	return /* @__PURE__ */ React.createElement(ToolBarButton, {
		label: item_6.label,
		title: item_6.label,
		expanded: true,
		component: item_6.component,
		click: item_6.click,
		aria: item_6.aria,
		key: item_6.id
	});
}
//#endregion
export { PrimaryActionHeader };

//# sourceMappingURL=PrimaryActionHeader.mjs.map