Rocky_Mountain_Vending/.pnpm-store/v10/files/f6/beeafc16facb719e8fbea931a322f957c1fa4e32f0c0ed16e51c51c38ed1aa00d866d8caa83e20b33d9a541f4e1e8e5df314b854948d2e312eae9833007746
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

31 lines
1.1 KiB
Text

import { UNICODE_EXTENSION_SEQUENCE_REGEX, findBestMatch } from './utils';
/**
* https://tc39.es/ecma402/#sec-bestfitmatcher
* @param availableLocales
* @param requestedLocales
* @param getDefaultLocale
*/
export function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
var foundLocale;
var extension;
var noExtensionLocales = [];
var noExtensionLocaleMap = requestedLocales.reduce(function (all, l) {
var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, '');
noExtensionLocales.push(noExtensionLocale);
all[noExtensionLocale] = l;
return all;
}, {});
var result = findBestMatch(noExtensionLocales, availableLocales);
if (result.matchedSupportedLocale && result.matchedDesiredLocale) {
foundLocale = result.matchedSupportedLocale;
extension =
noExtensionLocaleMap[result.matchedDesiredLocale].slice(result.matchedDesiredLocale.length) || undefined;
}
if (!foundLocale) {
return { locale: getDefaultLocale() };
}
return {
locale: foundLocale,
extension: extension,
};
}