{"version":3,"file":"resident-benefits.DqXHf5Ud.js","sources":["../../../src/components/cap-rating/cap-full-icon.tsx","../../../src/components/cap-rating/cap-half-icon.tsx","../../../src/components/cap-rating/cap-empty-icon.tsx","../../../src/components/cap-rating/cap-rating.tsx","../../../src/components/resident-benefits/resident-benefits-best-image.webp","../../../src/components/resident-benefits/resident-benefits-good-image.webp","../../../src/components/resident-benefits/resident-benefits-basic-image.webp","../../../src/components/resident-benefits/resident-benefits-empty-image.webp","../../../src/components/resident-benefits/resident-benefits.tsx"],"sourcesContent":["export default function CapFullIcon() {\n return (\n \n \n \n \n \n )\n}\n","export default function CapHalfIcon() {\n return (\n \n \n \n \n \n \n )\n}\n","export default function CapEmptyIcon() {\n return (\n \n \n \n \n \n )\n}\n","import { cn } from '@lib/utils'\nimport CapFullIcon from './cap-full-icon'\nimport CapHalfIcon from './cap-half-icon'\nimport CapEmptyIcon from './cap-empty-icon'\n\nexport const CapRating = ({\n rating,\n hideText = false,\n className\n}: {\n rating: string\n hideText?: boolean\n className?: string\n}) => {\n const { numericRating, fullCaps, halfCaps, emptyCaps } = calculateCapRatings(rating)\n\n return (\n
\n
\n {[...Array(fullCaps)].map((_, i) => (\n \n ))}\n {halfCaps === 1 && }\n {[...Array(emptyCaps)].map((_, i) => (\n \n ))}\n
\n\n {!hideText && (\n

\n {numericRating}{' '}\n / 5\n

\n )}\n
\n )\n}\n\nconst calculateCapRatings = (rating: string) => {\n const numericRating = getNumericRating(rating)\n const fullCaps = Math.floor(numericRating)\n const halfCaps = numericRating % 1 >= 0.5 ? 1 : 0\n const emptyCaps = 5 - fullCaps - halfCaps\n return { numericRating, fullCaps, halfCaps, emptyCaps }\n}\n\n// Function to convert rating string to a numeric value\nexport const getNumericRating = (rating: string): number => {\n // Check if the string contains any digits\n if (!/\\d/.test(rating)) {\n return 0\n }\n\n // Check if the entire string is a valid number\n if (rating.match(/^\\d+(\\.\\d+)?$/)) {\n return parseFloat(rating)\n }\n\n // Extract numeric part if present\n const numericPart = rating.match(/[0-9]+(?:\\.[0-9]+)?/)\n return numericPart ? parseFloat(numericPart[0]) : 0\n}\n","export default {\"src\":\"__ASTRO_ASSET_IMAGE__CLNeJ13K__\",\"width\":156,\"height\":86,\"format\":\"webp\"}","export default {\"src\":\"__ASTRO_ASSET_IMAGE__BtZaF3rP__\",\"width\":157,\"height\":86,\"format\":\"webp\"}","export default {\"src\":\"__ASTRO_ASSET_IMAGE__DQxw20bM__\",\"width\":157,\"height\":86,\"format\":\"webp\"}","export default {\"src\":\"__ASTRO_ASSET_IMAGE__8hrov1se__\",\"width\":156,\"height\":86,\"format\":\"webp\"}","import type { ResidentBenefitsLevel } from '@schema/plans-model'\nimport { InfoBubble } from '@components/ui/info-bubble'\nimport residentBenefitsBestImage from './resident-benefits-best-image.webp'\nimport residentBenefitsGoodImage from './resident-benefits-good-image.webp'\nimport residentBenefitsBasicImage from './resident-benefits-basic-image.webp'\nimport residentBenefitsEmptyImage from './resident-benefits-empty-image.webp'\nimport { getProcessedImage, type ProcessedImages } from '@lib/image'\nimport { ResponsiveImage } from '@components/ui/responsive-image'\n\ninterface ResidentBenefitsProps {\n level: ResidentBenefitsLevel\n stateCode?: string\n hideText?: boolean\n processedImages: ProcessedImages\n}\n\nexport const benefitsTextMap: Record = {\n '1': 'Best',\n '2': 'Good',\n '3': 'Basic',\n '--': 'Unavailable'\n}\n\nexport const ResidentBenefits = ({\n level,\n stateCode,\n hideText,\n processedImages\n}: ResidentBenefitsProps) => {\n const benefitsImageMap: Record = {\n '1': residentBenefitsBestImage as ImageMetadata,\n '2': residentBenefitsGoodImage as ImageMetadata,\n '3': residentBenefitsBasicImage as ImageMetadata,\n '--': residentBenefitsEmptyImage as ImageMetadata\n }\n\n const image = getProcessedImage(processedImages, benefitsImageMap[level])\n\n return (\n <>\n \n {!hideText && (\n
\n

\n {stateCode ? `${stateCode} resident` : 'Resident'} benefits\n

\n \n
\n )}\n \n )\n}\n"],"names":["CapFullIcon","jsxs","jsx","CapHalfIcon","CapEmptyIcon","CapRating","rating","hideText","className","numericRating","fullCaps","halfCaps","emptyCaps","calculateCapRatings","cn","_","i","getNumericRating","numericPart","residentBenefitsBestImage","residentBenefitsGoodImage","residentBenefitsBasicImage","residentBenefitsEmptyImage","benefitsTextMap","ResidentBenefits","level","stateCode","processedImages","image","getProcessedImage","Fragment","ResponsiveImage","InfoBubble"],"mappings":"kiBAAA,SAAwBA,GAAc,CAElC,OAAAC,EAAA,KAAC,MAAI,CAAA,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,SAAA,CAAAC,EAAA,IAAC,OAAA,CACC,EAAE,OACF,EAAE,KACF,MAAM,UACN,OAAO,UACP,UAAU,sBACV,KAAK,SAAA,CACP,EACAA,EAAA,IAAC,OAAA,CACC,SAAS,UACT,SAAS,UACT,EAAE,iKACF,KAAK,OAAA,CACP,EACAA,EAAA,IAAC,OAAA,CACC,EAAE,0IACF,KAAK,SAAA,CACP,CACF,CAAA,CAAA,CAEJ,CCvBA,SAAwBC,GAAc,CAElC,OAAAF,EAAA,KAAC,MAAI,CAAA,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,SAAA,CAAAC,EAAA,IAAC,OAAA,CACC,EAAE,OACF,EAAE,KACF,MAAM,UACN,OAAO,UACP,UAAU,sBACV,KAAK,SAAA,CACP,EACCA,EAAA,IAAA,OAAA,CAAK,EAAE,yDAAyD,KAAK,UAAU,EAChFA,EAAA,IAAC,OAAA,CACC,SAAS,UACT,SAAS,UACT,EAAE,oKACF,KAAK,OAAA,CACP,EACAA,EAAA,IAAC,OAAA,CACC,EAAE,0IACF,KAAK,SAAA,CACP,CACF,CAAA,CAAA,CAEJ,CCxBA,SAAwBE,GAAe,CAEnC,OAAAH,EAAA,KAAC,MAAI,CAAA,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,SAAA,CAAAC,EAAA,IAAC,OAA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