import { get } from "./index.js"; function itemHasDescription(item, descriptionKey) { if (typeof item !== "object" || item === null) { return false; } const value = get(item, descriptionKey); return value !== void 0 && value !== null && value !== ""; } function getSize(size, hasDescription) { const sizes = hasDescription ? { xs: 44, sm: 48, md: 52, lg: 56, xl: 60 } : { xs: 24, sm: 28, md: 32, lg: 36, xl: 40 }; return sizes[size] ?? sizes.md; } export function getEstimateSize(items, size, descriptionKey, hasDescriptionSlot) { const sizeWithDescription = getSize(size, true); const sizeWithoutDescription = getSize(size, false); if (hasDescriptionSlot) { return () => sizeWithDescription; } if (!descriptionKey) { return () => sizeWithoutDescription; } return (index) => { return itemHasDescription(items[index], descriptionKey) ? sizeWithDescription : sizeWithoutDescription; }; }