require("../../../../_virtual/_rolldown/runtime.js");
const require_useDataSource = require("../../hooks/useDataSource.js");
let react = require("react");
let _pisell_utils = require("@pisell/utils");
//#region src/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.ts
const useDataSourceKey = () => {
	const { dataSource } = require_useDataSource.default();
	const dataSourceKey = (0, react.useMemo)(() => {
		return (0, _pisell_utils.isString)(dataSource) ? dataSource : (dataSource === null || dataSource === void 0 ? void 0 : dataSource.key) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.tableName);
	}, [dataSource]);
	const dataSourceKeyRef = (0, react.useRef)(dataSourceKey);
	dataSourceKeyRef.current = dataSourceKey;
	return {
		dataSourceKey,
		dataSourceKeyRef
	};
};
//#endregion
exports.default = useDataSourceKey;
