{"version":3,"file":"index.cjs","sources":["../../utils/src/string.ts","../../ui/src/button.tsx","../../ui/src/card.tsx","../../ui/src/Icon.tsx","../../features/src/paraglide/runtime.js","../../features/src/paraglide/messages/hello_world_title.js","../../features/src/paraglide/messages/welcome_message.js","../../features/src/paraglide/messages/feature_description.js","../../features/src/paraglide/messages/greet_button.js","../../features/src/paraglide/messages/greeting_alert.js","../../features/src/HelloWorld.tsx"],"sourcesContent":["/**\n * String utility functions\n */\n\n/**\n * Capitalizes the first letter of a string\n */\nexport function capitalize(str: string): string {\n  if (!str) return str;\n  return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n/**\n * Converts a string to kebab-case\n */\nexport function toKebabCase(str: string): string {\n  return str\n    .replace(/([a-z])([A-Z])/g, \"$1-$2\")\n    .replace(/[\\s_]+/g, \"-\")\n    .toLowerCase();\n}\n\n/**\n * Converts a string to camelCase\n */\nexport function toCamelCase(str: string): string {\n  return str\n    .toLowerCase()\n    .replace(/[^a-zA-Z0-9]+(.)/g, (_, chr) => chr.toUpperCase());\n}\n\n/**\n * Converts a string to PascalCase\n */\nexport function toPascalCase(str: string): string {\n  return capitalize(toCamelCase(str));\n}\n\n/**\n * Truncates a string to a specified length\n */\nexport function truncate(\n  str: string,\n  maxLength: number,\n  suffix = \"...\"\n): string {\n  if (str.length <= maxLength) return str;\n  return str.slice(0, maxLength - suffix.length) + suffix;\n}\n\n/**\n * Removes extra whitespace from a string\n */\nexport function normalizeWhitespace(str: string): string {\n  return str.replace(/\\s+/g, \" \").trim();\n}\n","import { ReactNode } from \"react\";\n\nimport { capitalize } from \"@repo/utils\";\n\nimport styles from \"./Button.module.scss\";\n\ninterface ButtonProps {\n  children: ReactNode;\n  className?: string;\n  appName?: string;\n  onClick?: () => void;\n  variant?:\n    | \"default\"\n    | \"secondary\"\n    | \"destructive\"\n    | \"outline\"\n    | \"ghost\"\n    | \"link\";\n}\n\nexport const Button = ({\n  children,\n  className,\n  appName,\n  onClick,\n  variant = \"default\",\n}: ButtonProps) => {\n  const handleClick = () => {\n    if (onClick) {\n      onClick();\n    } else if (appName) {\n      alert(`Hello from your ${appName} app!`);\n    }\n  };\n\n  return (\n    <button\n      className={`${styles.button} ${styles[variant]} ${className || \"\"}`.trim()}\n      onClick={handleClick}\n    >\n      {capitalize(children as string)}\n    </button>\n  );\n};\n","import { type JSX, ReactNode } from \"react\";\n\n// Основной компонент Card\nexport function Card({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}): JSX.Element {\n  return (\n    <div\n      className={className}\n      style={{\n        border: \"1px solid #e2e8f0\",\n        borderRadius: \"8px\",\n        padding: \"16px\",\n        backgroundColor: \"white\",\n        boxShadow: \"0 1px 3px rgba(0, 0, 0, 0.1)\",\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n\n// Заголовок карточки\nexport function CardHeader({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}): JSX.Element {\n  return (\n    <div className={className} style={{ marginBottom: \"12px\" }}>\n      {children}\n    </div>\n  );\n}\n\n// Заголовок карточки\nexport function CardTitle({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}): JSX.Element {\n  return (\n    <h3\n      className={className}\n      style={{\n        fontSize: \"18px\",\n        fontWeight: \"600\",\n        margin: \"0 0 8px 0\",\n      }}\n    >\n      {children}\n    </h3>\n  );\n}\n\n// Описание карточки\nexport function CardDescription({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}): JSX.Element {\n  return (\n    <p\n      className={className}\n      style={{\n        fontSize: \"14px\",\n        color: \"#64748b\",\n        margin: \"0\",\n      }}\n    >\n      {children}\n    </p>\n  );\n}\n\n// Содержимое карточки\nexport function CardContent({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}): JSX.Element {\n  return (\n    <div className={className} style={{ marginBottom: \"12px\" }}>\n      {children}\n    </div>\n  );\n}\n\n// Футер карточки\nexport function CardFooter({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}): JSX.Element {\n  return (\n    <div\n      className={className}\n      style={{\n        marginTop: \"12px\",\n        paddingTop: \"12px\",\n        borderTop: \"1px solid #e2e8f0\",\n      }}\n    >\n      {children}\n    </div>\n  );\n}\n","import { type JSX } from \"react\";\n\nexport type IconName = \"check\" | \"close\" | \"add\" | \"edit\" | \"delete\";\n\ninterface IconProps {\n  name: IconName;\n  size?: number;\n  className?: string;\n  color?: string;\n}\n\nconst icons: Record<IconName, JSX.Element> = {\n  check: (\n    <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M5 13l4 4L19 7\" />\n  ),\n  close: (\n    <path\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      d=\"M6 18L18 6M6 6l12 12\"\n    />\n  ),\n  add: <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 6v12m6-6H6\" />,\n  edit: (\n    <path\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      d=\"M16.862 3.487a2.25 2.25 0 013.182 0l.469.469a2.25 2.25 0 010 3.182l-9.75 9.75a4.5 4.5 0 01-1.59 1.05l-3.75 1.313 1.313-3.75a4.5 4.5 0 011.05-1.59l9.076-9.076zM15 5l4 4\"\n    />\n  ),\n  delete: (\n    <path\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      d=\"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0\"\n    />\n  ),\n};\n\nexport function Icon({\n  name,\n  size = 24,\n  className = \"\",\n  color = \"currentColor\",\n}: IconProps): JSX.Element {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      fill=\"none\"\n      viewBox=\"0 0 24 24\"\n      strokeWidth={2}\n      stroke={color}\n      width={size}\n      height={size}\n      className={className}\n      aria-hidden=\"true\"\n    >\n      {icons[name]}\n    </svg>\n  );\n}\n","/* eslint-disable */\n\n/** @type {any} */\nconst URLPattern = {}\n\n/**\n * The project's base locale.\n *\n * @example\n *   if (locale === baseLocale) {\n *     // do something\n *   }\n */\nexport const baseLocale = \"ru\";\n/**\n * The project's locales that have been specified in the settings.\n *\n * @example\n *   if (locales.includes(userSelectedLocale) === false) {\n *     throw new Error('Locale is not available');\n *   }\n */\nexport const locales = /** @type {const} */ ([\"ru\", \"en\", \"de\", \"es\"]);\n/** @type {string} */\nexport const cookieName = \"PARAGLIDE_LOCALE\";\n/** @type {number} */\nexport const cookieMaxAge = 34560000;\n/** @type {string} */\nexport const cookieDomain = \"\";\n/** @type {string} */\nexport const localStorageKey = \"PARAGLIDE_LOCALE\";\n/**\n * @type {Array<\"cookie\" | \"baseLocale\" | \"globalVariable\" | \"url\" | \"preferredLanguage\" | \"localStorage\" | `custom-${string}`>}\n */\nexport const strategy = [\n  \"cookie\",\n  \"globalVariable\",\n  \"baseLocale\"\n];\n/**\n * The used URL patterns.\n *\n * @type {Array<{ pattern: string, localized: Array<[Locale, string]> }> }\n */\nexport const urlPatterns = [\n  {\n    \"pattern\": \":protocol://:domain(.*)::port?/:path(.*)?\",\n    \"localized\": [\n      [\n        \"en\",\n        \":protocol://:domain(.*)::port?/en/:path(.*)?\"\n      ],\n      [\n        \"de\",\n        \":protocol://:domain(.*)::port?/de/:path(.*)?\"\n      ],\n      [\n        \"es\",\n        \":protocol://:domain(.*)::port?/es/:path(.*)?\"\n      ],\n      [\n        \"ru\",\n        \":protocol://:domain(.*)::port?/:path(.*)?\"\n      ]\n    ]\n  }\n];\n/**\n * @typedef {{\n * \t\tgetStore(): {\n *   \t\tlocale?: Locale,\n * \t\t\torigin?: string,\n * \t\t\tmessageCalls?: Set<string>\n *   \t} | undefined,\n * \t\trun: (store: { locale?: Locale, origin?: string, messageCalls?: Set<string>},\n *    cb: any) => any\n * }} ParaglideAsyncLocalStorage\n */\n/**\n * Server side async local storage that is set by `serverMiddleware()`.\n *\n * The variable is used to retrieve the locale and origin in a server-side\n * rendering context without effecting other requests.\n *\n * @type {ParaglideAsyncLocalStorage | undefined}\n */\nexport let serverAsyncLocalStorage = undefined;\nexport const disableAsyncLocalStorage = false;\nexport const experimentalMiddlewareLocaleSplitting = false;\nexport const isServer = typeof window === 'undefined';\n/**\n * Sets the server side async local storage.\n *\n * The function is needed because the `runtime.js` file\n * must define the `serverAsyncLocalStorage` variable to\n * avoid a circular import between `runtime.js` and\n * `server.js` files.\n *\n * @param {ParaglideAsyncLocalStorage | undefined} value\n */\nexport function overwriteServerAsyncLocalStorage(value) {\n    serverAsyncLocalStorage = value;\n}\nconst TREE_SHAKE_COOKIE_STRATEGY_USED = true;\nconst TREE_SHAKE_URL_STRATEGY_USED = false;\nconst TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = true;\nconst TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = false;\nconst TREE_SHAKE_DEFAULT_URL_PATTERN_USED = true;\nconst TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;\n\nglobalThis.__paraglide = {}\n\n/**\n * This is a fallback to get started with a custom\n * strategy and avoid type errors.\n *\n * The implementation is overwritten\n * by \\`overwriteGetLocale()\\` and \\`defineSetLocale()\\`.\n *\n * @type {Locale|undefined}\n */\nlet _locale;\nlet localeInitiallySet = false;\n/**\n * Get the current locale.\n *\n * @example\n *   if (getLocale() === 'de') {\n *     console.log('Germany 🇩🇪');\n *   } else if (getLocale() === 'nl') {\n *     console.log('Netherlands 🇳🇱');\n *   }\n *\n * @type {() => Locale}\n */\nexport let getLocale = () => {\n    /** @type {string | undefined} */\n    let locale;\n    // if running in a server-side rendering context\n    // retrieve the locale from the async local storage\n    if (serverAsyncLocalStorage) {\n        const locale = serverAsyncLocalStorage?.getStore()?.locale;\n        if (locale) {\n            return locale;\n        }\n    }\n    for (const strat of strategy) {\n        if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === \"cookie\") {\n            locale = extractLocaleFromCookie();\n        }\n        else if (strat === \"baseLocale\") {\n            locale = baseLocale;\n        }\n        else if (TREE_SHAKE_URL_STRATEGY_USED &&\n            strat === \"url\" &&\n            !isServer &&\n            typeof window !== \"undefined\") {\n            locale = extractLocaleFromUrl(window.location.href);\n        }\n        else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&\n            strat === \"globalVariable\" &&\n            _locale !== undefined) {\n            locale = _locale;\n        }\n        else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED &&\n            strat === \"preferredLanguage\" &&\n            !isServer) {\n            locale = extractLocaleFromNavigator();\n        }\n        else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&\n            strat === \"localStorage\" &&\n            !isServer) {\n            locale = localStorage.getItem(localStorageKey) ?? undefined;\n        }\n        else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {\n            const handler = customClientStrategies.get(strat);\n            if (handler) {\n                const result = handler.getLocale();\n                // Handle both sync and async results - skip async in sync getLocale\n                if (result instanceof Promise) {\n                    // Can't await in sync function, skip async strategies\n                    continue;\n                }\n                locale = result;\n            }\n        }\n        // check if match, else continue loop\n        if (locale !== undefined) {\n            const asserted = assertIsLocale(locale);\n            if (!localeInitiallySet) {\n                _locale = asserted;\n                // https://github.com/opral/inlang-paraglide-js/issues/455\n                localeInitiallySet = true;\n                setLocale(asserted, { reload: false });\n            }\n            return asserted;\n        }\n    }\n    throw new Error(\"No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found\");\n};\n/**\n * Overwrite the \\`getLocale()\\` function.\n *\n * Use this function to overwrite how the locale is resolved. For example,\n * you can resolve the locale from the browser's preferred language,\n * a cookie, env variable, or a user's preference.\n *\n * @example\n *   overwriteGetLocale(() => {\n *     // resolve the locale from a cookie. fallback to the base locale.\n *     return Cookies.get('locale') ?? baseLocale\n *   }\n *\n * @type {(fn: () => Locale) => void}\n */\nexport const overwriteGetLocale = (fn) => {\n    getLocale = fn;\n};\n\n/**\n * Navigates to the localized URL, or reloads the current page\n *\n * @param {string} [newLocation] The new location\n * @return {undefined}\n */\nconst navigateOrReload = (newLocation) => {\n    if (newLocation) {\n        // reload the page by navigating to the new url\n        window.location.href = newLocation;\n    }\n    else {\n        // reload the page to reflect the new locale\n        window.location.reload();\n    }\n};\n/**\n * @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn\n */\n/**\n * Set the locale.\n *\n * Set locale reloads the site by default on the client. Reloading\n * can be disabled by passing \\`reload: false\\` as an option. If\n * reloading is disabled, you need to ensure that the UI is updated\n * to reflect the new locale.\n *\n * If any custom strategy's \\`setLocale\\` function is async, then this\n * function will become async as well.\n *\n * @example\n *   setLocale('en');\n *\n * @example\n *   setLocale('en', { reload: false });\n *\n * @type {SetLocaleFn}\n */\nexport let setLocale = (newLocale, options) => {\n    const optionsWithDefaults = {\n        reload: true,\n        ...options,\n    };\n    // locale is already set\n    // https://github.com/opral/inlang-paraglide-js/issues/430\n    /** @type {Locale | undefined} */\n    let currentLocale;\n    try {\n        currentLocale = getLocale();\n    }\n    catch {\n        // do nothing, no locale has been set yet.\n    }\n    /** @type {Array<Promise<any>>} */\n    const customSetLocalePromises = [];\n    /** @type {string | undefined} */\n    let newLocation = undefined;\n    for (const strat of strategy) {\n        if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED &&\n            strat === \"globalVariable\") {\n            // a default for a custom strategy to get started quickly\n            // is likely overwritten by `defineSetLocale()`\n            _locale = newLocale;\n        }\n        else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === \"cookie\") {\n            if (isServer ||\n                typeof document === \"undefined\" ||\n                typeof window === \"undefined\") {\n                continue;\n            }\n            // set the cookie\n            const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;\n            document.cookie = cookieDomain\n                ? `${cookieString}; domain=${cookieDomain}`\n                : cookieString;\n        }\n        else if (strat === \"baseLocale\") {\n            // nothing to be set here. baseLocale is only a fallback\n            continue;\n        }\n        else if (TREE_SHAKE_URL_STRATEGY_USED &&\n            strat === \"url\" &&\n            typeof window !== \"undefined\") {\n            // route to the new url\n            //\n            // this triggers a page reload but a user rarely\n            // switches locales, so this should be fine.\n            //\n            // if the behavior is not desired, the implementation\n            // can be overwritten by `defineSetLocale()` to avoid\n            // a full page reload.\n            newLocation = localizeUrl(window.location.href, {\n                locale: newLocale,\n            }).href;\n        }\n        else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED &&\n            strat === \"localStorage\" &&\n            typeof window !== \"undefined\") {\n            // set the localStorage\n            localStorage.setItem(localStorageKey, newLocale);\n        }\n        else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {\n            const handler = customClientStrategies.get(strat);\n            if (handler) {\n                let result = handler.setLocale(newLocale);\n                // Handle async setLocale\n                if (result instanceof Promise) {\n                    result = result.catch((error) => {\n                        throw new Error(`Custom strategy \"${strat}\" setLocale failed.`, {\n                            cause: error,\n                        });\n                    });\n                    customSetLocalePromises.push(result);\n                }\n            }\n        }\n    }\n    const runReload = () => {\n        if (!isServer &&\n            optionsWithDefaults.reload &&\n            window.location &&\n            newLocale !== currentLocale) {\n            navigateOrReload(newLocation);\n        }\n    };\n    if (customSetLocalePromises.length) {\n        return Promise.all(customSetLocalePromises).then(() => {\n            runReload();\n        });\n    }\n    runReload();\n    return;\n};\n/**\n * Overwrite the \\`setLocale()\\` function.\n *\n * Use this function to overwrite how the locale is set. For example,\n * modify a cookie, env variable, or a user's preference.\n *\n * @example\n *   overwriteSetLocale((newLocale) => {\n *     // set the locale in a cookie\n *     return Cookies.set('locale', newLocale)\n *   });\n *\n * @param {SetLocaleFn} fn\n */\nexport const overwriteSetLocale = (fn) => {\n    setLocale = /** @type {SetLocaleFn} */ (fn);\n};\n\n/**\n * The origin of the current URL.\n *\n * Defaults to \"http://y.com\" in non-browser environments. If this\n * behavior is not desired, the implementation can be overwritten\n * by `overwriteGetUrlOrigin()`.\n *\n * @type {() => string}\n */\nexport let getUrlOrigin = () => {\n    if (serverAsyncLocalStorage) {\n        return serverAsyncLocalStorage.getStore()?.origin ?? \"http://fallback.com\";\n    }\n    else if (typeof window !== \"undefined\") {\n        return window.location.origin;\n    }\n    return \"http://fallback.com\";\n};\n/**\n * Overwrite the getUrlOrigin function.\n *\n * Use this function in server environments to\n * define how the URL origin is resolved.\n *\n * @type {(fn: () => string) => void}\n */\nexport let overwriteGetUrlOrigin = (fn) => {\n    getUrlOrigin = fn;\n};\n\n/**\n * Check if something is an available locale.\n *\n * @example\n *   if (isLocale(params.locale)) {\n *     setLocale(params.locale);\n *   } else {\n *     setLocale('en');\n *   }\n *\n * @param {any} locale\n * @returns {locale is Locale}\n */\nexport function isLocale(locale) {\n    return !locale ? false : locales.includes(locale);\n}\n\n/**\n * Asserts that the input is a locale.\n *\n * @param {any} input - The input to check.\n * @returns {Locale} The input if it is a locale.\n * @throws {Error} If the input is not a locale.\n */\nexport function assertIsLocale(input) {\n    if (isLocale(input) === false) {\n        throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(\", \")}`);\n    }\n    return input;\n}\n\n/**\n * Extracts a locale from a request.\n *\n * Use the function on the server to extract the locale\n * from a request.\n *\n * The function goes through the strategies in the order\n * they are defined. If a strategy returns an invalid locale,\n * it will fall back to the next strategy.\n *\n * Note: Custom server strategies are not supported in this synchronous version.\n * Use `extractLocaleFromRequestAsync` if you need custom server strategies with async getLocale methods.\n *\n * @example\n *   const locale = extractLocaleFromRequest(request);\n *\n * @type {(request: Request) => Locale}\n */\nexport const extractLocaleFromRequest = (request) => {\n    /** @type {string|undefined} */\n    let locale;\n    for (const strat of strategy) {\n        if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === \"cookie\") {\n            locale = request.headers\n                .get(\"cookie\")\n                ?.split(\"; \")\n                .find((c) => c.startsWith(cookieName + \"=\"))\n                ?.split(\"=\")[1];\n        }\n        else if (TREE_SHAKE_URL_STRATEGY_USED && strat === \"url\") {\n            locale = extractLocaleFromUrl(request.url);\n        }\n        else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED &&\n            strat === \"preferredLanguage\") {\n            locale = extractLocaleFromHeader(request);\n        }\n        else if (strat === \"globalVariable\") {\n            locale = _locale;\n        }\n        else if (strat === \"baseLocale\") {\n            return baseLocale;\n        }\n        else if (strat === \"localStorage\") {\n            continue;\n        }\n        else if (isCustomStrategy(strat)) {\n            // Custom strategies are not supported in sync version\n            // Use extractLocaleFromRequestAsync for custom server strategies\n            continue;\n        }\n        if (locale !== undefined) {\n            if (!isLocale(locale)) {\n                locale = undefined;\n            }\n            else {\n                return assertIsLocale(locale);\n            }\n        }\n    }\n    throw new Error(\"No locale found. There is an error in your strategy. Try adding 'baseLocale' as the very last strategy. Read more here https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found\");\n};\n\n/**\n * Asynchronously extracts a locale from a request.\n *\n * This function supports async custom server strategies, unlike the synchronous\n * `extractLocaleFromRequest`. Use this function when you have custom server strategies\n * that need to perform asynchronous operations (like database calls) in their getLocale method.\n *\n * The function first processes any custom server strategies asynchronously, then falls back\n * to the synchronous `extractLocaleFromRequest` for all other strategies.\n *\n * @see {@link https://github.com/opral/inlang-paraglide-js/issues/527#issuecomment-2978151022}\n *\n * @example\n *   // Basic usage\n *   const locale = await extractLocaleFromRequestAsync(request);\n *\n * @example\n *   // With custom async server strategy\n *   defineCustomServerStrategy(\"custom-database\", {\n *     getLocale: async (request) => {\n *       const userId = extractUserIdFromRequest(request);\n *       return await getUserLocaleFromDatabase(userId);\n *     }\n *   });\n *\n *   const locale = await extractLocaleFromRequestAsync(request);\n *\n * @type {(request: Request) => Promise<Locale>}\n */\nexport const extractLocaleFromRequestAsync = async (request) => {\n    /** @type {string|undefined} */\n    let locale;\n    // Process custom strategies first, in order\n    for (const strat of strategy) {\n        if (isCustomStrategy(strat) && customServerStrategies.has(strat)) {\n            const handler = customServerStrategies.get(strat);\n            if (handler) {\n                /** @type {string|undefined} */\n                locale = await handler.getLocale(request);\n            }\n            // If we got a valid locale from this custom strategy, use it\n            if (locale !== undefined && isLocale(locale)) {\n                return assertIsLocale(locale);\n            }\n        }\n    }\n    // If no custom strategy provided a valid locale, fall back to sync version\n    locale = extractLocaleFromRequest(request);\n    return assertIsLocale(locale);\n};\n\n/**\n * Extracts a cookie from the document.\n *\n * Will return undefined if the document is not available or if the cookie is not set.\n * The `document` object is not available in server-side rendering, so this function should not be called in that context.\n *\n * @returns {string | undefined}\n */\nexport function extractLocaleFromCookie() {\n    if (typeof document === \"undefined\" || !document.cookie) {\n        return;\n    }\n    const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));\n    const locale = match?.[2];\n    if (isLocale(locale)) {\n        return locale;\n    }\n    return undefined;\n}\n\n/**\n * Extracts a locale from the accept-language header.\n *\n * Use the function on the server to extract the locale\n * from the accept-language header that is sent by the client.\n *\n * @example\n *   const locale = extractLocaleFromHeader(request);\n *\n * @type {(request: Request) => Locale}\n * @param {Request} request - The request object to extract the locale from.\n * @returns {string|undefined} The negotiated preferred language.\n */\nexport function extractLocaleFromHeader(request) {\n    const acceptLanguageHeader = request.headers.get(\"accept-language\");\n    if (acceptLanguageHeader) {\n        // Parse language preferences with their q-values and base language codes\n        const languages = acceptLanguageHeader\n            .split(\",\")\n            .map((lang) => {\n            const [tag, q = \"1\"] = lang.trim().split(\";q=\");\n            // Get both the full tag and base language code\n            const baseTag = tag?.split(\"-\")[0]?.toLowerCase();\n            return {\n                fullTag: tag?.toLowerCase(),\n                baseTag,\n                q: Number(q),\n            };\n        })\n            .sort((a, b) => b.q - a.q);\n        for (const lang of languages) {\n            if (isLocale(lang.fullTag)) {\n                return lang.fullTag;\n            }\n            else if (isLocale(lang.baseTag)) {\n                return lang.baseTag;\n            }\n        }\n        return undefined;\n    }\n    return undefined;\n}\n\n/**\n * Negotiates a preferred language from navigator.languages.\n *\n * Use the function on the client to extract the locale\n * from the navigator.languages array.\n *\n * @example\n *   const locale = extractLocaleFromNavigator();\n *\n * @type {() => Locale | undefined}\n * @returns {string | undefined}\n */\nexport function extractLocaleFromNavigator() {\n    if (!navigator?.languages?.length) {\n        return undefined;\n    }\n    const languages = navigator.languages.map((lang) => ({\n        fullTag: lang.toLowerCase(),\n        baseTag: lang.split(\"-\")[0]?.toLowerCase(),\n    }));\n    for (const lang of languages) {\n        if (isLocale(lang.fullTag)) {\n            return lang.fullTag;\n        }\n        else if (isLocale(lang.baseTag)) {\n            return lang.baseTag;\n        }\n    }\n    return undefined;\n}\n\n/**\n * If extractLocaleFromUrl is called many times on the same page and the URL\n * hasn't changed, we don't need to recompute it every time which can get expensive.\n * We might use a LRU cache if needed, but for now storing only the last result is enough.\n * https://github.com/opral/monorepo/pull/3575#discussion_r2066731243\n */\n/** @type {string|undefined} */\nlet cachedUrl;\n/** @type {Locale|undefined} */\nlet cachedLocale;\n/**\n * Extracts the locale from a given URL using native URLPattern.\n *\n * @param {URL|string} url - The full URL from which to extract the locale.\n * @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.\n */\nexport function extractLocaleFromUrl(url) {\n    const urlString = typeof url === \"string\" ? url : url.href;\n    if (cachedUrl === urlString) {\n        return cachedLocale;\n    }\n    let result;\n    if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {\n        result = defaultUrlPatternExtractLocale(url);\n    }\n    else {\n        const urlObj = typeof url === \"string\" ? new URL(url) : url;\n        // Iterate over URL patterns\n        for (const element of urlPatterns) {\n            for (const [locale, localizedPattern] of element.localized) {\n                const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);\n                if (!match) {\n                    continue;\n                }\n                // Check if the locale is valid\n                if (assertIsLocale(locale)) {\n                    result = locale;\n                    break;\n                }\n            }\n            if (result)\n                break;\n        }\n    }\n    cachedUrl = urlString;\n    cachedLocale = result;\n    return result;\n}\n/**\n * https://github.com/opral/inlang-paraglide-js/issues/381\n *\n * @param {URL|string} url - The full URL from which to extract the locale.\n * @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.\n */\nfunction defaultUrlPatternExtractLocale(url) {\n    const urlObj = new URL(url, \"http://dummy.com\");\n    const pathSegments = urlObj.pathname.split(\"/\").filter(Boolean);\n    if (pathSegments.length > 0) {\n        const potentialLocale = pathSegments[0];\n        if (isLocale(potentialLocale)) {\n            return potentialLocale;\n        }\n    }\n    // everything else has to be the base locale\n    return baseLocale;\n}\n\n/**\n * Lower-level URL localization function, primarily used in server contexts.\n *\n * This function is designed for server-side usage where you need precise control\n * over URL localization, such as in middleware or request handlers. It works with\n * URL objects and always returns absolute URLs.\n *\n * For client-side UI components, use `localizeHref()` instead, which provides\n * a more convenient API with relative paths and automatic locale detection.\n *\n * @example\n * ```typescript\n * // Server middleware example\n * app.use((req, res, next) => {\n *   const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);\n *   const localized = localizeUrl(url, { locale: \"de\" });\n *\n *   if (localized.href !== url.href) {\n *     return res.redirect(localized.href);\n *   }\n *   next();\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using with URL patterns\n * const url = new URL(\"https://example.com/about\");\n * localizeUrl(url, { locale: \"de\" });\n * // => URL(\"https://example.com/de/about\")\n *\n * // Using with domain-based localization\n * const url = new URL(\"https://example.com/store\");\n * localizeUrl(url, { locale: \"de\" });\n * // => URL(\"https://de.example.com/store\")\n * ```\n *\n * @param {string | URL} url - The URL to localize. If string, must be absolute.\n * @param {Object} [options] - Options for localization\n * @param {string} [options.locale] - Target locale. If not provided, uses getLocale()\n * @returns {URL} The localized URL, always absolute\n */\nexport function localizeUrl(url, options) {\n    if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {\n        return localizeUrlDefaultPattern(url, options);\n    }\n    const targetLocale = options?.locale ?? getLocale();\n    const urlObj = typeof url === \"string\" ? new URL(url) : url;\n    // Iterate over URL patterns\n    for (const element of urlPatterns) {\n        // match localized patterns\n        for (const [, localizedPattern] of element.localized) {\n            const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);\n            if (!match) {\n                continue;\n            }\n            const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];\n            if (!targetPattern) {\n                continue;\n            }\n            const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);\n            return fillMissingUrlParts(localizedUrl, match);\n        }\n        const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);\n        if (unlocalizedMatch) {\n            const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];\n            if (targetPattern) {\n                const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);\n                return fillMissingUrlParts(localizedUrl, unlocalizedMatch);\n            }\n        }\n    }\n    // If no match found, return the original URL\n    return urlObj;\n}\n/**\n * https://github.com/opral/inlang-paraglide-js/issues/381\n *\n * @param {string | URL} url\n * @param {Object} [options]\n * @param {string} [options.locale]\n * @returns {URL}\n */\nfunction localizeUrlDefaultPattern(url, options) {\n    const urlObj = typeof url === \"string\" ? new URL(url, getUrlOrigin()) : new URL(url);\n    const locale = options?.locale ?? getLocale();\n    const currentLocale = extractLocaleFromUrl(urlObj);\n    // If current locale matches target locale, no change needed\n    if (currentLocale === locale) {\n        return urlObj;\n    }\n    const pathSegments = urlObj.pathname.split(\"/\").filter(Boolean);\n    // If current path starts with a locale, remove it\n    if (pathSegments.length > 0 && isLocale(pathSegments[0])) {\n        pathSegments.shift();\n    }\n    // For base locale, don't add prefix\n    if (locale === baseLocale) {\n        urlObj.pathname = \"/\" + pathSegments.join(\"/\");\n    }\n    else {\n        // For other locales, add prefix\n        urlObj.pathname = \"/\" + locale + \"/\" + pathSegments.join(\"/\");\n    }\n    return urlObj;\n}\n/**\n * Low-level URL de-localization function, primarily used in server contexts.\n *\n * This function is designed for server-side usage where you need precise control\n * over URL de-localization, such as in middleware or request handlers. It works with\n * URL objects and always returns absolute URLs.\n *\n * For client-side UI components, use `deLocalizeHref()` instead, which provides\n * a more convenient API with relative paths.\n *\n * @example\n * ```typescript\n * // Server middleware example\n * app.use((req, res, next) => {\n *   const url = new URL(req.url, `${req.protocol}://${req.headers.host}`);\n *   const baseUrl = deLocalizeUrl(url);\n *\n *   // Store the base URL for later use\n *   req.baseUrl = baseUrl;\n *   next();\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Using with URL patterns\n * const url = new URL(\"https://example.com/de/about\");\n * deLocalizeUrl(url); // => URL(\"https://example.com/about\")\n *\n * // Using with domain-based localization\n * const url = new URL(\"https://de.example.com/store\");\n * deLocalizeUrl(url); // => URL(\"https://example.com/store\")\n * ```\n *\n * @param {string | URL} url - The URL to de-localize. If string, must be absolute.\n * @returns {URL} The de-localized URL, always absolute\n */\nexport function deLocalizeUrl(url) {\n    if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {\n        return deLocalizeUrlDefaultPattern(url);\n    }\n    const urlObj = typeof url === \"string\" ? new URL(url) : url;\n    // Iterate over URL patterns\n    for (const element of urlPatterns) {\n        // Iterate over localized versions\n        for (const [, localizedPattern] of element.localized) {\n            const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);\n            if (match) {\n                // Convert localized URL back to the base pattern\n                const groups = aggregateGroups(match);\n                const baseUrl = fillPattern(element.pattern, groups, urlObj.origin);\n                return fillMissingUrlParts(baseUrl, match);\n            }\n        }\n        // match unlocalized pattern\n        const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);\n        if (unlocalizedMatch) {\n            const baseUrl = fillPattern(element.pattern, aggregateGroups(unlocalizedMatch), urlObj.origin);\n            return fillMissingUrlParts(baseUrl, unlocalizedMatch);\n        }\n    }\n    // no match found return the original url\n    return urlObj;\n}\n/**\n * De-localizes a URL using the default pattern (/:locale/*)\n * @param {string|URL} url\n * @returns {URL}\n */\nfunction deLocalizeUrlDefaultPattern(url) {\n    const urlObj = typeof url === \"string\" ? new URL(url, getUrlOrigin()) : new URL(url);\n    const pathSegments = urlObj.pathname.split(\"/\").filter(Boolean);\n    // If first segment is a locale, remove it\n    if (pathSegments.length > 0 && isLocale(pathSegments[0])) {\n        urlObj.pathname = \"/\" + pathSegments.slice(1).join(\"/\");\n    }\n    return urlObj;\n}\n/**\n * Takes matches of implicit wildcards in the UrlPattern (when a part is missing\n * it is equal to '*') and adds them back to the result of fillPattern.\n *\n * At least protocol and hostname are required to create a valid URL inside fillPattern.\n *\n * @param {URL} url\n * @param {any} match\n * @returns {URL}\n */\nfunction fillMissingUrlParts(url, match) {\n    if (match.protocol.groups[\"0\"]) {\n        url.protocol = match.protocol.groups[\"0\"] ?? \"\";\n    }\n    if (match.hostname.groups[\"0\"]) {\n        url.hostname = match.hostname.groups[\"0\"] ?? \"\";\n    }\n    if (match.username.groups[\"0\"]) {\n        url.username = match.username.groups[\"0\"] ?? \"\";\n    }\n    if (match.password.groups[\"0\"]) {\n        url.password = match.password.groups[\"0\"] ?? \"\";\n    }\n    if (match.port.groups[\"0\"]) {\n        url.port = match.port.groups[\"0\"] ?? \"\";\n    }\n    if (match.pathname.groups[\"0\"]) {\n        url.pathname = match.pathname.groups[\"0\"] ?? \"\";\n    }\n    if (match.search.groups[\"0\"]) {\n        url.search = match.search.groups[\"0\"] ?? \"\";\n    }\n    if (match.hash.groups[\"0\"]) {\n        url.hash = match.hash.groups[\"0\"] ?? \"\";\n    }\n    return url;\n}\n/**\n * Fills a URL pattern with values for named groups, supporting all URLPattern-style modifiers.\n *\n * This function will eventually be replaced by https://github.com/whatwg/urlpattern/issues/73\n *\n * Matches:\n * - :name        -> Simple\n * - :name?       -> Optional\n * - :name+       -> One or more\n * - :name*       -> Zero or more\n * - :name(...)   -> Regex group\n * - {text}       -> Group delimiter\n * - {text}?      -> Optional group delimiter\n *\n * If the value is `null`, the segment is removed.\n *\n * @param {string} pattern - The URL pattern containing named groups.\n * @param {Record<string, string | null | undefined>} values - Object of values for named groups.\n * @param {string} origin - Base URL to use for URL construction.\n * @returns {URL} - The constructed URL with named groups filled.\n */\nfunction fillPattern(pattern, values, origin) {\n    // Pre-process the pattern to handle explicit port numbers\n    // This detects patterns like \"http://localhost:5173\" and protects the port number\n    // from being interpreted as a parameter\n    let processedPattern = pattern.replace(/(https?:\\/\\/[^:/]+):(\\d+)(\\/|$)/g, (_, protocol, port, slash) => {\n        // Replace \":5173\" with \"#PORT-5173#\" to protect it from parameter replacement\n        return `${protocol}#PORT-${port}#${slash}`;\n    });\n    // First, handle group delimiters with curly braces\n    let processedGroupDelimiters = processedPattern.replace(/\\{([^{}]*)\\}([?+*]?)/g, (_, content, modifier) => {\n        // For optional group delimiters\n        if (modifier === \"?\") {\n            // For optional groups, we'll include the content\n            return content;\n        }\n        // For non-optional group delimiters, always include the content\n        return content;\n    });\n    // Then handle named groups\n    let filled = processedGroupDelimiters.replace(/(\\/?):([a-zA-Z0-9_]+)(\\([^)]*\\))?([?+*]?)/g, (_, slash, name, __, modifier) => {\n        const value = values[name];\n        if (value === null) {\n            // If value is null, remove the entire segment including the preceding slash\n            return \"\";\n        }\n        if (modifier === \"?\") {\n            // Optional segment\n            return value !== undefined ? `${slash}${value}` : \"\";\n        }\n        if (modifier === \"+\" || modifier === \"*\") {\n            // Repeatable segments\n            if (value === undefined && modifier === \"+\") {\n                throw new Error(`Missing value for \"${name}\" (one or more required)`);\n            }\n            return value ? `${slash}${value}` : \"\";\n        }\n        // Simple named group (no modifier)\n        if (value === undefined) {\n            throw new Error(`Missing value for \"${name}\"`);\n        }\n        return `${slash}${value}`;\n    });\n    // Restore port numbers\n    filled = filled.replace(/#PORT-(\\d+)#/g, \":$1\");\n    return new URL(filled, origin);\n}\n/**\n * Aggregates named groups from various parts of the URLPattern match result.\n *\n *\n * @type {(match: any) => Record<string, string | null | undefined>}\n */\nexport function aggregateGroups(match) {\n    return {\n        ...match.hash.groups,\n        ...match.hostname.groups,\n        ...match.password.groups,\n        ...match.pathname.groups,\n        ...match.port.groups,\n        ...match.protocol.groups,\n        ...match.search.groups,\n        ...match.username.groups,\n    };\n}\n\n/**\n * @typedef {object} ShouldRedirectServerInput\n * @property {Request} request\n * @property {string | URL} [url]\n * @property {ReturnType<typeof assertIsLocale>} [locale]\n *\n * @typedef {object} ShouldRedirectClientInput\n * @property {undefined} [request]\n * @property {string | URL} [url]\n * @property {ReturnType<typeof assertIsLocale>} [locale]\n *\n * @typedef {ShouldRedirectServerInput | ShouldRedirectClientInput} ShouldRedirectInput\n *\n * @typedef {object} ShouldRedirectResult\n * @property {boolean} shouldRedirect - Indicates whether the consumer should perform a redirect.\n * @property {ReturnType<typeof assertIsLocale>} locale - Locale resolved using the configured strategies.\n * @property {URL | undefined} redirectUrl - Destination URL when a redirect is required.\n */\n/**\n * Determines whether a redirect is required to align the current URL with the active locale.\n *\n * This helper mirrors the logic that powers `paraglideMiddleware`, but works in both server\n * and client environments. It evaluates the configured strategies in order, computes the\n * canonical localized URL, and reports when the current URL does not match.\n *\n * When called in the browser without arguments, the current `window.location.href` is used.\n *\n * @example\n * // Client side usage (e.g. TanStack Router beforeLoad hook)\n * async function beforeLoad({ location }) {\n *   const decision = await shouldRedirect({ url: location.href });\n *\n *   if (decision.shouldRedirect) {\n *     throw redirect({ to: decision.redirectUrl.href });\n *   }\n * }\n *\n * @example\n * // Server side usage with a Request\n * export async function handle(request) {\n *   const decision = await shouldRedirect({ request });\n *\n *   if (decision.shouldRedirect) {\n *     return Response.redirect(decision.redirectUrl, 307);\n *   }\n *\n *   return render(request, decision.locale);\n * }\n *\n * @param {ShouldRedirectInput} [input]\n * @returns {Promise<ShouldRedirectResult>}\n */\nexport async function shouldRedirect(input = {}) {\n    const locale = /** @type {ReturnType<typeof assertIsLocale>} */ (await resolveLocale(input));\n    if (!strategy.includes(\"url\")) {\n        return { shouldRedirect: false, locale, redirectUrl: undefined };\n    }\n    const currentUrl = resolveUrl(input);\n    const localizedUrl = localizeUrl(currentUrl.href, { locale });\n    const shouldRedirectToLocalizedUrl = normalizeUrl(localizedUrl.href) !== normalizeUrl(currentUrl.href);\n    return {\n        shouldRedirect: shouldRedirectToLocalizedUrl,\n        locale,\n        redirectUrl: shouldRedirectToLocalizedUrl ? localizedUrl : undefined,\n    };\n}\n/**\n * Resolves the locale either from the provided input or by using the configured strategies.\n *\n * @param {ShouldRedirectInput} input\n * @returns {Promise<ReturnType<typeof assertIsLocale>>}\n */\nasync function resolveLocale(input) {\n    if (input.locale) {\n        return assertIsLocale(input.locale);\n    }\n    if (input.request) {\n        return extractLocaleFromRequestAsync(input.request);\n    }\n    return getLocale();\n}\n/**\n * Resolves the current URL from the provided input or runtime context.\n *\n * @param {ShouldRedirectInput} input\n * @returns {URL}\n */\nfunction resolveUrl(input) {\n    if (input.request) {\n        return new URL(input.request.url);\n    }\n    if (input.url instanceof URL) {\n        return new URL(input.url.href);\n    }\n    if (typeof input.url === \"string\") {\n        return new URL(input.url, getUrlOrigin());\n    }\n    if (typeof window !== \"undefined\" && window?.location?.href) {\n        return new URL(window.location.href);\n    }\n    throw new Error(\"shouldRedirect() requires either a request, an absolute URL, or must run in a browser environment.\");\n}\n/**\n * Normalize url for comparison by stripping the trailing slash.\n *\n * @param {string} url\n * @returns {string}\n */\nfunction normalizeUrl(url) {\n    const urlObj = new URL(url);\n    urlObj.pathname = urlObj.pathname.replace(/\\/$/, \"\");\n    return urlObj.href;\n}\n\n/**\n * High-level URL localization function optimized for client-side UI usage.\n *\n * This is a convenience wrapper around `localizeUrl()` that provides features\n * needed in UI:\n *\n * - Accepts relative paths (e.g., \"/about\")\n * - Returns relative paths when possible\n * - Automatically detects current locale if not specified\n * - Handles string input/output instead of URL objects\n *\n * @example\n * ```typescript\n * // In a React/Vue/Svelte component\n * const NavLink = ({ href }) => {\n *   // Automatically uses current locale, keeps path relative\n *   return <a href={localizeHref(href)}>...</a>;\n * };\n *\n * // Examples:\n * localizeHref(\"/about\")\n * // => \"/de/about\" (if current locale is \"de\")\n * localizeHref(\"/store\", { locale: \"fr\" })\n * // => \"/fr/store\" (explicit locale)\n *\n * // Cross-origin links remain absolute\n * localizeHref(\"https://other-site.com/about\")\n * // => \"https://other-site.com/de/about\"\n * ```\n *\n * For server-side URL localization (e.g., in middleware), use `localizeUrl()`\n * which provides more precise control over URL handling.\n *\n * @param {string} href - The href to localize (can be relative or absolute)\n * @param {Object} [options] - Options for localization\n * @param {string} [options.locale] - Target locale. If not provided, uses `getLocale()`\n * @returns {string} The localized href, relative if input was relative\n */\nexport function localizeHref(href, options) {\n    const currentLocale = getLocale();\n    const locale = options?.locale ?? currentLocale;\n    const url = new URL(href, getUrlOrigin());\n    const localized = localizeUrl(url, { locale });\n    // if the origin is identical and the href is relative,\n    // return the relative path\n    if (href.startsWith(\"/\") && url.origin === localized.origin) {\n        // check for cross origin localization in which case an absolute URL must be returned.\n        if (locale !== currentLocale) {\n            const localizedCurrentLocale = localizeUrl(url, {\n                locale: currentLocale,\n            });\n            if (localizedCurrentLocale.origin !== localized.origin) {\n                return localized.href;\n            }\n        }\n        return localized.pathname + localized.search + localized.hash;\n    }\n    return localized.href;\n}\n/**\n * High-level URL de-localization function optimized for client-side UI usage.\n *\n * This is a convenience wrapper around `deLocalizeUrl()` that provides features\n * needed in the UI:\n *\n * - Accepts relative paths (e.g., \"/de/about\")\n * - Returns relative paths when possible\n * - Handles string input/output instead of URL objects\n *\n * @example\n * ```typescript\n * // In a React/Vue/Svelte component\n * const LocaleSwitcher = ({ href }) => {\n *   // Remove locale prefix before switching\n *   const baseHref = deLocalizeHref(href);\n *   return locales.map(locale =>\n *     <a href={localizeHref(baseHref, { locale })}>\n *       Switch to {locale}\n *     </a>\n *   );\n * };\n *\n * // Examples:\n * deLocalizeHref(\"/de/about\")  // => \"/about\"\n * deLocalizeHref(\"/fr/store\")  // => \"/store\"\n *\n * // Cross-origin links remain absolute\n * deLocalizeHref(\"https://example.com/de/about\")\n * // => \"https://example.com/about\"\n * ```\n *\n * For server-side URL de-localization (e.g., in middleware), use `deLocalizeUrl()`\n * which provides more precise control over URL handling.\n *\n * @param {string} href - The href to de-localize (can be relative or absolute)\n * @returns {string} The de-localized href, relative if input was relative\n * @see deLocalizeUrl - For low-level URL de-localization in server contexts\n */\nexport function deLocalizeHref(href) {\n    const url = new URL(href, getUrlOrigin());\n    const deLocalized = deLocalizeUrl(url);\n    // If the origin is identical and the href is relative,\n    // return the relative path instead of the full URL.\n    if (href.startsWith(\"/\") && url.origin === deLocalized.origin) {\n        return deLocalized.pathname + deLocalized.search + deLocalized.hash;\n    }\n    return deLocalized.href;\n}\n\n/**\n * @param {string} safeModuleId\n * @param {Locale} locale\n */\nexport function trackMessageCall(safeModuleId, locale) {\n    if (isServer === false)\n        return;\n    const store = serverAsyncLocalStorage?.getStore();\n    if (store) {\n        store.messageCalls?.add(`${safeModuleId}:${locale}`);\n    }\n}\n\n/**\n * Generates a list of localized URLs for all provided URLs.\n *\n * This is useful for SSG (Static Site Generation) and sitemap generation.\n * NextJS and other frameworks use this function for SSG.\n *\n * @example\n * ```typescript\n * const urls = generateStaticLocalizedUrls([\n *   \"https://example.com/about\",\n *   \"https://example.com/blog\",\n * ]);\n * urls[0].href // => \"https://example.com/about\"\n * urls[1].href // => \"https://example.com/blog\"\n * urls[2].href // => \"https://example.com/de/about\"\n * urls[3].href // => \"https://example.com/de/blog\"\n * ...\n * ```\n *\n * @param {(string | URL)[]} urls - List of URLs to generate localized versions for. Can be absolute URLs or paths.\n * @returns {URL[]} List of localized URLs as URL objects\n */\nexport function generateStaticLocalizedUrls(urls) {\n    const localizedUrls = new Set();\n    // For default URL pattern, we can optimize the generation\n    if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {\n        for (const urlInput of urls) {\n            const url = urlInput instanceof URL\n                ? urlInput\n                : new URL(urlInput, \"http://localhost\");\n            // Base locale doesn't get a prefix\n            localizedUrls.add(url);\n            // Other locales get their code as prefix\n            for (const locale of locales) {\n                if (locale !== baseLocale) {\n                    const localizedPath = `/${locale}${url.pathname}${url.search}${url.hash}`;\n                    const localizedUrl = new URL(localizedPath, url.origin);\n                    localizedUrls.add(localizedUrl);\n                }\n            }\n        }\n        return Array.from(localizedUrls);\n    }\n    // For custom URL patterns, we need to use localizeUrl for each URL and locale\n    for (const urlInput of urls) {\n        const url = urlInput instanceof URL\n            ? urlInput\n            : new URL(urlInput, \"http://localhost\");\n        // Try each URL pattern to find one that matches\n        let patternFound = false;\n        for (const pattern of urlPatterns) {\n            try {\n                // Try to match the unlocalized pattern\n                const unlocalizedMatch = new URLPattern(pattern.pattern, url.href).exec(url.href);\n                if (!unlocalizedMatch)\n                    continue;\n                patternFound = true;\n                // Track unique localized URLs to avoid duplicates when patterns are the same\n                const seenUrls = new Set();\n                // Generate localized URL for each locale\n                for (const [locale] of pattern.localized) {\n                    try {\n                        const localizedUrl = localizeUrl(url, { locale });\n                        const urlString = localizedUrl.href;\n                        // Only add if we haven't seen this exact URL before\n                        if (!seenUrls.has(urlString)) {\n                            seenUrls.add(urlString);\n                            localizedUrls.add(localizedUrl);\n                        }\n                    }\n                    catch {\n                        // Skip if localization fails for this locale\n                        continue;\n                    }\n                }\n                break;\n            }\n            catch {\n                // Skip if pattern matching fails\n                continue;\n            }\n        }\n        // If no pattern matched, use the URL as is\n        if (!patternFound) {\n            localizedUrls.add(url);\n        }\n    }\n    return Array.from(localizedUrls);\n}\n\n/**\n * @typedef {\"cookie\" | \"baseLocale\" | \"globalVariable\" | \"url\" | \"preferredLanguage\" | \"localStorage\"} BuiltInStrategy\n */\n/**\n * @typedef {`custom_${string}`} CustomStrategy\n */\n/**\n * @typedef {BuiltInStrategy | CustomStrategy} Strategy\n */\n/**\n * @typedef {Array<Strategy>} Strategies\n */\n/**\n * @typedef {{ getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined) }} CustomServerStrategyHandler\n */\n/**\n * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler\n */\n/** @type {Map<string, CustomServerStrategyHandler>} */\nexport const customServerStrategies = new Map();\n/** @type {Map<string, CustomClientStrategyHandler>} */\nexport const customClientStrategies = new Map();\n/**\n * Checks if the given strategy is a custom strategy.\n *\n * @param {any} strategy The name of the custom strategy to validate.\n * Must be a string that starts with \"custom-\" followed by alphanumeric characters, hyphens, or underscores.\n * @returns {boolean} Returns true if it is a custom strategy, false otherwise.\n */\nexport function isCustomStrategy(strategy) {\n    return (typeof strategy === \"string\" && /^custom-[A-Za-z0-9_-]+$/.test(strategy));\n}\n/**\n * Defines a custom strategy that is executed on the server.\n *\n * @param {any} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.\n * @param {CustomServerStrategyHandler} handler The handler for the custom strategy, which should implement\n * the method getLocale.\n * @returns {void}\n */\nexport function defineCustomServerStrategy(strategy, handler) {\n    if (!isCustomStrategy(strategy)) {\n        throw new Error(`Invalid custom strategy: \"${strategy}\". Must be a custom strategy following the pattern custom-name.`);\n    }\n    customServerStrategies.set(strategy, handler);\n}\n/**\n * Defines a custom strategy that is executed on the client.\n *\n * @param {any} strategy The name of the custom strategy to define. Must follow the pattern custom-name with alphanumeric characters, hyphens, or underscores.\n * @param {CustomClientStrategyHandler} handler The handler for the custom strategy, which should implement the\n * methods getLocale and setLocale.\n * @returns {void}\n */\nexport function defineCustomClientStrategy(strategy, handler) {\n    if (!isCustomStrategy(strategy)) {\n        throw new Error(`Invalid custom strategy: \"${strategy}\". Must be a custom strategy following the pattern custom-name.`);\n    }\n    customClientStrategies.set(strategy, handler);\n}\n\n// ------ TYPES ------\n\n/**\n * A locale that is available in the project.\n *\n * @example\n *   setLocale(request.locale as Locale)\n *\n * @typedef {(typeof locales)[number]} Locale\n */\n\n","/* eslint-disable */\nimport { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';\n\nconst ru_hello_world_title = /** @type {(inputs: {}) => string} */ () => {\n\treturn `👋 Hello World Feature`\n};\n\nconst en_hello_world_title = /** @type {(inputs: {}) => string} */ () => {\n\treturn `👋 Hello World Feature`\n};\n\nconst de_hello_world_title = /** @type {(inputs: {}) => string} */ () => {\n\treturn `👋 Hello World Feature`\n};\n\nconst es_hello_world_title = /** @type {(inputs: {}) => string} */ () => {\n\treturn `👋 Hello World Feature`\n};\n\n/**\n* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).\n*\n* - Changing this function will be over-written by the next build.\n*\n* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or\n* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).\n* \n* @param {{}} inputs\n* @param {{ locale?: \"ru\" | \"en\" | \"de\" | \"es\" }} options\n* @returns {string}\n*/\n/* @__NO_SIDE_EFFECTS__ */\nexport const hello_world_title = (inputs = {}, options = {}) => {\n\tif (experimentalMiddlewareLocaleSplitting && isServer === false) {\n\t\treturn /** @type {any} */ (globalThis).__paraglide_ssr.hello_world_title(inputs) \n\t}\n\tconst locale = options.locale ?? getLocale()\n\ttrackMessageCall(\"hello_world_title\", locale)\n\tif (locale === \"ru\") return ru_hello_world_title(inputs)\n\tif (locale === \"en\") return en_hello_world_title(inputs)\n\tif (locale === \"de\") return de_hello_world_title(inputs)\n\treturn es_hello_world_title(inputs)\n};","/* eslint-disable */\nimport { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';\n\nconst ru_welcome_message = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Добро пожаловать, ${i.name}!`\n};\n\nconst en_welcome_message = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Welcome, ${i.name}!`\n};\n\nconst de_welcome_message = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Willkommen, ${i.name}!`\n};\n\nconst es_welcome_message = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Bienvenido, ${i.name}!`\n};\n\n/**\n* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).\n*\n* - Changing this function will be over-written by the next build.\n*\n* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or\n* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).\n* \n* @param {{ name: NonNullable<unknown> }} inputs\n* @param {{ locale?: \"ru\" | \"en\" | \"de\" | \"es\" }} options\n* @returns {string}\n*/\n/* @__NO_SIDE_EFFECTS__ */\nexport const welcome_message = (inputs, options = {}) => {\n\tif (experimentalMiddlewareLocaleSplitting && isServer === false) {\n\t\treturn /** @type {any} */ (globalThis).__paraglide_ssr.welcome_message(inputs) \n\t}\n\tconst locale = options.locale ?? getLocale()\n\ttrackMessageCall(\"welcome_message\", locale)\n\tif (locale === \"ru\") return ru_welcome_message(inputs)\n\tif (locale === \"en\") return en_welcome_message(inputs)\n\tif (locale === \"de\") return de_welcome_message(inputs)\n\treturn es_welcome_message(inputs)\n};","/* eslint-disable */\nimport { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';\n\nconst ru_feature_description = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Это демонстрационная фича из пакета @repo/features.`\n};\n\nconst en_feature_description = /** @type {(inputs: {}) => string} */ () => {\n\treturn `This is a demo feature from the @repo/features package.`\n};\n\nconst de_feature_description = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Dies ist eine Demo-Funktion aus dem @repo/features-Paket.`\n};\n\nconst es_feature_description = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Esta es una función de demostración del paquete @repo/features.`\n};\n\n/**\n* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).\n*\n* - Changing this function will be over-written by the next build.\n*\n* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or\n* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).\n* \n* @param {{}} inputs\n* @param {{ locale?: \"ru\" | \"en\" | \"de\" | \"es\" }} options\n* @returns {string}\n*/\n/* @__NO_SIDE_EFFECTS__ */\nexport const feature_description = (inputs = {}, options = {}) => {\n\tif (experimentalMiddlewareLocaleSplitting && isServer === false) {\n\t\treturn /** @type {any} */ (globalThis).__paraglide_ssr.feature_description(inputs) \n\t}\n\tconst locale = options.locale ?? getLocale()\n\ttrackMessageCall(\"feature_description\", locale)\n\tif (locale === \"ru\") return ru_feature_description(inputs)\n\tif (locale === \"en\") return en_feature_description(inputs)\n\tif (locale === \"de\") return de_feature_description(inputs)\n\treturn es_feature_description(inputs)\n};","/* eslint-disable */\nimport { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';\n\nconst ru_greet_button = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Поздороваться`\n};\n\nconst en_greet_button = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Say Hello`\n};\n\nconst de_greet_button = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Hallo sagen`\n};\n\nconst es_greet_button = /** @type {(inputs: {}) => string} */ () => {\n\treturn `Saludar`\n};\n\n/**\n* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).\n*\n* - Changing this function will be over-written by the next build.\n*\n* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or\n* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).\n* \n* @param {{}} inputs\n* @param {{ locale?: \"ru\" | \"en\" | \"de\" | \"es\" }} options\n* @returns {string}\n*/\n/* @__NO_SIDE_EFFECTS__ */\nexport const greet_button = (inputs = {}, options = {}) => {\n\tif (experimentalMiddlewareLocaleSplitting && isServer === false) {\n\t\treturn /** @type {any} */ (globalThis).__paraglide_ssr.greet_button(inputs) \n\t}\n\tconst locale = options.locale ?? getLocale()\n\ttrackMessageCall(\"greet_button\", locale)\n\tif (locale === \"ru\") return ru_greet_button(inputs)\n\tif (locale === \"en\") return en_greet_button(inputs)\n\tif (locale === \"de\") return de_greet_button(inputs)\n\treturn es_greet_button(inputs)\n};","/* eslint-disable */\nimport { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';\n\nconst ru_greeting_alert = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Hello, ${i.name}!`\n};\n\nconst en_greeting_alert = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Hello, ${i.name}!`\n};\n\nconst de_greeting_alert = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `Hallo, ${i.name}!`\n};\n\nconst es_greeting_alert = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {\n\treturn `¡Hola, ${i.name}!`\n};\n\n/**\n* This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).\n*\n* - Changing this function will be over-written by the next build.\n*\n* - If you want to change the translations, you can either edit the source files e.g. `en.json`, or\n* use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).\n* \n* @param {{ name: NonNullable<unknown> }} inputs\n* @param {{ locale?: \"ru\" | \"en\" | \"de\" | \"es\" }} options\n* @returns {string}\n*/\n/* @__NO_SIDE_EFFECTS__ */\nexport const greeting_alert = (inputs, options = {}) => {\n\tif (experimentalMiddlewareLocaleSplitting && isServer === false) {\n\t\treturn /** @type {any} */ (globalThis).__paraglide_ssr.greeting_alert(inputs) \n\t}\n\tconst locale = options.locale ?? getLocale()\n\ttrackMessageCall(\"greeting_alert\", locale)\n\tif (locale === \"ru\") return ru_greeting_alert(inputs)\n\tif (locale === \"en\") return en_greeting_alert(inputs)\n\tif (locale === \"de\") return de_greeting_alert(inputs)\n\treturn es_greeting_alert(inputs)\n};","import {\n  Button,\n  Card,\n  CardContent,\n  CardHeader,\n  CardTitle,\n  Icon,\n  IconName,\n} from \"@repo/ui\";\nimport { capitalize } from \"@repo/utils\";\n\nimport * as m from \"./paraglide/messages\";\n\nexport interface HelloWorldProps {\n  name?: string;\n  showButton?: boolean;\n  onGreet?: (name: string) => void;\n  icon?: IconName;\n}\n\n/**\n * HelloWorld Feature Component\n *\n * Демонстрационная фича, показывающая приветствие пользователю.\n * Использует компоненты из @repo/ui и утилиты из @repo/utils.\n * Поддерживает интернационализацию через Paraglide JS.\n */\nexport function HelloWorld({\n  name = \"World\",\n  showButton = true,\n  onGreet,\n  icon,\n}: HelloWorldProps) {\n  const capitalizedName = capitalize(name);\n\n  const handleGreet = () => {\n    const greeting = m.greeting_alert({ name: capitalizedName });\n    if (onGreet) {\n      onGreet(greeting);\n    } else {\n      alert(greeting);\n    }\n  };\n\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>\n          {m.hello_world_title()} {icon && <Icon name={icon} />}\n        </CardTitle>\n      </CardHeader>\n      <CardContent>\n        <p style={{ marginBottom: \"16px\", fontSize: \"16px\", color: \"#475569\" }}>\n          <span\n            dangerouslySetInnerHTML={{\n              __html: m\n                .welcome_message({ name: capitalizedName })\n                .replace(\n                  capitalizedName,\n                  `<strong>${capitalizedName}</strong>`\n                ),\n            }}\n          />\n        </p>\n        <p style={{ marginBottom: \"16px\", fontSize: \"14px\", color: \"#64748b\" }}>\n          {m.feature_description()}\n        </p>\n        {showButton && (\n          <Button onClick={handleGreet} variant=\"default\">\n            {m.greet_button()}\n          </Button>\n        )}\n      </CardContent>\n    </Card>\n  );\n}\n"],"names":["capitalize","str","Button","children","className","appName","onClick","variant","handleClick","jsx","styles","Card","CardHeader","CardTitle","CardContent","icons","Icon","name","size","color","baseLocale","locales","cookieName","cookieMaxAge","strategy","isServer","_locale","localeInitiallySet","getLocale","locale","strat","extractLocaleFromCookie","isCustomStrategy","customClientStrategies","handler","result","asserted","assertIsLocale","setLocale","navigateOrReload","newLocation","newLocale","options","optionsWithDefaults","currentLocale","customSetLocalePromises","cookieString","error","runReload","isLocale","input","match","ru_hello_world_title","en_hello_world_title","de_hello_world_title","es_hello_world_title","hello_world_title","inputs","ru_welcome_message","i","en_welcome_message","de_welcome_message","es_welcome_message","welcome_message","ru_feature_description","en_feature_description","de_feature_description","es_feature_description","feature_description","ru_greet_button","en_greet_button","de_greet_button","es_greet_button","greet_button","ru_greeting_alert","en_greeting_alert","de_greeting_alert","es_greeting_alert","greeting_alert","HelloWorld","showButton","onGreet","icon","capitalizedName","handleGreet","greeting","m.greeting_alert","m.hello_world_title","m.welcome_message","m.feature_description","m.greet_button"],"mappings":"qHAOO,SAASA,EAAWC,EAAqB,CAC9C,OAAKA,GACEA,EAAI,OAAO,CAAC,EAAE,cAAgBA,EAAI,MAAM,CAAC,CAClD,sOCUaC,EAAS,CAAC,CACrB,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,QAAAC,EACA,QAAAC,EAAU,SACZ,IAAmB,CACjB,MAAMC,EAAc,IAAM,CACpBF,EACFA,EAAA,EACSD,GACT,MAAM,mBAAmBA,CAAO,OAAO,CAE3C,EAEA,OACEI,EAAAA,IAAC,SAAA,CACC,UAAW,GAAGC,EAAO,MAAM,IAAIA,EAAOH,CAAO,CAAC,IAAIH,GAAa,EAAE,GAAG,KAAA,EACpE,QAASI,EAER,WAAWL,CAAkB,CAAA,CAAA,CAGpC,ECxCO,SAASQ,EAAK,CACnB,UAAAP,EACA,SAAAD,CACF,EAGgB,CACd,OACEM,EAAAA,IAAC,MAAA,CACC,UAAAL,EACA,MAAO,CACL,OAAQ,oBACR,aAAc,MACd,QAAS,OACT,gBAAiB,QACjB,UAAW,8BAAA,EAGZ,SAAAD,CAAA,CAAA,CAGP,CAGO,SAASS,EAAW,CACzB,UAAAR,EACA,SAAAD,CACF,EAGgB,CACd,OACEM,EAAAA,IAAC,OAAI,UAAAL,EAAsB,MAAO,CAAE,aAAc,QAC/C,SAAAD,EACH,CAEJ,CAGO,SAASU,EAAU,CACxB,U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