import { UdpButton } from "../../UI/fluent-web-components/UdpButton.mjs";
import { UdpCard } from "../../UI/fluent-web-components/UdpCard.mjs";
import { UdpDrawer } from "../../UI/fluent-web-components/UdpDrawer.mjs";
import { UdpBadge } from "../../UI/fluent-web-components/UdpBadge.mjs";
import { UdpDropdown } from "../../UI/fluent-web-components/UdpDropdown.mjs";
import { UdpFlexbox } from "../../UI/fluent-web-components/UdpFlexbox.mjs";
import { UdpIconButton } from "../../UI/fluent-web-components/UdpIconButton.mjs";
import { UdpMessageBar } from "../../UI/fluent-web-components/UdpMessageBar.mjs";
import { UdpText } from "../../UI/fluent-web-components/UdpText.mjs";
import { UdpTextInput } from "../../UI/fluent-web-components/UdpTextInput.mjs";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { LookupColumnTypeId, LookupTypeId, isCatalogModelObject } from "udp-stencil-component-library";
//#region src/udp/lookups/LookupCreationSheet.jsx
const LOOKUP_TYPE_OPTIONS = [{
	label: "Domain",
	value: LookupTypeId.Domain
}, {
	label: "Virtual",
	value: LookupTypeId.Lookup
}];
const COLUMN_TYPE_OPTIONS = [
	{
		label: "String",
		value: LookupColumnTypeId.String
	},
	{
		label: "Long",
		value: LookupColumnTypeId.Long
	},
	{
		label: "Boolean",
		value: LookupColumnTypeId.Boolean
	},
	{
		label: "DateTime",
		value: LookupColumnTypeId.DateTime
	},
	{
		label: "Double",
		value: LookupColumnTypeId.Double
	}
];
const BOOLEAN_OPTIONS = [{
	label: "true",
	value: "true"
}, {
	label: "false",
	value: "false"
}];
const getSimpleName = (name) => {
	if (!name) return "";
	const parts = name.split(".");
	return parts[parts.length - 1];
};
/**
* LookupCreationSheet — create or edit a lookup.
*
* Pass `lookup` to enter edit mode. When omitted, the sheet is in create mode.
*/
const LookupCreationSheet = ({ open, onClose, lookup = null, onCreateLookup, onCreateLookupColumn, onCreateLookupValue, onUpdateLookup, onUpdateLookupColumn, onDeleteLookupValue, onLookupCreated, fetchColumns, fetchValues, catalogObjectList = [], lookupMethodStatus = {} }) => {
	const isEditMode = !!lookup;
	const [name, setName] = useState("");
	const [description, setDescription] = useState("");
	const [typeOption, setTypeOption] = useState(LOOKUP_TYPE_OPTIONS[0]);
	const [saving, setSaving] = useState(false);
	const [selectedEntity, setSelectedEntity] = useState(null);
	const [keyNameOption, setKeyNameOption] = useState(null);
	const [valueNameOption, setValueNameOption] = useState(null);
	const [keyName, setKeyName] = useState("");
	const [valueName, setValueName] = useState("");
	const [virtualColumns, setVirtualColumns] = useState([{
		name: "Key",
		typeOption: COLUMN_TYPE_OPTIONS[0]
	}, {
		name: "Value",
		typeOption: COLUMN_TYPE_OPTIONS[0]
	}]);
	const [virtualRows, setVirtualRows] = useState([["", ""]]);
	const [editColumns, setEditColumns] = useState([]);
	const [editRows, setEditRows] = useState([]);
	const [loadingData, setLoadingData] = useState(false);
	const { lookupCreateAvailable, lookupUpdateAvailable, columnCreateAvailable, valueCreateAvailable } = lookupMethodStatus;
	const virtualAvailable = columnCreateAvailable && valueCreateAvailable;
	const typeOptions = useMemo(() => LOOKUP_TYPE_OPTIONS.map((o) => ({
		...o,
		disabled: o.value === 4 && !virtualAvailable
	})), [virtualAvailable]);
	const isDomain = isEditMode ? lookup?.typeId === LookupTypeId.Domain : typeOption?.value === LookupTypeId.Domain;
	const isVirtual = isEditMode ? lookup?.typeId === LookupTypeId.Lookup : typeOption?.value === LookupTypeId.Lookup;
	useEffect(() => {
		if (!open || !isEditMode) return;
		setName(lookup.name ?? "");
		setDescription(lookup.description ?? "");
		setTypeOption(LOOKUP_TYPE_OPTIONS.find((o_0) => o_0.value === lookup.typeId) ?? LOOKUP_TYPE_OPTIONS[0]);
		setKeyName(lookup.keyName ?? "");
		setValueName(lookup.valueName ?? "");
		if (lookup.typeId === LookupTypeId.Lookup && fetchColumns && fetchValues) loadVirtualData(lookup.id);
	}, [
		open,
		lookup?.id,
		lookup?.typeId
	]);
	const loadVirtualData = async (lookupId) => {
		setLoadingData(true);
		try {
			const [allColumns, allValues] = await Promise.all([fetchColumns(), fetchValues()]);
			const lookupColumns = allColumns.filter((c) => c.lookupId === lookupId).sort((a, b) => a.order - b.order);
			const lookupValues = allValues.filter((v) => lookupColumns.some((c) => c.id === v.lookupColumnId));
			const colState = lookupColumns.map((c) => ({
				...c,
				typeOption: COLUMN_TYPE_OPTIONS.find((o) => o.value === c.lookupColumnTypeId) ?? COLUMN_TYPE_OPTIONS[0]
			}));
			setEditColumns(colState);
			const maxRow = lookupValues.reduce((max, v) => Math.max(max, v.rowNumber), 0);
			const rowState = [];
			for (let r = 1; r <= maxRow; r++) {
				const row = colState.map((col) => {
					const val = lookupValues.find((v) => v.lookupColumnId === col.id && v.rowNumber === r);
					return {
						value: val?.value ?? "",
						id: val?.id ?? null
					};
				});
				rowState.push(row);
			}
			if (rowState.length === 0) rowState.push(colState.map(() => ({
				value: "",
				id: null
			})));
			setEditRows(rowState);
		} finally {
			setLoadingData(false);
		}
	};
	const entityOptions = useMemo(() => catalogObjectList.filter((obj) => isCatalogModelObject(obj)).map((obj_0) => ({
		label: getSimpleName(obj_0.catalogObjectName),
		value: obj_0.catalogObjectName,
		properties: obj_0.properties ?? []
	})), [catalogObjectList]);
	const fieldOptions = useMemo(() => {
		if (!selectedEntity?.properties) return [];
		return selectedEntity.properties.map((p) => ({
			label: p.name,
			value: p.name
		}));
	}, [selectedEntity]);
	const editDomainFieldOptions = useMemo(() => {
		if (!isEditMode || !isDomain || !lookup?.domainName) return [];
		const entity = catalogObjectList.find((obj_1) => obj_1.catalogObjectName === lookup.domainName);
		if (!entity?.properties) return [];
		return entity.properties.map((p_0) => ({
			label: p_0.name,
			value: p_0.name
		}));
	}, [
		isEditMode,
		isDomain,
		lookup?.domainName,
		catalogObjectList
	]);
	const updateColumn = useCallback((index, field, value) => {
		setVirtualColumns((prev) => {
			const updated = [...prev];
			updated[index] = {
				...updated[index],
				[field]: value
			};
			return updated;
		});
	}, []);
	const addColumn = useCallback(() => {
		setVirtualColumns((prev_0) => [...prev_0, {
			name: "",
			typeOption: COLUMN_TYPE_OPTIONS[0]
		}]);
		setVirtualRows((prev_1) => prev_1.map((row) => [...row, ""]));
	}, []);
	const removeColumn = useCallback((index_0) => {
		if (virtualColumns.length <= 2) return;
		setVirtualColumns((prev_2) => prev_2.filter((_, i) => i !== index_0));
		setVirtualRows((prev_3) => prev_3.map((row_0) => row_0.filter((__0, i_0) => i_0 !== index_0)));
	}, [virtualColumns.length]);
	const updateRowValue = useCallback((rowIndex, colIndex, value_0) => {
		setVirtualRows((prev_4) => {
			const updated_0 = [...prev_4];
			updated_0[rowIndex] = [...updated_0[rowIndex]];
			updated_0[rowIndex][colIndex] = value_0;
			return updated_0;
		});
	}, []);
	const addRow = useCallback(() => {
		setVirtualRows((prev_5) => [...prev_5, virtualColumns.map(() => "")]);
	}, [virtualColumns]);
	const removeRow = useCallback((index_1) => {
		if (virtualRows.length <= 1) return;
		setVirtualRows((prev_6) => prev_6.filter((__1, i_1) => i_1 !== index_1));
	}, [virtualRows.length]);
	const updateEditColumnField = (index_2, field_0, value_1) => {
		setEditColumns((prev_7) => {
			const updated_1 = [...prev_7];
			updated_1[index_2] = {
				...updated_1[index_2],
				[field_0]: value_1
			};
			return updated_1;
		});
	};
	const addEditColumn = () => {
		setEditColumns((prev_8) => [...prev_8, {
			name: "",
			typeOption: COLUMN_TYPE_OPTIONS[0],
			id: null,
			_new: true
		}]);
		setEditRows((prev_9) => prev_9.map((row_1) => [...row_1, {
			value: "",
			id: null
		}]));
	};
	const removeEditColumn = (index_3) => {
		if (editColumns.length <= 2) return;
		setEditColumns((prev_10) => prev_10.filter((__2, i_2) => i_2 !== index_3));
		setEditRows((prev_11) => prev_11.map((row_2) => row_2.filter((__3, i_3) => i_3 !== index_3)));
	};
	const updateEditRowValue = (rowIdx, colIdx, value_2) => {
		setEditRows((prev_12) => {
			const updated_2 = [...prev_12];
			updated_2[rowIdx] = [...updated_2[rowIdx]];
			updated_2[rowIdx][colIdx] = {
				...updated_2[rowIdx][colIdx],
				value: value_2
			};
			return updated_2;
		});
	};
	const addEditRow = () => {
		setEditRows((prev_13) => [...prev_13, editColumns.map(() => ({
			value: "",
			id: null
		}))]);
	};
	const removeEditRow = (index_4) => {
		if (editRows.length <= 1) return;
		setEditRows((prev_14) => prev_14.filter((__4, i_4) => i_4 !== index_4));
	};
	const resetForm = () => {
		setName("");
		setDescription("");
		setTypeOption(LOOKUP_TYPE_OPTIONS[0]);
		setSelectedEntity(null);
		setKeyNameOption(null);
		setValueNameOption(null);
		setKeyName("");
		setValueName("");
		setVirtualColumns([{
			name: "Key",
			typeOption: COLUMN_TYPE_OPTIONS[0]
		}, {
			name: "Value",
			typeOption: COLUMN_TYPE_OPTIONS[0]
		}]);
		setVirtualRows([["", ""]]);
		setEditColumns([]);
		setEditRows([]);
	};
	const handleClose = () => {
		resetForm();
		onClose();
	};
	const handleEntityChange = (e) => {
		const selected = e.target.value;
		setSelectedEntity(selected ? entityOptions.find((o_1) => o_1.value === selected.value) : null);
		setKeyNameOption(null);
		setValueNameOption(null);
	};
	const handleCreate = async () => {
		if (!name.trim()) return;
		setSaving(true);
		try {
			if (isDomain) {
				const created = await onCreateLookup({
					name: name.trim(),
					description: description.trim() || void 0,
					typeId: LookupTypeId.Domain,
					keyName: keyNameOption?.value ?? "",
					valueName: valueNameOption?.value ?? "",
					domainName: selectedEntity?.value ?? "",
					isProductLookup: false
				});
				if (created) {
					onLookupCreated?.(created);
					handleClose();
				}
			} else {
				const created = await onCreateLookup({
					name: name.trim(),
					description: description.trim() || void 0,
					typeId: LookupTypeId.Lookup,
					keyName: virtualColumns[0]?.name || "key",
					valueName: virtualColumns[1]?.name || "value",
					isProductLookup: false
				});
				if (!created?.id) return;
				const columnIds = [];
				for (let i = 0; i < virtualColumns.length; i++) {
					const col = virtualColumns[i];
					const colResult = await onCreateLookupColumn({
						lookupId: created.id,
						name: col.name || `Column ${i + 1}`,
						order: i + 1,
						lookupColumnTypeId: col.typeOption?.value ?? 1
					});
					columnIds.push(colResult?.id ?? null);
				}
				for (let rowIdx = 0; rowIdx < virtualRows.length; rowIdx++) {
					const row = virtualRows[rowIdx];
					for (let colIdx = 0; colIdx < row.length; colIdx++) {
						const columnId = columnIds[colIdx];
						if (!columnId || !row[colIdx]) continue;
						await onCreateLookupValue({
							lookupColumnId: columnId,
							value: row[colIdx],
							rowNumber: rowIdx + 1
						});
					}
				}
				onLookupCreated?.(created);
				handleClose();
			}
		} finally {
			setSaving(false);
		}
	};
	const handleUpdate = async () => {
		if (!name.trim()) return;
		setSaving(true);
		try {
			await onUpdateLookup({
				...lookup,
				name: name.trim(),
				description: description.trim() || null,
				keyName: isVirtual ? editColumns[0]?.name || keyName : keyName,
				valueName: isVirtual ? editColumns[1]?.name || valueName : valueName
			});
			if (isVirtual) {
				for (let i = 0; i < editColumns.length; i++) {
					const col = editColumns[i];
					if (col._new || !col.id) {
						const created = await onCreateLookupColumn({
							lookupId: lookup.id,
							name: col.name || `Column ${i + 1}`,
							order: i + 1,
							lookupColumnTypeId: col.typeOption?.value ?? 1
						});
						if (created?.id) editColumns[i] = {
							...col,
							id: created.id,
							_new: false
						};
					} else await onUpdateLookupColumn({
						...col,
						name: col.name || `Column ${i + 1}`,
						order: i + 1,
						lookupColumnTypeId: col.typeOption?.value ?? 1
					});
				}
				const createValueFn = onCreateLookupValue;
				for (let rowIdx = 0; rowIdx < editRows.length; rowIdx++) {
					const row = editRows[rowIdx];
					for (let colIdx = 0; colIdx < row.length; colIdx++) {
						const cell = row[colIdx];
						const columnId = editColumns[colIdx]?.id;
						if (!columnId) continue;
						if (cell.id && !cell.value.trim()) await onDeleteLookupValue?.({ id: cell.id });
						else if (cell.id) {} else if (cell.value.trim()) await createValueFn?.({
							lookupColumnId: columnId,
							value: cell.value,
							rowNumber: rowIdx + 1
						});
					}
				}
			}
			onLookupCreated?.(lookup);
			handleClose();
		} finally {
			setSaving(false);
		}
	};
	const handleSave = isEditMode ? handleUpdate : handleCreate;
	const canSave = name.trim().length > 0 && (isEditMode ? true : isDomain ? !!selectedEntity : virtualColumns.every((c) => c.name.trim()) && virtualRows.some((r) => r.some((v) => v.trim())));
	const saveDisabled = isEditMode ? !canSave || !lookupUpdateAvailable : !canSave || !lookupCreateAvailable;
	const activeCols = isEditMode ? editColumns : virtualColumns;
	const activeRows = isEditMode ? editRows : virtualRows;
	return /* @__PURE__ */ React.createElement(UdpDrawer, {
		open,
		drawerTitle: isEditMode ? `Edit Lookup: ${lookup?.name}` : "Create Lookup",
		size: "medium",
		onDrawerClose: handleClose,
		excludeVerticalPadding: true
	}, /* @__PURE__ */ React.createElement(UdpFlexbox, { gap: "md" }, !isEditMode && !lookupCreateAvailable && /* @__PURE__ */ React.createElement(UdpMessageBar, { intent: "warning" }, "UdpLookup create method is not promoted. Lookup creation is disabled."), !isEditMode && lookupCreateAvailable && !virtualAvailable && /* @__PURE__ */ React.createElement(UdpMessageBar, { intent: "warning" }, !columnCreateAvailable && !valueCreateAvailable ? "UdpLookupColumn and UdpLookupValue create methods are not promoted." : !columnCreateAvailable ? "UdpLookupColumn create method is not promoted." : "UdpLookupValue create method is not promoted.", " ", "Virtual lookup creation is disabled."), /* @__PURE__ */ React.createElement(UdpCard, { label: "Lookup Details" }, /* @__PURE__ */ React.createElement(UdpFlexbox, {
		direction: "column",
		gap: "sm"
	}, /* @__PURE__ */ React.createElement(UdpTextInput, {
		label: "Display Name",
		value: name,
		onChange: (e_0) => setName(e_0.target.value),
		required: true,
		disabled: isEditMode ? !lookupUpdateAvailable : !lookupCreateAvailable
	}), /* @__PURE__ */ React.createElement(UdpTextInput, {
		label: "Description",
		value: description,
		onChange: (e_1) => setDescription(e_1.target.value),
		disabled: isEditMode ? !lookupUpdateAvailable : !lookupCreateAvailable
	}), isEditMode ? /* @__PURE__ */ React.createElement(UdpFlexbox, {
		direction: "row",
		gap: "sm",
		style: { alignItems: "center" }
	}, /* @__PURE__ */ React.createElement(UdpText, { variant: "caption1" }, "Type:"), /* @__PURE__ */ React.createElement(UdpBadge, {
		appearance: "tint",
		color: lookup?.typeId === LookupTypeId.Domain ? "warning" : "informative"
	}, lookup?.typeId === LookupTypeId.Domain ? "Domain" : "Virtual")) : /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Type",
		hint: "Domain: backed by an entity table. Virtual: custom key/value pairs",
		options: typeOptions,
		value: typeOption,
		optionLabel: "label",
		optionValue: "value",
		onChange: (e_2) => setTypeOption(e_2.target.value),
		disabled: !lookupCreateAvailable
	}))), isDomain && !isEditMode && /* @__PURE__ */ React.createElement(UdpCard, { label: "Field Mapping" }, /* @__PURE__ */ React.createElement(UdpFlexbox, {
		direction: "column",
		gap: "md"
	}, /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Domain Entity",
		hint: "The entity table this lookup resolves against",
		options: entityOptions,
		value: selectedEntity,
		optionLabel: "label",
		optionValue: "value",
		onChange: handleEntityChange
	}), fieldOptions.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Key Name",
		hint: "The field used to match values (e.g. the ID field)",
		options: fieldOptions,
		value: keyNameOption,
		optionLabel: "label",
		optionValue: "value",
		onChange: (e_3) => setKeyNameOption(e_3.target.value)
	}), /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Value Name",
		hint: "The field displayed to the user (e.g. name)",
		options: fieldOptions,
		value: valueNameOption,
		optionLabel: "label",
		optionValue: "value",
		onChange: (e_4) => setValueNameOption(e_4.target.value)
	})))), isDomain && isEditMode && /* @__PURE__ */ React.createElement(UdpCard, { label: "Field Mapping" }, /* @__PURE__ */ React.createElement(UdpFlexbox, {
		direction: "column",
		gap: "sm"
	}, /* @__PURE__ */ React.createElement(UdpTextInput, {
		label: "Domain Name",
		value: getSimpleName(lookup?.domainName) ?? "",
		disabled: true
	}), /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Key Name",
		hint: "The field used to match values (e.g. the ID field)",
		options: editDomainFieldOptions,
		value: editDomainFieldOptions.find((o_2) => o_2.value === keyName) ?? null,
		optionLabel: "label",
		optionValue: "value",
		onChange: (e_5) => setKeyName(e_5.target.value?.value ?? "")
	}), /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Value Name",
		hint: "The field displayed to the user (e.g. name)",
		options: editDomainFieldOptions,
		value: editDomainFieldOptions.find((o_3) => o_3.value === valueName) ?? null,
		optionLabel: "label",
		optionValue: "value",
		onChange: (e_6) => setValueName(e_6.target.value?.value ?? "")
	}))), isVirtual && !(isEditMode && loadingData) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UdpCard, {
		label: "Columns",
		subtitle: "The first two columns are used as the key and display value."
	}, /* @__PURE__ */ React.createElement(UdpFlexbox, {
		direction: "column",
		gap: "md"
	}, activeCols.map((col, i_5) => /* @__PURE__ */ React.createElement(UdpFlexbox, {
		key: isEditMode ? col.id ?? `new-${i_5}` : i_5,
		direction: "row",
		gap: "sm",
		style: { alignItems: "flex-end" }
	}, /* @__PURE__ */ React.createElement(UdpTextInput, {
		label: i_5 === 0 ? "Column 1 (Key)" : i_5 === 1 ? "Column 2 (Value)" : `Column ${i_5 + 1}`,
		value: col.name,
		onChange: (e_7) => isEditMode ? updateEditColumnField(i_5, "name", e_7.target.value) : updateColumn(i_5, "name", e_7.target.value),
		style: { flex: 1 },
		includeErrorPadding: false
	}), /* @__PURE__ */ React.createElement(UdpDropdown, {
		label: "Type",
		includeErrorPadding: false,
		options: COLUMN_TYPE_OPTIONS,
		value: col.typeOption,
		optionLabel: "label",
		optionValue: "value",
		onChange: (e_8) => isEditMode ? updateEditColumnField(i_5, "typeOption", e_8.target.value) : updateColumn(i_5, "typeOption", e_8.target.value),
		style: { width: "120px" }
	}), activeCols.length > 2 && /* @__PURE__ */ React.createElement(UdpIconButton, {
		iconName: "delete",
		appearance: "transparent",
		size: "small",
		onClick: () => isEditMode ? removeEditColumn(i_5) : removeColumn(i_5),
		ariaLabel: "Remove column"
	}))), (isEditMode ? columnCreateAvailable : true) && /* @__PURE__ */ React.createElement(UdpButton, {
		startIconName: "add",
		appearance: "subtle",
		size: "small",
		onClick: isEditMode ? addEditColumn : addColumn,
		ariaLabel: "Add column"
	}, "Add Additional Column"))), /* @__PURE__ */ React.createElement(UdpCard, { label: "Values" }, /* @__PURE__ */ React.createElement(UdpFlexbox, {
		direction: "column",
		gap: "md"
	}, activeRows.map((row_3, rowIdx_0) => /* @__PURE__ */ React.createElement(UdpFlexbox, {
		key: rowIdx_0,
		direction: "row",
		gap: "sm",
		style: { alignItems: "flex-end" }
	}, row_3.map((cell, colIdx_0) => {
		const col_0 = activeCols[colIdx_0];
		const colLabel = col_0?.name || `Column ${colIdx_0 + 1}`;
		const cellValue = isEditMode ? cell.value : cell;
		const onCellChange = (val) => isEditMode ? updateEditRowValue(rowIdx_0, colIdx_0, val) : updateRowValue(rowIdx_0, colIdx_0, val);
		const colTypeId = col_0?.typeOption?.value;
		if (colTypeId === LookupColumnTypeId.Boolean) return /* @__PURE__ */ React.createElement(UdpDropdown, {
			key: colIdx_0,
			label: colLabel,
			options: BOOLEAN_OPTIONS,
			value: BOOLEAN_OPTIONS.find((o_4) => o_4.value === cellValue) ?? null,
			optionLabel: "label",
			optionValue: "value",
			onChange: (e_9) => onCellChange(e_9.target.value?.value ?? ""),
			style: { flex: 1 },
			includeErrorPadding: false
		});
		return /* @__PURE__ */ React.createElement(UdpTextInput, {
			key: colIdx_0,
			label: colLabel,
			value: cellValue,
			onChange: (e_10) => onCellChange(e_10.target.value),
			style: { flex: 1 },
			includeErrorPadding: false,
			autocomplete: "off",
			type: colTypeId === LookupColumnTypeId.Long || colTypeId === LookupColumnTypeId.Double ? "number" : "text"
		});
	}), activeRows.length > 1 && /* @__PURE__ */ React.createElement(UdpIconButton, {
		iconName: "delete",
		appearance: "transparent",
		size: "small",
		onClick: () => isEditMode ? removeEditRow(rowIdx_0) : removeRow(rowIdx_0),
		ariaLabel: "Remove row"
	}))), (isEditMode ? valueCreateAvailable : true) && /* @__PURE__ */ React.createElement(UdpButton, {
		startIconName: "add",
		appearance: "subtle",
		size: "small",
		onClick: isEditMode ? addEditRow : addRow,
		ariaLabel: "Add value mapping"
	}, "Add Value Mapping")))), isVirtual && isEditMode && loadingData && /* @__PURE__ */ React.createElement(UdpText, { variant: "caption1" }, "Loading columns and values...")), /* @__PURE__ */ React.createElement("div", { slot: "footer" }, /* @__PURE__ */ React.createElement(UdpButton, {
		appearance: "primary",
		onClick: handleSave,
		disabled: saveDisabled,
		loading: saving
	}, isEditMode ? "Save" : "Create Lookup")));
};
//#endregion
export { COLUMN_TYPE_OPTIONS, LookupCreationSheet as default };

//# sourceMappingURL=LookupCreationSheet.mjs.map