next-intl 3.1.4 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/development/middleware/middleware.js +6 -6
  2. package/dist/development/navigation/react-client/{BaseLink.js → ClientLink.js} +7 -7
  3. package/dist/development/navigation/react-client/{baseRedirect.js → clientRedirect.js} +7 -4
  4. package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +21 -20
  5. package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +32 -5
  6. package/dist/development/navigation/react-server/{BaseLink.js → ServerLink.js} +5 -5
  7. package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +14 -9
  8. package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +26 -6
  9. package/dist/development/navigation/react-server/{baseRedirect.js → serverRedirect.js} +8 -5
  10. package/dist/development/{shared/BaseLinkWithLocale.js → navigation/shared/BaseLink.js} +21 -16
  11. package/dist/development/navigation/shared/baseRedirect.js +16 -0
  12. package/dist/development/react-server/NextIntlClientProvider.js +3 -3
  13. package/dist/development/react-server/getBaseTranslator.js +1 -1
  14. package/dist/development/react-server/useFormatter.js +1 -1
  15. package/dist/development/react-server/useLocale.js +1 -1
  16. package/dist/development/react-server/useMessages.js +1 -1
  17. package/dist/development/react-server/useNow.js +1 -1
  18. package/dist/development/react-server/useTimeZone.js +1 -1
  19. package/dist/development/server/react-client/index.js +34 -0
  20. package/dist/development/server/{RequestLocale.js → react-server/RequestLocale.js} +1 -1
  21. package/dist/development/server.react-client.js +16 -0
  22. package/dist/development/server.react-server.js +23 -0
  23. package/dist/development/shared/utils.js +7 -7
  24. package/dist/esm/middleware/middleware.js +1 -1
  25. package/dist/esm/navigation/react-client/ClientLink.js +1 -0
  26. package/dist/esm/navigation/react-client/clientRedirect.js +1 -0
  27. package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
  28. package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
  29. package/dist/esm/navigation/react-server/{BaseLink.js → ServerLink.js} +1 -1
  30. package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
  31. package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
  32. package/dist/esm/navigation/react-server/serverRedirect.js +1 -0
  33. package/dist/esm/navigation/shared/BaseLink.js +2 -0
  34. package/dist/esm/navigation/shared/baseRedirect.js +1 -0
  35. package/dist/esm/react-server/NextIntlClientProvider.js +1 -1
  36. package/dist/esm/react-server/getBaseTranslator.js +1 -1
  37. package/dist/esm/react-server/useFormatter.js +1 -1
  38. package/dist/esm/react-server/useLocale.js +1 -1
  39. package/dist/esm/react-server/useMessages.js +1 -1
  40. package/dist/esm/react-server/useNow.js +1 -1
  41. package/dist/esm/react-server/useTimeZone.js +1 -1
  42. package/dist/esm/server/react-client/index.js +1 -0
  43. package/dist/esm/server/react-server/RequestLocale.js +1 -0
  44. package/dist/esm/server.react-client.js +1 -0
  45. package/dist/esm/server.react-server.js +1 -0
  46. package/dist/esm/shared/utils.js +1 -1
  47. package/dist/production/middleware/middleware.js +1 -1
  48. package/dist/production/navigation/react-client/ClientLink.js +1 -0
  49. package/dist/production/navigation/react-client/clientRedirect.js +1 -0
  50. package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
  51. package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
  52. package/dist/production/navigation/react-server/ServerLink.js +1 -0
  53. package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
  54. package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
  55. package/dist/production/navigation/react-server/serverRedirect.js +1 -0
  56. package/dist/production/navigation/shared/BaseLink.js +2 -0
  57. package/dist/production/navigation/shared/baseRedirect.js +1 -0
  58. package/dist/production/react-server/NextIntlClientProvider.js +1 -1
  59. package/dist/production/react-server/getBaseTranslator.js +1 -1
  60. package/dist/production/react-server/useFormatter.js +1 -1
  61. package/dist/production/react-server/useLocale.js +1 -1
  62. package/dist/production/react-server/useMessages.js +1 -1
  63. package/dist/production/react-server/useNow.js +1 -1
  64. package/dist/production/react-server/useTimeZone.js +1 -1
  65. package/dist/production/server/react-client/index.js +1 -0
  66. package/dist/production/server/react-server/RequestLocale.js +1 -0
  67. package/dist/production/server.react-client.js +1 -0
  68. package/dist/production/server.react-server.js +1 -0
  69. package/dist/production/shared/utils.js +1 -1
  70. package/dist/server.react-client.js +7 -0
  71. package/dist/server.react-server.js +7 -0
  72. package/dist/types/src/middleware/NextIntlMiddlewareConfig.d.ts +1 -2
  73. package/dist/types/src/navigation/react-client/{BaseLink.d.ts → ClientLink.d.ts} +5 -4
  74. package/dist/types/src/navigation/react-client/clientRedirect.d.ts +6 -0
  75. package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +7 -5
  76. package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +44 -7
  77. package/dist/types/src/navigation/react-client/useBasePathname.d.ts +1 -1
  78. package/dist/types/src/navigation/react-server/ServerLink.d.ts +8 -0
  79. package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +5 -3
  80. package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +6 -38
  81. package/dist/types/src/navigation/react-server/serverRedirect.d.ts +6 -0
  82. package/dist/types/src/navigation/shared/BaseLink.d.ts +9 -0
  83. package/dist/types/src/navigation/shared/baseRedirect.d.ts +7 -0
  84. package/dist/types/src/server/react-client/index.d.ts +15 -0
  85. package/dist/types/src/server.react-client.d.ts +1 -0
  86. package/dist/types/src/server.react-server.d.ts +1 -0
  87. package/dist/types/src/shared/types.d.ts +1 -0
  88. package/dist/types/src/shared/utils.d.ts +3 -3
  89. package/dist/types/test/navigation/react-client/ClientLink.test.d.ts +1 -0
  90. package/dist/types/test/server/react-server/index.test.d.ts +1 -0
  91. package/package.json +17 -11
  92. package/server.d.ts +1 -1
  93. package/dist/development/server.js +0 -23
  94. package/dist/development/shared/redirectWithLocale.js +0 -16
  95. package/dist/esm/navigation/react-client/BaseLink.js +0 -1
  96. package/dist/esm/navigation/react-client/baseRedirect.js +0 -1
  97. package/dist/esm/navigation/react-server/baseRedirect.js +0 -1
  98. package/dist/esm/server/RequestLocale.js +0 -1
  99. package/dist/esm/server.js +0 -1
  100. package/dist/esm/shared/BaseLinkWithLocale.js +0 -2
  101. package/dist/esm/shared/redirectWithLocale.js +0 -1
  102. package/dist/production/navigation/react-client/BaseLink.js +0 -1
  103. package/dist/production/navigation/react-client/baseRedirect.js +0 -1
  104. package/dist/production/navigation/react-server/BaseLink.js +0 -1
  105. package/dist/production/navigation/react-server/baseRedirect.js +0 -1
  106. package/dist/production/server/RequestLocale.js +0 -1
  107. package/dist/production/server.js +0 -1
  108. package/dist/production/shared/BaseLinkWithLocale.js +0 -2
  109. package/dist/production/shared/redirectWithLocale.js +0 -1
  110. package/dist/server.js +0 -7
  111. package/dist/types/src/navigation/react-client/baseRedirect.d.ts +0 -3
  112. package/dist/types/src/navigation/react-server/BaseLink.d.ts +0 -8
  113. package/dist/types/src/navigation/react-server/baseRedirect.d.ts +0 -3
  114. package/dist/types/src/server.d.ts +0 -1
  115. package/dist/types/src/shared/BaseLinkWithLocale.d.ts +0 -7
  116. package/dist/types/src/shared/redirectWithLocale.d.ts +0 -3
  117. /package/dist/development/server/{createRequestConfig.js → react-server/createRequestConfig.js} +0 -0
  118. /package/dist/development/server/{getConfig.js → react-server/getConfig.js} +0 -0
  119. /package/dist/development/server/{getFormatter.js → react-server/getFormatter.js} +0 -0
  120. /package/dist/development/server/{getLocale.js → react-server/getLocale.js} +0 -0
  121. /package/dist/development/server/{getMessages.js → react-server/getMessages.js} +0 -0
  122. /package/dist/development/server/{getNow.js → react-server/getNow.js} +0 -0
  123. /package/dist/development/server/{getRequestConfig.js → react-server/getRequestConfig.js} +0 -0
  124. /package/dist/development/server/{getTimeZone.js → react-server/getTimeZone.js} +0 -0
  125. /package/dist/development/server/{getTranslations.js → react-server/getTranslations.js} +0 -0
  126. /package/dist/development/server/{resolveLocaleArg.js → react-server/resolveLocaleArg.js} +0 -0
  127. /package/dist/esm/server/{createRequestConfig.js → react-server/createRequestConfig.js} +0 -0
  128. /package/dist/esm/server/{getConfig.js → react-server/getConfig.js} +0 -0
  129. /package/dist/esm/server/{getFormatter.js → react-server/getFormatter.js} +0 -0
  130. /package/dist/esm/server/{getLocale.js → react-server/getLocale.js} +0 -0
  131. /package/dist/esm/server/{getMessages.js → react-server/getMessages.js} +0 -0
  132. /package/dist/esm/server/{getNow.js → react-server/getNow.js} +0 -0
  133. /package/dist/esm/server/{getRequestConfig.js → react-server/getRequestConfig.js} +0 -0
  134. /package/dist/esm/server/{getTimeZone.js → react-server/getTimeZone.js} +0 -0
  135. /package/dist/esm/server/{getTranslations.js → react-server/getTranslations.js} +0 -0
  136. /package/dist/esm/server/{resolveLocaleArg.js → react-server/resolveLocaleArg.js} +0 -0
  137. /package/dist/production/server/{createRequestConfig.js → react-server/createRequestConfig.js} +0 -0
  138. /package/dist/production/server/{getConfig.js → react-server/getConfig.js} +0 -0
  139. /package/dist/production/server/{getFormatter.js → react-server/getFormatter.js} +0 -0
  140. /package/dist/production/server/{getLocale.js → react-server/getLocale.js} +0 -0
  141. /package/dist/production/server/{getMessages.js → react-server/getMessages.js} +0 -0
  142. /package/dist/production/server/{getNow.js → react-server/getNow.js} +0 -0
  143. /package/dist/production/server/{getRequestConfig.js → react-server/getRequestConfig.js} +0 -0
  144. /package/dist/production/server/{getTimeZone.js → react-server/getTimeZone.js} +0 -0
  145. /package/dist/production/server/{getTranslations.js → react-server/getTranslations.js} +0 -0
  146. /package/dist/production/server/{resolveLocaleArg.js → react-server/resolveLocaleArg.js} +0 -0
  147. /package/dist/types/src/server/{RequestLocale.d.ts → react-server/RequestLocale.d.ts} +0 -0
  148. /package/dist/types/src/server/{createRequestConfig.d.ts → react-server/createRequestConfig.d.ts} +0 -0
  149. /package/dist/types/src/server/{getConfig.d.ts → react-server/getConfig.d.ts} +0 -0
  150. /package/dist/types/src/server/{getFormatter.d.ts → react-server/getFormatter.d.ts} +0 -0
  151. /package/dist/types/src/server/{getLocale.d.ts → react-server/getLocale.d.ts} +0 -0
  152. /package/dist/types/src/server/{getMessages.d.ts → react-server/getMessages.d.ts} +0 -0
  153. /package/dist/types/src/server/{getNow.d.ts → react-server/getNow.d.ts} +0 -0
  154. /package/dist/types/src/server/{getRequestConfig.d.ts → react-server/getRequestConfig.d.ts} +0 -0
  155. /package/dist/types/src/server/{getTimeZone.d.ts → react-server/getTimeZone.d.ts} +0 -0
  156. /package/dist/types/src/server/{getTranslations.d.ts → react-server/getTranslations.d.ts} +0 -0
  157. /package/dist/types/src/server/{index.d.ts → react-server/index.d.ts} +0 -0
  158. /package/dist/types/src/server/{resolveLocaleArg.d.ts → react-server/resolveLocaleArg.d.ts} +0 -0
  159. /package/dist/types/test/navigation/{react-client/BaseLink.test.d.ts → createLocalizedPathnamesNavigation.test.d.ts} +0 -0
  160. /package/dist/types/test/{server/index.test.d.ts → navigation/createSharedPathnamesNavigation.test.d.ts} +0 -0
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var getRequestConfig = require('./server/react-server/getRequestConfig.js');
6
+ var getFormatter = require('./server/react-server/getFormatter.js');
7
+ var getNow = require('./server/react-server/getNow.js');
8
+ var getTimeZone = require('./server/react-server/getTimeZone.js');
9
+ var getTranslations = require('./server/react-server/getTranslations.js');
10
+ var getMessages = require('./server/react-server/getMessages.js');
11
+ var getLocale = require('./server/react-server/getLocale.js');
12
+ var RequestLocale = require('./server/react-server/RequestLocale.js');
13
+
14
+
15
+
16
+ exports.getRequestConfig = getRequestConfig.default;
17
+ exports.getFormatter = getFormatter.default;
18
+ exports.getNow = getNow.default;
19
+ exports.getTimeZone = getTimeZone.default;
20
+ exports.getTranslations = getTranslations.default;
21
+ exports.getMessages = getMessages.default;
22
+ exports.getLocale = getLocale.default;
23
+ exports.unstable_setRequestLocale = RequestLocale.setRequestLocale;
@@ -15,14 +15,14 @@ function isLocalHref(href) {
15
15
  }
16
16
  }
17
17
  function localizeHref(href, locale) {
18
- let defaultLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : locale;
18
+ let curLocale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : locale;
19
19
  let pathname = arguments.length > 3 ? arguments[3] : undefined;
20
20
  if (!isLocalHref(href) || isRelativeHref(href)) {
21
21
  return href;
22
22
  }
23
- const isSwitchingLocale = locale !== defaultLocale;
23
+ const isSwitchingLocale = locale !== curLocale;
24
24
  const isPathnamePrefixed = locale == null || hasPathnamePrefixed(locale, pathname);
25
- const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;
25
+ const shouldPrefix = isSwitchingLocale || isPathnamePrefixed;
26
26
  if (shouldPrefix && locale != null) {
27
27
  return prefixHref(href, locale);
28
28
  }
@@ -31,13 +31,13 @@ function localizeHref(href, locale) {
31
31
  function prefixHref(href, locale) {
32
32
  let prefixedHref;
33
33
  if (typeof href === 'string') {
34
- prefixedHref = localizePathname(locale, href);
34
+ prefixedHref = prefixPathname(locale, href);
35
35
  } else {
36
36
  prefixedHref = {
37
37
  ...href
38
38
  };
39
39
  if (href.pathname) {
40
- prefixedHref.pathname = localizePathname(locale, href.pathname);
40
+ prefixedHref.pathname = prefixPathname(locale, href.pathname);
41
41
  }
42
42
  }
43
43
  return prefixedHref;
@@ -45,7 +45,7 @@ function prefixHref(href, locale) {
45
45
  function unlocalizePathname(pathname, locale) {
46
46
  return pathname.replace(new RegExp("^/".concat(locale)), '') || '/';
47
47
  }
48
- function localizePathname(locale, pathname) {
48
+ function prefixPathname(locale, pathname) {
49
49
  let localizedHref = '/' + locale;
50
50
 
51
51
  // Avoid trailing slashes
@@ -80,8 +80,8 @@ exports.hasPathnamePrefixed = hasPathnamePrefixed;
80
80
  exports.isLocalHref = isLocalHref;
81
81
  exports.isRelativeHref = isRelativeHref;
82
82
  exports.localizeHref = localizeHref;
83
- exports.localizePathname = localizePathname;
84
83
  exports.matchesPathname = matchesPathname;
85
84
  exports.prefixHref = prefixHref;
85
+ exports.prefixPathname = prefixPathname;
86
86
  exports.templateToRegex = templateToRegex;
87
87
  exports.unlocalizePathname = unlocalizePathname;
@@ -1 +1 @@
1
- import{NextResponse as e}from"next/server";import{COOKIE_LOCALE_NAME as o,HEADER_LOCALE_NAME as l}from"../shared/constants.js";import{matchesPathname as n}from"../shared/utils.js";import t from"./getAlternateLinksHeaderValue.js";import a from"./resolveLocale.js";import{isLocaleSupportedOnDomain as r,getNormalizedPathname as i,getKnownLocaleFromPathname as s,getInternalTemplate as c,formatTemplatePathname as d,getPathWithSearch as f,getBasePath as u,getBestMatchingDomain as m}from"./utils.js";function v(v){const h=function(e){var o,l,n;return{...e,alternateLinks:null===(o=e.alternateLinks)||void 0===o||o,localePrefix:null!==(l=e.localePrefix)&&void 0!==l?l:"always",localeDetection:null===(n=e.localeDetection)||void 0===n||n}}(v);return function(v){var p,x;const{domain:L,locale:P}=a(h,v.headers,v.cookies,v.nextUrl.pathname),g=h.localeDetection&&(null===(p=v.cookies.get(o))||void 0===p?void 0:p.value)!==P,U=L?L.defaultLocale===P:P===h.defaultLocale,k=(null===(x=h.domains)||void 0===x?void 0:x.filter((e=>r(P,e))))||[],w=null!=h.domains&&!L;function j(o){return e.rewrite(new URL(o,v.url),function(){const e=new Headers(v.headers);return e.set(l,P),{request:{headers:e}}}())}function y(o,l){const n=new URL(o,v.url);if(k.length>0&&!l){const e=m(L,P,k);e&&(l=e.domain,e.defaultLocale===P&&"as-needed"===h.localePrefix&&(n.pathname=n.pathname.replace("/".concat(P),"")))}var t;l&&(n.protocol=null!==(t=v.headers.get("x-forwarded-proto"))&&void 0!==t?t:v.nextUrl.protocol,n.port="",n.host=l);return e.redirect(n.toString())}const D=i(v.nextUrl.pathname,h.locales),q=s(v.nextUrl.pathname,h.locales),A=null!=q;let H,R,S=v.nextUrl.pathname;if(h.pathnames){let e;if([e=P,R]=c(h.pathnames,D),R){const o=h.pathnames[R],l="string"==typeof o?o:o[P];if(n(l,D))S=d(D,l,R,q);else{const n=h.defaultLocale===P||(null==L?void 0:L.defaultLocale)===P;H=y(f(d(D,"string"==typeof o?o:o[e],l,q||!n?P:void 0),v.nextUrl.search))}}}if(!H)if("/"===S){const e=f("/".concat(P),v.nextUrl.search);H="never"===h.localePrefix||U&&"as-needed"===h.localePrefix?j(e):y(e)}else{const e=f(S,v.nextUrl.search);if(A){const o=u(e,q);if("never"===h.localePrefix)H=y(o);else if(q===P)if(U&&"as-needed"===h.localePrefix)H=y(o);else if(h.domains){const l=m(L,q,k);H=(null==L?void 0:L.domain)===(null==l?void 0:l.domain)||w?j(e):y(o,null==l?void 0:l.domain)}else H=j(e);else H=y("/".concat(P).concat(o))}else H="never"===h.localePrefix||U&&("as-needed"===h.localePrefix||h.domains)?j("/".concat(P).concat(e)):y("/".concat(P).concat(e))}var z;(g&&H.cookies.set(o,P,{sameSite:"strict",maxAge:31536e3}),"never"!==h.localePrefix&&h.alternateLinks&&h.locales.length>1)&&H.headers.set("Link",t({config:h,localizedPathnames:null!=R?null===(z=h.pathnames)||void 0===z?void 0:z[R]:void 0,request:v,resolvedLocale:P}));return H}}export{v as default};
1
+ import{NextResponse as e}from"next/server";import{COOKIE_LOCALE_NAME as o,HEADER_LOCALE_NAME as l}from"../shared/constants.js";import{matchesPathname as n}from"../shared/utils.js";import t from"./getAlternateLinksHeaderValue.js";import a from"./resolveLocale.js";import{isLocaleSupportedOnDomain as r,getNormalizedPathname as i,getKnownLocaleFromPathname as s,getInternalTemplate as c,formatTemplatePathname as d,getPathWithSearch as f,getBasePath as u,getBestMatchingDomain as m}from"./utils.js";function v(v){const h=function(e){var o,l,n;return{...e,alternateLinks:null===(o=e.alternateLinks)||void 0===o||o,localePrefix:null!==(l=e.localePrefix)&&void 0!==l?l:"always",localeDetection:null===(n=e.localeDetection)||void 0===n||n}}(v);return function(v){var p,x;const{domain:L,locale:P}=a(h,v.headers,v.cookies,v.nextUrl.pathname),U=h.localeDetection&&(null===(p=v.cookies.get(o))||void 0===p?void 0:p.value)!==P,g=L?L.defaultLocale===P:P===h.defaultLocale,k=(null===(x=h.domains)||void 0===x?void 0:x.filter((e=>r(P,e))))||[],w=null!=h.domains&&!L;function j(o){return e.rewrite(new URL(o,v.url),function(){const e=new Headers(v.headers);return e.set(l,P),{request:{headers:e}}}())}function y(o,l){const n=new URL(o,v.url);if(k.length>0&&!l){const e=m(L,P,k);e&&(l=e.domain,e.defaultLocale===P&&"as-needed"===h.localePrefix&&(n.pathname=n.pathname.replace("/".concat(P),"")))}var t;l&&(n.protocol=null!==(t=v.headers.get("x-forwarded-proto"))&&void 0!==t?t:v.nextUrl.protocol,n.port="",n.host=l);return e.redirect(n.toString())}const D=i(v.nextUrl.pathname,h.locales),q=s(v.nextUrl.pathname,h.locales),A=null!=q;let H,R,S=v.nextUrl.pathname;if(h.pathnames){let e;if([e=P,R]=c(h.pathnames,D),R){const o=h.pathnames[R],l="string"==typeof o?o:o[P];if(n(l,D))S=d(D,l,R,q);else{const n=h.defaultLocale===P||(null==L?void 0:L.defaultLocale)===P;H=y(f(d(D,"string"==typeof o?o:o[e],l,q||!n?P:void 0),v.nextUrl.search))}}}if(!H)if("/"===S){const e=f("/".concat(P),v.nextUrl.search);H="never"===h.localePrefix||g&&"as-needed"===h.localePrefix?j(e):y(e)}else{const e=f(S,v.nextUrl.search);if(A){const o=u(f(D,v.nextUrl.search),q);if("never"===h.localePrefix)H=y(o);else if(q===P)if(g&&"as-needed"===h.localePrefix)H=y(o);else if(h.domains){const l=m(L,q,k);H=(null==L?void 0:L.domain)===(null==l?void 0:l.domain)||w?j(e):y(o,null==l?void 0:l.domain)}else H=j(e);else H=y("/".concat(P).concat(o))}else H="never"===h.localePrefix||g&&("as-needed"===h.localePrefix||h.domains)?j("/".concat(P).concat(e)):y("/".concat(P).concat(e))}var z;(U&&H.cookies.set(o,P,{sameSite:"strict",maxAge:31536e3}),"never"!==h.localePrefix&&h.alternateLinks&&h.locales.length>1)&&H.headers.set("Link",t({config:h,localizedPathnames:null!=R?null===(z=h.pathnames)||void 0===z?void 0:z[R]:void 0,request:v,resolvedLocale:P}));return H}}export{v as default};
@@ -0,0 +1 @@
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import a from"../../react-client/useLocale.js";import l from"../shared/BaseLink.js";function o(t,o){let{locale:n,...s}=t;const i=a(),c=n||i;return r.createElement(l,e({ref:o,hrefLang:c,locale:c},s))}const n=t(o);n.displayName="ClientLink";var s=n;export{s as default};
@@ -0,0 +1 @@
1
+ import e from"../../react-client/useLocale.js";import r from"../shared/baseRedirect.js";function t(t){let a;try{a=e()}catch(e){throw new Error("`redirect()` can only be called during render. To redirect in an event handler or similar, you can use `useRouter()` instead.")}for(var n=arguments.length,o=new Array(n>1?n-1:0),c=1;c<n;c++)o[c-1]=arguments[c];return r({...t,locale:a},...o)}export{t as default};
@@ -1 +1 @@
1
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import o from"../../react-client/useLocale.js";import{getRoute as a,compileLocalizedPathname as n,normalizeNameOrNameWithParams as l}from"../shared/utils.js";import c from"./BaseLink.js";import s from"./baseRedirect.js";import u from"./useBasePathname.js";import i from"./useBaseRouter.js";function f(f){let{locales:m,pathnames:p}=f;function h(){const e=o();if(!m.includes(e))throw new Error('Unknown locale encountered: "'.concat(e,'". Make sure to validate the locale in `app/[locale]/layout.tsx`.'));return e}function d(t,o){let{href:a,locale:l,...s}=t;const u=h(),i=l||u;return r.createElement(c,e({ref:o,href:n({locale:i,pathname:a,params:"object"==typeof a?a.params:void 0,pathnames:p}),locale:l},s))}const v=t(d);function j(e){let{href:r,locale:t}=e;return n({...l(r),locale:t,pathnames:p})}return v.displayName="Link",{Link:v,redirect:function(e){const r=j({href:e,locale:h()});for(var t=arguments.length,o=new Array(t>1?t-1:0),a=1;a<t;a++)o[a-1]=arguments[a];return s(r,...o)},usePathname:function(){const e=u(),r=h();return a({pathname:e,locale:r,pathnames:p})},useRouter:function(){const e=i(),r=h();return{...e,push(t){for(var o,a=arguments.length,n=new Array(a>1?a-1:0),l=1;l<a;l++)n[l-1]=arguments[l];const c=j({href:t,locale:(null===(o=n[0])||void 0===o?void 0:o.locale)||r});return e.push(c,...n)},replace(t){for(var o,a=arguments.length,n=new Array(a>1?a-1:0),l=1;l<a;l++)n[l-1]=arguments[l];const c=j({href:t,locale:(null===(o=n[0])||void 0===o?void 0:o.locale)||r});return e.replace(c,...n)},prefetch(t){for(var o,a=arguments.length,n=new Array(a>1?a-1:0),l=1;l<a;l++)n[l-1]=arguments[l];const c=j({href:t,locale:(null===(o=n[0])||void 0===o?void 0:o.locale)||r});return e.prefetch(c,...n)}}},getPathname:j}}export{f as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import a from"../../react-client/useLocale.js";import{getRoute as o,compileLocalizedPathname as n,normalizeNameOrNameWithParams as l}from"../shared/utils.js";import c from"./ClientLink.js";import s from"./clientRedirect.js";import i from"./useBasePathname.js";import u from"./useBaseRouter.js";function f(f){function m(){const e=a();if(!f.locales.includes(e))throw new Error('Unknown locale encountered: "'.concat(e,'". Make sure to validate the locale in `app/[locale]/layout.tsx`.'));return e}function p(t,a){let{href:o,locale:l,...s}=t;const i=m(),u=l||i;return r.createElement(c,e({ref:a,href:n({locale:u,pathname:o,params:"object"==typeof o?o.params:void 0,pathnames:f.pathnames}),locale:l,localePrefix:f.localePrefix},s))}const h=t(p);function d(e){let{href:r,locale:t}=e;return n({...l(r),locale:t,pathnames:f.pathnames})}return h.displayName="Link",{Link:h,redirect:function(e){const r=d({href:e,locale:m()});for(var t=arguments.length,a=new Array(t>1?t-1:0),o=1;o<t;o++)a[o-1]=arguments[o];return s({...f,pathname:r},...a)},usePathname:function(){const e=i(),r=m();return e?o({pathname:e,locale:r,pathnames:f.pathnames}):e},useRouter:function(){const e=u(),r=m();return{...e,push(t){for(var a,o=arguments.length,n=new Array(o>1?o-1:0),l=1;l<o;l++)n[l-1]=arguments[l];const c=d({href:t,locale:(null===(a=n[0])||void 0===a?void 0:a.locale)||r});return e.push(c,...n)},replace(t){for(var a,o=arguments.length,n=new Array(o>1?o-1:0),l=1;l<o;l++)n[l-1]=arguments[l];const c=d({href:t,locale:(null===(a=n[0])||void 0===a?void 0:a.locale)||r});return e.replace(c,...n)},prefetch(t){for(var a,o=arguments.length,n=new Array(o>1?o-1:0),l=1;l<o;l++)n[l-1]=arguments[l];const c=d({href:t,locale:(null===(a=n[0])||void 0===a?void 0:a.locale)||r});return e.prefetch(c,...n)}}},getPathname:d}}export{f as default};
@@ -1 +1 @@
1
- import e from"./BaseLink.js";import r from"./baseRedirect.js";import t from"./useBasePathname.js";import s from"./useBaseRouter.js";function o(o){return{Link:e,redirect:r,usePathname:t,useRouter:s}}export{o as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r,{forwardRef as t}from"react";import n from"./ClientLink.js";import o from"./clientRedirect.js";import i from"./useBasePathname.js";import a from"./useBaseRouter.js";function u(u){function m(t,o){return r.createElement(n,e({ref:o,localePrefix:u.localePrefix},t))}const s=t(m);return s.displayName="Link",{Link:s,redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return o({...u,pathname:e},...t)},usePathname:function(){return i()},useRouter:a}}export{u as default};
@@ -1 +1 @@
1
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"../../shared/BaseLinkWithLocale.js";import a from"../../server/getLocale.js";async function l(l){let{locale:o,...s}=l;return r.createElement(t,e({locale:o||await a()},s))}export{l as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"../shared/BaseLink.js";import a from"../../server/react-server/getLocale.js";async function l(l){let{locale:o,...s}=l;return r.createElement(t,e({locale:o||await a()},s))}export{l as default};
@@ -1 +1 @@
1
- import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import{getRequestLocale as r}from"../../server/RequestLocale.js";import{compileLocalizedPathname as o,normalizeNameOrNameWithParams as n}from"../shared/utils.js";import a from"./BaseLink.js";import s from"./baseRedirect.js";function l(l){let{locales:u,pathnames:c}=l;function m(e){let{href:t,locale:r}=e;return o({...n(t),locale:r,pathnames:c})}function i(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(n){let{href:s,locale:l,...u}=n;const m=r(),i=l||m;return t.createElement(a,e({href:o({locale:i,pathname:s,params:"object"==typeof s?s.params:void 0,pathnames:c}),locale:l},u))},redirect:function(e){const t=m({href:e,locale:r()});for(var o=arguments.length,n=new Array(o>1?o-1:0),a=1;a<o;a++)n[a-1]=arguments[a];return s(t,...n)},getPathname:m,usePathname:i("usePathname"),useRouter:i("useRouter")}}export{l as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import{getRequestLocale as t}from"../../server/react-server/RequestLocale.js";import{compileLocalizedPathname as o,normalizeNameOrNameWithParams as a}from"../shared/utils.js";import n from"./ServerLink.js";import l from"./serverRedirect.js";function s(s){let{localePrefix:c,locales:i,pathnames:m}=s;function u(e){let{href:r,locale:t}=e;return o({...a(r),locale:t,pathnames:m})}function f(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(a){let{href:l,locale:s,...i}=a;const u=t(),f=s||u;return r.createElement(n,e({href:o({locale:f,pathname:l,params:"object"==typeof l?l.params:void 0,pathnames:m}),locale:s,localePrefix:c},i))},redirect:function(e){const r=u({href:e,locale:t()});for(var o=arguments.length,a=new Array(o>1?o-1:0),n=1;n<o;n++)a[n-1]=arguments[n];return l({localePrefix:c,pathname:r},...a)},getPathname:u,usePathname:f("usePathname"),useRouter:f("useRouter")}}export{s as default};
@@ -1 +1 @@
1
- import e from"./BaseLink.js";import o from"./baseRedirect.js";function t(t){function n(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:e,redirect:o,usePathname:n("usePathname"),useRouter:n("useRouter")}}export{t as default};
1
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"./ServerLink.js";import o from"./serverRedirect.js";function n(n){function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(o){return r.createElement(t,e({localePrefix:n.localePrefix},o))},redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),u=1;u<r;u++)t[u-1]=arguments[u];return o({...n,pathname:e},...t)},usePathname:u("usePathname"),useRouter:u("useRouter")}}export{n as default};
@@ -0,0 +1 @@
1
+ import{getRequestLocale as e}from"../../server/react-server/RequestLocale.js";import r from"../shared/baseRedirect.js";function t(t){const o=e();for(var a=arguments.length,s=new Array(a>1?a-1:0),c=1;c<a;c++)s[c-1]=arguments[c];return r({...t,locale:o},...s)}export{t as default};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ import{extends as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"next/link";import{usePathname as t}from"next/navigation";import o,{forwardRef as l,useState as n,useEffect as i}from"react";import a from"../../react-client/useLocale.js";import{isLocalHref as p,prefixHref as c,localizeHref as s}from"../../shared/utils.js";function f(l,f){let{href:m,locale:u,localePrefix:h,prefetch:d,...v}=l;const x=t(),g=a(),j=u!==g,[k,L]=n((()=>p(m)&&("never"!==h||j)?c(m,u):m));return i((()=>{x&&"never"!==h&&L(s(m,u,g,null!=x?x:void 0))}),[g,m,u,h,x]),j&&(d&&console.error("The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`"),d=!1),o.createElement(r,e({ref:f,href:k,prefetch:d},v))}const m=l(f);m.displayName="ClientLink";var u=m;export{u as default};
@@ -0,0 +1 @@
1
+ import{redirect as e}from"next/navigation";import{prefixPathname as r}from"../../shared/utils.js";function a(a){const t="never"===a.localePrefix?a.pathname:r(a.locale,a.pathname);for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e(t,...o)}export{a as default};
@@ -1 +1 @@
1
- import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"../shared/NextIntlClientProvider.js";import o from"../server/getLocale.js";import l from"../server/getNow.js";import a from"../server/getTimeZone.js";async function i(i){let{locale:n,now:m,timeZone:s,...p}=i;return r.createElement(t,e({locale:null!=n?n:await o(),now:null!=m?m:await l(),timeZone:null!=s?s:await a()},p))}export{i as default};
1
+ import{extends as e}from"../_virtual/_rollupPluginBabelHelpers.js";import r from"react";import t from"../shared/NextIntlClientProvider.js";import o from"../server/react-server/getLocale.js";import l from"../server/react-server/getNow.js";import a from"../server/react-server/getTimeZone.js";async function i(i){let{locale:n,now:s,timeZone:m,...c}=i;return r.createElement(t,e({locale:null!=n?n:await o(),now:null!=s?s:await l(),timeZone:null!=m?m:await a()},c))}export{i as default};
@@ -1 +1 @@
1
- import{cache as e}from"react";import{createTranslator as s}from"use-intl/core";import a from"../server/getConfig.js";const r=e((()=>new Map));var t=e((async function(e,t){const o=await a(e);return s({...o,messageFormatCache:r(),namespace:t,messages:o.messages})}));export{t as default};
1
+ import{cache as e}from"react";import{createTranslator as r}from"use-intl/core";import s from"../server/react-server/getConfig.js";const a=e((()=>new Map));var t=e((async function(e,t){const o=await s(e);return r({...o,messageFormatCache:a(),namespace:t,messages:o.messages})}));export{t as default};
@@ -1 +1 @@
1
- import r from"../server/getFormatter.js";import o from"./useHook.js";import e from"./useLocale.js";function t(){for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];const m=e();return o("useFormatter",r({locale:m}))}export{t as default};
1
+ import r from"../server/react-server/getFormatter.js";import e from"./useHook.js";import o from"./useLocale.js";function t(){for(var t=arguments.length,s=new Array(t),a=0;a<t;a++)s[a]=arguments[a];const m=o();return e("useFormatter",r({locale:m}))}export{t as default};
@@ -1 +1 @@
1
- import{getRequestLocale as r}from"../server/RequestLocale.js";function e(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return r()}export{e as default};
1
+ import{getRequestLocale as r}from"../server/react-server/RequestLocale.js";function e(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return r()}export{e as default};
@@ -1 +1 @@
1
- import e from"../server/getMessages.js";import r from"./useHook.js";import s from"./useLocale.js";function o(){for(var o=arguments.length,t=new Array(o),a=0;a<o;a++)t[a]=arguments[a];const f=s();return r("useMessages",e({locale:f}))}export{o as default};
1
+ import e from"../server/react-server/getMessages.js";import r from"./useHook.js";import s from"./useLocale.js";function o(){for(var o=arguments.length,t=new Array(o),a=0;a<o;a++)t[a]=arguments[a];const f=s();return r("useMessages",e({locale:f}))}export{o as default};
@@ -1 +1 @@
1
- import e from"../server/getNow.js";import o from"./useHook.js";import t from"./useLocale.js";function n(){for(var n=arguments.length,r=new Array(n),l=0;l<n;l++)r[l]=arguments[l];let[u]=r;null!=(null==u?void 0:u.updateInterval)&&console.error("`useNow` doesn't support the `updateInterval` option in Server Components, the value will be ignored. If you need the value to update, you can convert the component to a Client Component.");const a=t();return o("useNow",e({locale:a}))}export{n as default};
1
+ import e from"../server/react-server/getNow.js";import o from"./useHook.js";import t from"./useLocale.js";function r(){for(var r=arguments.length,n=new Array(r),l=0;l<r;l++)n[l]=arguments[l];let[u]=n;null!=(null==u?void 0:u.updateInterval)&&console.error("`useNow` doesn't support the `updateInterval` option in Server Components, the value will be ignored. If you need the value to update, you can convert the component to a Client Component.");const a=t();return o("useNow",e({locale:a}))}export{r as default};
@@ -1 +1 @@
1
- import e from"../server/getTimeZone.js";import o from"./useHook.js";import r from"./useLocale.js";function t(){for(var t=arguments.length,s=new Array(t),m=0;m<t;m++)s[m]=arguments[m];const n=r();return o("useTimeZone",e({locale:n}))}export{t as default};
1
+ import e from"../server/react-server/getTimeZone.js";import r from"./useHook.js";import o from"./useLocale.js";function t(){for(var t=arguments.length,s=new Array(t),m=0;m<t;m++)s[m]=arguments[m];const n=o();return r("useTimeZone",e({locale:n}))}export{t as default};
@@ -0,0 +1 @@
1
+ function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}const t=e("getRequestConfig"),o=e("getFormatter"),n=e("getNow"),s=e("getTimeZone"),r=e("getTranslations"),g=e("getMessages"),a=e("getLocale"),i=e("unstable_setRequestLocale");export{o as getFormatter,a as getLocale,g as getMessages,n as getNow,t as getRequestConfig,s as getTimeZone,r as getTranslations,i as unstable_setRequestLocale};
@@ -0,0 +1 @@
1
+ import{headers as e}from"next/headers";import{cache as t}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";const r=t((()=>{let t;try{t=e().get(n)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components#static-rendering",{cause:e}):e}if(!t)throw new Error("Unable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale");return t})),o=t((()=>({locale:void 0})));function i(e){o().locale=e}function s(){return o().locale||r()}export{s as getRequestLocale,i as setRequestLocale};
@@ -0,0 +1 @@
1
+ export{getFormatter,getLocale,getMessages,getNow,getRequestConfig,getTimeZone,getTranslations,unstable_setRequestLocale}from"./server/react-client/index.js";
@@ -0,0 +1 @@
1
+ export{default as getRequestConfig}from"./server/react-server/getRequestConfig.js";export{default as getFormatter}from"./server/react-server/getFormatter.js";export{default as getNow}from"./server/react-server/getNow.js";export{default as getTimeZone}from"./server/react-server/getTimeZone.js";export{default as getTranslations}from"./server/react-server/getTranslations.js";export{default as getMessages}from"./server/react-server/getMessages.js";export{default as getLocale}from"./server/react-server/getLocale.js";export{setRequestLocale as unstable_setRequestLocale}from"./server/react-server/RequestLocale.js";
@@ -1 +1 @@
1
- function t(t){const n="object"==typeof t?t.pathname:t;return null!=n&&!n.startsWith("/")}function n(t){if("object"==typeof t)return null==t.host&&null==t.hostname;return!/^[a-z]+:/i.test(t)}function e(e,c){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c,a=arguments.length>3?arguments[3]:void 0;if(!n(e)||t(e))return e;const l=c!==o;return(null==c||u(c,a)||l)&&null!=c?r(e,c):e}function r(t,n){let e;return"string"==typeof t?e=o(n,t):(e={...t},t.pathname&&(e.pathname=o(n,t.pathname))),e}function c(t,n){return t.replace(new RegExp("^/".concat(n)),"")||"/"}function o(t,n){let e="/"+t;return/^\/(\?.*)?$/.test(n)&&(n=n.slice(1)),e+=n,e}function u(t,n){const e="/".concat(t);return n===e||n.startsWith("".concat(e,"/"))}function a(t,n){return l(t).test(n)}function l(t){const n=t.replace(/\[([^\]]+)\]/g,(t=>t.startsWith("[...")||t.startsWith("[[...")?"(.*)":"([^/]+)")).replaceAll("(.*)]","(.*)");return new RegExp("^".concat(n,"$"))}export{u as hasPathnamePrefixed,n as isLocalHref,t as isRelativeHref,e as localizeHref,o as localizePathname,a as matchesPathname,r as prefixHref,l as templateToRegex,c as unlocalizePathname};
1
+ function t(t){const n="object"==typeof t?t.pathname:t;return null!=n&&!n.startsWith("/")}function n(t){if("object"==typeof t)return null==t.host&&null==t.hostname;return!/^[a-z]+:/i.test(t)}function e(e,c){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c,a=arguments.length>3?arguments[3]:void 0;if(!n(e)||t(e))return e;const l=c!==o,i=null==c||u(c,a);return(l||i)&&null!=c?r(e,c):e}function r(t,n){let e;return"string"==typeof t?e=o(n,t):(e={...t},t.pathname&&(e.pathname=o(n,t.pathname))),e}function c(t,n){return t.replace(new RegExp("^/".concat(n)),"")||"/"}function o(t,n){let e="/"+t;return/^\/(\?.*)?$/.test(n)&&(n=n.slice(1)),e+=n,e}function u(t,n){const e="/".concat(t);return n===e||n.startsWith("".concat(e,"/"))}function a(t,n){return l(t).test(n)}function l(t){const n=t.replace(/\[([^\]]+)\]/g,(t=>t.startsWith("[...")||t.startsWith("[[...")?"(.*)":"([^/]+)")).replaceAll("(.*)]","(.*)");return new RegExp("^".concat(n,"$"))}export{u as hasPathnamePrefixed,n as isLocalHref,t as isRelativeHref,e as localizeHref,a as matchesPathname,r as prefixHref,o as prefixPathname,l as templateToRegex,c as unlocalizePathname};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),t=require("../shared/constants.js"),a=require("../shared/utils.js"),n=require("./getAlternateLinksHeaderValue.js"),l=require("./resolveLocale.js"),o=require("./utils.js");exports.default=function(r){const i=function(e){var t,a,n;return{...e,alternateLinks:null===(t=e.alternateLinks)||void 0===t||t,localePrefix:null!==(a=e.localePrefix)&&void 0!==a?a:"always",localeDetection:null===(n=e.localeDetection)||void 0===n||n}}(r);return function(r){var s,c;const{domain:d,locale:u}=l.default(i,r.headers,r.cookies,r.nextUrl.pathname),f=i.localeDetection&&(null===(s=r.cookies.get(t.COOKIE_LOCALE_NAME))||void 0===s?void 0:s.value)!==u,h=d?d.defaultLocale===u:u===i.defaultLocale,m=(null===(c=i.domains)||void 0===c?void 0:c.filter((e=>o.isLocaleSupportedOnDomain(u,e))))||[],v=null!=i.domains&&!d;function p(a){return e.NextResponse.rewrite(new URL(a,r.url),function(){const e=new Headers(r.headers);return e.set(t.HEADER_LOCALE_NAME,u),{request:{headers:e}}}())}function x(t,a){const n=new URL(t,r.url);if(m.length>0&&!a){const e=o.getBestMatchingDomain(d,u,m);e&&(a=e.domain,e.defaultLocale===u&&"as-needed"===i.localePrefix&&(n.pathname=n.pathname.replace("/".concat(u),"")))}var l;a&&(n.protocol=null!==(l=r.headers.get("x-forwarded-proto"))&&void 0!==l?l:r.nextUrl.protocol,n.port="",n.host=a);return e.NextResponse.redirect(n.toString())}const L=o.getNormalizedPathname(r.nextUrl.pathname,i.locales),g=o.getKnownLocaleFromPathname(r.nextUrl.pathname,i.locales),P=null!=g;let E,U,A=r.nextUrl.pathname;if(i.pathnames){let e;if([e=u,U]=o.getInternalTemplate(i.pathnames,L),U){const t=i.pathnames[U],n="string"==typeof t?t:t[u];if(a.matchesPathname(n,L))A=o.formatTemplatePathname(L,n,U,g);else{const a=i.defaultLocale===u||(null==d?void 0:d.defaultLocale)===u;E=x(o.getPathWithSearch(o.formatTemplatePathname(L,"string"==typeof t?t:t[e],n,g||!a?u:void 0),r.nextUrl.search))}}}if(!E)if("/"===A){const e=o.getPathWithSearch("/".concat(u),r.nextUrl.search);E="never"===i.localePrefix||h&&"as-needed"===i.localePrefix?p(e):x(e)}else{const e=o.getPathWithSearch(A,r.nextUrl.search);if(P){const t=o.getBasePath(e,g);if("never"===i.localePrefix)E=x(t);else if(g===u)if(h&&"as-needed"===i.localePrefix)E=x(t);else if(i.domains){const a=o.getBestMatchingDomain(d,g,m);E=(null==d?void 0:d.domain)===(null==a?void 0:a.domain)||v?p(e):x(t,null==a?void 0:a.domain)}else E=p(e);else E=x("/".concat(u).concat(t))}else E="never"===i.localePrefix||h&&("as-needed"===i.localePrefix||i.domains)?p("/".concat(u).concat(e)):x("/".concat(u).concat(e))}var O;(f&&E.cookies.set(t.COOKIE_LOCALE_NAME,u,{sameSite:"strict",maxAge:31536e3}),"never"!==i.localePrefix&&i.alternateLinks&&i.locales.length>1)&&E.headers.set("Link",n.default({config:i,localizedPathnames:null!=U?null===(O=i.pathnames)||void 0===O?void 0:O[U]:void 0,request:r,resolvedLocale:u}));return E}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/server"),t=require("../shared/constants.js"),a=require("../shared/utils.js"),n=require("./getAlternateLinksHeaderValue.js"),l=require("./resolveLocale.js"),o=require("./utils.js");exports.default=function(r){const i=function(e){var t,a,n;return{...e,alternateLinks:null===(t=e.alternateLinks)||void 0===t||t,localePrefix:null!==(a=e.localePrefix)&&void 0!==a?a:"always",localeDetection:null===(n=e.localeDetection)||void 0===n||n}}(r);return function(r){var s,c;const{domain:d,locale:u}=l.default(i,r.headers,r.cookies,r.nextUrl.pathname),h=i.localeDetection&&(null===(s=r.cookies.get(t.COOKIE_LOCALE_NAME))||void 0===s?void 0:s.value)!==u,f=d?d.defaultLocale===u:u===i.defaultLocale,m=(null===(c=i.domains)||void 0===c?void 0:c.filter((e=>o.isLocaleSupportedOnDomain(u,e))))||[],v=null!=i.domains&&!d;function p(a){return e.NextResponse.rewrite(new URL(a,r.url),function(){const e=new Headers(r.headers);return e.set(t.HEADER_LOCALE_NAME,u),{request:{headers:e}}}())}function x(t,a){const n=new URL(t,r.url);if(m.length>0&&!a){const e=o.getBestMatchingDomain(d,u,m);e&&(a=e.domain,e.defaultLocale===u&&"as-needed"===i.localePrefix&&(n.pathname=n.pathname.replace("/".concat(u),"")))}var l;a&&(n.protocol=null!==(l=r.headers.get("x-forwarded-proto"))&&void 0!==l?l:r.nextUrl.protocol,n.port="",n.host=a);return e.NextResponse.redirect(n.toString())}const g=o.getNormalizedPathname(r.nextUrl.pathname,i.locales),L=o.getKnownLocaleFromPathname(r.nextUrl.pathname,i.locales),P=null!=L;let U,E,A=r.nextUrl.pathname;if(i.pathnames){let e;if([e=u,E]=o.getInternalTemplate(i.pathnames,g),E){const t=i.pathnames[E],n="string"==typeof t?t:t[u];if(a.matchesPathname(n,g))A=o.formatTemplatePathname(g,n,E,L);else{const a=i.defaultLocale===u||(null==d?void 0:d.defaultLocale)===u;U=x(o.getPathWithSearch(o.formatTemplatePathname(g,"string"==typeof t?t:t[e],n,L||!a?u:void 0),r.nextUrl.search))}}}if(!U)if("/"===A){const e=o.getPathWithSearch("/".concat(u),r.nextUrl.search);U="never"===i.localePrefix||f&&"as-needed"===i.localePrefix?p(e):x(e)}else{const e=o.getPathWithSearch(A,r.nextUrl.search);if(P){const t=o.getBasePath(o.getPathWithSearch(g,r.nextUrl.search),L);if("never"===i.localePrefix)U=x(t);else if(L===u)if(f&&"as-needed"===i.localePrefix)U=x(t);else if(i.domains){const a=o.getBestMatchingDomain(d,L,m);U=(null==d?void 0:d.domain)===(null==a?void 0:a.domain)||v?p(e):x(t,null==a?void 0:a.domain)}else U=p(e);else U=x("/".concat(u).concat(t))}else U="never"===i.localePrefix||f&&("as-needed"===i.localePrefix||i.domains)?p("/".concat(u).concat(e)):x("/".concat(u).concat(e))}var O;(h&&U.cookies.set(t.COOKIE_LOCALE_NAME,u,{sameSite:"strict",maxAge:31536e3}),"never"!==i.localePrefix&&i.alternateLinks&&i.locales.length>1)&&U.headers.set("Link",n.default({config:i,localizedPathnames:null!=E?null===(O=i.pathnames)||void 0===O?void 0:O[E]:void 0,request:r,resolvedLocale:u}));return U}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../react-client/useLocale.js"),l=require("../shared/BaseLink.js");function a(e){return e&&e.__esModule?e:{default:e}}var u=a(r);function n(r,a){let{locale:n,...s}=r;const i=t.default(),o=n||i;return u.default.createElement(l.default,e.extends({ref:a,hrefLang:o,locale:o},s))}const s=r.forwardRef(n);s.displayName="ClientLink";var i=s;exports.default=i;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../react-client/useLocale.js"),r=require("../shared/baseRedirect.js");exports.default=function(t){let a;try{a=e.default()}catch(e){throw new Error(void 0)}for(var l=arguments.length,o=new Array(l>1?l-1:0),u=1;u<l;u++)o[u-1]=arguments[u];return r.default({...t,locale:a},...o)};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../../react-client/useLocale.js"),t=require("../shared/utils.js"),l=require("./BaseLink.js"),n=require("./baseRedirect.js"),o=require("./useBasePathname.js"),u=require("./useBaseRouter.js");function c(e){return e&&e.__esModule?e:{default:e}}var s=c(r);exports.default=function(c){let{locales:i,pathnames:f}=c;function h(){const e=a.default();if(!i.includes(e))throw new Error(void 0);return e}function d(r,a){let{href:n,locale:o,...u}=r;const c=h(),i=o||c;return s.default.createElement(l.default,e.extends({ref:a,href:t.compileLocalizedPathname({locale:i,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:f}),locale:o},u))}const p=r.forwardRef(d);function m(e){let{href:r,locale:a}=e;return t.compileLocalizedPathname({...t.normalizeNameOrNameWithParams(r),locale:a,pathnames:f})}return p.displayName="Link",{Link:p,redirect:function(e){const r=m({href:e,locale:h()});for(var a=arguments.length,t=new Array(a>1?a-1:0),l=1;l<a;l++)t[l-1]=arguments[l];return n.default(r,...t)},usePathname:function(){const e=o.default(),r=h();return t.getRoute({pathname:e,locale:r,pathnames:f})},useRouter:function(){const e=u.default(),r=h();return{...e,push(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=m({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.push(u,...n)},replace(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=m({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.replace(u,...n)},prefetch(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=m({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.prefetch(u,...n)}}},getPathname:m}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),a=require("../../react-client/useLocale.js"),t=require("../shared/utils.js"),l=require("./ClientLink.js"),n=require("./clientRedirect.js"),o=require("./useBasePathname.js"),u=require("./useBaseRouter.js");function c(e){return e&&e.__esModule?e:{default:e}}var i=c(r);exports.default=function(c){function s(){const e=a.default();if(!c.locales.includes(e))throw new Error(void 0);return e}function f(r,a){let{href:n,locale:o,...u}=r;const f=s(),h=o||f;return i.default.createElement(l.default,e.extends({ref:a,href:t.compileLocalizedPathname({locale:h,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:c.pathnames}),locale:o,localePrefix:c.localePrefix},u))}const h=r.forwardRef(f);function d(e){let{href:r,locale:a}=e;return t.compileLocalizedPathname({...t.normalizeNameOrNameWithParams(r),locale:a,pathnames:c.pathnames})}return h.displayName="Link",{Link:h,redirect:function(e){const r=d({href:e,locale:s()});for(var a=arguments.length,t=new Array(a>1?a-1:0),l=1;l<a;l++)t[l-1]=arguments[l];return n.default({...c,pathname:r},...t)},usePathname:function(){const e=o.default(),r=s();return e?t.getRoute({pathname:e,locale:r,pathnames:c.pathnames}):e},useRouter:function(){const e=u.default(),r=s();return{...e,push(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=d({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.push(u,...n)},replace(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=d({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.replace(u,...n)},prefetch(a){for(var t,l=arguments.length,n=new Array(l>1?l-1:0),o=1;o<l;o++)n[o-1]=arguments[o];const u=d({href:a,locale:(null===(t=n[0])||void 0===t?void 0:t.locale)||r});return e.prefetch(u,...n)}}},getPathname:d}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./BaseLink.js"),r=require("./baseRedirect.js"),u=require("./useBasePathname.js"),t=require("./useBaseRouter.js");exports.default=function(s){return{Link:e.default,redirect:r.default,usePathname:u.default,useRouter:t.default}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("./ClientLink.js"),u=require("./clientRedirect.js"),n=require("./useBasePathname.js"),a=require("./useBaseRouter.js");function i(e){return e&&e.__esModule?e:{default:e}}var l=i(r);exports.default=function(i){function s(r,u){return l.default.createElement(t.default,e.extends({ref:u,localePrefix:i.localePrefix},r))}const f=r.forwardRef(s);return f.displayName="Link",{Link:f,redirect:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return u.default({...i,pathname:e},...t)},usePathname:function(){return n.default()},useRouter:a.default}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../shared/BaseLink.js"),a=require("../../server/react-server/getLocale.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=l(r);exports.default=async function(r){let{locale:l,...s}=r;return u.default.createElement(t.default,e.extends({locale:l||await a.default()},s))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),r=require("../../server/RequestLocale.js"),a=require("../shared/utils.js"),o=require("./BaseLink.js"),n=require("./baseRedirect.js");function u(e){return e&&e.__esModule?e:{default:e}}var l=u(t);exports.default=function(t){let{locales:u,pathnames:s}=t;function c(e){let{href:t,locale:r}=e;return a.compileLocalizedPathname({...a.normalizeNameOrNameWithParams(t),locale:r,pathnames:s})}function i(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(t){let{href:n,locale:u,...c}=t;const i=r.getRequestLocale(),m=u||i;return l.default.createElement(o.default,e.extends({href:a.compileLocalizedPathname({locale:m,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:s}),locale:u},c))},redirect:function(e){const t=c({href:e,locale:r.getRequestLocale()});for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u<a;u++)o[u-1]=arguments[u];return n.default(t,...o)},getPathname:c,usePathname:i("usePathname"),useRouter:i("useRouter")}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../server/react-server/RequestLocale.js"),a=require("../shared/utils.js"),o=require("./ServerLink.js"),n=require("./serverRedirect.js");function l(e){return e&&e.__esModule?e:{default:e}}var u=l(r);exports.default=function(r){let{localePrefix:l,locales:s,pathnames:c}=r;function i(e){let{href:r,locale:t}=e;return a.compileLocalizedPathname({...a.normalizeNameOrNameWithParams(r),locale:t,pathnames:c})}function f(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(r){let{href:n,locale:s,...i}=r;const f=t.getRequestLocale(),m=s||f;return u.default.createElement(o.default,e.extends({href:a.compileLocalizedPathname({locale:m,pathname:n,params:"object"==typeof n?n.params:void 0,pathnames:c}),locale:s,localePrefix:l},i))},redirect:function(e){const r=i({href:e,locale:t.getRequestLocale()});for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u<a;u++)o[u-1]=arguments[u];return n.default({localePrefix:l,pathname:r},...o)},getPathname:i,usePathname:f("usePathname"),useRouter:f("useRouter")}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./BaseLink.js"),t=require("./baseRedirect.js");exports.default=function(r){function o(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:e.default,redirect:t.default,usePathname:o("usePathname"),useRouter:o("useRouter")}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("./ServerLink.js"),n=require("./serverRedirect.js");function u(e){return e&&e.__esModule?e:{default:e}}var o=u(r);exports.default=function(r){function u(e){return()=>{throw new Error("`".concat(e,"` is not supported in Server Components. You can use this hook if you convert the component to a Client Component."))}}return{Link:function(n){return o.default.createElement(t.default,e.extends({localePrefix:r.localePrefix},n))},redirect:function(e){for(var t=arguments.length,u=new Array(t>1?t-1:0),o=1;o<t;o++)u[o-1]=arguments[o];return n.default({...r,pathname:e},...u)},usePathname:u("usePathname"),useRouter:u("useRouter")}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../server/react-server/RequestLocale.js"),r=require("../shared/baseRedirect.js");exports.default=function(t){const s=e.getRequestLocale();for(var a=arguments.length,u=new Array(a>1?a-1:0),o=1;o<a;o++)u[o-1]=arguments[o];return r.default({...t,locale:s},...u)};
@@ -0,0 +1,2 @@
1
+ 'use client';
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_rollupPluginBabelHelpers.js"),r=require("next/link"),t=require("next/navigation"),l=require("react"),a=require("../../react-client/useLocale.js"),u=require("../../shared/utils.js");function i(e){return e&&e.__esModule?e:{default:e}}var n=i(r),f=i(l);function s(r,i){let{href:s,locale:c,localePrefix:o,prefetch:d,...p}=r;const v=t.usePathname(),x=a.default(),h=c!==x,[q,_]=l.useState((()=>u.isLocalHref(s)&&("never"!==o||h)?u.prefixHref(s,c):s));return l.useEffect((()=>{v&&"never"!==o&&_(u.localizeHref(s,c,x,null!=v?v:void 0))}),[x,s,c,o,v]),h&&(d=!1),f.default.createElement(n.default,e.extends({ref:i,href:q,prefetch:d},p))}const c=l.forwardRef(s);c.displayName="ClientLink";var o=c;exports.default=o;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/navigation"),r=require("../../shared/utils.js");exports.default=function(t){const a="never"===t.localePrefix?t.pathname:r.prefixPathname(t.locale,t.pathname);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return e.redirect(a,...i)};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../shared/NextIntlClientProvider.js"),l=require("../server/getLocale.js"),u=require("../server/getNow.js"),a=require("../server/getTimeZone.js");function n(e){return e&&e.__esModule?e:{default:e}}var i=n(r);exports.default=async function(r){let{locale:n,now:o,timeZone:s,...d}=r;return i.default.createElement(t.default,e.extends({locale:null!=n?n:await l.default(),now:null!=o?o:await u.default(),timeZone:null!=s?s:await a.default()},d))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../shared/NextIntlClientProvider.js"),l=require("../server/react-server/getLocale.js"),a=require("../server/react-server/getNow.js"),u=require("../server/react-server/getTimeZone.js");function n(e){return e&&e.__esModule?e:{default:e}}var s=n(r);exports.default=async function(r){let{locale:n,now:i,timeZone:o,...c}=r;return s.default.createElement(t.default,e.extends({locale:null!=n?n:await l.default(),now:null!=i?i:await a.default(),timeZone:null!=o?o:await u.default()},c))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),a=require("../server/getConfig.js");const s=e.cache((()=>new Map));var t=e.cache((async function(e,t){const c=await a.default(e);return r.createTranslator({...c,messageFormatCache:s(),namespace:t,messages:c.messages})}));exports.default=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("use-intl/core"),a=require("../server/react-server/getConfig.js");const s=e.cache((()=>new Map));var t=e.cache((async function(e,t){const c=await a.default(e);return r.createTranslator({...c,messageFormatCache:s(),namespace:t,messages:c.messages})}));exports.default=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getFormatter.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var u=arguments.length,o=new Array(u),s=0;s<u;s++)o[s]=arguments[s];const a=t.default();return r.default("useFormatter",e.default({locale:a}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/react-server/getFormatter.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var u=arguments.length,s=new Array(u),a=0;a<u;a++)s[a]=arguments[a];const o=t.default();return r.default("useFormatter",e.default({locale:o}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/RequestLocale.js");exports.default=function(){for(var r=arguments.length,t=new Array(r),s=0;s<r;s++)t[s]=arguments[s];return e.getRequestLocale()};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/react-server/RequestLocale.js");exports.default=function(){for(var r=arguments.length,t=new Array(r),s=0;s<r;s++)t[s]=arguments[s];return e.getRequestLocale()};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getMessages.js"),r=require("./useHook.js"),s=require("./useLocale.js");exports.default=function(){for(var t=arguments.length,u=new Array(t),a=0;a<t;a++)u[a]=arguments[a];const o=s.default();return r.default("useMessages",e.default({locale:o}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/react-server/getMessages.js"),r=require("./useHook.js"),s=require("./useLocale.js");exports.default=function(){for(var t=arguments.length,u=new Array(t),a=0;a<t;a++)u[a]=arguments[a];const o=s.default();return r.default("useMessages",e.default({locale:o}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getNow.js"),t=require("./useHook.js"),o=require("./useLocale.js");exports.default=function(){for(var r=arguments.length,n=new Array(r),u=0;u<r;u++)n[u]=arguments[u];let[l]=n;null!=(null==l?void 0:l.updateInterval)&&console.error("`useNow` doesn't support the `updateInterval` option in Server Components, the value will be ignored. If you need the value to update, you can convert the component to a Client Component.");const a=o.default();return t.default("useNow",e.default({locale:a}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/react-server/getNow.js"),t=require("./useHook.js"),o=require("./useLocale.js");exports.default=function(){for(var r=arguments.length,n=new Array(r),u=0;u<r;u++)n[u]=arguments[u];let[l]=n;null!=(null==l?void 0:l.updateInterval)&&console.error("`useNow` doesn't support the `updateInterval` option in Server Components, the value will be ignored. If you need the value to update, you can convert the component to a Client Component.");const a=o.default();return t.default("useNow",e.default({locale:a}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/getTimeZone.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var u=arguments.length,o=new Array(u),s=0;s<u;s++)o[s]=arguments[s];const a=t.default();return r.default("useTimeZone",e.default({locale:a}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../server/react-server/getTimeZone.js"),r=require("./useHook.js"),t=require("./useLocale.js");exports.default=function(){for(var u=arguments.length,s=new Array(u),o=0;o<u;o++)s[o]=arguments[o];const a=t.default();return r.default("useTimeZone",e.default({locale:a}))};
@@ -0,0 +1 @@
1
+ "use strict";function e(e){return()=>{throw new Error("`".concat(e,"` is not supported in Client Components."))}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getRequestConfig"),o=e("getFormatter"),s=e("getNow"),r=e("getTimeZone"),n=e("getTranslations"),g=e("getMessages"),a=e("getLocale"),p=e("unstable_setRequestLocale");exports.getFormatter=o,exports.getLocale=a,exports.getMessages=g,exports.getNow=s,exports.getRequestConfig=t,exports.getTimeZone=r,exports.getTranslations=n,exports.unstable_setRequestLocale=p;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("next/headers"),t=require("react"),r=require("../../shared/constants.js");const n=t.cache((()=>{let t;try{t=e.headers().get(r.HEADER_LOCALE_NAME)}catch(e){throw e instanceof Error&&"DYNAMIC_SERVER_USAGE"===e.digest?new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `unstable_setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components#static-rendering",{cause:e}):e}if(!t)throw new Error("Unable to find `next-intl` locale because the middleware didn't run on this request. See https://next-intl-docs.vercel.app/docs/routing/middleware#unable-to-find-locale");return t})),o=t.cache((()=>({locale:void 0})));exports.getRequestLocale=function(){return o().locale||n()},exports.setRequestLocale=function(e){o().locale=e};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-client/index.js");exports.getFormatter=e.getFormatter,exports.getLocale=e.getLocale,exports.getMessages=e.getMessages,exports.getNow=e.getNow,exports.getRequestConfig=e.getRequestConfig,exports.getTimeZone=e.getTimeZone,exports.getTranslations=e.getTranslations,exports.unstable_setRequestLocale=e.unstable_setRequestLocale;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getNow.js"),s=require("./server/react-server/getTimeZone.js"),a=require("./server/react-server/getTranslations.js"),o=require("./server/react-server/getMessages.js"),u=require("./server/react-server/getLocale.js"),g=require("./server/react-server/RequestLocale.js");exports.getRequestConfig=e.default,exports.getFormatter=r.default,exports.getNow=t.default,exports.getTimeZone=s.default,exports.getTranslations=a.default,exports.getMessages=o.default,exports.getLocale=u.default,exports.unstable_setRequestLocale=g.setRequestLocale;
@@ -1 +1 @@
1
- "use strict";function t(t){const e="object"==typeof t?t.pathname:t;return null!=e&&!e.startsWith("/")}function e(t){if("object"==typeof t)return null==t.host&&null==t.hostname;return!/^[a-z]+:/i.test(t)}function n(t,e){let n;return"string"==typeof t?n=r(e,t):(n={...t},t.pathname&&(n.pathname=r(e,t.pathname))),n}function r(t,e){let n="/"+t;return/^\/(\?.*)?$/.test(e)&&(e=e.slice(1)),n+=e,n}function o(t,e){const n="/".concat(t);return e===n||e.startsWith("".concat(n,"/"))}function a(t){const e=t.replace(/\[([^\]]+)\]/g,(t=>t.startsWith("[...")||t.startsWith("[[...")?"(.*)":"([^/]+)")).replaceAll("(.*)]","(.*)");return new RegExp("^".concat(e,"$"))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.hasPathnamePrefixed=o,exports.isLocalHref=e,exports.isRelativeHref=t,exports.localizeHref=function(r,a){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,c=arguments.length>3?arguments[3]:void 0;if(!e(r)||t(r))return r;const l=a!==s;return(null==a||o(a,c)||l)&&null!=a?n(r,a):r},exports.localizePathname=r,exports.matchesPathname=function(t,e){return a(t).test(e)},exports.prefixHref=n,exports.templateToRegex=a,exports.unlocalizePathname=function(t,e){return t.replace(new RegExp("^/".concat(e)),"")||"/"};
1
+ "use strict";function t(t){const e="object"==typeof t?t.pathname:t;return null!=e&&!e.startsWith("/")}function e(t){if("object"==typeof t)return null==t.host&&null==t.hostname;return!/^[a-z]+:/i.test(t)}function n(t,e){let n;return"string"==typeof t?n=r(e,t):(n={...t},t.pathname&&(n.pathname=r(e,t.pathname))),n}function r(t,e){let n="/"+t;return/^\/(\?.*)?$/.test(e)&&(e=e.slice(1)),n+=e,n}function o(t,e){const n="/".concat(t);return e===n||e.startsWith("".concat(n,"/"))}function a(t){const e=t.replace(/\[([^\]]+)\]/g,(t=>t.startsWith("[...")||t.startsWith("[[...")?"(.*)":"([^/]+)")).replaceAll("(.*)]","(.*)");return new RegExp("^".concat(e,"$"))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.hasPathnamePrefixed=o,exports.isLocalHref=e,exports.isRelativeHref=t,exports.localizeHref=function(r,a){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,c=arguments.length>3?arguments[3]:void 0;if(!e(r)||t(r))return r;const i=a!==s,l=null==a||o(a,c);return(i||l)&&null!=a?n(r,a):r},exports.matchesPathname=function(t,e){return a(t).test(e)},exports.prefixHref=n,exports.prefixPathname=r,exports.templateToRegex=a,exports.unlocalizePathname=function(t,e){return t.replace(new RegExp("^/".concat(e)),"")||"/"};
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./production/server.react-client.js');
5
+ } else {
6
+ module.exports = require('./development/server.react-client.js');
7
+ }
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./production/server.react-server.js');
5
+ } else {
6
+ module.exports = require('./development/server.react-server.js');
7
+ }
@@ -1,5 +1,4 @@
1
- import { AllLocales, Pathnames } from '../shared/types';
2
- type LocalePrefix = 'as-needed' | 'always' | 'never';
1
+ import { AllLocales, LocalePrefix, Pathnames } from '../shared/types';
3
2
  type RoutingBaseConfig<Locales extends AllLocales> = {
4
3
  /** A list of all locales that are supported. */
5
4
  locales: Locales;
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import React, { ComponentProps, ReactElement } from 'react';
3
- import BaseLinkWithLocale from '../../shared/BaseLinkWithLocale';
4
3
  import { AllLocales } from '../../shared/types';
5
- type Props<Locales extends AllLocales> = Omit<ComponentProps<typeof BaseLinkWithLocale>, 'locale'> & {
4
+ import BaseLink from '../shared/BaseLink';
5
+ type Props<Locales extends AllLocales> = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
6
6
  locale?: Locales[number];
7
7
  };
8
8
  /**
@@ -25,7 +25,7 @@ type Props<Locales extends AllLocales> = Omit<ComponentProps<typeof BaseLinkWith
25
25
  * the `set-cookie` response header would cause the locale cookie on the current
26
26
  * page to be overwritten before the user even decides to change the locale.
27
27
  */
28
- declare const BaseLinkWithRef: <Locales extends AllLocales>(props: Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
28
+ declare const ClientLinkWithRef: <Locales extends AllLocales>(props: Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
29
29
  href: string | import("url").UrlObject;
30
30
  as?: (string | import("url").UrlObject) | undefined;
31
31
  replace?: boolean | undefined;
@@ -55,9 +55,10 @@ declare const BaseLinkWithRef: <Locales extends AllLocales>(props: Omit<Omit<Omi
55
55
  children?: React.ReactNode;
56
56
  } & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
57
57
  locale: string;
58
+ localePrefix?: import("../../shared/types").LocalePrefix | undefined;
58
59
  }, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
59
60
  locale?: Locales[number] | undefined;
60
61
  } & {
61
62
  ref?: React.Ref<HTMLAnchorElement> | undefined;
62
63
  }) => ReactElement;
63
- export default BaseLinkWithRef;
64
+ export default ClientLinkWithRef;
@@ -0,0 +1,6 @@
1
+ import { LocalePrefix, ParametersExceptFirstTwo } from '../../shared/types';
2
+ import baseRedirect from '../shared/baseRedirect';
3
+ export default function clientRedirect(params: {
4
+ localePrefix?: LocalePrefix;
5
+ pathname: string;
6
+ }, ...args: ParametersExceptFirstTwo<typeof baseRedirect>): never;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  import React, { ComponentProps, ReactElement } from 'react';
3
- import { AllLocales, Pathnames } from '../../shared/types';
3
+ import { AllLocales, LocalePrefix, Pathnames } from '../../shared/types';
4
4
  import { HrefOrHrefWithParams } from '../shared/utils';
5
- import BaseLink from './BaseLink';
6
- export default function createLocalizedPathnamesNavigation<Locales extends AllLocales, PathnamesConfig extends Pathnames<Locales>>({ locales, pathnames }: {
5
+ import ClientLink from './ClientLink';
6
+ export default function createLocalizedPathnamesNavigation<Locales extends AllLocales, PathnamesConfig extends Pathnames<Locales>>(opts: {
7
7
  locales: Locales;
8
8
  pathnames: PathnamesConfig;
9
+ localePrefix?: LocalePrefix;
9
10
  }): {
10
11
  Link: <Pathname extends keyof PathnamesConfig>(props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
11
12
  href: string | import("url").UrlObject;
@@ -37,6 +38,7 @@ export default function createLocalizedPathnamesNavigation<Locales extends AllLo
37
38
  children?: React.ReactNode;
38
39
  } & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
39
40
  locale: string;
41
+ localePrefix?: LocalePrefix | undefined;
40
42
  }, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
41
43
  locale?: string | undefined;
42
44
  } & {
@@ -53,9 +55,9 @@ export default function createLocalizedPathnamesNavigation<Locales extends AllLo
53
55
  } & Omit<import("url").UrlObject, "pathname">);
54
56
  locale?: Locales[number] | undefined;
55
57
  } & {
56
- ref?: ComponentProps<typeof BaseLink>['ref'];
58
+ ref?: ComponentProps<typeof ClientLink>['ref'];
57
59
  }) => ReactElement;
58
- redirect: <Pathname_1 extends keyof PathnamesConfig>(href: HrefOrHrefWithParams<Pathname_1>, type?: import("next/navigation").RedirectType | undefined) => never;
60
+ redirect: <Pathname_1 extends keyof PathnamesConfig>(href: HrefOrHrefWithParams<Pathname_1>) => never;
59
61
  usePathname: () => keyof PathnamesConfig;
60
62
  useRouter: () => {
61
63
  push<Pathname_2 extends keyof PathnamesConfig>(href: HrefOrHrefWithParams<Pathname_2>, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & {
@@ -1,13 +1,50 @@
1
- import { AllLocales } from '../../shared/types';
2
- import BaseLink from './BaseLink';
3
- import baseRedirect from './baseRedirect';
4
- import useBasePathname from './useBasePathname';
1
+ /// <reference types="node" />
2
+ import React, { ReactElement } from 'react';
3
+ import { AllLocales, LocalePrefix } from '../../shared/types';
5
4
  import useBaseRouter from './useBaseRouter';
6
5
  export default function createSharedPathnamesNavigation<Locales extends AllLocales>(opts: {
7
6
  locales: Locales;
7
+ localePrefix?: LocalePrefix;
8
8
  }): {
9
- Link: typeof BaseLink<Locales>;
10
- redirect: typeof baseRedirect;
11
- usePathname: typeof useBasePathname;
9
+ Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
10
+ href: string | import("url").UrlObject;
11
+ as?: (string | import("url").UrlObject) | undefined;
12
+ replace?: boolean | undefined;
13
+ scroll?: boolean | undefined;
14
+ shallow?: boolean | undefined;
15
+ passHref?: boolean | undefined;
16
+ prefetch?: boolean | undefined;
17
+ locale?: string | false | undefined;
18
+ legacyBehavior?: boolean | undefined;
19
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
20
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
21
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
+ }> & {
23
+ href: string | import("url").UrlObject;
24
+ as?: (string | import("url").UrlObject) | undefined;
25
+ replace?: boolean | undefined;
26
+ scroll?: boolean | undefined;
27
+ shallow?: boolean | undefined;
28
+ passHref?: boolean | undefined;
29
+ prefetch?: boolean | undefined;
30
+ locale?: string | false | undefined;
31
+ legacyBehavior?: boolean | undefined;
32
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
33
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
34
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
35
+ } & {
36
+ children?: React.ReactNode;
37
+ } & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
38
+ locale: string;
39
+ localePrefix?: LocalePrefix | undefined;
40
+ }, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale"> & {
41
+ locale?: Locales[number] | undefined;
42
+ } & {
43
+ ref?: React.Ref<HTMLAnchorElement> | undefined;
44
+ }, "localePrefix"> & {
45
+ ref?: React.Ref<HTMLAnchorElement> | undefined;
46
+ }) => ReactElement;
47
+ redirect: (pathname: string) => never;
48
+ usePathname: () => string;
12
49
  useRouter: typeof useBaseRouter;
13
50
  };
@@ -11,4 +11,4 @@
11
11
  * const pathname = usePathname();
12
12
  * ```
13
13
  */
14
- export default function useBasePathname(): string;
14
+ export default function useBasePathname(): string | null;
@@ -0,0 +1,8 @@
1
+ import React, { ComponentProps } from 'react';
2
+ import { AllLocales } from '../../shared/types';
3
+ import BaseLink from '../shared/BaseLink';
4
+ type Props<Locales extends AllLocales> = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {
5
+ locale?: Locales[number];
6
+ };
7
+ export default function ServerLink<Locales extends AllLocales>({ locale, ...rest }: Props<Locales>): Promise<React.JSX.Element>;
8
+ export {};