require("../../_virtual/_rolldown/runtime.js");
let lodash = require("lodash");
//#region src/plus/clientCard/utils.ts
function getFieldValue(data, fieldKey, mapping) {
	if (!fieldKey || typeof fieldKey !== "string") {
		console.warn("getFieldValue: fieldKey must be a non-empty string");
		return;
	}
	if (!data || typeof data !== "object") {
		console.warn("getFieldValue: data must be a valid object");
		return;
	}
	const mappingRule = (mapping || {})[fieldKey];
	try {
		if (typeof mappingRule === "function") return mappingRule(data);
		if (typeof mappingRule === "string") return (0, lodash.get)(data, mappingRule);
		return (0, lodash.get)(data, fieldKey);
	} catch (error) {
		console.error(`getFieldValue: Error processing field '${fieldKey}':`, error);
		return;
	}
}
const getAvatarText = (name) => {
	if (!name) return "";
	return name.trim().split(/\s+/).slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("");
};
const isWalkIn = (customer_id) => {
	if (customer_id === void 0) return true;
	if (typeof customer_id === "string") return [
		"",
		"0",
		"1"
	].includes(customer_id);
	return [0, 1].includes(customer_id);
};
//#endregion
exports.getAvatarText = getAvatarText;
exports.getFieldValue = getFieldValue;
exports.isWalkIn = isWalkIn;
