@instockng/storefront-ui 1.0.49 → 1.0.51

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 (253) hide show
  1. package/dist/components/Checkout.d.ts.map +1 -1
  2. package/dist/components/PostPurchaseUpsell.d.ts +14 -0
  3. package/dist/components/PostPurchaseUpsell.d.ts.map +1 -0
  4. package/dist/index.mjs +56 -54
  5. package/dist/index100.mjs +16 -26
  6. package/dist/index101.mjs +210 -13
  7. package/dist/index102.mjs +159 -194
  8. package/dist/index103.mjs +17 -175
  9. package/dist/index104.mjs +15 -14
  10. package/dist/index105.mjs +25 -15
  11. package/dist/index106.mjs +150 -27
  12. package/dist/index107.mjs +15 -151
  13. package/dist/index108.mjs +24 -13
  14. package/dist/index109.mjs +75 -22
  15. package/dist/index11.mjs +41 -45
  16. package/dist/index110.mjs +30 -76
  17. package/dist/index111.mjs +139 -32
  18. package/dist/index112.mjs +45 -135
  19. package/dist/index113.mjs +19 -51
  20. package/dist/index114.mjs +19 -15
  21. package/dist/index115.mjs +17 -21
  22. package/dist/index116.mjs +18 -16
  23. package/dist/index117.mjs +13 -17
  24. package/dist/index118.mjs +14 -13
  25. package/dist/index119.mjs +12 -13
  26. package/dist/index120.mjs +58 -14
  27. package/dist/index121.mjs +10 -57
  28. package/dist/index122.mjs +32 -11
  29. package/dist/index123.mjs +17 -32
  30. package/dist/index124.mjs +27 -17
  31. package/dist/index125.mjs +19 -26
  32. package/dist/index126.mjs +12 -20
  33. package/dist/index127.mjs +14 -12
  34. package/dist/index128.mjs +40 -14
  35. package/dist/index129.mjs +16 -40
  36. package/dist/index13.mjs +148 -141
  37. package/dist/index130.mjs +261 -16
  38. package/dist/index131.mjs +64 -262
  39. package/dist/index132.mjs +7 -69
  40. package/dist/index133.mjs +2 -8
  41. package/dist/index134.mjs +2 -2
  42. package/dist/index135.mjs +33 -2
  43. package/dist/index136.mjs +2 -33
  44. package/dist/index137.mjs +34 -2
  45. package/dist/index138.mjs +40 -18
  46. package/dist/index139.mjs +2 -56
  47. package/dist/index14.mjs +2 -2
  48. package/dist/index140.mjs +2 -29
  49. package/dist/index141.mjs +2 -7
  50. package/dist/index142.mjs +16 -50
  51. package/dist/index143.mjs +32 -6
  52. package/dist/index144.mjs +37 -11
  53. package/dist/index145.mjs +18 -7
  54. package/dist/index146.mjs +18 -28
  55. package/dist/index147.mjs +2 -2
  56. package/dist/index148.mjs +20 -70
  57. package/dist/index149.mjs +42 -163
  58. package/dist/index150.mjs +2 -2
  59. package/dist/index151.mjs +30 -2
  60. package/dist/index152.mjs +18 -2
  61. package/dist/index153.mjs +2 -18
  62. package/dist/index154.mjs +2 -32
  63. package/dist/index155.mjs +2 -38
  64. package/dist/index156.mjs +2 -18
  65. package/dist/index157.mjs +67 -13
  66. package/dist/index158.mjs +2 -2
  67. package/dist/index159.mjs +48 -15
  68. package/dist/index16.mjs +1 -1
  69. package/dist/index160.mjs +2 -46
  70. package/dist/index161.mjs +36 -2
  71. package/dist/index162.mjs +142 -20
  72. package/dist/index163.mjs +2 -18
  73. package/dist/index164.mjs +2 -2
  74. package/dist/index165.mjs +19 -2
  75. package/dist/index167.mjs +2 -2
  76. package/dist/index168.mjs +18 -64
  77. package/dist/index169.mjs +2 -2
  78. package/dist/index17.mjs +7 -7
  79. package/dist/index170.mjs +2 -53
  80. package/dist/index171.mjs +24 -2
  81. package/dist/index172.mjs +15 -28
  82. package/dist/index173.mjs +2 -152
  83. package/dist/index174.mjs +2 -2
  84. package/dist/index175.mjs +2 -2
  85. package/dist/index176.mjs +14 -10
  86. package/dist/index177.mjs +2 -2
  87. package/dist/index178.mjs +23 -2
  88. package/dist/index179.mjs +2 -26
  89. package/dist/index180.mjs +2 -2
  90. package/dist/index181.mjs +2 -2
  91. package/dist/index182.mjs +16 -17
  92. package/dist/index183.mjs +2 -23
  93. package/dist/index184.mjs +23 -2
  94. package/dist/index185.mjs +2 -2
  95. package/dist/index186.mjs +2 -2
  96. package/dist/index187.mjs +2 -23
  97. package/dist/index188.mjs +2 -2
  98. package/dist/index189.mjs +2 -23
  99. package/dist/index190.mjs +2 -2
  100. package/dist/index191.mjs +2 -2
  101. package/dist/index192.mjs +2 -2
  102. package/dist/index193.mjs +124 -20
  103. package/dist/index194.mjs +2 -2
  104. package/dist/index195.mjs +71 -20
  105. package/dist/index196.mjs +74 -2
  106. package/dist/index197.mjs +2 -2
  107. package/dist/index198.mjs +21 -2
  108. package/dist/index199.mjs +56 -2
  109. package/dist/index20.mjs +2 -2
  110. package/dist/index200.mjs +29 -2
  111. package/dist/index201.mjs +7 -2
  112. package/dist/index202.mjs +52 -2
  113. package/dist/index203.mjs +6 -2
  114. package/dist/index204.mjs +11 -126
  115. package/dist/index205.mjs +7 -2
  116. package/dist/index206.mjs +28 -74
  117. package/dist/index207.mjs +2 -74
  118. package/dist/index208.mjs +70 -2
  119. package/dist/index209.mjs +164 -28
  120. package/dist/index210.mjs +2 -11
  121. package/dist/index211.mjs +2 -4
  122. package/dist/index212.mjs +2 -4
  123. package/dist/index213.mjs +2 -13
  124. package/dist/index214.mjs +2 -7
  125. package/dist/index215.mjs +2 -12
  126. package/dist/index216.mjs +107 -4
  127. package/dist/index217.mjs +2 -33
  128. package/dist/index218.mjs +2 -31
  129. package/dist/index219.mjs +2 -28
  130. package/dist/index220.mjs +2 -61
  131. package/dist/index221.mjs +2 -2
  132. package/dist/index222.mjs +37 -2
  133. package/dist/index223.mjs +2 -2
  134. package/dist/index224.mjs +244 -2
  135. package/dist/index226.mjs +33 -2
  136. package/dist/index227.mjs +65 -2
  137. package/dist/index228.mjs +25 -2
  138. package/dist/index229.mjs +2 -108
  139. package/dist/index23.mjs +2 -2
  140. package/dist/index230.mjs +2 -2
  141. package/dist/index231.mjs +2 -2
  142. package/dist/index232.mjs +2 -37
  143. package/dist/index233.mjs +2 -2
  144. package/dist/index234.mjs +2 -2
  145. package/dist/index236.mjs +2 -2
  146. package/dist/index237.mjs +2 -2
  147. package/dist/index238.mjs +4 -2
  148. package/dist/index239.mjs +2 -244
  149. package/dist/index24.mjs +1 -1
  150. package/dist/index241.mjs +13 -33
  151. package/dist/index242.mjs +7 -65
  152. package/dist/index243.mjs +11 -24
  153. package/dist/index244.mjs +5 -2
  154. package/dist/index245.mjs +33 -2
  155. package/dist/index246.mjs +31 -2
  156. package/dist/index247.mjs +28 -2
  157. package/dist/index248.mjs +61 -2
  158. package/dist/index249.mjs +31 -4
  159. package/dist/index250.mjs +11 -2
  160. package/dist/index251.mjs +4 -2
  161. package/dist/index252.mjs +4 -2
  162. package/dist/index253.mjs +2 -2
  163. package/dist/index254.mjs +2 -18
  164. package/dist/index255.mjs +13 -42
  165. package/dist/index256.mjs +47 -2
  166. package/dist/index257.mjs +2 -2
  167. package/dist/index258.mjs +2 -2
  168. package/dist/index259.mjs +2 -2
  169. package/dist/index260.mjs +2 -91
  170. package/dist/index261.mjs +91 -2
  171. package/dist/index262.mjs +1 -2
  172. package/dist/index263.mjs +3 -2
  173. package/dist/index264.mjs +2 -2
  174. package/dist/index265.mjs +2 -17
  175. package/dist/index266.mjs +15 -11
  176. package/dist/index267.mjs +13 -6
  177. package/dist/index268.mjs +6 -30
  178. package/dist/index269.mjs +30 -2
  179. package/dist/index27.mjs +21 -10
  180. package/dist/index271.mjs +2 -2
  181. package/dist/index272.mjs +5 -0
  182. package/dist/index30.mjs +4 -3
  183. package/dist/index31.mjs +11 -10
  184. package/dist/index32.mjs +11 -11
  185. package/dist/index33.mjs +1 -1
  186. package/dist/index34.mjs +21 -12
  187. package/dist/index35.mjs +1 -1
  188. package/dist/index36.mjs +1 -1
  189. package/dist/index37.mjs +1 -1
  190. package/dist/index38.mjs +2 -2
  191. package/dist/index40.mjs +1 -1
  192. package/dist/index44.mjs +70 -2
  193. package/dist/index45.mjs +2 -60
  194. package/dist/index46.mjs +57 -48
  195. package/dist/index47.mjs +51 -33
  196. package/dist/index48.mjs +33 -15
  197. package/dist/index49.mjs +12 -2260
  198. package/dist/index50.mjs +2263 -36
  199. package/dist/index51.mjs +36 -44
  200. package/dist/index52.mjs +44 -99
  201. package/dist/index53.mjs +99 -113
  202. package/dist/index54.mjs +82 -50
  203. package/dist/index55.mjs +55 -51
  204. package/dist/index56.mjs +46 -64
  205. package/dist/index57.mjs +71 -57
  206. package/dist/index58.mjs +57 -55
  207. package/dist/index59.mjs +75 -15
  208. package/dist/index60.mjs +13 -14
  209. package/dist/index61.mjs +16 -59
  210. package/dist/index62.mjs +43 -105
  211. package/dist/index63.mjs +89 -93
  212. package/dist/index64.mjs +128 -23
  213. package/dist/index65.mjs +24 -2
  214. package/dist/index66.mjs +7 -7
  215. package/dist/index67.mjs +22 -4
  216. package/dist/index68.mjs +2 -23
  217. package/dist/index71.mjs +2 -2
  218. package/dist/index72.mjs +5 -2
  219. package/dist/index73.mjs +2 -6
  220. package/dist/index74.mjs +5 -1133
  221. package/dist/index75.mjs +1130 -16
  222. package/dist/index76.mjs +16 -51
  223. package/dist/index77.mjs +49 -27
  224. package/dist/index78.mjs +33 -2
  225. package/dist/index79.mjs +2 -235
  226. package/dist/index80.mjs +233 -4
  227. package/dist/index81.mjs +5 -133
  228. package/dist/index82.mjs +129 -63
  229. package/dist/index83.mjs +67 -86
  230. package/dist/index84.mjs +85 -27
  231. package/dist/index85.mjs +28 -8
  232. package/dist/index86.mjs +8 -74
  233. package/dist/index87.mjs +74 -3
  234. package/dist/index88.mjs +4 -2
  235. package/dist/index89.mjs +2 -83
  236. package/dist/index90.mjs +81 -52
  237. package/dist/index91.mjs +53 -5
  238. package/dist/index92.mjs +5 -4
  239. package/dist/index93.mjs +4 -178
  240. package/dist/index94.mjs +174 -48
  241. package/dist/index95.mjs +51 -67
  242. package/dist/index96.mjs +69 -34
  243. package/dist/index97.mjs +2 -43
  244. package/dist/index98.mjs +2 -2
  245. package/dist/index99.mjs +28 -2
  246. package/dist/styles.css +1 -1
  247. package/package.json +2 -2
  248. package/src/components/Checkout.stories.tsx +84 -0
  249. package/src/components/Checkout.tsx +26 -34
  250. package/src/components/PostPurchaseUpsell.stories.tsx +201 -0
  251. package/src/components/PostPurchaseUpsell.tsx +154 -0
  252. package/src/components/ShoppingCart.tsx +3 -3
  253. package/src/components/ui/modal.tsx +3 -3
package/dist/index74.mjs CHANGED
@@ -1,1137 +1,9 @@
1
1
  'use client';
2
- import { __exports as ge } from "./index99.mjs";
3
- import "./index73.mjs";
4
- import { __require as $e } from "./index100.mjs";
5
- import { __require as Ze } from "./index101.mjs";
6
- import { __require as et } from "./index102.mjs";
7
- import { __require as tt } from "./index103.mjs";
8
- import { __require as rt } from "./index76.mjs";
9
- import { __require as at } from "./index104.mjs";
10
- import { __require as st } from "./index105.mjs";
11
- import { __require as it } from "./index106.mjs";
12
- import { __require as ot } from "./index107.mjs";
13
- import { __require as nt } from "./index108.mjs";
14
- import { __require as lt } from "./index109.mjs";
15
- import { __require as ct } from "./index110.mjs";
16
- import { __require as ht } from "./index111.mjs";
17
- import { __require as ut } from "./index112.mjs";
18
- import { __require as dt } from "./index113.mjs";
19
- import { __require as ft } from "./index114.mjs";
20
- import { __require as pt } from "./index115.mjs";
21
- import { __require as mt } from "./index116.mjs";
22
- import { __require as _t } from "./index117.mjs";
23
- import { __require as gt } from "./index118.mjs";
24
- import { __require as vt } from "./index119.mjs";
25
- import { __require as wt } from "./index120.mjs";
26
- import { __require as Pt } from "./index121.mjs";
27
- import { __require as Rt } from "./index122.mjs";
28
- import { __require as St } from "./index123.mjs";
29
- import { __require as Et } from "./index124.mjs";
30
- import { __require as yt } from "./index125.mjs";
31
- import { __require as Nt } from "./index126.mjs";
32
- import { __require as Lt } from "./index127.mjs";
33
- import { __require as Tt } from "./index128.mjs";
34
- import { __require as At } from "./index129.mjs";
35
- import { __require as qt } from "./index130.mjs";
36
- import { __require as Ct } from "./index131.mjs";
37
- import { __require as It } from "./index132.mjs";
38
- import { __require as Dt } from "./index133.mjs";
39
- import { __exports as bt } from "./index78.mjs";
40
- var Ue;
41
- function wr() {
42
- return Ue ? ge : (Ue = 1, function(ve) {
43
- Object.defineProperty(ve, "__esModule", {
44
- value: !0
45
- });
46
- function Me(u, r) {
47
- for (var t in r) Object.defineProperty(u, t, {
48
- enumerable: !0,
49
- get: r[t]
50
- });
51
- }
52
- Me(ve, {
53
- createKey: function() {
54
- return me;
55
- },
56
- default: function() {
57
- return D;
58
- },
59
- matchesMiddleware: function() {
60
- return oe;
61
- }
62
- });
63
- const we = bt, We = $e(), U = Ze(), K = et(), je = tt(), se = /* @__PURE__ */ We._(rt()), ke = at(), F = st(), Fe = /* @__PURE__ */ we._(it()), J = ot(), X = nt(), j = lt(), he = /* @__PURE__ */ we._(ct()), ie = ht(), te = ut(), A = dt(), Pe = ft(), re = pt(), M = mt(), ue = _t(), I = gt(), E = vt(), Q = wt(), Re = Pt(), Xe = Rt(), le = St(), Se = Et(), Ve = yt(), Ee = Nt(), Ge = Lt(), ze = Tt(), Ke = At(), Je = qt(), Qe = Ct();
64
- function ye() {
65
- return Object.assign(new Error("Route Cancelled"), {
66
- cancelled: !0
67
- });
68
- }
69
- async function oe(u) {
70
- const r = await Promise.resolve(u.router.pageLoader.getMiddleware());
71
- if (!r) return !1;
72
- const { pathname: t } = (0, re.parsePath)(u.asPath), e = (0, Q.hasBasePath)(t) ? (0, I.removeBasePath)(t) : t, a = (0, E.addBasePath)((0, M.addLocale)(e, u.locale));
73
- return r.some((d) => new RegExp(d.regexp).test(a));
74
- }
75
- function de(u) {
76
- const r = (0, J.getLocationOrigin)();
77
- return u.startsWith(r) ? u.substring(r.length) : u;
78
- }
79
- function fe(u, r, t) {
80
- let [e, a] = (0, Re.resolveHref)(u, r, !0);
81
- const d = (0, J.getLocationOrigin)(), p = e.startsWith(d), n = a && a.startsWith(d);
82
- e = de(e), a = a && de(a);
83
- const v = p ? e : (0, E.addBasePath)(e), i = t ? de((0, Re.resolveHref)(u, t)) : a || e;
84
- return {
85
- url: v,
86
- as: n ? i : (0, E.addBasePath)(i)
87
- };
88
- }
89
- function V(u, r) {
90
- const t = (0, U.removeTrailingSlash)((0, ke.denormalizePagePath)(u));
91
- return t === "/404" || t === "/_error" ? u : (r.includes(t) || r.some((e) => {
92
- if ((0, X.isDynamicRoute)(e) && (0, te.getRouteRegex)(e).re.test(t))
93
- return u = e, !0;
94
- }), (0, U.removeTrailingSlash)(u));
95
- }
96
- function Ye(u, r, t) {
97
- const e = {
98
- basePath: t.router.basePath,
99
- i18n: {
100
- locales: t.router.locales
101
- },
102
- trailingSlash: !!process.env.__NEXT_TRAILING_SLASH
103
- }, a = r.headers.get("x-nextjs-rewrite");
104
- let d = a || r.headers.get("x-nextjs-matched-path");
105
- const p = r.headers.get(Qe.MATCHED_PATH_HEADER);
106
- if (p && !d && !p.includes("__next_data_catchall") && !p.includes("/_error") && !p.includes("/404") && (d = p), d) {
107
- if (d.startsWith("/") || process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE) {
108
- const f = (0, j.parseRelativeUrl)(d), R = (0, le.getNextPathnameInfo)(f.pathname, {
109
- nextConfig: e,
110
- parseData: !0
111
- });
112
- let l = (0, U.removeTrailingSlash)(R.pathname);
113
- return Promise.all([
114
- t.router.pageLoader.getPageList(),
115
- (0, K.getClientBuildManifest)()
116
- ]).then((g) => {
117
- let [c, { __rewrites: m }] = g, h = (0, M.addLocale)(R.pathname, R.locale);
118
- if ((0, X.isDynamicRoute)(h) || !a && c.includes((0, F.normalizeLocalePath)((0, I.removeBasePath)(h), t.router.locales).pathname)) {
119
- const S = (0, le.getNextPathnameInfo)((0, j.parseRelativeUrl)(u).pathname, {
120
- nextConfig: process.env.__NEXT_HAS_REWRITES ? void 0 : e,
121
- parseData: !0
122
- });
123
- h = (0, E.addBasePath)(S.pathname), f.pathname = h;
124
- }
125
- if (process.env.__NEXT_HAS_REWRITES) {
126
- const S = (0, he.default)(h, c, m, f.query, (y) => V(y, c), t.router.locales);
127
- S.matchedPage && (f.pathname = S.parsedAs.pathname, h = f.pathname, Object.assign(f.query, S.parsedAs.query));
128
- } else if (!c.includes(l)) {
129
- const S = V(l, c);
130
- S !== l && (l = S);
131
- }
132
- const w = c.includes(l) ? l : V((0, F.normalizeLocalePath)((0, I.removeBasePath)(f.pathname), t.router.locales).pathname, c);
133
- if ((0, X.isDynamicRoute)(w)) {
134
- const S = (0, ie.getRouteMatcher)((0, te.getRouteRegex)(w))(h);
135
- Object.assign(f.query, S || {});
136
- }
137
- return {
138
- type: "rewrite",
139
- parsedAs: f,
140
- resolvedHref: w
141
- };
142
- });
143
- }
144
- const v = (0, re.parsePath)(u), i = (0, Se.formatNextPathnameInfo)({
145
- ...(0, le.getNextPathnameInfo)(v.pathname, {
146
- nextConfig: e,
147
- parseData: !0
148
- }),
149
- defaultLocale: t.router.defaultLocale,
150
- buildId: ""
151
- });
152
- return Promise.resolve({
153
- type: "redirect-external",
154
- destination: "" + i + v.query + v.hash
155
- });
156
- }
157
- const n = r.headers.get("x-nextjs-redirect");
158
- if (n) {
159
- if (n.startsWith("/")) {
160
- const v = (0, re.parsePath)(n), i = (0, Se.formatNextPathnameInfo)({
161
- ...(0, le.getNextPathnameInfo)(v.pathname, {
162
- nextConfig: e,
163
- parseData: !0
164
- }),
165
- defaultLocale: t.router.defaultLocale,
166
- buildId: ""
167
- });
168
- return Promise.resolve({
169
- type: "redirect-internal",
170
- newAs: "" + i + v.query + v.hash,
171
- newUrl: "" + i + v.query + v.hash
172
- });
173
- }
174
- return Promise.resolve({
175
- type: "redirect-external",
176
- destination: n
177
- });
178
- }
179
- return Promise.resolve({
180
- type: "next"
181
- });
182
- }
183
- async function Ne(u) {
184
- if (!await oe(u) || !u.fetchData)
185
- return null;
186
- const t = await u.fetchData(), e = await Ye(t.dataHref, t.response, u);
187
- return {
188
- dataHref: t.dataHref,
189
- json: t.json,
190
- response: t.response,
191
- text: t.text,
192
- cacheKey: t.cacheKey,
193
- effect: e
194
- };
195
- }
196
- const pe = process.env.__NEXT_SCROLL_RESTORATION && typeof window < "u" && "scrollRestoration" in window.history && !!function() {
197
- try {
198
- let u = "__next";
199
- return sessionStorage.setItem(u, u), sessionStorage.removeItem(u), !0;
200
- } catch {
201
- }
202
- }(), Le = Symbol("SSG_DATA_NOT_FOUND");
203
- function Te(u, r, t) {
204
- return fetch(u, {
205
- // Cookies are required to be present for Next.js' SSG "Preview Mode".
206
- // Cookies may also be required for `getServerSideProps`.
207
- //
208
- // > `fetch` won’t send cookies, unless you set the credentials init
209
- // > option.
210
- // https://developer.mozilla.org/docs/Web/API/Fetch_API/Using_Fetch
211
- //
212
- // > For maximum browser compatibility when it comes to sending &
213
- // > receiving cookies, always supply the `credentials: 'same-origin'`
214
- // > option instead of relying on the default.
215
- // https://github.com/github/fetch#caveats
216
- credentials: "same-origin",
217
- method: t.method || "GET",
218
- headers: Object.assign({}, t.headers, {
219
- "x-nextjs-data": "1"
220
- })
221
- }).then((e) => !e.ok && r > 1 && e.status >= 500 ? Te(u, r - 1, t) : e);
222
- }
223
- function Ae(u) {
224
- try {
225
- return JSON.parse(u);
226
- } catch {
227
- return null;
228
- }
229
- }
230
- function ne(u) {
231
- let { dataHref: r, inflightCache: t, isPrefetch: e, hasMiddleware: a, isServerRender: d, parseJSON: p, persistCache: n, isBackground: v, unstable_skipClientCache: i } = u;
232
- const { href: f } = new URL(r, window.location.href), R = (l) => {
233
- var g;
234
- return Te(r, d ? 3 : 1, {
235
- headers: Object.assign({}, e ? {
236
- purpose: "prefetch"
237
- } : {}, e && a ? {
238
- "x-middleware-prefetch": "1"
239
- } : {}),
240
- method: (g = l == null ? void 0 : l.method) != null ? g : "GET"
241
- }).then((c) => c.ok && (l == null ? void 0 : l.method) === "HEAD" ? {
242
- dataHref: r,
243
- response: c,
244
- text: "",
245
- json: {},
246
- cacheKey: f
247
- } : c.text().then((m) => {
248
- if (!c.ok) {
249
- if (a && [
250
- 301,
251
- 302,
252
- 307,
253
- 308
254
- ].includes(c.status))
255
- return {
256
- dataHref: r,
257
- response: c,
258
- text: m,
259
- json: {},
260
- cacheKey: f
261
- };
262
- if (c.status === 404) {
263
- var h;
264
- if ((h = Ae(m)) != null && h.notFound)
265
- return {
266
- dataHref: r,
267
- json: {
268
- notFound: Le
269
- },
270
- response: c,
271
- text: m,
272
- cacheKey: f
273
- };
274
- }
275
- const w = new Error("Failed to load static props");
276
- throw d || (0, K.markAssetError)(w), w;
277
- }
278
- return {
279
- dataHref: r,
280
- json: p ? Ae(m) : null,
281
- response: c,
282
- text: m,
283
- cacheKey: f
284
- };
285
- })).then((c) => ((!n || process.env.NODE_ENV !== "production" || c.response.headers.get("x-middleware-cache") === "no-cache") && delete t[f], c)).catch((c) => {
286
- throw i || delete t[f], // chrome
287
- (c.message === "Failed to fetch" || // firefox
288
- c.message === "NetworkError when attempting to fetch resource." || // safari
289
- c.message === "Load failed") && (0, K.markAssetError)(c), c;
290
- });
291
- };
292
- return i && n ? R({}).then((l) => (l.response.headers.get("x-middleware-cache") !== "no-cache" && (t[f] = Promise.resolve(l)), l)) : t[f] !== void 0 ? t[f] : t[f] = R(v ? {
293
- method: "HEAD"
294
- } : {});
295
- }
296
- function me() {
297
- return Math.random().toString(36).slice(2, 10);
298
- }
299
- function O(u) {
300
- let { url: r, router: t } = u;
301
- if (r === (0, E.addBasePath)((0, M.addLocale)(t.asPath, t.locale)))
302
- throw new Error("Invariant: attempted to hard navigate to the same URL " + r + " " + location.href);
303
- window.location.href = r;
304
- }
305
- const qe = (u) => {
306
- let { route: r, router: t } = u, e = !1;
307
- const a = t.clc = () => {
308
- e = !0;
309
- };
310
- return () => {
311
- if (e) {
312
- const p = new Error('Abort fetching component for route: "' + r + '"');
313
- throw p.cancelled = !0, p;
314
- }
315
- a === t.clc && (t.clc = null);
316
- };
317
- };
318
- class D {
319
- reload() {
320
- window.location.reload();
321
- }
322
- /**
323
- * Go back in history
324
- */
325
- back() {
326
- window.history.back();
327
- }
328
- /**
329
- * Go forward in history
330
- */
331
- forward() {
332
- window.history.forward();
333
- }
334
- /**
335
- * Performs a `pushState` with arguments
336
- * @param url of the route
337
- * @param as masks `url` for the browser
338
- * @param options object you can define `shallow` and other options
339
- */
340
- push(r, t, e) {
341
- if (e === void 0 && (e = {}), process.env.__NEXT_SCROLL_RESTORATION && pe)
342
- try {
343
- sessionStorage.setItem("__next_scroll_" + this._key, JSON.stringify({
344
- x: self.pageXOffset,
345
- y: self.pageYOffset
346
- }));
347
- } catch {
348
- }
349
- return { url: r, as: t } = fe(this, r, t), this.change("pushState", r, t, e);
350
- }
351
- /**
352
- * Performs a `replaceState` with arguments
353
- * @param url of the route
354
- * @param as masks `url` for the browser
355
- * @param options object you can define `shallow` and other options
356
- */
357
- replace(r, t, e) {
358
- return e === void 0 && (e = {}), { url: r, as: t } = fe(this, r, t), this.change("replaceState", r, t, e);
359
- }
360
- async _bfl(r, t, e, a) {
361
- if (process.env.__NEXT_CLIENT_ROUTER_FILTER_ENABLED) {
362
- if (!this._bfl_s && !this._bfl_d) {
363
- const { BloomFilter: R } = It();
364
- let l, g;
365
- try {
366
- ({ __routerFilterStatic: l, __routerFilterDynamic: g } = await (0, K.getClientBuildManifest)());
367
- } catch (h) {
368
- return console.error(h), a ? !0 : (O({
369
- url: (0, E.addBasePath)((0, M.addLocale)(r, e || this.locale, this.defaultLocale)),
370
- router: this
371
- }), new Promise(() => {
372
- }));
373
- }
374
- const c = process.env.__NEXT_CLIENT_ROUTER_S_FILTER;
375
- !l && c && (l = c || void 0);
376
- const m = process.env.__NEXT_CLIENT_ROUTER_D_FILTER;
377
- !g && m && (g = m || void 0), l != null && l.numHashes && (this._bfl_s = new R(l.numItems, l.errorRate), this._bfl_s.import(l)), g != null && g.numHashes && (this._bfl_d = new R(g.numItems, g.errorRate), this._bfl_d.import(g));
378
- }
379
- let v = !1, i = !1;
380
- const f = [
381
- {
382
- as: r
383
- },
384
- {
385
- as: t
386
- }
387
- ];
388
- for (const { as: R, allowMatchCurrent: l } of f)
389
- if (R) {
390
- const g = (0, U.removeTrailingSlash)(new URL(R, "http://n").pathname), c = (0, E.addBasePath)((0, M.addLocale)(g, e || this.locale));
391
- if (l || g !== (0, U.removeTrailingSlash)(new URL(this.asPath, "http://n").pathname)) {
392
- var d, p;
393
- v = v || !!((d = this._bfl_s) != null && d.contains(g)) || !!((p = this._bfl_s) != null && p.contains(c));
394
- for (const m of [
395
- g,
396
- c
397
- ]) {
398
- const h = m.split("/");
399
- for (let w = 0; !i && w < h.length + 1; w++) {
400
- var n;
401
- const S = h.slice(0, w).join("/");
402
- if (S && ((n = this._bfl_d) != null && n.contains(S))) {
403
- i = !0;
404
- break;
405
- }
406
- }
407
- }
408
- if (v || i)
409
- return a ? !0 : (O({
410
- url: (0, E.addBasePath)((0, M.addLocale)(r, e || this.locale, this.defaultLocale)),
411
- router: this
412
- }), new Promise(() => {
413
- }));
414
- }
415
- }
416
- }
417
- return !1;
418
- }
419
- async change(r, t, e, a, d) {
420
- var p;
421
- if (!(0, Ee.isLocalURL)(t))
422
- return O({
423
- url: t,
424
- router: this
425
- }), !1;
426
- const n = a._h === 1;
427
- !n && !a.shallow && await this._bfl(e, void 0, a.locale);
428
- let v = n || a._shouldResolveHref || (0, re.parsePath)(t).pathname === (0, re.parsePath)(e).pathname;
429
- const i = {
430
- ...this.state
431
- }, f = this.isReady !== !0;
432
- this.isReady = !0;
433
- const R = this.isSsr;
434
- if (n || (this.isSsr = !1), n && this.clc)
435
- return !1;
436
- const l = i.locale;
437
- if (process.env.__NEXT_I18N_SUPPORT) {
438
- i.locale = a.locale === !1 ? this.defaultLocale : a.locale || i.locale, typeof a.locale > "u" && (a.locale = i.locale);
439
- const s = (0, j.parseRelativeUrl)((0, Q.hasBasePath)(e) ? (0, I.removeBasePath)(e) : e), B = (0, F.normalizeLocalePath)(s.pathname, this.locales);
440
- B.detectedLocale && (i.locale = B.detectedLocale, s.pathname = (0, E.addBasePath)(s.pathname), e = (0, A.formatWithValidation)(s), t = (0, E.addBasePath)((0, F.normalizeLocalePath)((0, Q.hasBasePath)(t) ? (0, I.removeBasePath)(t) : t, this.locales).pathname));
441
- let k = !1;
442
- if (process.env.__NEXT_I18N_SUPPORT) {
443
- var g;
444
- (g = this.locales) != null && g.includes(i.locale) || (s.pathname = (0, M.addLocale)(s.pathname, i.locale), O({
445
- url: (0, A.formatWithValidation)(s),
446
- router: this
447
- }), k = !0);
448
- }
449
- const C = (0, Pe.detectDomainLocale)(this.domainLocales, void 0, i.locale);
450
- if (process.env.__NEXT_I18N_SUPPORT && !k && C && this.isLocaleDomain && self.location.hostname !== C.domain) {
451
- const Z = (0, I.removeBasePath)(e);
452
- O({
453
- url: "http" + (C.http ? "" : "s") + "://" + C.domain + (0, E.addBasePath)((i.locale === C.defaultLocale ? "" : "/" + i.locale) + (Z === "/" ? "" : Z) || "/"),
454
- router: this
455
- }), k = !0;
456
- }
457
- if (k)
458
- return new Promise(() => {
459
- });
460
- }
461
- J.ST && performance.mark("routeChange");
462
- const { shallow: c = !1, scroll: m = !0 } = a, h = {
463
- shallow: c
464
- };
465
- this._inFlightRoute && this.clc && (R || D.events.emit("routeChangeError", ye(), this._inFlightRoute, h), this.clc(), this.clc = null), e = (0, E.addBasePath)((0, M.addLocale)((0, Q.hasBasePath)(e) ? (0, I.removeBasePath)(e) : e, a.locale, this.defaultLocale));
466
- const w = (0, ue.removeLocale)((0, Q.hasBasePath)(e) ? (0, I.removeBasePath)(e) : e, i.locale);
467
- this._inFlightRoute = e;
468
- const S = l !== i.locale;
469
- if (!n && this.onlyAHashChange(w) && !S) {
470
- i.asPath = w, D.events.emit("hashChangeStart", e, h), this.changeState(r, t, e, {
471
- ...a,
472
- scroll: !1
473
- }), m && this.scrollToHash(w);
474
- try {
475
- await this.set(i, this.components[i.route], null);
476
- } catch (s) {
477
- throw (0, se.default)(s) && s.cancelled && D.events.emit("routeChangeError", s, w, h), s;
478
- }
479
- return D.events.emit("hashChangeComplete", e, h), !0;
480
- }
481
- let y = (0, j.parseRelativeUrl)(t), { pathname: _, query: P } = y, W, G;
482
- try {
483
- [W, { __rewrites: G }] = await Promise.all([
484
- this.pageLoader.getPageList(),
485
- (0, K.getClientBuildManifest)(),
486
- this.pageLoader.getMiddleware()
487
- ]);
488
- } catch {
489
- return O({
490
- url: e,
491
- router: this
492
- }), !1;
493
- }
494
- !this.urlIsNew(w) && !S && (r = "replaceState");
495
- let b = e;
496
- _ = _ && (0, U.removeTrailingSlash)((0, I.removeBasePath)(_));
497
- let o = (0, U.removeTrailingSlash)(_);
498
- const N = e.startsWith("/") && (0, j.parseRelativeUrl)(e).pathname;
499
- if ((p = this.components[_]) != null && p.__appRouter)
500
- return O({
501
- url: e,
502
- router: this
503
- }), new Promise(() => {
504
- });
505
- const Y = !!(N && o !== N && (!(0, X.isDynamicRoute)(o) || !(0, ie.getRouteMatcher)((0, te.getRouteRegex)(o))(N))), q = !a.shallow && await oe({
506
- asPath: e,
507
- locale: i.locale,
508
- router: this
509
- });
510
- if (n && q && (v = !1), v && _ !== "/_error")
511
- if (a._shouldResolveHref = !0, process.env.__NEXT_HAS_REWRITES && e.startsWith("/")) {
512
- const s = (0, he.default)((0, E.addBasePath)((0, M.addLocale)(w, i.locale), !0), W, G, P, (B) => V(B, W), this.locales);
513
- if (s.externalDest)
514
- return O({
515
- url: e,
516
- router: this
517
- }), !0;
518
- q || (b = s.asPath), s.matchedPage && s.resolvedHref && (_ = s.resolvedHref, y.pathname = (0, E.addBasePath)(_), q || (t = (0, A.formatWithValidation)(y)));
519
- } else
520
- y.pathname = V(_, W), y.pathname !== _ && (_ = y.pathname, y.pathname = (0, E.addBasePath)(_), q || (t = (0, A.formatWithValidation)(y)));
521
- if (!(0, Ee.isLocalURL)(e)) {
522
- if (process.env.NODE_ENV !== "production")
523
- throw new Error('Invalid href: "' + t + '" and as: "' + e + `", received relative href and external as
524
- See more info: https://nextjs.org/docs/messages/invalid-relative-url-external-as`);
525
- return O({
526
- url: e,
527
- router: this
528
- }), !1;
529
- }
530
- b = (0, ue.removeLocale)((0, I.removeBasePath)(b), i.locale), o = (0, U.removeTrailingSlash)(_);
531
- let H = !1;
532
- if ((0, X.isDynamicRoute)(o)) {
533
- const s = (0, j.parseRelativeUrl)(b), B = s.pathname, k = (0, te.getRouteRegex)(o);
534
- H = (0, ie.getRouteMatcher)(k)(B);
535
- const C = o === B, Z = C ? (0, Ke.interpolateAs)(o, B, P) : {};
536
- if (!H || C && !Z.result) {
537
- const ee = Object.keys(k.groups).filter((ae) => !P[ae] && !k.groups[ae].optional);
538
- if (ee.length > 0 && !q)
539
- throw process.env.NODE_ENV !== "production" && console.warn((C ? "Interpolating href" : "Mismatching `as` and `href`") + " failed to manually provide " + ("the params: " + ee.join(", ") + " in the `href`'s `query`")), new Error((C ? "The provided `href` (" + t + ") value is missing query values (" + ee.join(", ") + ") to be interpolated properly. " : "The provided `as` value (" + B + ") is incompatible with the `href` value (" + o + "). ") + ("Read more: https://nextjs.org/docs/messages/" + (C ? "href-interpolation-failed" : "incompatible-href-as")));
540
- } else C ? e = (0, A.formatWithValidation)(Object.assign({}, s, {
541
- pathname: Z.result,
542
- query: (0, ze.omit)(P, Z.params)
543
- })) : Object.assign(P, H);
544
- }
545
- n || D.events.emit("routeChangeStart", e, h);
546
- const ce = this.pathname === "/404" || this.pathname === "/_error";
547
- try {
548
- var T, $, Ce;
549
- let s = await this.getRouteInfo({
550
- route: o,
551
- pathname: _,
552
- query: P,
553
- as: e,
554
- resolvedAs: b,
555
- routeProps: h,
556
- locale: i.locale,
557
- isPreview: i.isPreview,
558
- hasMiddleware: q,
559
- unstable_skipClientCache: a.unstable_skipClientCache,
560
- isQueryUpdating: n && !this.isFallback,
561
- isMiddlewareRewrite: Y
562
- });
563
- if (!n && !a.shallow && await this._bfl(e, "resolvedAs" in s ? s.resolvedAs : void 0, i.locale), "route" in s && q) {
564
- _ = s.route || o, o = _, h.shallow || (P = Object.assign({}, s.query || {}, P));
565
- const L = (0, Q.hasBasePath)(y.pathname) ? (0, I.removeBasePath)(y.pathname) : y.pathname;
566
- if (H && _ !== L && Object.keys(H).forEach((x) => {
567
- H && P[x] === H[x] && delete P[x];
568
- }), (0, X.isDynamicRoute)(_)) {
569
- let z = !h.shallow && s.resolvedAs ? s.resolvedAs : (0, E.addBasePath)((0, M.addLocale)(new URL(e, location.href).pathname, i.locale), !0);
570
- if ((0, Q.hasBasePath)(z) && (z = (0, I.removeBasePath)(z)), process.env.__NEXT_I18N_SUPPORT) {
571
- const Be = (0, F.normalizeLocalePath)(z, this.locales);
572
- i.locale = Be.detectedLocale || i.locale, z = Be.pathname;
573
- }
574
- const _e = (0, te.getRouteRegex)(_), He = (0, ie.getRouteMatcher)(_e)(new URL(z, location.href).pathname);
575
- He && Object.assign(P, He);
576
- }
577
- }
578
- if ("type" in s)
579
- return s.type === "redirect-internal" ? this.change(r, s.newUrl, s.newAs, a) : (O({
580
- url: s.destination,
581
- router: this
582
- }), new Promise(() => {
583
- }));
584
- const B = s.Component;
585
- if (B && B.unstable_scriptLoader && [].concat(B.unstable_scriptLoader()).forEach((x) => {
586
- (0, je.handleClientScriptLoad)(x.props);
587
- }), (s.__N_SSG || s.__N_SSP) && s.props) {
588
- if (s.props.pageProps && s.props.pageProps.__N_REDIRECT) {
589
- a.locale = !1;
590
- const L = s.props.pageProps.__N_REDIRECT;
591
- if (L.startsWith("/") && s.props.pageProps.__N_REDIRECT_BASE_PATH !== !1) {
592
- const x = (0, j.parseRelativeUrl)(L);
593
- x.pathname = V(x.pathname, W);
594
- const { url: z, as: _e } = fe(this, L, L);
595
- return this.change(r, z, _e, a);
596
- }
597
- return O({
598
- url: L,
599
- router: this
600
- }), new Promise(() => {
601
- });
602
- }
603
- if (i.isPreview = !!s.props.__N_PREVIEW, s.props.notFound === Le) {
604
- let L;
605
- try {
606
- await this.fetchComponent("/404"), L = "/404";
607
- } catch {
608
- L = "/_error";
609
- }
610
- if (s = await this.getRouteInfo({
611
- route: L,
612
- pathname: L,
613
- query: P,
614
- as: e,
615
- resolvedAs: b,
616
- routeProps: {
617
- shallow: !1
618
- },
619
- locale: i.locale,
620
- isPreview: i.isPreview,
621
- isNotFound: !0
622
- }), "type" in s)
623
- throw new Error("Unexpected middleware effect on /404");
624
- }
625
- }
626
- n && this.pathname === "/_error" && (($ = self.__NEXT_DATA__.props) == null || (T = $.pageProps) == null ? void 0 : T.statusCode) === 500 && ((Ce = s.props) != null && Ce.pageProps) && (s.props.pageProps.statusCode = 500);
627
- var Ie;
628
- const k = a.shallow && i.route === ((Ie = s.route) != null ? Ie : o);
629
- var De;
630
- const C = (De = a.scroll) != null ? De : !n && !k, ee = d ?? (C ? {
631
- x: 0,
632
- y: 0
633
- } : null), ae = {
634
- ...i,
635
- route: o,
636
- pathname: _,
637
- query: P,
638
- asPath: w,
639
- isFallback: !1
640
- };
641
- if (n && ce) {
642
- var be, xe, Oe;
643
- if (s = await this.getRouteInfo({
644
- route: this.pathname,
645
- pathname: this.pathname,
646
- query: P,
647
- as: e,
648
- resolvedAs: b,
649
- routeProps: {
650
- shallow: !1
651
- },
652
- locale: i.locale,
653
- isPreview: i.isPreview,
654
- isQueryUpdating: n && !this.isFallback
655
- }), "type" in s)
656
- throw new Error("Unexpected middleware effect on " + this.pathname);
657
- this.pathname === "/_error" && ((xe = self.__NEXT_DATA__.props) == null || (be = xe.pageProps) == null ? void 0 : be.statusCode) === 500 && ((Oe = s.props) != null && Oe.pageProps) && (s.props.pageProps.statusCode = 500);
658
- try {
659
- await this.set(ae, s, ee);
660
- } catch (L) {
661
- throw (0, se.default)(L) && L.cancelled && D.events.emit("routeChangeError", L, w, h), L;
662
- }
663
- return !0;
664
- }
665
- if (D.events.emit("beforeHistoryChange", e, h), this.changeState(r, t, e, a), !(n && !ee && !f && !S && (0, Ve.compareRouterStates)(ae, this.state))) {
666
- try {
667
- await this.set(ae, s, ee);
668
- } catch (x) {
669
- if (x.cancelled) s.error = s.error || x;
670
- else throw x;
671
- }
672
- if (s.error)
673
- throw n || D.events.emit("routeChangeError", s.error, w, h), s.error;
674
- process.env.__NEXT_I18N_SUPPORT && i.locale && (document.documentElement.lang = i.locale), n || D.events.emit("routeChangeComplete", e, h), C && /#.+$/.test(e) && this.scrollToHash(e);
675
- }
676
- return !0;
677
- } catch (s) {
678
- if ((0, se.default)(s) && s.cancelled)
679
- return !1;
680
- throw s;
681
- }
682
- }
683
- changeState(r, t, e, a) {
684
- if (a === void 0 && (a = {}), process.env.NODE_ENV !== "production") {
685
- if (typeof window.history > "u") {
686
- console.error("Warning: window.history is not available.");
687
- return;
688
- }
689
- if (typeof window.history[r] > "u") {
690
- console.error("Warning: window.history." + r + " is not available");
691
- return;
692
- }
693
- }
694
- (r !== "pushState" || (0, J.getURL)() !== e) && (this._shallow = a.shallow, window.history[r](
695
- {
696
- url: t,
697
- as: e,
698
- options: a,
699
- __N: !0,
700
- key: this._key = r !== "pushState" ? this._key : me()
701
- },
702
- // Most browsers currently ignores this parameter, although they may use it in the future.
703
- // Passing the empty string here should be safe against future changes to the method.
704
- // https://developer.mozilla.org/docs/Web/API/History/replaceState
705
- "",
706
- e
707
- ));
708
- }
709
- async handleRouteInfoError(r, t, e, a, d, p) {
710
- if (r.cancelled)
711
- throw r;
712
- if ((0, K.isAssetError)(r) || p)
713
- throw D.events.emit("routeChangeError", r, a, d), O({
714
- url: a,
715
- router: this
716
- }), ye();
717
- console.error(r);
718
- try {
719
- let n;
720
- const { page: v, styleSheets: i } = await this.fetchComponent("/_error"), f = {
721
- props: n,
722
- Component: v,
723
- styleSheets: i,
724
- err: r,
725
- error: r
726
- };
727
- if (!f.props)
728
- try {
729
- f.props = await this.getInitialProps(v, {
730
- err: r,
731
- pathname: t,
732
- query: e
733
- });
734
- } catch (R) {
735
- console.error("Error in error page `getInitialProps`: ", R), f.props = {};
736
- }
737
- return f;
738
- } catch (n) {
739
- return this.handleRouteInfoError((0, se.default)(n) ? n : new Error(n + ""), t, e, a, d, !0);
740
- }
741
- }
742
- async getRouteInfo(r) {
743
- let { route: t, pathname: e, query: a, as: d, resolvedAs: p, routeProps: n, locale: v, hasMiddleware: i, isPreview: f, unstable_skipClientCache: R, isQueryUpdating: l, isMiddlewareRewrite: g, isNotFound: c } = r, m = t;
744
- try {
745
- var h, w, S, y;
746
- let _ = this.components[m];
747
- if (n.shallow && _ && this.route === m)
748
- return _;
749
- const P = qe({
750
- route: m,
751
- router: this
752
- });
753
- i && (_ = void 0);
754
- let W = _ && !("initial" in _) && process.env.NODE_ENV !== "development" ? _ : void 0;
755
- const G = l, b = {
756
- dataHref: this.pageLoader.getDataHref({
757
- href: (0, A.formatWithValidation)({
758
- pathname: e,
759
- query: a
760
- }),
761
- skipInterpolation: !0,
762
- asPath: c ? "/404" : p,
763
- locale: v
764
- }),
765
- hasMiddleware: !0,
766
- isServerRender: this.isSsr,
767
- parseJSON: !0,
768
- inflightCache: G ? this.sbc : this.sdc,
769
- persistCache: !f,
770
- isPrefetch: !1,
771
- unstable_skipClientCache: R,
772
- isBackground: G
773
- };
774
- let o = l && !g ? null : await Ne({
775
- fetchData: () => ne(b),
776
- asPath: c ? "/404" : p,
777
- locale: v,
778
- router: this
779
- }).catch((T) => {
780
- if (l)
781
- return null;
782
- throw T;
783
- });
784
- if (o && (e === "/_error" || e === "/404") && (o.effect = void 0), l && (o ? o.json = self.__NEXT_DATA__.props : o = {
785
- json: self.__NEXT_DATA__.props
786
- }), P(), (o == null || (h = o.effect) == null ? void 0 : h.type) === "redirect-internal" || (o == null || (w = o.effect) == null ? void 0 : w.type) === "redirect-external")
787
- return o.effect;
788
- if ((o == null || (S = o.effect) == null ? void 0 : S.type) === "rewrite") {
789
- const T = (0, U.removeTrailingSlash)(o.effect.resolvedHref), $ = await this.pageLoader.getPageList();
790
- if ((!l || $.includes(T)) && (m = T, e = o.effect.resolvedHref, a = {
791
- ...a,
792
- ...o.effect.parsedAs.query
793
- }, p = (0, I.removeBasePath)((0, F.normalizeLocalePath)(o.effect.parsedAs.pathname, this.locales).pathname), _ = this.components[m], n.shallow && _ && this.route === m && !i))
794
- return {
795
- ..._,
796
- route: m
797
- };
798
- }
799
- if ((0, Xe.isAPIRoute)(m))
800
- return O({
801
- url: d,
802
- router: this
803
- }), new Promise(() => {
804
- });
805
- const N = W || await this.fetchComponent(m).then((T) => ({
806
- Component: T.page,
807
- styleSheets: T.styleSheets,
808
- __N_SSG: T.mod.__N_SSG,
809
- __N_SSP: T.mod.__N_SSP
810
- }));
811
- if (process.env.NODE_ENV !== "production") {
812
- const { isValidElementType: T } = Dt();
813
- if (!T(N.Component))
814
- throw new Error('The default export is not a React Component in page: "' + e + '"');
815
- }
816
- const Y = o == null || (y = o.response) == null ? void 0 : y.headers.get("x-middleware-skip"), q = N.__N_SSG || N.__N_SSP;
817
- Y && (o != null && o.dataHref) && delete this.sdc[o.dataHref];
818
- const { props: H, cacheKey: ce } = await this._getData(async () => {
819
- if (q) {
820
- if (o != null && o.json && !Y)
821
- return {
822
- cacheKey: o.cacheKey,
823
- props: o.json
824
- };
825
- const T = o != null && o.dataHref ? o.dataHref : this.pageLoader.getDataHref({
826
- href: (0, A.formatWithValidation)({
827
- pathname: e,
828
- query: a
829
- }),
830
- asPath: p,
831
- locale: v
832
- }), $ = await ne({
833
- dataHref: T,
834
- isServerRender: this.isSsr,
835
- parseJSON: !0,
836
- inflightCache: Y ? {} : this.sdc,
837
- persistCache: !f,
838
- isPrefetch: !1,
839
- unstable_skipClientCache: R
840
- });
841
- return {
842
- cacheKey: $.cacheKey,
843
- props: $.json || {}
844
- };
845
- }
846
- return {
847
- headers: {},
848
- props: await this.getInitialProps(
849
- N.Component,
850
- // we provide AppTree later so this needs to be `any`
851
- {
852
- pathname: e,
853
- query: a,
854
- asPath: d,
855
- locale: v,
856
- locales: this.locales,
857
- defaultLocale: this.defaultLocale
858
- }
859
- )
860
- };
861
- });
862
- return N.__N_SSP && b.dataHref && ce && delete this.sdc[ce], !this.isPreview && N.__N_SSG && process.env.NODE_ENV !== "development" && !l && ne(Object.assign({}, b, {
863
- isBackground: !0,
864
- persistCache: !1,
865
- inflightCache: this.sbc
866
- })).catch(() => {
867
- }), H.pageProps = Object.assign({}, H.pageProps), N.props = H, N.route = m, N.query = a, N.resolvedAs = p, this.components[m] = N, N;
868
- } catch (_) {
869
- return this.handleRouteInfoError((0, se.getProperError)(_), e, a, d, n);
870
- }
871
- }
872
- set(r, t, e) {
873
- return this.state = r, this.sub(t, this.components["/_app"].Component, e);
874
- }
875
- /**
876
- * Callback to execute before replacing router state
877
- * @param cb callback to be executed
878
- */
879
- beforePopState(r) {
880
- this._bps = r;
881
- }
882
- onlyAHashChange(r) {
883
- if (!this.asPath) return !1;
884
- const [t, e] = this.asPath.split("#", 2), [a, d] = r.split("#", 2);
885
- return d && t === a && e === d ? !0 : t !== a ? !1 : e !== d;
886
- }
887
- scrollToHash(r) {
888
- const [, t = ""] = r.split("#", 2);
889
- (0, Je.handleSmoothScroll)(() => {
890
- if (t === "" || t === "top") {
891
- window.scrollTo(0, 0);
892
- return;
893
- }
894
- const e = decodeURIComponent(t), a = document.getElementById(e);
895
- if (a) {
896
- a.scrollIntoView();
897
- return;
898
- }
899
- const d = document.getElementsByName(e)[0];
900
- d && d.scrollIntoView();
901
- }, {
902
- onlyHashChange: this.onlyAHashChange(r)
903
- });
904
- }
905
- urlIsNew(r) {
906
- return this.asPath !== r;
907
- }
908
- /**
909
- * Prefetch page code, you may wait for the data during page rendering.
910
- * This feature only works in production!
911
- * @param url the href of prefetched page
912
- * @param asPath the as path of the prefetched page
913
- */
914
- async prefetch(r, t, e) {
915
- if (t === void 0 && (t = r), e === void 0 && (e = {}), process.env.NODE_ENV !== "production" || typeof window < "u" && (0, Ge.isBot)(window.navigator.userAgent))
916
- return;
917
- let a = (0, j.parseRelativeUrl)(r);
918
- const d = a.pathname;
919
- let { pathname: p, query: n } = a;
920
- const v = p;
921
- if (process.env.__NEXT_I18N_SUPPORT && e.locale === !1) {
922
- p = (0, F.normalizeLocalePath)(p, this.locales).pathname, a.pathname = p, r = (0, A.formatWithValidation)(a);
923
- let m = (0, j.parseRelativeUrl)(t);
924
- const h = (0, F.normalizeLocalePath)(m.pathname, this.locales);
925
- m.pathname = h.pathname, e.locale = h.detectedLocale || this.defaultLocale, t = (0, A.formatWithValidation)(m);
926
- }
927
- const i = await this.pageLoader.getPageList();
928
- let f = t;
929
- const R = typeof e.locale < "u" ? e.locale || void 0 : this.locale, l = await oe({
930
- asPath: t,
931
- locale: R,
932
- router: this
933
- });
934
- if (process.env.__NEXT_HAS_REWRITES && t.startsWith("/")) {
935
- let m;
936
- ({ __rewrites: m } = await (0, K.getClientBuildManifest)());
937
- const h = (0, he.default)((0, E.addBasePath)((0, M.addLocale)(t, this.locale), !0), i, m, a.query, (w) => V(w, i), this.locales);
938
- if (h.externalDest)
939
- return;
940
- l || (f = (0, ue.removeLocale)((0, I.removeBasePath)(h.asPath), this.locale)), h.matchedPage && h.resolvedHref && (p = h.resolvedHref, a.pathname = p, l || (r = (0, A.formatWithValidation)(a)));
941
- }
942
- a.pathname = V(a.pathname, i), (0, X.isDynamicRoute)(a.pathname) && (p = a.pathname, a.pathname = p, Object.assign(n, (0, ie.getRouteMatcher)((0, te.getRouteRegex)(a.pathname))((0, re.parsePath)(t).pathname) || {}), l || (r = (0, A.formatWithValidation)(a)));
943
- const g = process.env.__NEXT_MIDDLEWARE_PREFETCH === "strict" ? null : await Ne({
944
- fetchData: () => ne({
945
- dataHref: this.pageLoader.getDataHref({
946
- href: (0, A.formatWithValidation)({
947
- pathname: v,
948
- query: n
949
- }),
950
- skipInterpolation: !0,
951
- asPath: f,
952
- locale: R
953
- }),
954
- hasMiddleware: !0,
955
- isServerRender: !1,
956
- parseJSON: !0,
957
- inflightCache: this.sdc,
958
- persistCache: !this.isPreview,
959
- isPrefetch: !0
960
- }),
961
- asPath: t,
962
- locale: R,
963
- router: this
964
- });
965
- if ((g == null ? void 0 : g.effect.type) === "rewrite" && (a.pathname = g.effect.resolvedHref, p = g.effect.resolvedHref, n = {
966
- ...n,
967
- ...g.effect.parsedAs.query
968
- }, f = g.effect.parsedAs.pathname, r = (0, A.formatWithValidation)(a)), (g == null ? void 0 : g.effect.type) === "redirect-external")
969
- return;
970
- const c = (0, U.removeTrailingSlash)(p);
971
- await this._bfl(t, f, e.locale, !0) && (this.components[d] = {
972
- __appRouter: !0
973
- }), await Promise.all([
974
- this.pageLoader._isSsg(c).then((m) => m ? ne({
975
- dataHref: g != null && g.json ? g == null ? void 0 : g.dataHref : this.pageLoader.getDataHref({
976
- href: r,
977
- asPath: f,
978
- locale: R
979
- }),
980
- isServerRender: !1,
981
- parseJSON: !0,
982
- inflightCache: this.sdc,
983
- persistCache: !this.isPreview,
984
- isPrefetch: !0,
985
- unstable_skipClientCache: e.unstable_skipClientCache || e.priority && !!process.env.__NEXT_OPTIMISTIC_CLIENT_CACHE
986
- }).then(() => !1).catch(() => !1) : !1),
987
- this.pageLoader[e.priority ? "loadPage" : "prefetch"](c)
988
- ]);
989
- }
990
- async fetchComponent(r) {
991
- const t = qe({
992
- route: r,
993
- router: this
994
- });
995
- try {
996
- const e = await this.pageLoader.loadPage(r);
997
- return t(), e;
998
- } catch (e) {
999
- throw t(), e;
1000
- }
1001
- }
1002
- _getData(r) {
1003
- let t = !1;
1004
- const e = () => {
1005
- t = !0;
1006
- };
1007
- return this.clc = e, r().then((a) => {
1008
- if (e === this.clc && (this.clc = null), t) {
1009
- const d = new Error("Loading initial props cancelled");
1010
- throw d.cancelled = !0, d;
1011
- }
1012
- return a;
1013
- });
1014
- }
1015
- getInitialProps(r, t) {
1016
- const { Component: e } = this.components["/_app"], a = this._wrapApp(e);
1017
- return t.AppTree = a, (0, J.loadGetInitialProps)(e, {
1018
- AppTree: a,
1019
- Component: r,
1020
- router: this,
1021
- ctx: t
1022
- });
1023
- }
1024
- get route() {
1025
- return this.state.route;
1026
- }
1027
- get pathname() {
1028
- return this.state.pathname;
1029
- }
1030
- get query() {
1031
- return this.state.query;
1032
- }
1033
- get asPath() {
1034
- return this.state.asPath;
1035
- }
1036
- get locale() {
1037
- return this.state.locale;
1038
- }
1039
- get isFallback() {
1040
- return this.state.isFallback;
1041
- }
1042
- get isPreview() {
1043
- return this.state.isPreview;
1044
- }
1045
- constructor(r, t, e, { initialProps: a, pageLoader: d, App: p, wrapApp: n, Component: v, err: i, subscription: f, isFallback: R, locale: l, locales: g, defaultLocale: c, domainLocales: m, isPreview: h }) {
1046
- this.sdc = {}, this.sbc = {}, this.isFirstPopStateEvent = !0, this._key = me(), this.onPopState = (y) => {
1047
- const { isFirstPopStateEvent: _ } = this;
1048
- this.isFirstPopStateEvent = !1;
1049
- const P = y.state;
1050
- if (!P) {
1051
- const { pathname: q, query: H } = this;
1052
- this.changeState("replaceState", (0, A.formatWithValidation)({
1053
- pathname: (0, E.addBasePath)(q),
1054
- query: H
1055
- }), (0, J.getURL)());
1056
- return;
1057
- }
1058
- if (P.__NA) {
1059
- window.location.reload();
1060
- return;
1061
- }
1062
- if (!P.__N || _ && this.locale === P.options.locale && P.as === this.asPath)
1063
- return;
1064
- let W;
1065
- const { url: G, as: b, options: o, key: N } = P;
1066
- if (process.env.__NEXT_SCROLL_RESTORATION && pe && this._key !== N) {
1067
- try {
1068
- sessionStorage.setItem("__next_scroll_" + this._key, JSON.stringify({
1069
- x: self.pageXOffset,
1070
- y: self.pageYOffset
1071
- }));
1072
- } catch {
1073
- }
1074
- try {
1075
- const q = sessionStorage.getItem("__next_scroll_" + N);
1076
- W = JSON.parse(q);
1077
- } catch {
1078
- W = {
1079
- x: 0,
1080
- y: 0
1081
- };
1082
- }
1083
- }
1084
- this._key = N;
1085
- const { pathname: Y } = (0, j.parseRelativeUrl)(G);
1086
- this.isSsr && b === (0, E.addBasePath)(this.asPath) && Y === (0, E.addBasePath)(this.pathname) || this._bps && !this._bps(P) || this.change("replaceState", G, b, Object.assign({}, o, {
1087
- shallow: o.shallow && this._shallow,
1088
- locale: o.locale || this.defaultLocale,
1089
- // @ts-ignore internal value not exposed on types
1090
- _h: 0
1091
- }), W);
1092
- };
1093
- const w = (0, U.removeTrailingSlash)(r);
1094
- this.components = {}, r !== "/_error" && (this.components[w] = {
1095
- Component: v,
1096
- initial: !0,
1097
- props: a,
1098
- err: i,
1099
- __N_SSG: a && a.__N_SSG,
1100
- __N_SSP: a && a.__N_SSP
1101
- }), this.components["/_app"] = {
1102
- Component: p,
1103
- styleSheets: []
1104
- }, this.events = D.events, this.pageLoader = d;
1105
- const S = (0, X.isDynamicRoute)(r) && self.__NEXT_DATA__.autoExport;
1106
- if (this.basePath = process.env.__NEXT_ROUTER_BASEPATH || "", this.sub = f, this.clc = null, this._wrapApp = n, this.isSsr = !0, this.isLocaleDomain = !1, this.isReady = !!(self.__NEXT_DATA__.gssp || self.__NEXT_DATA__.gip || self.__NEXT_DATA__.isExperimentalCompile || self.__NEXT_DATA__.appGip && !self.__NEXT_DATA__.gsp || !S && !self.location.search && !process.env.__NEXT_HAS_REWRITES), process.env.__NEXT_I18N_SUPPORT && (this.locales = g, this.defaultLocale = c, this.domainLocales = m, this.isLocaleDomain = !!(0, Pe.detectDomainLocale)(m, self.location.hostname)), this.state = {
1107
- route: w,
1108
- pathname: r,
1109
- query: t,
1110
- asPath: S ? r : e,
1111
- isPreview: !!h,
1112
- locale: process.env.__NEXT_I18N_SUPPORT ? l : void 0,
1113
- isFallback: R
1114
- }, this._initialMatchesMiddlewarePromise = Promise.resolve(!1), typeof window < "u") {
1115
- if (!e.startsWith("//")) {
1116
- const y = {
1117
- locale: l
1118
- }, _ = (0, J.getURL)();
1119
- this._initialMatchesMiddlewarePromise = oe({
1120
- router: this,
1121
- locale: l,
1122
- asPath: _
1123
- }).then((P) => (y._shouldResolveHref = e !== r, this.changeState("replaceState", P ? _ : (0, A.formatWithValidation)({
1124
- pathname: (0, E.addBasePath)(r),
1125
- query: t
1126
- }), _, y), P));
1127
- }
1128
- window.addEventListener("popstate", this.onPopState), process.env.__NEXT_SCROLL_RESTORATION && pe && (window.history.scrollRestoration = "manual");
1129
- }
1130
- }
1131
- }
1132
- D.events = (0, Fe.default)();
1133
- }(ge), ge);
2
+ import { __exports as r } from "./index79.mjs";
3
+ function t(e) {
4
+ return e && e.__esModule ? e : { default: e };
1134
5
  }
6
+ r._ = t;
1135
7
  export {
1136
- wr as __require
8
+ r as default
1137
9
  };