@faststore/core 3.0.20 → 3.0.21
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +90 -89
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_abdhua +1 -0
- package/.next/cache/next-server.js.nft.json +1 -0
- package/.next/cache/webpack/client-development/0.pack +0 -0
- package/.next/cache/webpack/client-development/1.pack +0 -0
- package/.next/cache/webpack/client-development/2.pack +0 -0
- package/.next/cache/webpack/client-development/index.pack +0 -0
- package/.next/cache/webpack/client-development/index.pack.old +0 -0
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/1.pack +0 -0
- package/.next/cache/webpack/client-production/2.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/server-development/0.pack +0 -0
- package/.next/cache/webpack/server-development/1.pack +0 -0
- package/.next/cache/webpack/server-development/2.pack +0 -0
- package/.next/cache/webpack/server-development/3.pack +0 -0
- package/.next/cache/webpack/server-development/4.pack +0 -0
- package/.next/cache/webpack/server-development/index.pack +0 -0
- package/.next/cache/webpack/server-development/index.pack.old +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/1.pack +0 -0
- package/.next/cache/webpack/server-production/2.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/.next/images-manifest.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +18 -18
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/117.js +430 -0
- package/.next/server/chunks/177.js +125 -0
- package/.next/server/chunks/183.js +122 -0
- package/.next/server/chunks/184.js +61 -0
- package/.next/server/chunks/289.js +240 -0
- package/.next/server/chunks/312.js +678 -0
- package/.next/server/chunks/350.js +2834 -0
- package/.next/server/chunks/386.js +200 -0
- package/.next/server/chunks/390.js +550 -0
- package/.next/server/chunks/398.js +611 -0
- package/.next/server/chunks/404.js +434 -1
- package/.next/server/chunks/53.js +61 -0
- package/.next/server/chunks/57.js +434 -1
- package/.next/server/chunks/574.js +145 -0
- package/.next/server/chunks/576.js +122 -0
- package/.next/server/chunks/585.js +640 -0
- package/.next/server/chunks/676.js +32 -0
- package/.next/server/chunks/693.js +58 -1
- package/.next/server/chunks/732.js +1881 -0
- package/.next/server/chunks/74.js +4066 -0
- package/.next/server/chunks/779.js +58 -1
- package/.next/server/chunks/825.js +4074 -0
- package/.next/server/chunks/854.js +72 -0
- package/.next/server/chunks/859.js +957 -4
- package/.next/server/chunks/863.js +111 -0
- package/.next/server/chunks/979.js +1305 -0
- package/.next/server/chunks/98.js +163 -0
- package/.next/server/chunks/988.js +211 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js +391 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js +395 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1076 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +2265 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js +301 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +363 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js +164 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account.js +370 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +2999 -1
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/api/health/live.js +31 -1
- package/.next/server/pages/api/health/live.js.nft.json +1 -1
- package/.next/server/pages/api/health/ready.js +31 -1
- package/.next/server/pages/api/health/ready.js.nft.json +1 -1
- package/.next/server/pages/api/preview.js +137 -1
- package/.next/server/pages/api/preview.js.nft.json +1 -1
- package/.next/server/pages/checkout.js +370 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/404.json +1 -1
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/500.json +1 -1
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/account.json +1 -1
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/checkout.json +1 -1
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/login.json +1 -1
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US/s.json +1 -1
- package/.next/server/pages/en-US.html +5 -5
- package/.next/server/pages/en-US.json +1 -1
- package/.next/server/pages/index.js +439 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js +382 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +554 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +18 -1
- package/.next/server/webpack-api-runtime.js +229 -1
- package/.next/server/webpack-runtime.js +229 -1
- package/.next/static/HI-kc1kjNIbFyFsZCeDEA/_buildManifest.js +1 -0
- package/.next/static/chunks/223-cb77217cce52d45c.js +1 -0
- package/.next/static/chunks/251.1c79f06f2a2814b1.js +1 -0
- package/.next/static/chunks/386.d01e0db26c523f0f.js +1 -0
- package/.next/static/chunks/400-d4daabcd57b2ea80.js +1 -0
- package/.next/static/chunks/469-7259b855711d4ad3.js +1 -0
- package/.next/static/chunks/574.70612be06fd1365f.js +1 -0
- package/.next/static/chunks/585.4c5d40fc6a72a611.js +1 -0
- package/.next/static/chunks/651.7142f31ce1e052b3.js +1 -0
- package/.next/static/chunks/741.52f7fb873418346f.js +1 -0
- package/.next/static/chunks/783-fbcb7a3216c40744.js +1 -0
- package/.next/static/chunks/800.ee4f8b9622001e8c.js +1 -0
- package/.next/static/chunks/98.40c7e17d9de4eb8f.js +1 -0
- package/.next/static/chunks/988.afda042dd9ba11d1.js +1 -0
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +1 -0
- package/.next/static/chunks/main-e4e873ee741162eb.js +1 -0
- package/.next/static/chunks/pages/404-2240f0b22db2d370.js +1 -0
- package/.next/static/chunks/pages/500-c0580e3299329874.js +1 -0
- package/.next/static/chunks/pages/[...slug]-3eed3497c887fae5.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-e1df08570f34a0d8.js +1 -0
- package/.next/static/chunks/pages/_app-30b9666307e4b3b1.js +1 -0
- package/.next/static/chunks/pages/_error-319451dea77827a6.js +1 -0
- package/.next/static/chunks/pages/account-b35bcbef719765f3.js +1 -0
- package/.next/static/chunks/pages/checkout-55bd56ade4408cbe.js +1 -0
- package/.next/static/chunks/pages/index-2506749e45c335bf.js +1 -0
- package/.next/static/chunks/pages/login-3f94bff1503b4fdc.js +1 -0
- package/.next/static/chunks/pages/s-2374cff2e39ed624.js +1 -0
- package/.next/static/chunks/webpack-af94306e71c4459d.js +1 -0
- package/.next/static/css/29868543c76bc6fd.css +1 -0
- package/.next/static/css/527e334fa69cf40a.css +1 -0
- package/.next/static/css/{b9d9ba1b04f3160d.css → 6a7fdc5a21fbead5.css} +1 -1
- package/.next/static/css/723835bce380750d.css +1 -0
- package/.next/static/css/{d586715f4f707df4.css → a2eefb25a4608343.css} +1 -1
- package/.next/static/css/{e32410b31c666cb2.css → cb7d1fcea42fab9c.css} +1 -1
- package/.next/static/css/d7bbfbd552f407e9.css +1 -0
- package/.next/static/css/{2980acad3f8e1028.css → df588bb98c0b0ca6.css} +1 -1
- package/.next/static/css/dfbdb0f27fd64782.css +1 -0
- package/.next/static/css/e84fc497732ea596.css +1 -0
- package/.next/trace +80 -91
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-dev.log +45 -0
- package/@generated/gql.ts +4 -4
- package/@generated/graphql.ts +54 -12
- package/package.json +3 -3
- package/src/components/product/ProductCard/ProductCard.tsx +7 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +7 -0
- package/.next/cache/config.json +0 -7
- package/.next/cache/eslint/.cache_1gneedd +0 -1
- package/.next/next-minimal-server.js.nft.json +0 -1
- package/.next/prerender-manifest.js +0 -1
- package/.next/server/chunks/119.js +0 -1
- package/.next/server/chunks/12.js +0 -1
- package/.next/server/chunks/187.js +0 -1
- package/.next/server/chunks/202.js +0 -1
- package/.next/server/chunks/24.js +0 -1
- package/.next/server/chunks/242.js +0 -1
- package/.next/server/chunks/247.js +0 -1
- package/.next/server/chunks/344.js +0 -1
- package/.next/server/chunks/414.js +0 -1
- package/.next/server/chunks/484.js +0 -1
- package/.next/server/chunks/493.js +0 -1
- package/.next/server/chunks/498.js +0 -1
- package/.next/server/chunks/540.js +0 -1
- package/.next/server/chunks/624.js +0 -1
- package/.next/server/chunks/640.js +0 -6
- package/.next/server/chunks/646.js +0 -280
- package/.next/server/chunks/659.js +0 -9
- package/.next/server/chunks/679.js +0 -1
- package/.next/server/chunks/694.js +0 -1
- package/.next/server/chunks/82.js +0 -8
- package/.next/server/chunks/857.js +0 -1
- package/.next/server/chunks/881.js +0 -1
- package/.next/server/chunks/917.js +0 -1
- package/.next/server/chunks/936.js +0 -1
- package/.next/server/chunks/96.js +0 -1
- package/.next/server/chunks/997.js +0 -1
- package/.next/server/functions-config-manifest.json +0 -1
- package/.next/server/next-font-manifest.js +0 -1
- package/.next/server/next-font-manifest.json +0 -1
- package/.next/static/chunks/104-4f83b1d87ad36358.js +0 -1
- package/.next/static/chunks/161-b39fe2f79ff7bc85.js +0 -1
- package/.next/static/chunks/202.c7d8a71173edecfb.js +0 -1
- package/.next/static/chunks/217.01bc0ad07edd6f1b.js +0 -1
- package/.next/static/chunks/247.6f1391104a867395.js +0 -1
- package/.next/static/chunks/484.b82b73b1d8c37e02.js +0 -1
- package/.next/static/chunks/540.6c62d2536d42a1e0.js +0 -1
- package/.next/static/chunks/575-853fb8b1ba4ce8c4.js +0 -14
- package/.next/static/chunks/624.d3de62b4562a33f3.js +0 -1
- package/.next/static/chunks/629-c74f247bd29420a5.js +0 -1
- package/.next/static/chunks/65.da22595d53beae76.js +0 -1
- package/.next/static/chunks/758.b53ee01b506973e0.js +0 -1
- package/.next/static/chunks/857.d2299cfe995af21d.js +0 -1
- package/.next/static/chunks/framework-8e279965036b6169.js +0 -33
- package/.next/static/chunks/main-6f63f6746cc029db.js +0 -1
- package/.next/static/chunks/pages/404-1334d11ab8467b3d.js +0 -1
- package/.next/static/chunks/pages/500-449c5bd51f98423f.js +0 -1
- package/.next/static/chunks/pages/[...slug]-bcaf61b01157d8cb.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-5fb8fe2c80ec1608.js +0 -1
- package/.next/static/chunks/pages/_app-ad8623e78bc5b766.js +0 -68
- package/.next/static/chunks/pages/_error-fbf331a03642b495.js +0 -1
- package/.next/static/chunks/pages/account-dbc5c028225cd1ac.js +0 -1
- package/.next/static/chunks/pages/checkout-29ae2c37eaf172e1.js +0 -1
- package/.next/static/chunks/pages/index-cd109119d65df8e3.js +0 -1
- package/.next/static/chunks/pages/login-c4d2c856008df5ac.js +0 -1
- package/.next/static/chunks/pages/s-26e475975386c51a.js +0 -1
- package/.next/static/chunks/webpack-b4a2fdf4ef127bb7.js +0 -1
- package/.next/static/css/0d45c82d8887a269.css +0 -1
- package/.next/static/css/211c7542af66d8b4.css +0 -1
- package/.next/static/css/4c4d90eb8cb1d2b7.css +0 -1
- package/.next/static/css/821a5219786be653.css +0 -1
- package/.next/static/css/96e3fddf695d6aa9.css +0 -1
- package/.next/static/css/cff9aafa16fccc9c.css +0 -1
- package/.next/static/rG9HjHHbItuqOEnXtbNZ5/_buildManifest.js +0 -1
- package/.turbo/turbo-lint.log +0 -2
- package/.turbo/turbo-test.log +0 -23
- package/@generated/graphql/persisted.json +0 -13
- package/@generated/graphql/schema.graphql +0 -1053
- package/@generated/persisted-documents.json +0 -13
- package/@generated/schema.graphql +0 -1055
- /package/.next/static/{rG9HjHHbItuqOEnXtbNZ5 → HI-kc1kjNIbFyFsZCeDEA}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,4074 @@
|
|
|
1
|
+
exports.id = 825;
|
|
2
|
+
exports.ids = [825];
|
|
3
|
+
exports.modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 932:
|
|
6
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
var __webpack_unused_export__;
|
|
10
|
+
|
|
11
|
+
__webpack_unused_export__ = ({
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.Z = _asyncToGenerator;
|
|
15
|
+
function _asyncToGenerator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
31
|
+
try {
|
|
32
|
+
var info = gen[key](arg);
|
|
33
|
+
var value = info.value;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
reject(error);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (info.done) {
|
|
39
|
+
resolve(value);
|
|
40
|
+
} else {
|
|
41
|
+
Promise.resolve(value).then(_next, _throw);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/***/ }),
|
|
47
|
+
|
|
48
|
+
/***/ 6495:
|
|
49
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
50
|
+
|
|
51
|
+
"use strict";
|
|
52
|
+
var __webpack_unused_export__;
|
|
53
|
+
|
|
54
|
+
__webpack_unused_export__ = ({
|
|
55
|
+
value: true
|
|
56
|
+
});
|
|
57
|
+
exports.Z = _extends;
|
|
58
|
+
function _extends() {
|
|
59
|
+
return extends_.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
function extends_() {
|
|
62
|
+
extends_ = Object.assign || function(target) {
|
|
63
|
+
for(var i = 1; i < arguments.length; i++){
|
|
64
|
+
var source = arguments[i];
|
|
65
|
+
for(var key in source){
|
|
66
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
67
|
+
target[key] = source[key];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return target;
|
|
72
|
+
};
|
|
73
|
+
return extends_.apply(this, arguments);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
/***/ }),
|
|
78
|
+
|
|
79
|
+
/***/ 2648:
|
|
80
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
81
|
+
|
|
82
|
+
"use strict";
|
|
83
|
+
var __webpack_unused_export__;
|
|
84
|
+
|
|
85
|
+
__webpack_unused_export__ = ({
|
|
86
|
+
value: true
|
|
87
|
+
});
|
|
88
|
+
exports.Z = _interopRequireDefault;
|
|
89
|
+
function _interopRequireDefault(obj) {
|
|
90
|
+
return obj && obj.__esModule ? obj : {
|
|
91
|
+
default: obj
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/***/ }),
|
|
97
|
+
|
|
98
|
+
/***/ 1598:
|
|
99
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
100
|
+
|
|
101
|
+
"use strict";
|
|
102
|
+
var __webpack_unused_export__;
|
|
103
|
+
|
|
104
|
+
__webpack_unused_export__ = ({
|
|
105
|
+
value: true
|
|
106
|
+
});
|
|
107
|
+
exports.Z = _interopRequireWildcard;
|
|
108
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
109
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
110
|
+
return obj;
|
|
111
|
+
}
|
|
112
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
113
|
+
return {
|
|
114
|
+
default: obj
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
118
|
+
if (cache && cache.has(obj)) {
|
|
119
|
+
return cache.get(obj);
|
|
120
|
+
}
|
|
121
|
+
var newObj = {};
|
|
122
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
123
|
+
for(var key in obj){
|
|
124
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
125
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
126
|
+
if (desc && (desc.get || desc.set)) {
|
|
127
|
+
Object.defineProperty(newObj, key, desc);
|
|
128
|
+
} else {
|
|
129
|
+
newObj[key] = obj[key];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
newObj.default = obj;
|
|
134
|
+
if (cache) {
|
|
135
|
+
cache.set(obj, newObj);
|
|
136
|
+
}
|
|
137
|
+
return newObj;
|
|
138
|
+
}
|
|
139
|
+
function _getRequireWildcardCache(nodeInterop1) {
|
|
140
|
+
if (typeof WeakMap !== "function") return null;
|
|
141
|
+
var cacheBabelInterop = new WeakMap();
|
|
142
|
+
var cacheNodeInterop = new WeakMap();
|
|
143
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
144
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
145
|
+
})(nodeInterop1);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
/***/ }),
|
|
150
|
+
|
|
151
|
+
/***/ 7273:
|
|
152
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
153
|
+
|
|
154
|
+
"use strict";
|
|
155
|
+
var __webpack_unused_export__;
|
|
156
|
+
|
|
157
|
+
__webpack_unused_export__ = ({
|
|
158
|
+
value: true
|
|
159
|
+
});
|
|
160
|
+
exports.Z = _objectWithoutPropertiesLoose;
|
|
161
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
162
|
+
if (source == null) return {};
|
|
163
|
+
var target = {};
|
|
164
|
+
var sourceKeys = Object.keys(source);
|
|
165
|
+
var key, i;
|
|
166
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
167
|
+
key = sourceKeys[i];
|
|
168
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
169
|
+
target[key] = source[key];
|
|
170
|
+
}
|
|
171
|
+
return target;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
/***/ }),
|
|
176
|
+
|
|
177
|
+
/***/ 227:
|
|
178
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
179
|
+
|
|
180
|
+
"use strict";
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
184
|
+
value: true
|
|
185
|
+
}));
|
|
186
|
+
exports.addBasePath = addBasePath;
|
|
187
|
+
|
|
188
|
+
var _addPathPrefix = __webpack_require__(1751);
|
|
189
|
+
|
|
190
|
+
var _normalizeTrailingSlash = __webpack_require__(4969);
|
|
191
|
+
|
|
192
|
+
const basePath = false || '';
|
|
193
|
+
|
|
194
|
+
function addBasePath(path, required) {
|
|
195
|
+
if (false) {}
|
|
196
|
+
|
|
197
|
+
return (0, _normalizeTrailingSlash).normalizePathTrailingSlash((0, _addPathPrefix).addPathPrefix(path, basePath));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
201
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
202
|
+
value: true
|
|
203
|
+
});
|
|
204
|
+
Object.assign(exports.default, exports);
|
|
205
|
+
module.exports = exports.default;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/***/ }),
|
|
209
|
+
|
|
210
|
+
/***/ 7995:
|
|
211
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
212
|
+
|
|
213
|
+
"use strict";
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
217
|
+
value: true
|
|
218
|
+
}));
|
|
219
|
+
exports.addLocale = void 0;
|
|
220
|
+
|
|
221
|
+
var _normalizeTrailingSlash = __webpack_require__(4969);
|
|
222
|
+
|
|
223
|
+
const addLocale = (path, ...args) => {
|
|
224
|
+
if (true) {
|
|
225
|
+
return (0, _normalizeTrailingSlash).normalizePathTrailingSlash((__webpack_require__(3431).addLocale)(path, ...args));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return path;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
exports.addLocale = addLocale;
|
|
232
|
+
|
|
233
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
234
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
235
|
+
value: true
|
|
236
|
+
});
|
|
237
|
+
Object.assign(exports.default, exports);
|
|
238
|
+
module.exports = exports.default;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/***/ }),
|
|
242
|
+
|
|
243
|
+
/***/ 7565:
|
|
244
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
245
|
+
|
|
246
|
+
"use strict";
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
250
|
+
value: true
|
|
251
|
+
}));
|
|
252
|
+
exports.detectDomainLocale = void 0;
|
|
253
|
+
|
|
254
|
+
const detectDomainLocale = (...args) => {
|
|
255
|
+
if (true) {
|
|
256
|
+
return (__webpack_require__(3539).detectDomainLocale)(...args);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
exports.detectDomainLocale = detectDomainLocale;
|
|
261
|
+
|
|
262
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
263
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
264
|
+
value: true
|
|
265
|
+
});
|
|
266
|
+
Object.assign(exports.default, exports);
|
|
267
|
+
module.exports = exports.default;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/***/ }),
|
|
271
|
+
|
|
272
|
+
/***/ 1432:
|
|
273
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
274
|
+
|
|
275
|
+
"client";
|
|
276
|
+
"use strict";
|
|
277
|
+
|
|
278
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
279
|
+
value: true
|
|
280
|
+
}));
|
|
281
|
+
exports["default"] = Image;
|
|
282
|
+
|
|
283
|
+
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
|
|
284
|
+
|
|
285
|
+
var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
|
|
286
|
+
|
|
287
|
+
var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
|
|
288
|
+
|
|
289
|
+
var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
|
|
290
|
+
|
|
291
|
+
var _react = _interop_require_wildcard(__webpack_require__(6689));
|
|
292
|
+
|
|
293
|
+
var _head = _interop_require_default(__webpack_require__(4957));
|
|
294
|
+
|
|
295
|
+
var _imageBlurSvg = __webpack_require__(4486);
|
|
296
|
+
|
|
297
|
+
var _imageConfig = __webpack_require__(5843);
|
|
298
|
+
|
|
299
|
+
var _imageConfigContext = __webpack_require__(744);
|
|
300
|
+
|
|
301
|
+
var _utils = __webpack_require__(9232);
|
|
302
|
+
|
|
303
|
+
function Image(_param) {
|
|
304
|
+
var {
|
|
305
|
+
src,
|
|
306
|
+
sizes,
|
|
307
|
+
unoptimized = false,
|
|
308
|
+
priority = false,
|
|
309
|
+
loading,
|
|
310
|
+
className,
|
|
311
|
+
quality,
|
|
312
|
+
width,
|
|
313
|
+
height,
|
|
314
|
+
fill,
|
|
315
|
+
style,
|
|
316
|
+
onLoadingComplete,
|
|
317
|
+
placeholder = 'empty',
|
|
318
|
+
blurDataURL
|
|
319
|
+
} = _param,
|
|
320
|
+
all = _object_without_properties_loose(_param, ["src", "sizes", "unoptimized", "priority", "loading", "className", "quality", "width", "height", "fill", "style", "onLoadingComplete", "placeholder", "blurDataURL"]);
|
|
321
|
+
|
|
322
|
+
const configContext = (0, _react).useContext(_imageConfigContext.ImageConfigContext);
|
|
323
|
+
const config = (0, _react).useMemo(() => {
|
|
324
|
+
const c = configEnv || configContext || _imageConfig.imageConfigDefault;
|
|
325
|
+
const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b);
|
|
326
|
+
const deviceSizes = c.deviceSizes.sort((a, b) => a - b);
|
|
327
|
+
return _extends({}, c, {
|
|
328
|
+
allSizes,
|
|
329
|
+
deviceSizes
|
|
330
|
+
});
|
|
331
|
+
}, [configContext]);
|
|
332
|
+
let rest = all;
|
|
333
|
+
let loader = defaultLoader;
|
|
334
|
+
|
|
335
|
+
if ('loader' in rest) {
|
|
336
|
+
if (rest.loader) {
|
|
337
|
+
const customImageLoader = rest.loader;
|
|
338
|
+
|
|
339
|
+
var _tmp;
|
|
340
|
+
|
|
341
|
+
_tmp = obj => {
|
|
342
|
+
const {
|
|
343
|
+
config: _
|
|
344
|
+
} = obj,
|
|
345
|
+
opts = _object_without_properties_loose(obj, ["config"]); // The config object is internal only so we must
|
|
346
|
+
// not pass it to the user-defined loader()
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
return customImageLoader(opts);
|
|
350
|
+
}, loader = _tmp, _tmp;
|
|
351
|
+
} // Remove property so it's not spread on <img>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
delete rest.loader;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
let staticSrc = '';
|
|
358
|
+
let widthInt = getInt(width);
|
|
359
|
+
let heightInt = getInt(height);
|
|
360
|
+
let blurWidth;
|
|
361
|
+
let blurHeight;
|
|
362
|
+
|
|
363
|
+
if (isStaticImport(src)) {
|
|
364
|
+
const staticImageData = isStaticRequire(src) ? src.default : src;
|
|
365
|
+
|
|
366
|
+
if (!staticImageData.src) {
|
|
367
|
+
throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(staticImageData)}`);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (!staticImageData.height || !staticImageData.width) {
|
|
371
|
+
throw new Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(staticImageData)}`);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
blurWidth = staticImageData.blurWidth;
|
|
375
|
+
blurHeight = staticImageData.blurHeight;
|
|
376
|
+
blurDataURL = blurDataURL || staticImageData.blurDataURL;
|
|
377
|
+
staticSrc = staticImageData.src;
|
|
378
|
+
|
|
379
|
+
if (!fill) {
|
|
380
|
+
if (!widthInt && !heightInt) {
|
|
381
|
+
widthInt = staticImageData.width;
|
|
382
|
+
heightInt = staticImageData.height;
|
|
383
|
+
} else if (widthInt && !heightInt) {
|
|
384
|
+
const ratio = widthInt / staticImageData.width;
|
|
385
|
+
heightInt = Math.round(staticImageData.height * ratio);
|
|
386
|
+
} else if (!widthInt && heightInt) {
|
|
387
|
+
const ratio = heightInt / staticImageData.height;
|
|
388
|
+
widthInt = Math.round(staticImageData.width * ratio);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
src = typeof src === 'string' ? src : staticSrc;
|
|
394
|
+
let isLazy = !priority && (loading === 'lazy' || typeof loading === 'undefined');
|
|
395
|
+
|
|
396
|
+
if (src.startsWith('data:') || src.startsWith('blob:')) {
|
|
397
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
|
|
398
|
+
unoptimized = true;
|
|
399
|
+
isLazy = false;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (config.unoptimized) {
|
|
403
|
+
unoptimized = true;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const [blurComplete, setBlurComplete] = (0, _react).useState(false);
|
|
407
|
+
const [showAltText, setShowAltText] = (0, _react).useState(false);
|
|
408
|
+
const qualityInt = getInt(quality);
|
|
409
|
+
|
|
410
|
+
if (false) {}
|
|
411
|
+
|
|
412
|
+
const imgStyle = Object.assign(fill ? {
|
|
413
|
+
position: 'absolute',
|
|
414
|
+
height: '100%',
|
|
415
|
+
width: '100%',
|
|
416
|
+
left: 0,
|
|
417
|
+
top: 0,
|
|
418
|
+
right: 0,
|
|
419
|
+
bottom: 0
|
|
420
|
+
} : {}, showAltText ? {} : {
|
|
421
|
+
color: 'transparent'
|
|
422
|
+
}, style);
|
|
423
|
+
const blurStyle = placeholder === 'blur' && blurDataURL && !blurComplete ? {
|
|
424
|
+
backgroundSize: imgStyle.objectFit || 'cover',
|
|
425
|
+
backgroundPosition: imgStyle.objectPosition || '50% 50%',
|
|
426
|
+
backgroundRepeat: 'no-repeat',
|
|
427
|
+
backgroundImage: `url("data:image/svg+xml;charset=utf-8,${(0, _imageBlurSvg).getImageBlurSvg({
|
|
428
|
+
widthInt,
|
|
429
|
+
heightInt,
|
|
430
|
+
blurWidth,
|
|
431
|
+
blurHeight,
|
|
432
|
+
blurDataURL
|
|
433
|
+
})}")`
|
|
434
|
+
} : {};
|
|
435
|
+
|
|
436
|
+
if (false) {}
|
|
437
|
+
|
|
438
|
+
const imgAttributes = generateImgAttrs({
|
|
439
|
+
config,
|
|
440
|
+
src,
|
|
441
|
+
unoptimized,
|
|
442
|
+
width: widthInt,
|
|
443
|
+
quality: qualityInt,
|
|
444
|
+
sizes,
|
|
445
|
+
loader
|
|
446
|
+
});
|
|
447
|
+
let srcString = src;
|
|
448
|
+
|
|
449
|
+
if (false) {}
|
|
450
|
+
|
|
451
|
+
let imageSrcSetPropName = 'imagesrcset';
|
|
452
|
+
let imageSizesPropName = 'imagesizes';
|
|
453
|
+
|
|
454
|
+
if (true) {
|
|
455
|
+
imageSrcSetPropName = 'imageSrcSet';
|
|
456
|
+
imageSizesPropName = 'imageSizes';
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const linkProps = {
|
|
460
|
+
// Note: imagesrcset and imagesizes are not in the link element type with react 17.
|
|
461
|
+
[imageSrcSetPropName]: imgAttributes.srcSet,
|
|
462
|
+
[imageSizesPropName]: imgAttributes.sizes,
|
|
463
|
+
crossOrigin: rest.crossOrigin
|
|
464
|
+
};
|
|
465
|
+
const onLoadingCompleteRef = (0, _react).useRef(onLoadingComplete);
|
|
466
|
+
(0, _react).useEffect(() => {
|
|
467
|
+
onLoadingCompleteRef.current = onLoadingComplete;
|
|
468
|
+
}, [onLoadingComplete]);
|
|
469
|
+
|
|
470
|
+
const imgElementArgs = _extends({
|
|
471
|
+
isLazy,
|
|
472
|
+
imgAttributes,
|
|
473
|
+
heightInt,
|
|
474
|
+
widthInt,
|
|
475
|
+
qualityInt,
|
|
476
|
+
className,
|
|
477
|
+
imgStyle,
|
|
478
|
+
blurStyle,
|
|
479
|
+
loading,
|
|
480
|
+
config,
|
|
481
|
+
fill,
|
|
482
|
+
unoptimized,
|
|
483
|
+
placeholder,
|
|
484
|
+
loader,
|
|
485
|
+
srcString,
|
|
486
|
+
onLoadingCompleteRef,
|
|
487
|
+
setBlurComplete,
|
|
488
|
+
setShowAltText
|
|
489
|
+
}, rest);
|
|
490
|
+
|
|
491
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ImageElement, Object.assign({}, imgElementArgs)), priority ? // Note how we omit the `href` attribute, as it would only be relevant
|
|
492
|
+
// for browsers that do not support `imagesrcset`, and in those cases
|
|
493
|
+
// it would likely cause the incorrect image to be preloaded.
|
|
494
|
+
//
|
|
495
|
+
// https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset
|
|
496
|
+
|
|
497
|
+
/*#__PURE__*/
|
|
498
|
+
_react.default.createElement(_head.default, null, /*#__PURE__*/_react.default.createElement("link", Object.assign({
|
|
499
|
+
key: '__nimg-' + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes,
|
|
500
|
+
rel: "preload",
|
|
501
|
+
as: "image",
|
|
502
|
+
href: imgAttributes.srcSet ? undefined : imgAttributes.src
|
|
503
|
+
}, linkProps))) : null);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
'client';
|
|
507
|
+
const configEnv = {"deviceSizes":[360,540,768,1280,1440],"imageSizes":[34,68,154,320],"path":"/_next/image","loader":"default","dangerouslyAllowSVG":false,"unoptimized":false};
|
|
508
|
+
const allImgs = new Map();
|
|
509
|
+
let perfObserver;
|
|
510
|
+
|
|
511
|
+
if (true) {
|
|
512
|
+
global.__NEXT_IMAGE_IMPORTED = true;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const VALID_LOADING_VALUES = (/* unused pure expression or super */ null && (['lazy', 'eager', undefined]));
|
|
516
|
+
|
|
517
|
+
function isStaticRequire(src) {
|
|
518
|
+
return src.default !== undefined;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function isStaticImageData(src) {
|
|
522
|
+
return src.src !== undefined;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function isStaticImport(src) {
|
|
526
|
+
return typeof src === 'object' && (isStaticRequire(src) || isStaticImageData(src));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
function getWidths({
|
|
530
|
+
deviceSizes,
|
|
531
|
+
allSizes
|
|
532
|
+
}, width, sizes) {
|
|
533
|
+
if (sizes) {
|
|
534
|
+
// Find all the "vw" percent sizes used in the sizes prop
|
|
535
|
+
const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g;
|
|
536
|
+
const percentSizes = [];
|
|
537
|
+
|
|
538
|
+
for (let match; match = viewportWidthRe.exec(sizes); match) {
|
|
539
|
+
percentSizes.push(parseInt(match[2]));
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (percentSizes.length) {
|
|
543
|
+
const smallestRatio = Math.min(...percentSizes) * 0.01;
|
|
544
|
+
return {
|
|
545
|
+
widths: allSizes.filter(s => s >= deviceSizes[0] * smallestRatio),
|
|
546
|
+
kind: 'w'
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
return {
|
|
551
|
+
widths: allSizes,
|
|
552
|
+
kind: 'w'
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (typeof width !== 'number') {
|
|
557
|
+
return {
|
|
558
|
+
widths: deviceSizes,
|
|
559
|
+
kind: 'w'
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
const widths = [...new Set( // > This means that most OLED screens that say they are 3x resolution,
|
|
564
|
+
// > are actually 3x in the green color, but only 1.5x in the red and
|
|
565
|
+
// > blue colors. Showing a 3x resolution image in the app vs a 2x
|
|
566
|
+
// > resolution image will be visually the same, though the 3x image
|
|
567
|
+
// > takes significantly more data. Even true 3x resolution screens are
|
|
568
|
+
// > wasteful as the human eye cannot see that level of detail without
|
|
569
|
+
// > something like a magnifying glass.
|
|
570
|
+
// https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
|
|
571
|
+
[width, width * 2
|
|
572
|
+
/*, width * 3*/
|
|
573
|
+
].map(w => allSizes.find(p => p >= w) || allSizes[allSizes.length - 1]))];
|
|
574
|
+
return {
|
|
575
|
+
widths,
|
|
576
|
+
kind: 'x'
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function generateImgAttrs({
|
|
581
|
+
config,
|
|
582
|
+
src,
|
|
583
|
+
unoptimized,
|
|
584
|
+
width,
|
|
585
|
+
quality,
|
|
586
|
+
sizes,
|
|
587
|
+
loader
|
|
588
|
+
}) {
|
|
589
|
+
if (unoptimized) {
|
|
590
|
+
return {
|
|
591
|
+
src,
|
|
592
|
+
srcSet: undefined,
|
|
593
|
+
sizes: undefined
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const {
|
|
598
|
+
widths,
|
|
599
|
+
kind
|
|
600
|
+
} = getWidths(config, width, sizes);
|
|
601
|
+
const last = widths.length - 1;
|
|
602
|
+
return {
|
|
603
|
+
sizes: !sizes && kind === 'w' ? '100vw' : sizes,
|
|
604
|
+
srcSet: widths.map((w, i) => `${loader({
|
|
605
|
+
config,
|
|
606
|
+
src,
|
|
607
|
+
quality,
|
|
608
|
+
width: w
|
|
609
|
+
})} ${kind === 'w' ? w : i + 1}${kind}`).join(', '),
|
|
610
|
+
// It's intended to keep `src` the last attribute because React updates
|
|
611
|
+
// attributes in order. If we keep `src` the first one, Safari will
|
|
612
|
+
// immediately start to fetch `src`, before `sizes` and `srcSet` are even
|
|
613
|
+
// updated by React. That causes multiple unnecessary requests if `srcSet`
|
|
614
|
+
// and `sizes` are defined.
|
|
615
|
+
// This bug cannot be reproduced in Chrome or Firefox.
|
|
616
|
+
src: loader({
|
|
617
|
+
config,
|
|
618
|
+
src,
|
|
619
|
+
quality,
|
|
620
|
+
width: widths[last]
|
|
621
|
+
})
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
function getInt(x) {
|
|
626
|
+
if (typeof x === 'number' || typeof x === 'undefined') {
|
|
627
|
+
return x;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (typeof x === 'string' && /^[0-9]+$/.test(x)) {
|
|
631
|
+
return parseInt(x, 10);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
return NaN;
|
|
635
|
+
} // See https://stackoverflow.com/q/39777833/266535 for why we use this ref
|
|
636
|
+
// handler instead of the img's onLoad attribute.
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
function handleLoading(img, src, placeholder, onLoadingCompleteRef, setBlurComplete) {
|
|
640
|
+
if (!img || img['data-loaded-src'] === src) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
img['data-loaded-src'] = src;
|
|
645
|
+
const p = 'decode' in img ? img.decode() : Promise.resolve();
|
|
646
|
+
p.catch(() => {}).then(() => {
|
|
647
|
+
if (!img.parentNode) {
|
|
648
|
+
// Exit early in case of race condition:
|
|
649
|
+
// - onload() is called
|
|
650
|
+
// - decode() is called but incomplete
|
|
651
|
+
// - unmount is called
|
|
652
|
+
// - decode() completes
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (placeholder === 'blur') {
|
|
657
|
+
setBlurComplete(true);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
if (onLoadingCompleteRef == null ? void 0 : onLoadingCompleteRef.current) {
|
|
661
|
+
onLoadingCompleteRef.current(img);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
if (false) {}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const ImageElement = _param => {
|
|
669
|
+
var {
|
|
670
|
+
imgAttributes,
|
|
671
|
+
heightInt,
|
|
672
|
+
widthInt,
|
|
673
|
+
qualityInt,
|
|
674
|
+
className,
|
|
675
|
+
imgStyle,
|
|
676
|
+
blurStyle,
|
|
677
|
+
isLazy,
|
|
678
|
+
fill,
|
|
679
|
+
placeholder,
|
|
680
|
+
loading,
|
|
681
|
+
srcString,
|
|
682
|
+
config,
|
|
683
|
+
unoptimized,
|
|
684
|
+
loader,
|
|
685
|
+
onLoadingCompleteRef,
|
|
686
|
+
setBlurComplete,
|
|
687
|
+
setShowAltText,
|
|
688
|
+
onLoad,
|
|
689
|
+
onError
|
|
690
|
+
} = _param,
|
|
691
|
+
rest = _object_without_properties_loose(_param, ["imgAttributes", "heightInt", "widthInt", "qualityInt", "className", "imgStyle", "blurStyle", "isLazy", "fill", "placeholder", "loading", "srcString", "config", "unoptimized", "loader", "onLoadingCompleteRef", "setBlurComplete", "setShowAltText", "onLoad", "onError"]);
|
|
692
|
+
|
|
693
|
+
loading = isLazy ? 'lazy' : loading;
|
|
694
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("img", Object.assign({}, rest, imgAttributes, {
|
|
695
|
+
width: widthInt,
|
|
696
|
+
height: heightInt,
|
|
697
|
+
decoding: "async",
|
|
698
|
+
"data-nimg": `future${fill ? '-fill' : ''}`,
|
|
699
|
+
className: className,
|
|
700
|
+
// @ts-ignore - TODO: upgrade to `@types/react@17`
|
|
701
|
+
loading: loading,
|
|
702
|
+
style: _extends({}, imgStyle, blurStyle),
|
|
703
|
+
ref: (0, _react).useCallback(img => {
|
|
704
|
+
if (!img) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (onError) {
|
|
709
|
+
// If the image has an error before react hydrates, then the error is lost.
|
|
710
|
+
// The workaround is to wait until the image is mounted which is after hydration,
|
|
711
|
+
// then we set the src again to trigger the error handler (if there was an error).
|
|
712
|
+
// eslint-disable-next-line no-self-assign
|
|
713
|
+
img.src = img.src;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if (false) {}
|
|
717
|
+
|
|
718
|
+
if (img.complete) {
|
|
719
|
+
handleLoading(img, srcString, placeholder, onLoadingCompleteRef, setBlurComplete);
|
|
720
|
+
}
|
|
721
|
+
}, [srcString, placeholder, onLoadingCompleteRef, setBlurComplete, onError]),
|
|
722
|
+
onLoad: event => {
|
|
723
|
+
const img = event.currentTarget;
|
|
724
|
+
handleLoading(img, srcString, placeholder, onLoadingCompleteRef, setBlurComplete);
|
|
725
|
+
|
|
726
|
+
if (onLoad) {
|
|
727
|
+
onLoad(event);
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
onError: event => {
|
|
731
|
+
// if the real image fails to load, this will ensure "alt" is visible
|
|
732
|
+
setShowAltText(true);
|
|
733
|
+
|
|
734
|
+
if (placeholder === 'blur') {
|
|
735
|
+
// If the real image fails to load, this will still remove the placeholder.
|
|
736
|
+
setBlurComplete(true);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
if (onError) {
|
|
740
|
+
onError(event);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
})));
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
function defaultLoader({
|
|
747
|
+
config,
|
|
748
|
+
src,
|
|
749
|
+
width,
|
|
750
|
+
quality
|
|
751
|
+
}) {
|
|
752
|
+
if (false) {}
|
|
753
|
+
|
|
754
|
+
if (src.endsWith('.svg') && !config.dangerouslyAllowSVG) {
|
|
755
|
+
// Special case to make svg serve as-is to avoid proxying
|
|
756
|
+
// through the built-in Image Optimization API.
|
|
757
|
+
return src;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
return `${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
764
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
765
|
+
value: true
|
|
766
|
+
});
|
|
767
|
+
Object.assign(exports.default, exports);
|
|
768
|
+
module.exports = exports.default;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/***/ }),
|
|
772
|
+
|
|
773
|
+
/***/ 4019:
|
|
774
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
775
|
+
|
|
776
|
+
"use strict";
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
780
|
+
value: true
|
|
781
|
+
}));
|
|
782
|
+
exports.getDomainLocale = getDomainLocale;
|
|
783
|
+
const basePath = false || '';
|
|
784
|
+
|
|
785
|
+
function getDomainLocale(path, locale, locales, domainLocales) {
|
|
786
|
+
if (true) {
|
|
787
|
+
const normalizeLocalePath = (__webpack_require__(6340).normalizeLocalePath);
|
|
788
|
+
|
|
789
|
+
const detectDomainLocale = (__webpack_require__(7565).detectDomainLocale);
|
|
790
|
+
|
|
791
|
+
const target = locale || normalizeLocalePath(path, locales).detectedLocale;
|
|
792
|
+
const domain = detectDomainLocale(domainLocales, undefined, target);
|
|
793
|
+
|
|
794
|
+
if (domain) {
|
|
795
|
+
const proto = `http${domain.http ? '' : 's'}://`;
|
|
796
|
+
const finalLocale = target === domain.defaultLocale ? '' : `/${target}`;
|
|
797
|
+
return `${proto}${domain.domain}${basePath}${finalLocale}${path}`;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
return false;
|
|
801
|
+
} else {}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
805
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
806
|
+
value: true
|
|
807
|
+
});
|
|
808
|
+
Object.assign(exports.default, exports);
|
|
809
|
+
module.exports = exports.default;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/***/ }),
|
|
813
|
+
|
|
814
|
+
/***/ 8771:
|
|
815
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
816
|
+
|
|
817
|
+
"use strict";
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
821
|
+
value: true
|
|
822
|
+
}));
|
|
823
|
+
exports.hasBasePath = hasBasePath;
|
|
824
|
+
|
|
825
|
+
var _pathHasPrefix = __webpack_require__(4567);
|
|
826
|
+
|
|
827
|
+
const basePath = false || '';
|
|
828
|
+
|
|
829
|
+
function hasBasePath(path) {
|
|
830
|
+
return (0, _pathHasPrefix).pathHasPrefix(path, basePath);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
834
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
835
|
+
value: true
|
|
836
|
+
});
|
|
837
|
+
Object.assign(exports.default, exports);
|
|
838
|
+
module.exports = exports.default;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/***/ }),
|
|
842
|
+
|
|
843
|
+
/***/ 877:
|
|
844
|
+
/***/ ((module, exports) => {
|
|
845
|
+
|
|
846
|
+
"use strict";
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
850
|
+
value: true
|
|
851
|
+
}));
|
|
852
|
+
exports["default"] = initHeadManager;
|
|
853
|
+
exports.isEqualNode = isEqualNode;
|
|
854
|
+
exports.DOMAttributeNames = void 0;
|
|
855
|
+
|
|
856
|
+
function initHeadManager() {
|
|
857
|
+
return {
|
|
858
|
+
mountedInstances: new Set(),
|
|
859
|
+
updateHead: head => {
|
|
860
|
+
const tags = {};
|
|
861
|
+
head.forEach(h => {
|
|
862
|
+
if ( // If the font tag is loaded only on client navigation
|
|
863
|
+
// it won't be inlined. In this case revert to the original behavior
|
|
864
|
+
h.type === 'link' && h.props['data-optimized-fonts']) {
|
|
865
|
+
if (document.querySelector(`style[data-href="${h.props['data-href']}"]`)) {
|
|
866
|
+
return;
|
|
867
|
+
} else {
|
|
868
|
+
h.props.href = h.props['data-href'];
|
|
869
|
+
h.props['data-href'] = undefined;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const components = tags[h.type] || [];
|
|
874
|
+
components.push(h);
|
|
875
|
+
tags[h.type] = components;
|
|
876
|
+
});
|
|
877
|
+
const titleComponent = tags.title ? tags.title[0] : null;
|
|
878
|
+
let title = '';
|
|
879
|
+
|
|
880
|
+
if (titleComponent) {
|
|
881
|
+
const {
|
|
882
|
+
children
|
|
883
|
+
} = titleComponent.props;
|
|
884
|
+
title = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : '';
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
if (title !== document.title) document.title = title;
|
|
888
|
+
['meta', 'base', 'link', 'style', 'script'].forEach(type => {
|
|
889
|
+
updateElements(type, tags[type] || []);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
const DOMAttributeNames = {
|
|
896
|
+
acceptCharset: 'accept-charset',
|
|
897
|
+
className: 'class',
|
|
898
|
+
htmlFor: 'for',
|
|
899
|
+
httpEquiv: 'http-equiv',
|
|
900
|
+
noModule: 'noModule'
|
|
901
|
+
};
|
|
902
|
+
exports.DOMAttributeNames = DOMAttributeNames;
|
|
903
|
+
|
|
904
|
+
function reactElementToDOM({
|
|
905
|
+
type,
|
|
906
|
+
props
|
|
907
|
+
}) {
|
|
908
|
+
const el = document.createElement(type);
|
|
909
|
+
|
|
910
|
+
for (const p in props) {
|
|
911
|
+
if (!props.hasOwnProperty(p)) continue;
|
|
912
|
+
if (p === 'children' || p === 'dangerouslySetInnerHTML') continue; // we don't render undefined props to the DOM
|
|
913
|
+
|
|
914
|
+
if (props[p] === undefined) continue;
|
|
915
|
+
const attr = DOMAttributeNames[p] || p.toLowerCase();
|
|
916
|
+
|
|
917
|
+
if (type === 'script' && (attr === 'async' || attr === 'defer' || attr === 'noModule')) {
|
|
918
|
+
el[attr] = !!props[p];
|
|
919
|
+
} else {
|
|
920
|
+
el.setAttribute(attr, props[p]);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
const {
|
|
925
|
+
children,
|
|
926
|
+
dangerouslySetInnerHTML
|
|
927
|
+
} = props;
|
|
928
|
+
|
|
929
|
+
if (dangerouslySetInnerHTML) {
|
|
930
|
+
el.innerHTML = dangerouslySetInnerHTML.__html || '';
|
|
931
|
+
} else if (children) {
|
|
932
|
+
el.textContent = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : '';
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
return el;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function isEqualNode(oldTag, newTag) {
|
|
939
|
+
if (oldTag instanceof HTMLElement && newTag instanceof HTMLElement) {
|
|
940
|
+
const nonce = newTag.getAttribute('nonce'); // Only strip the nonce if `oldTag` has had it stripped. An element's nonce attribute will not
|
|
941
|
+
// be stripped if there is no content security policy response header that includes a nonce.
|
|
942
|
+
|
|
943
|
+
if (nonce && !oldTag.getAttribute('nonce')) {
|
|
944
|
+
const cloneTag = newTag.cloneNode(true);
|
|
945
|
+
cloneTag.setAttribute('nonce', '');
|
|
946
|
+
cloneTag.nonce = nonce;
|
|
947
|
+
return nonce === oldTag.nonce && oldTag.isEqualNode(cloneTag);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
return oldTag.isEqualNode(newTag);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
function updateElements(type, components) {
|
|
955
|
+
const headEl = document.getElementsByTagName('head')[0];
|
|
956
|
+
const headCountEl = headEl.querySelector('meta[name=next-head-count]');
|
|
957
|
+
|
|
958
|
+
if (false) {}
|
|
959
|
+
|
|
960
|
+
const headCount = Number(headCountEl.content);
|
|
961
|
+
const oldTags = [];
|
|
962
|
+
|
|
963
|
+
for (let i = 0, j = headCountEl.previousElementSibling; i < headCount; i++, j = (j == null ? void 0 : j.previousElementSibling) || null) {
|
|
964
|
+
var ref;
|
|
965
|
+
|
|
966
|
+
if ((j == null ? void 0 : (ref = j.tagName) == null ? void 0 : ref.toLowerCase()) === type) {
|
|
967
|
+
oldTags.push(j);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
const newTags = components.map(reactElementToDOM).filter(newTag => {
|
|
972
|
+
for (let k = 0, len = oldTags.length; k < len; k++) {
|
|
973
|
+
const oldTag = oldTags[k];
|
|
974
|
+
|
|
975
|
+
if (isEqualNode(oldTag, newTag)) {
|
|
976
|
+
oldTags.splice(k, 1);
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
return true;
|
|
982
|
+
});
|
|
983
|
+
oldTags.forEach(t => {
|
|
984
|
+
var ref;
|
|
985
|
+
return (ref = t.parentNode) == null ? void 0 : ref.removeChild(t);
|
|
986
|
+
});
|
|
987
|
+
newTags.forEach(t => headEl.insertBefore(t, headCountEl));
|
|
988
|
+
headCountEl.content = (headCount - oldTags.length + newTags.length).toString();
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
992
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
993
|
+
value: true
|
|
994
|
+
});
|
|
995
|
+
Object.assign(exports.default, exports);
|
|
996
|
+
module.exports = exports.default;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/***/ }),
|
|
1000
|
+
|
|
1001
|
+
/***/ 7942:
|
|
1002
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1003
|
+
|
|
1004
|
+
"client";
|
|
1005
|
+
"use strict";
|
|
1006
|
+
|
|
1007
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1008
|
+
value: true
|
|
1009
|
+
}));
|
|
1010
|
+
exports["default"] = void 0;
|
|
1011
|
+
|
|
1012
|
+
var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
|
|
1013
|
+
|
|
1014
|
+
var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
|
|
1015
|
+
|
|
1016
|
+
var _react = _interop_require_default(__webpack_require__(6689));
|
|
1017
|
+
|
|
1018
|
+
var _router = __webpack_require__(5781);
|
|
1019
|
+
|
|
1020
|
+
var _addLocale = __webpack_require__(7995);
|
|
1021
|
+
|
|
1022
|
+
var _routerContext = __webpack_require__(4964);
|
|
1023
|
+
|
|
1024
|
+
var _appRouterContext = __webpack_require__(3280);
|
|
1025
|
+
|
|
1026
|
+
var _useIntersection = __webpack_require__(639);
|
|
1027
|
+
|
|
1028
|
+
var _getDomainLocale = __webpack_require__(4019);
|
|
1029
|
+
|
|
1030
|
+
var _addBasePath = __webpack_require__(227);
|
|
1031
|
+
|
|
1032
|
+
'client';
|
|
1033
|
+
const prefetched = {};
|
|
1034
|
+
|
|
1035
|
+
function prefetch(router, href, as, options) {
|
|
1036
|
+
if (true) return;
|
|
1037
|
+
if (!(0, _router).isLocalURL(href)) return; // Prefetch the JSON page if asked (only in the client)
|
|
1038
|
+
// We need to handle a prefetch error here since we may be
|
|
1039
|
+
// loading with priority which can reject but we don't
|
|
1040
|
+
// want to force navigation since this is only a prefetch
|
|
1041
|
+
|
|
1042
|
+
Promise.resolve(router.prefetch(href, as, options)).catch(err => {
|
|
1043
|
+
if (false) {}
|
|
1044
|
+
});
|
|
1045
|
+
const curLocale = options && typeof options.locale !== 'undefined' ? options.locale : router && router.locale; // Join on an invalid URI character
|
|
1046
|
+
|
|
1047
|
+
prefetched[href + '%' + as + (curLocale ? '%' + curLocale : '')] = true;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
function isModifiedEvent(event) {
|
|
1051
|
+
const {
|
|
1052
|
+
target
|
|
1053
|
+
} = event.currentTarget;
|
|
1054
|
+
return target && target !== '_self' || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.nativeEvent && event.nativeEvent.which === 2;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
function linkClicked(e, router, href, as, replace, shallow, scroll, locale, isAppRouter, prefetchEnabled) {
|
|
1058
|
+
const {
|
|
1059
|
+
nodeName
|
|
1060
|
+
} = e.currentTarget; // anchors inside an svg have a lowercase nodeName
|
|
1061
|
+
|
|
1062
|
+
const isAnchorNodeName = nodeName.toUpperCase() === 'A';
|
|
1063
|
+
|
|
1064
|
+
if (isAnchorNodeName && (isModifiedEvent(e) || !(0, _router).isLocalURL(href))) {
|
|
1065
|
+
// ignore click for browser’s default behavior
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
e.preventDefault();
|
|
1070
|
+
|
|
1071
|
+
const navigate = () => {
|
|
1072
|
+
// If the router is an NextRouter instance it will have `beforePopState`
|
|
1073
|
+
if ('beforePopState' in router) {
|
|
1074
|
+
router[replace ? 'replace' : 'push'](href, as, {
|
|
1075
|
+
shallow,
|
|
1076
|
+
locale,
|
|
1077
|
+
scroll
|
|
1078
|
+
});
|
|
1079
|
+
} else {
|
|
1080
|
+
// If `beforePopState` doesn't exist on the router it's the AppRouter.
|
|
1081
|
+
const method = replace ? 'replace' : 'push';
|
|
1082
|
+
router[method](href, {
|
|
1083
|
+
forceOptimisticNavigation: !prefetchEnabled
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
if (isAppRouter) {
|
|
1089
|
+
// @ts-expect-error startTransition exists.
|
|
1090
|
+
_react.default.startTransition(navigate);
|
|
1091
|
+
} else {
|
|
1092
|
+
navigate();
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
const Link = /*#__PURE__*/_react.default.forwardRef(function LinkComponent(props, forwardedRef) {
|
|
1097
|
+
if (false) { var createPropError; }
|
|
1098
|
+
|
|
1099
|
+
let children;
|
|
1100
|
+
|
|
1101
|
+
const {
|
|
1102
|
+
href: hrefProp,
|
|
1103
|
+
as: asProp,
|
|
1104
|
+
children: childrenProp,
|
|
1105
|
+
prefetch: prefetchProp,
|
|
1106
|
+
passHref,
|
|
1107
|
+
replace,
|
|
1108
|
+
shallow,
|
|
1109
|
+
scroll,
|
|
1110
|
+
locale,
|
|
1111
|
+
onClick,
|
|
1112
|
+
onMouseEnter,
|
|
1113
|
+
onTouchStart,
|
|
1114
|
+
legacyBehavior = Boolean(false) !== true
|
|
1115
|
+
} = props,
|
|
1116
|
+
restProps = _object_without_properties_loose(props, ["href", "as", "children", "prefetch", "passHref", "replace", "shallow", "scroll", "locale", "onClick", "onMouseEnter", "onTouchStart", "legacyBehavior"]);
|
|
1117
|
+
|
|
1118
|
+
children = childrenProp;
|
|
1119
|
+
|
|
1120
|
+
if (legacyBehavior && (typeof children === 'string' || typeof children === 'number')) {
|
|
1121
|
+
children = /*#__PURE__*/_react.default.createElement("a", null, children);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
const p = prefetchProp !== false;
|
|
1125
|
+
|
|
1126
|
+
let router = _react.default.useContext(_routerContext.RouterContext); // TODO-APP: type error. Remove `as any`
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
const appRouter = _react.default.useContext(_appRouterContext.AppRouterContext);
|
|
1130
|
+
|
|
1131
|
+
if (appRouter) {
|
|
1132
|
+
router = appRouter;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
const {
|
|
1136
|
+
href,
|
|
1137
|
+
as
|
|
1138
|
+
} = _react.default.useMemo(() => {
|
|
1139
|
+
const [resolvedHref, resolvedAs] = (0, _router).resolveHref(router, hrefProp, true);
|
|
1140
|
+
return {
|
|
1141
|
+
href: resolvedHref,
|
|
1142
|
+
as: asProp ? (0, _router).resolveHref(router, asProp) : resolvedAs || resolvedHref
|
|
1143
|
+
};
|
|
1144
|
+
}, [router, hrefProp, asProp]);
|
|
1145
|
+
|
|
1146
|
+
const previousHref = _react.default.useRef(href);
|
|
1147
|
+
|
|
1148
|
+
const previousAs = _react.default.useRef(as); // This will return the first child, if multiple are provided it will throw an error
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
let child;
|
|
1152
|
+
|
|
1153
|
+
if (legacyBehavior) {
|
|
1154
|
+
if (false) {} else {
|
|
1155
|
+
child = _react.default.Children.only(children);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
const childRef = legacyBehavior ? child && typeof child === 'object' && child.ref : forwardedRef;
|
|
1160
|
+
const [setIntersectionRef, isVisible, resetVisible] = (0, _useIntersection).useIntersection({
|
|
1161
|
+
rootMargin: '200px'
|
|
1162
|
+
});
|
|
1163
|
+
|
|
1164
|
+
const setRef = _react.default.useCallback(el => {
|
|
1165
|
+
// Before the link getting observed, check if visible state need to be reset
|
|
1166
|
+
if (previousAs.current !== as || previousHref.current !== href) {
|
|
1167
|
+
resetVisible();
|
|
1168
|
+
previousAs.current = as;
|
|
1169
|
+
previousHref.current = href;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
setIntersectionRef(el);
|
|
1173
|
+
|
|
1174
|
+
if (childRef) {
|
|
1175
|
+
if (typeof childRef === 'function') childRef(el);else if (typeof childRef === 'object') {
|
|
1176
|
+
childRef.current = el;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}, [as, childRef, href, resetVisible, setIntersectionRef]);
|
|
1180
|
+
|
|
1181
|
+
_react.default.useEffect(() => {
|
|
1182
|
+
const shouldPrefetch = isVisible && p && (0, _router).isLocalURL(href);
|
|
1183
|
+
const curLocale = typeof locale !== 'undefined' ? locale : router && router.locale;
|
|
1184
|
+
const isPrefetched = prefetched[href + '%' + as + (curLocale ? '%' + curLocale : '')];
|
|
1185
|
+
|
|
1186
|
+
if (shouldPrefetch && !isPrefetched) {
|
|
1187
|
+
prefetch(router, href, as, {
|
|
1188
|
+
locale: curLocale
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
}, [as, href, isVisible, locale, p, router]);
|
|
1192
|
+
|
|
1193
|
+
const childProps = {
|
|
1194
|
+
ref: setRef,
|
|
1195
|
+
onClick: e => {
|
|
1196
|
+
if (false) {}
|
|
1197
|
+
|
|
1198
|
+
if (!legacyBehavior && typeof onClick === 'function') {
|
|
1199
|
+
onClick(e);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
if (legacyBehavior && child.props && typeof child.props.onClick === 'function') {
|
|
1203
|
+
child.props.onClick(e);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
if (!e.defaultPrevented) {
|
|
1207
|
+
linkClicked(e, router, href, as, replace, shallow, scroll, locale, Boolean(appRouter), p);
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
onMouseEnter: e => {
|
|
1211
|
+
if (!legacyBehavior && typeof onMouseEnter === 'function') {
|
|
1212
|
+
onMouseEnter(e);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
if (legacyBehavior && child.props && typeof child.props.onMouseEnter === 'function') {
|
|
1216
|
+
child.props.onMouseEnter(e);
|
|
1217
|
+
} // Check for not prefetch disabled in page using appRouter
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
if (!(!p && appRouter)) {
|
|
1221
|
+
if ((0, _router).isLocalURL(href)) {
|
|
1222
|
+
prefetch(router, href, as, {
|
|
1223
|
+
priority: true
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
onTouchStart: e => {
|
|
1229
|
+
if (!legacyBehavior && typeof onTouchStart === 'function') {
|
|
1230
|
+
onTouchStart(e);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
if (legacyBehavior && child.props && typeof child.props.onTouchStart === 'function') {
|
|
1234
|
+
child.props.onTouchStart(e);
|
|
1235
|
+
} // Check for not prefetch disabled in page using appRouter
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
if (!(!p && appRouter)) {
|
|
1239
|
+
if ((0, _router).isLocalURL(href)) {
|
|
1240
|
+
prefetch(router, href, as, {
|
|
1241
|
+
priority: true
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}; // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
|
|
1247
|
+
// defined, we specify the current 'href', so that repetition is not needed by the user
|
|
1248
|
+
|
|
1249
|
+
if (!legacyBehavior || passHref || child.type === 'a' && !('href' in child.props)) {
|
|
1250
|
+
const curLocale = typeof locale !== 'undefined' ? locale : router && router.locale; // we only render domain locales if we are currently on a domain locale
|
|
1251
|
+
// so that locale links are still visitable in development/preview envs
|
|
1252
|
+
|
|
1253
|
+
const localeDomain = router && router.isLocaleDomain && (0, _getDomainLocale).getDomainLocale(as, curLocale, router.locales, router.domainLocales);
|
|
1254
|
+
childProps.href = localeDomain || (0, _addBasePath).addBasePath((0, _addLocale).addLocale(as, curLocale, router && router.defaultLocale));
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
return legacyBehavior ? /*#__PURE__*/_react.default.cloneElement(child, childProps) : /*#__PURE__*/_react.default.createElement("a", Object.assign({}, restProps, childProps), children);
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
var _default = Link;
|
|
1261
|
+
exports["default"] = _default;
|
|
1262
|
+
|
|
1263
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1264
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1265
|
+
value: true
|
|
1266
|
+
});
|
|
1267
|
+
Object.assign(exports.default, exports);
|
|
1268
|
+
module.exports = exports.default;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
/***/ }),
|
|
1272
|
+
|
|
1273
|
+
/***/ 6340:
|
|
1274
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1275
|
+
|
|
1276
|
+
"use strict";
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1280
|
+
value: true
|
|
1281
|
+
}));
|
|
1282
|
+
exports.normalizeLocalePath = void 0;
|
|
1283
|
+
|
|
1284
|
+
const normalizeLocalePath = (pathname, locales) => {
|
|
1285
|
+
if (true) {
|
|
1286
|
+
return (__webpack_require__(4014).normalizeLocalePath)(pathname, locales);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
return {
|
|
1290
|
+
pathname,
|
|
1291
|
+
detectedLocale: undefined
|
|
1292
|
+
};
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1295
|
+
exports.normalizeLocalePath = normalizeLocalePath;
|
|
1296
|
+
|
|
1297
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1298
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1299
|
+
value: true
|
|
1300
|
+
});
|
|
1301
|
+
Object.assign(exports.default, exports);
|
|
1302
|
+
module.exports = exports.default;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/***/ }),
|
|
1306
|
+
|
|
1307
|
+
/***/ 4969:
|
|
1308
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1309
|
+
|
|
1310
|
+
"use strict";
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1314
|
+
value: true
|
|
1315
|
+
}));
|
|
1316
|
+
exports.normalizePathTrailingSlash = void 0;
|
|
1317
|
+
|
|
1318
|
+
var _removeTrailingSlash = __webpack_require__(3297);
|
|
1319
|
+
|
|
1320
|
+
var _parsePath = __webpack_require__(8854);
|
|
1321
|
+
|
|
1322
|
+
const normalizePathTrailingSlash = path => {
|
|
1323
|
+
if (!path.startsWith('/') || undefined) {
|
|
1324
|
+
return path;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
const {
|
|
1328
|
+
pathname,
|
|
1329
|
+
query,
|
|
1330
|
+
hash
|
|
1331
|
+
} = (0, _parsePath).parsePath(path);
|
|
1332
|
+
|
|
1333
|
+
if (false) {}
|
|
1334
|
+
|
|
1335
|
+
return `${(0, _removeTrailingSlash).removeTrailingSlash(pathname)}${query}${hash}`;
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
exports.normalizePathTrailingSlash = normalizePathTrailingSlash;
|
|
1339
|
+
|
|
1340
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1341
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1342
|
+
value: true
|
|
1343
|
+
});
|
|
1344
|
+
Object.assign(exports.default, exports);
|
|
1345
|
+
module.exports = exports.default;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/***/ }),
|
|
1349
|
+
|
|
1350
|
+
/***/ 5678:
|
|
1351
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1352
|
+
|
|
1353
|
+
"use strict";
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1357
|
+
value: true
|
|
1358
|
+
}));
|
|
1359
|
+
exports.removeBasePath = removeBasePath;
|
|
1360
|
+
|
|
1361
|
+
var _hasBasePath = __webpack_require__(8771);
|
|
1362
|
+
|
|
1363
|
+
const basePath = false || '';
|
|
1364
|
+
|
|
1365
|
+
function removeBasePath(path) {
|
|
1366
|
+
if (false) {}
|
|
1367
|
+
|
|
1368
|
+
path = path.slice(basePath.length);
|
|
1369
|
+
if (!path.startsWith('/')) path = `/${path}`;
|
|
1370
|
+
return path;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1374
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1375
|
+
value: true
|
|
1376
|
+
});
|
|
1377
|
+
Object.assign(exports.default, exports);
|
|
1378
|
+
module.exports = exports.default;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
/***/ }),
|
|
1382
|
+
|
|
1383
|
+
/***/ 9781:
|
|
1384
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1385
|
+
|
|
1386
|
+
"use strict";
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1390
|
+
value: true
|
|
1391
|
+
}));
|
|
1392
|
+
exports.removeLocale = removeLocale;
|
|
1393
|
+
|
|
1394
|
+
var _parsePath = __webpack_require__(8854);
|
|
1395
|
+
|
|
1396
|
+
function removeLocale(path, locale) {
|
|
1397
|
+
if (true) {
|
|
1398
|
+
const {
|
|
1399
|
+
pathname
|
|
1400
|
+
} = (0, _parsePath).parsePath(path);
|
|
1401
|
+
const pathLower = pathname.toLowerCase();
|
|
1402
|
+
const localeLower = locale == null ? void 0 : locale.toLowerCase();
|
|
1403
|
+
return locale && (pathLower.startsWith(`/${localeLower}/`) || pathLower === `/${localeLower}`) ? `${pathname.length === locale.length + 1 ? `/` : ``}${path.slice(locale.length + 1)}` : path;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
return path;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1410
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1411
|
+
value: true
|
|
1412
|
+
});
|
|
1413
|
+
Object.assign(exports.default, exports);
|
|
1414
|
+
module.exports = exports.default;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/***/ }),
|
|
1418
|
+
|
|
1419
|
+
/***/ 6286:
|
|
1420
|
+
/***/ ((module, exports) => {
|
|
1421
|
+
|
|
1422
|
+
"use strict";
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1426
|
+
value: true
|
|
1427
|
+
}));
|
|
1428
|
+
exports.cancelIdleCallback = exports.requestIdleCallback = void 0;
|
|
1429
|
+
|
|
1430
|
+
const requestIdleCallback = typeof self !== 'undefined' && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function (cb) {
|
|
1431
|
+
let start = Date.now();
|
|
1432
|
+
return setTimeout(function () {
|
|
1433
|
+
cb({
|
|
1434
|
+
didTimeout: false,
|
|
1435
|
+
timeRemaining: function () {
|
|
1436
|
+
return Math.max(0, 50 - (Date.now() - start));
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
}, 1);
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
exports.requestIdleCallback = requestIdleCallback;
|
|
1443
|
+
|
|
1444
|
+
const cancelIdleCallback = typeof self !== 'undefined' && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function (id) {
|
|
1445
|
+
return clearTimeout(id);
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
exports.cancelIdleCallback = cancelIdleCallback;
|
|
1449
|
+
|
|
1450
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1451
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1452
|
+
value: true
|
|
1453
|
+
});
|
|
1454
|
+
Object.assign(exports.default, exports);
|
|
1455
|
+
module.exports = exports.default;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
/***/ }),
|
|
1459
|
+
|
|
1460
|
+
/***/ 4989:
|
|
1461
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1462
|
+
|
|
1463
|
+
"use strict";
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1467
|
+
value: true
|
|
1468
|
+
}));
|
|
1469
|
+
exports.markAssetError = markAssetError;
|
|
1470
|
+
exports.isAssetError = isAssetError;
|
|
1471
|
+
exports.getClientBuildManifest = getClientBuildManifest;
|
|
1472
|
+
exports.createRouteLoader = createRouteLoader;
|
|
1473
|
+
|
|
1474
|
+
var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
|
|
1475
|
+
|
|
1476
|
+
var _getAssetPathFromRoute = _interop_require_default(__webpack_require__(9565));
|
|
1477
|
+
|
|
1478
|
+
var _trustedTypes = __webpack_require__(5740);
|
|
1479
|
+
|
|
1480
|
+
var _requestIdleCallback = __webpack_require__(6286); // 3.8s was arbitrarily chosen as it's what https://web.dev/interactive
|
|
1481
|
+
// considers as "Good" time-to-interactive. We must assume something went
|
|
1482
|
+
// wrong beyond this point, and then fall-back to a full page transition to
|
|
1483
|
+
// show the user something of value.
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
const MS_MAX_IDLE_DELAY = 3800;
|
|
1487
|
+
|
|
1488
|
+
function withFuture(key, map, generator) {
|
|
1489
|
+
let entry = map.get(key);
|
|
1490
|
+
|
|
1491
|
+
if (entry) {
|
|
1492
|
+
if ('future' in entry) {
|
|
1493
|
+
return entry.future;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
return Promise.resolve(entry);
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
let resolver;
|
|
1500
|
+
const prom = new Promise(resolve => {
|
|
1501
|
+
resolver = resolve;
|
|
1502
|
+
});
|
|
1503
|
+
map.set(key, entry = {
|
|
1504
|
+
resolve: resolver,
|
|
1505
|
+
future: prom
|
|
1506
|
+
});
|
|
1507
|
+
return generator ? generator() // eslint-disable-next-line no-sequences
|
|
1508
|
+
.then(value => (resolver(value), value)).catch(err => {
|
|
1509
|
+
map.delete(key);
|
|
1510
|
+
throw err;
|
|
1511
|
+
}) : prom;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
function hasPrefetch(link) {
|
|
1515
|
+
try {
|
|
1516
|
+
link = document.createElement('link');
|
|
1517
|
+
return (// detect IE11 since it supports prefetch but isn't detected
|
|
1518
|
+
// with relList.support
|
|
1519
|
+
!!window.MSInputMethodContext && !!document.documentMode || link.relList.supports('prefetch')
|
|
1520
|
+
);
|
|
1521
|
+
} catch (e) {
|
|
1522
|
+
return false;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
const canPrefetch = hasPrefetch();
|
|
1527
|
+
|
|
1528
|
+
function prefetchViaDom(href, as, link) {
|
|
1529
|
+
return new Promise((res, rej) => {
|
|
1530
|
+
const selector = `
|
|
1531
|
+
link[rel="prefetch"][href^="${href}"],
|
|
1532
|
+
link[rel="preload"][href^="${href}"],
|
|
1533
|
+
script[src^="${href}"]`;
|
|
1534
|
+
|
|
1535
|
+
if (document.querySelector(selector)) {
|
|
1536
|
+
return res();
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
link = document.createElement('link'); // The order of property assignment here is intentional:
|
|
1540
|
+
|
|
1541
|
+
if (as) link.as = as;
|
|
1542
|
+
link.rel = `prefetch`;
|
|
1543
|
+
link.crossOrigin = undefined;
|
|
1544
|
+
link.onload = res;
|
|
1545
|
+
link.onerror = rej; // `href` should always be last:
|
|
1546
|
+
|
|
1547
|
+
link.href = href;
|
|
1548
|
+
document.head.appendChild(link);
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
const ASSET_LOAD_ERROR = Symbol('ASSET_LOAD_ERROR');
|
|
1553
|
+
|
|
1554
|
+
function markAssetError(err) {
|
|
1555
|
+
return Object.defineProperty(err, ASSET_LOAD_ERROR, {});
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
function isAssetError(err) {
|
|
1559
|
+
return err && ASSET_LOAD_ERROR in err;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
function appendScript(src, script) {
|
|
1563
|
+
return new Promise((resolve, reject) => {
|
|
1564
|
+
script = document.createElement('script'); // The order of property assignment here is intentional.
|
|
1565
|
+
// 1. Setup success/failure hooks in case the browser synchronously
|
|
1566
|
+
// executes when `src` is set.
|
|
1567
|
+
|
|
1568
|
+
script.onload = resolve;
|
|
1569
|
+
|
|
1570
|
+
script.onerror = () => reject(markAssetError(new Error(`Failed to load script: ${src}`))); // 2. Configure the cross-origin attribute before setting `src` in case the
|
|
1571
|
+
// browser begins to fetch.
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
script.crossOrigin = undefined; // 3. Finally, set the source and inject into the DOM in case the child
|
|
1575
|
+
// must be appended for fetching to start.
|
|
1576
|
+
|
|
1577
|
+
script.src = src;
|
|
1578
|
+
document.body.appendChild(script);
|
|
1579
|
+
});
|
|
1580
|
+
} // We wait for pages to be built in dev before we start the route transition
|
|
1581
|
+
// timeout to prevent an un-necessary hard navigation in development.
|
|
1582
|
+
|
|
1583
|
+
|
|
1584
|
+
let devBuildPromise; // Resolve a promise that times out after given amount of milliseconds.
|
|
1585
|
+
|
|
1586
|
+
function resolvePromiseWithTimeout(p, ms, err) {
|
|
1587
|
+
return new Promise((resolve, reject) => {
|
|
1588
|
+
let cancelled = false;
|
|
1589
|
+
p.then(r => {
|
|
1590
|
+
// Resolved, cancel the timeout
|
|
1591
|
+
cancelled = true;
|
|
1592
|
+
resolve(r);
|
|
1593
|
+
}).catch(reject); // We wrap these checks separately for better dead-code elimination in
|
|
1594
|
+
// production bundles.
|
|
1595
|
+
|
|
1596
|
+
if (false) {}
|
|
1597
|
+
|
|
1598
|
+
if (true) {
|
|
1599
|
+
(0, _requestIdleCallback).requestIdleCallback(() => setTimeout(() => {
|
|
1600
|
+
if (!cancelled) {
|
|
1601
|
+
reject(err);
|
|
1602
|
+
}
|
|
1603
|
+
}, ms));
|
|
1604
|
+
}
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
function getClientBuildManifest() {
|
|
1609
|
+
if (self.__BUILD_MANIFEST) {
|
|
1610
|
+
return Promise.resolve(self.__BUILD_MANIFEST);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
const onBuildManifest = new Promise(resolve => {
|
|
1614
|
+
// Mandatory because this is not concurrent safe:
|
|
1615
|
+
const cb = self.__BUILD_MANIFEST_CB;
|
|
1616
|
+
|
|
1617
|
+
self.__BUILD_MANIFEST_CB = () => {
|
|
1618
|
+
resolve(self.__BUILD_MANIFEST);
|
|
1619
|
+
cb && cb();
|
|
1620
|
+
};
|
|
1621
|
+
});
|
|
1622
|
+
return resolvePromiseWithTimeout(onBuildManifest, MS_MAX_IDLE_DELAY, markAssetError(new Error('Failed to load client build manifest')));
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
function getFilesForRoute(assetPrefix, route) {
|
|
1626
|
+
if (false) {}
|
|
1627
|
+
|
|
1628
|
+
return getClientBuildManifest().then(manifest => {
|
|
1629
|
+
if (!(route in manifest)) {
|
|
1630
|
+
throw markAssetError(new Error(`Failed to lookup route: ${route}`));
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
const allFiles = manifest[route].map(entry => assetPrefix + '/_next/' + encodeURI(entry));
|
|
1634
|
+
return {
|
|
1635
|
+
scripts: allFiles.filter(v => v.endsWith('.js')).map(v => (0, _trustedTypes).__unsafeCreateTrustedScriptURL(v)),
|
|
1636
|
+
css: allFiles.filter(v => v.endsWith('.css'))
|
|
1637
|
+
};
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
function createRouteLoader(assetPrefix) {
|
|
1642
|
+
const entrypoints = new Map();
|
|
1643
|
+
const loadedScripts = new Map();
|
|
1644
|
+
const styleSheets = new Map();
|
|
1645
|
+
const routes = new Map();
|
|
1646
|
+
|
|
1647
|
+
function maybeExecuteScript(src) {
|
|
1648
|
+
// With HMR we might need to "reload" scripts when they are
|
|
1649
|
+
// disposed and readded. Executing scripts twice has no functional
|
|
1650
|
+
// differences
|
|
1651
|
+
if (true) {
|
|
1652
|
+
let prom = loadedScripts.get(src.toString());
|
|
1653
|
+
|
|
1654
|
+
if (prom) {
|
|
1655
|
+
return prom;
|
|
1656
|
+
} // Skip executing script if it's already in the DOM:
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
if (document.querySelector(`script[src^="${src}"]`)) {
|
|
1660
|
+
return Promise.resolve();
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
loadedScripts.set(src.toString(), prom = appendScript(src));
|
|
1664
|
+
return prom;
|
|
1665
|
+
} else {}
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
function fetchStyleSheet(href) {
|
|
1669
|
+
let prom = styleSheets.get(href);
|
|
1670
|
+
|
|
1671
|
+
if (prom) {
|
|
1672
|
+
return prom;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
styleSheets.set(href, prom = fetch(href).then(res => {
|
|
1676
|
+
if (!res.ok) {
|
|
1677
|
+
throw new Error(`Failed to load stylesheet: ${href}`);
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
return res.text().then(text => ({
|
|
1681
|
+
href: href,
|
|
1682
|
+
content: text
|
|
1683
|
+
}));
|
|
1684
|
+
}).catch(err => {
|
|
1685
|
+
throw markAssetError(err);
|
|
1686
|
+
}));
|
|
1687
|
+
return prom;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
return {
|
|
1691
|
+
whenEntrypoint(route) {
|
|
1692
|
+
return withFuture(route, entrypoints);
|
|
1693
|
+
},
|
|
1694
|
+
|
|
1695
|
+
onEntrypoint(route, execute) {
|
|
1696
|
+
(execute ? Promise.resolve().then(() => execute()).then(exports => ({
|
|
1697
|
+
component: exports && exports.default || exports,
|
|
1698
|
+
exports: exports
|
|
1699
|
+
}), err => ({
|
|
1700
|
+
error: err
|
|
1701
|
+
})) : Promise.resolve(undefined)).then(input => {
|
|
1702
|
+
const old = entrypoints.get(route);
|
|
1703
|
+
|
|
1704
|
+
if (old && 'resolve' in old) {
|
|
1705
|
+
if (input) {
|
|
1706
|
+
entrypoints.set(route, input);
|
|
1707
|
+
old.resolve(input);
|
|
1708
|
+
}
|
|
1709
|
+
} else {
|
|
1710
|
+
if (input) {
|
|
1711
|
+
entrypoints.set(route, input);
|
|
1712
|
+
} else {
|
|
1713
|
+
entrypoints.delete(route);
|
|
1714
|
+
} // when this entrypoint has been resolved before
|
|
1715
|
+
// the route is outdated and we want to invalidate
|
|
1716
|
+
// this cache entry
|
|
1717
|
+
|
|
1718
|
+
|
|
1719
|
+
routes.delete(route);
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
},
|
|
1723
|
+
|
|
1724
|
+
loadRoute(route, prefetch) {
|
|
1725
|
+
return withFuture(route, routes, () => {
|
|
1726
|
+
let devBuildPromiseResolve;
|
|
1727
|
+
|
|
1728
|
+
if (false) {}
|
|
1729
|
+
|
|
1730
|
+
return resolvePromiseWithTimeout(getFilesForRoute(assetPrefix, route).then(({
|
|
1731
|
+
scripts,
|
|
1732
|
+
css
|
|
1733
|
+
}) => {
|
|
1734
|
+
return Promise.all([entrypoints.has(route) ? [] : Promise.all(scripts.map(maybeExecuteScript)), Promise.all(css.map(fetchStyleSheet))]);
|
|
1735
|
+
}).then(res => {
|
|
1736
|
+
return this.whenEntrypoint(route).then(entrypoint => ({
|
|
1737
|
+
entrypoint,
|
|
1738
|
+
styles: res[1]
|
|
1739
|
+
}));
|
|
1740
|
+
}), MS_MAX_IDLE_DELAY, markAssetError(new Error(`Route did not complete loading: ${route}`))).then(({
|
|
1741
|
+
entrypoint,
|
|
1742
|
+
styles
|
|
1743
|
+
}) => {
|
|
1744
|
+
const res = Object.assign({
|
|
1745
|
+
styles: styles
|
|
1746
|
+
}, entrypoint);
|
|
1747
|
+
return 'error' in entrypoint ? entrypoint : res;
|
|
1748
|
+
}).catch(err => {
|
|
1749
|
+
if (prefetch) {
|
|
1750
|
+
// we don't want to cache errors during prefetch
|
|
1751
|
+
throw err;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
return {
|
|
1755
|
+
error: err
|
|
1756
|
+
};
|
|
1757
|
+
}).finally(() => {
|
|
1758
|
+
return devBuildPromiseResolve == null ? void 0 : devBuildPromiseResolve();
|
|
1759
|
+
});
|
|
1760
|
+
});
|
|
1761
|
+
},
|
|
1762
|
+
|
|
1763
|
+
prefetch(route) {
|
|
1764
|
+
// https://github.com/GoogleChromeLabs/quicklink/blob/453a661fa1fa940e2d2e044452398e38c67a98fb/src/index.mjs#L115-L118
|
|
1765
|
+
// License: Apache 2.0
|
|
1766
|
+
let cn;
|
|
1767
|
+
|
|
1768
|
+
if (cn = navigator.connection) {
|
|
1769
|
+
// Don't prefetch if using 2G or if Save-Data is enabled.
|
|
1770
|
+
if (cn.saveData || /2g/.test(cn.effectiveType)) return Promise.resolve();
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
return getFilesForRoute(assetPrefix, route).then(output => Promise.all(canPrefetch ? output.scripts.map(script => prefetchViaDom(script.toString(), 'script')) : [])).then(() => {
|
|
1774
|
+
(0, _requestIdleCallback).requestIdleCallback(() => this.loadRoute(route, true).catch(() => {}));
|
|
1775
|
+
}).catch( // swallow prefetch errors
|
|
1776
|
+
() => {});
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
1783
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
1784
|
+
value: true
|
|
1785
|
+
});
|
|
1786
|
+
Object.assign(exports.default, exports);
|
|
1787
|
+
module.exports = exports.default;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
/***/ }),
|
|
1791
|
+
|
|
1792
|
+
/***/ 2189:
|
|
1793
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1794
|
+
|
|
1795
|
+
"client";
|
|
1796
|
+
"use strict";
|
|
1797
|
+
|
|
1798
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1799
|
+
value: true
|
|
1800
|
+
}));
|
|
1801
|
+
exports.handleClientScriptLoad = handleClientScriptLoad;
|
|
1802
|
+
exports.initScriptLoader = initScriptLoader;
|
|
1803
|
+
exports["default"] = void 0;
|
|
1804
|
+
|
|
1805
|
+
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
|
|
1806
|
+
|
|
1807
|
+
var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
|
|
1808
|
+
|
|
1809
|
+
var _object_without_properties_loose = (__webpack_require__(7273)/* ["default"] */ .Z);
|
|
1810
|
+
|
|
1811
|
+
var _react = _interop_require_wildcard(__webpack_require__(6689));
|
|
1812
|
+
|
|
1813
|
+
var _headManagerContext = __webpack_require__(2796);
|
|
1814
|
+
|
|
1815
|
+
var _headManager = __webpack_require__(877);
|
|
1816
|
+
|
|
1817
|
+
var _requestIdleCallback = __webpack_require__(6286);
|
|
1818
|
+
|
|
1819
|
+
'client';
|
|
1820
|
+
const ScriptCache = new Map();
|
|
1821
|
+
const LoadCache = new Set();
|
|
1822
|
+
const ignoreProps = ['onLoad', 'onReady', 'dangerouslySetInnerHTML', 'children', 'onError', 'strategy'];
|
|
1823
|
+
|
|
1824
|
+
const loadScript = props => {
|
|
1825
|
+
const {
|
|
1826
|
+
src,
|
|
1827
|
+
id,
|
|
1828
|
+
onLoad = () => {},
|
|
1829
|
+
onReady = null,
|
|
1830
|
+
dangerouslySetInnerHTML,
|
|
1831
|
+
children = '',
|
|
1832
|
+
strategy = 'afterInteractive',
|
|
1833
|
+
onError
|
|
1834
|
+
} = props;
|
|
1835
|
+
const cacheKey = id || src; // Script has already loaded
|
|
1836
|
+
|
|
1837
|
+
if (cacheKey && LoadCache.has(cacheKey)) {
|
|
1838
|
+
return;
|
|
1839
|
+
} // Contents of this script are already loading/loaded
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
if (ScriptCache.has(src)) {
|
|
1843
|
+
LoadCache.add(cacheKey); // It is possible that multiple `next/script` components all have same "src", but has different "onLoad"
|
|
1844
|
+
// This is to make sure the same remote script will only load once, but "onLoad" are executed in order
|
|
1845
|
+
|
|
1846
|
+
ScriptCache.get(src).then(onLoad, onError);
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
/** Execute after the script first loaded */
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
const afterLoad = () => {
|
|
1853
|
+
// Run onReady for the first time after load event
|
|
1854
|
+
if (onReady) {
|
|
1855
|
+
onReady();
|
|
1856
|
+
} // add cacheKey to LoadCache when load successfully
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
LoadCache.add(cacheKey);
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1862
|
+
const el = document.createElement('script');
|
|
1863
|
+
const loadPromise = new Promise((resolve, reject) => {
|
|
1864
|
+
el.addEventListener('load', function (e) {
|
|
1865
|
+
resolve();
|
|
1866
|
+
|
|
1867
|
+
if (onLoad) {
|
|
1868
|
+
onLoad.call(this, e);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
afterLoad();
|
|
1872
|
+
});
|
|
1873
|
+
el.addEventListener('error', function (e) {
|
|
1874
|
+
reject(e);
|
|
1875
|
+
});
|
|
1876
|
+
}).catch(function (e) {
|
|
1877
|
+
if (onError) {
|
|
1878
|
+
onError(e);
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
|
|
1882
|
+
if (dangerouslySetInnerHTML) {
|
|
1883
|
+
el.innerHTML = dangerouslySetInnerHTML.__html || '';
|
|
1884
|
+
afterLoad();
|
|
1885
|
+
} else if (children) {
|
|
1886
|
+
el.textContent = typeof children === 'string' ? children : Array.isArray(children) ? children.join('') : '';
|
|
1887
|
+
afterLoad();
|
|
1888
|
+
} else if (src) {
|
|
1889
|
+
el.src = src; // do not add cacheKey into LoadCache for remote script here
|
|
1890
|
+
// cacheKey will be added to LoadCache when it is actually loaded (see loadPromise above)
|
|
1891
|
+
|
|
1892
|
+
ScriptCache.set(src, loadPromise);
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
for (const [k, value] of Object.entries(props)) {
|
|
1896
|
+
if (value === undefined || ignoreProps.includes(k)) {
|
|
1897
|
+
continue;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
const attr = _headManager.DOMAttributeNames[k] || k.toLowerCase();
|
|
1901
|
+
el.setAttribute(attr, value);
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
if (strategy === 'worker') {
|
|
1905
|
+
el.setAttribute('type', 'text/partytown');
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
el.setAttribute('data-nscript', strategy);
|
|
1909
|
+
document.body.appendChild(el);
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
function handleClientScriptLoad(props) {
|
|
1913
|
+
const {
|
|
1914
|
+
strategy = 'afterInteractive'
|
|
1915
|
+
} = props;
|
|
1916
|
+
|
|
1917
|
+
if (strategy === 'lazyOnload') {
|
|
1918
|
+
window.addEventListener('load', () => {
|
|
1919
|
+
(0, _requestIdleCallback).requestIdleCallback(() => loadScript(props));
|
|
1920
|
+
});
|
|
1921
|
+
} else {
|
|
1922
|
+
loadScript(props);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
function loadLazyScript(props) {
|
|
1927
|
+
if (document.readyState === 'complete') {
|
|
1928
|
+
(0, _requestIdleCallback).requestIdleCallback(() => loadScript(props));
|
|
1929
|
+
} else {
|
|
1930
|
+
window.addEventListener('load', () => {
|
|
1931
|
+
(0, _requestIdleCallback).requestIdleCallback(() => loadScript(props));
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
function addBeforeInteractiveToCache() {
|
|
1937
|
+
const scripts = [...document.querySelectorAll('[data-nscript="beforeInteractive"]'), ...document.querySelectorAll('[data-nscript="beforePageRender"]')];
|
|
1938
|
+
scripts.forEach(script => {
|
|
1939
|
+
const cacheKey = script.id || script.getAttribute('src');
|
|
1940
|
+
LoadCache.add(cacheKey);
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
function initScriptLoader(scriptLoaderItems) {
|
|
1945
|
+
scriptLoaderItems.forEach(handleClientScriptLoad);
|
|
1946
|
+
addBeforeInteractiveToCache();
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
function Script(props) {
|
|
1950
|
+
const {
|
|
1951
|
+
id,
|
|
1952
|
+
src = '',
|
|
1953
|
+
onLoad = () => {},
|
|
1954
|
+
onReady = null,
|
|
1955
|
+
strategy = 'afterInteractive',
|
|
1956
|
+
onError
|
|
1957
|
+
} = props,
|
|
1958
|
+
restProps = _object_without_properties_loose(props, ["id", "src", "onLoad", "onReady", "strategy", "onError"]); // Context is available only during SSR
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
const {
|
|
1962
|
+
updateScripts,
|
|
1963
|
+
scripts,
|
|
1964
|
+
getIsSsr
|
|
1965
|
+
} = (0, _react).useContext(_headManagerContext.HeadManagerContext);
|
|
1966
|
+
/**
|
|
1967
|
+
* - First mount:
|
|
1968
|
+
* 1. The useEffect for onReady executes
|
|
1969
|
+
* 2. hasOnReadyEffectCalled.current is false, but the script hasn't loaded yet (not in LoadCache)
|
|
1970
|
+
* onReady is skipped, set hasOnReadyEffectCalled.current to true
|
|
1971
|
+
* 3. The useEffect for loadScript executes
|
|
1972
|
+
* 4. hasLoadScriptEffectCalled.current is false, loadScript executes
|
|
1973
|
+
* Once the script is loaded, the onLoad and onReady will be called by then
|
|
1974
|
+
* [If strict mode is enabled / is wrapped in <OffScreen /> component]
|
|
1975
|
+
* 5. The useEffect for onReady executes again
|
|
1976
|
+
* 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped
|
|
1977
|
+
* 7. The useEffect for loadScript executes again
|
|
1978
|
+
* 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped
|
|
1979
|
+
*
|
|
1980
|
+
* - Second mount:
|
|
1981
|
+
* 1. The useEffect for onReady executes
|
|
1982
|
+
* 2. hasOnReadyEffectCalled.current is false, but the script has already loaded (found in LoadCache)
|
|
1983
|
+
* onReady is called, set hasOnReadyEffectCalled.current to true
|
|
1984
|
+
* 3. The useEffect for loadScript executes
|
|
1985
|
+
* 4. The script is already loaded, loadScript bails out
|
|
1986
|
+
* [If strict mode is enabled / is wrapped in <OffScreen /> component]
|
|
1987
|
+
* 5. The useEffect for onReady executes again
|
|
1988
|
+
* 6. hasOnReadyEffectCalled.current is true, so entire effect is skipped
|
|
1989
|
+
* 7. The useEffect for loadScript executes again
|
|
1990
|
+
* 8. hasLoadScriptEffectCalled.current is true, so entire effect is skipped
|
|
1991
|
+
*/
|
|
1992
|
+
|
|
1993
|
+
const hasOnReadyEffectCalled = (0, _react).useRef(false);
|
|
1994
|
+
(0, _react).useEffect(() => {
|
|
1995
|
+
const cacheKey = id || src;
|
|
1996
|
+
|
|
1997
|
+
if (!hasOnReadyEffectCalled.current) {
|
|
1998
|
+
// Run onReady if script has loaded before but component is re-mounted
|
|
1999
|
+
if (onReady && cacheKey && LoadCache.has(cacheKey)) {
|
|
2000
|
+
onReady();
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
hasOnReadyEffectCalled.current = true;
|
|
2004
|
+
}
|
|
2005
|
+
}, [onReady, id, src]);
|
|
2006
|
+
const hasLoadScriptEffectCalled = (0, _react).useRef(false);
|
|
2007
|
+
(0, _react).useEffect(() => {
|
|
2008
|
+
if (!hasLoadScriptEffectCalled.current) {
|
|
2009
|
+
if (strategy === 'afterInteractive') {
|
|
2010
|
+
loadScript(props);
|
|
2011
|
+
} else if (strategy === 'lazyOnload') {
|
|
2012
|
+
loadLazyScript(props);
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
hasLoadScriptEffectCalled.current = true;
|
|
2016
|
+
}
|
|
2017
|
+
}, [props, strategy]);
|
|
2018
|
+
|
|
2019
|
+
if (strategy === 'beforeInteractive' || strategy === 'worker') {
|
|
2020
|
+
if (updateScripts) {
|
|
2021
|
+
scripts[strategy] = (scripts[strategy] || []).concat([_extends({
|
|
2022
|
+
id,
|
|
2023
|
+
src,
|
|
2024
|
+
onLoad,
|
|
2025
|
+
onReady,
|
|
2026
|
+
onError
|
|
2027
|
+
}, restProps)]);
|
|
2028
|
+
updateScripts(scripts);
|
|
2029
|
+
} else if (getIsSsr && getIsSsr()) {
|
|
2030
|
+
// Script has already loaded during SSR
|
|
2031
|
+
LoadCache.add(id || src);
|
|
2032
|
+
} else if (getIsSsr && !getIsSsr()) {
|
|
2033
|
+
loadScript(props);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
return null;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
Object.defineProperty(Script, '__nextScript', {
|
|
2041
|
+
value: true
|
|
2042
|
+
});
|
|
2043
|
+
var _default = Script;
|
|
2044
|
+
exports["default"] = _default;
|
|
2045
|
+
|
|
2046
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
2047
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
2048
|
+
value: true
|
|
2049
|
+
});
|
|
2050
|
+
Object.assign(exports.default, exports);
|
|
2051
|
+
module.exports = exports.default;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/***/ }),
|
|
2055
|
+
|
|
2056
|
+
/***/ 5740:
|
|
2057
|
+
/***/ ((module, exports) => {
|
|
2058
|
+
|
|
2059
|
+
"use strict";
|
|
2060
|
+
|
|
2061
|
+
|
|
2062
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2063
|
+
value: true
|
|
2064
|
+
}));
|
|
2065
|
+
exports.__unsafeCreateTrustedScriptURL = __unsafeCreateTrustedScriptURL;
|
|
2066
|
+
/**
|
|
2067
|
+
* Stores the Trusted Types Policy. Starts as undefined and can be set to null
|
|
2068
|
+
* if Trusted Types is not supported in the browser.
|
|
2069
|
+
*/
|
|
2070
|
+
|
|
2071
|
+
let policy;
|
|
2072
|
+
/**
|
|
2073
|
+
* Getter for the Trusted Types Policy. If it is undefined, it is instantiated
|
|
2074
|
+
* here or set to null if Trusted Types is not supported in the browser.
|
|
2075
|
+
*/
|
|
2076
|
+
|
|
2077
|
+
function getPolicy() {
|
|
2078
|
+
if (typeof policy === 'undefined' && false) { var ref; }
|
|
2079
|
+
|
|
2080
|
+
return policy;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
function __unsafeCreateTrustedScriptURL(url) {
|
|
2084
|
+
var ref;
|
|
2085
|
+
return ((ref = getPolicy()) == null ? void 0 : ref.createScriptURL(url)) || url;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
2089
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
2090
|
+
value: true
|
|
2091
|
+
});
|
|
2092
|
+
Object.assign(exports.default, exports);
|
|
2093
|
+
module.exports = exports.default;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
/***/ }),
|
|
2097
|
+
|
|
2098
|
+
/***/ 639:
|
|
2099
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
2100
|
+
|
|
2101
|
+
"use strict";
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2105
|
+
value: true
|
|
2106
|
+
}));
|
|
2107
|
+
exports.useIntersection = useIntersection;
|
|
2108
|
+
|
|
2109
|
+
var _react = __webpack_require__(6689);
|
|
2110
|
+
|
|
2111
|
+
var _requestIdleCallback = __webpack_require__(6286);
|
|
2112
|
+
|
|
2113
|
+
const hasIntersectionObserver = typeof IntersectionObserver === 'function';
|
|
2114
|
+
const observers = new Map();
|
|
2115
|
+
const idList = [];
|
|
2116
|
+
|
|
2117
|
+
function createObserver(options) {
|
|
2118
|
+
const id = {
|
|
2119
|
+
root: options.root || null,
|
|
2120
|
+
margin: options.rootMargin || ''
|
|
2121
|
+
};
|
|
2122
|
+
const existing = idList.find(obj => obj.root === id.root && obj.margin === id.margin);
|
|
2123
|
+
let instance;
|
|
2124
|
+
|
|
2125
|
+
if (existing) {
|
|
2126
|
+
instance = observers.get(existing);
|
|
2127
|
+
|
|
2128
|
+
if (instance) {
|
|
2129
|
+
return instance;
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
const elements = new Map();
|
|
2134
|
+
const observer = new IntersectionObserver(entries => {
|
|
2135
|
+
entries.forEach(entry => {
|
|
2136
|
+
const callback = elements.get(entry.target);
|
|
2137
|
+
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
|
2138
|
+
|
|
2139
|
+
if (callback && isVisible) {
|
|
2140
|
+
callback(isVisible);
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
}, options);
|
|
2144
|
+
instance = {
|
|
2145
|
+
id,
|
|
2146
|
+
observer,
|
|
2147
|
+
elements
|
|
2148
|
+
};
|
|
2149
|
+
idList.push(id);
|
|
2150
|
+
observers.set(id, instance);
|
|
2151
|
+
return instance;
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
function observe(element, callback, options) {
|
|
2155
|
+
const {
|
|
2156
|
+
id,
|
|
2157
|
+
observer,
|
|
2158
|
+
elements
|
|
2159
|
+
} = createObserver(options);
|
|
2160
|
+
elements.set(element, callback);
|
|
2161
|
+
observer.observe(element);
|
|
2162
|
+
return function unobserve() {
|
|
2163
|
+
elements.delete(element);
|
|
2164
|
+
observer.unobserve(element); // Destroy observer when there's nothing left to watch:
|
|
2165
|
+
|
|
2166
|
+
if (elements.size === 0) {
|
|
2167
|
+
observer.disconnect();
|
|
2168
|
+
observers.delete(id);
|
|
2169
|
+
const index = idList.findIndex(obj => obj.root === id.root && obj.margin === id.margin);
|
|
2170
|
+
|
|
2171
|
+
if (index > -1) {
|
|
2172
|
+
idList.splice(index, 1);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
function useIntersection({
|
|
2179
|
+
rootRef,
|
|
2180
|
+
rootMargin,
|
|
2181
|
+
disabled
|
|
2182
|
+
}) {
|
|
2183
|
+
const isDisabled = disabled || !hasIntersectionObserver;
|
|
2184
|
+
const [visible, setVisible] = (0, _react).useState(false);
|
|
2185
|
+
const [element, setElement] = (0, _react).useState(null);
|
|
2186
|
+
(0, _react).useEffect(() => {
|
|
2187
|
+
if (hasIntersectionObserver) {
|
|
2188
|
+
if (isDisabled || visible) return;
|
|
2189
|
+
|
|
2190
|
+
if (element && element.tagName) {
|
|
2191
|
+
const unobserve = observe(element, isVisible => isVisible && setVisible(isVisible), {
|
|
2192
|
+
root: rootRef == null ? void 0 : rootRef.current,
|
|
2193
|
+
rootMargin
|
|
2194
|
+
});
|
|
2195
|
+
return unobserve;
|
|
2196
|
+
}
|
|
2197
|
+
} else {
|
|
2198
|
+
if (!visible) {
|
|
2199
|
+
const idleCallback = (0, _requestIdleCallback).requestIdleCallback(() => setVisible(true));
|
|
2200
|
+
return () => (0, _requestIdleCallback).cancelIdleCallback(idleCallback);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
}, [element, isDisabled, rootMargin, rootRef, visible]);
|
|
2204
|
+
const resetVisible = (0, _react).useCallback(() => {
|
|
2205
|
+
setVisible(false);
|
|
2206
|
+
}, []);
|
|
2207
|
+
return [setElement, visible, resetVisible];
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
if ((typeof exports.default === 'function' || typeof exports.default === 'object' && exports.default !== null) && typeof exports.default.__esModule === 'undefined') {
|
|
2211
|
+
Object.defineProperty(exports.default, '__esModule', {
|
|
2212
|
+
value: true
|
|
2213
|
+
});
|
|
2214
|
+
Object.assign(exports.default, exports);
|
|
2215
|
+
module.exports = exports.default;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
/***/ }),
|
|
2219
|
+
|
|
2220
|
+
/***/ 5781:
|
|
2221
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2222
|
+
|
|
2223
|
+
"use strict";
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2227
|
+
value: true
|
|
2228
|
+
}));
|
|
2229
|
+
exports.matchesMiddleware = matchesMiddleware;
|
|
2230
|
+
exports.isLocalURL = isLocalURL;
|
|
2231
|
+
exports.interpolateAs = interpolateAs;
|
|
2232
|
+
exports.resolveHref = resolveHref;
|
|
2233
|
+
exports.createKey = createKey;
|
|
2234
|
+
exports["default"] = void 0;
|
|
2235
|
+
|
|
2236
|
+
var _async_to_generator = (__webpack_require__(932)/* ["default"] */ .Z);
|
|
2237
|
+
|
|
2238
|
+
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
|
|
2239
|
+
|
|
2240
|
+
var _interop_require_default = (__webpack_require__(2648)/* ["default"] */ .Z);
|
|
2241
|
+
|
|
2242
|
+
var _interop_require_wildcard = (__webpack_require__(1598)/* ["default"] */ .Z);
|
|
2243
|
+
|
|
2244
|
+
var _normalizeTrailingSlash = __webpack_require__(4969);
|
|
2245
|
+
|
|
2246
|
+
var _removeTrailingSlash = __webpack_require__(3297);
|
|
2247
|
+
|
|
2248
|
+
var _routeLoader = __webpack_require__(4989);
|
|
2249
|
+
|
|
2250
|
+
var _script = __webpack_require__(2189);
|
|
2251
|
+
|
|
2252
|
+
var _isError = _interop_require_wildcard(__webpack_require__(676));
|
|
2253
|
+
|
|
2254
|
+
var _denormalizePagePath = __webpack_require__(4406);
|
|
2255
|
+
|
|
2256
|
+
var _normalizeLocalePath = __webpack_require__(4014);
|
|
2257
|
+
|
|
2258
|
+
var _mitt = _interop_require_default(__webpack_require__(8020));
|
|
2259
|
+
|
|
2260
|
+
var _utils = __webpack_require__(9232);
|
|
2261
|
+
|
|
2262
|
+
var _isDynamic = __webpack_require__(1428);
|
|
2263
|
+
|
|
2264
|
+
var _parseRelativeUrl = __webpack_require__(1292);
|
|
2265
|
+
|
|
2266
|
+
var _querystring = __webpack_require__(979);
|
|
2267
|
+
|
|
2268
|
+
var _resolveRewrites = _interop_require_default(__webpack_require__(6052));
|
|
2269
|
+
|
|
2270
|
+
var _routeMatcher = __webpack_require__(4226);
|
|
2271
|
+
|
|
2272
|
+
var _routeRegex = __webpack_require__(5052);
|
|
2273
|
+
|
|
2274
|
+
var _formatUrl = __webpack_require__(3938);
|
|
2275
|
+
|
|
2276
|
+
var _detectDomainLocale = __webpack_require__(7565);
|
|
2277
|
+
|
|
2278
|
+
var _parsePath = __webpack_require__(8854);
|
|
2279
|
+
|
|
2280
|
+
var _addLocale = __webpack_require__(7995);
|
|
2281
|
+
|
|
2282
|
+
var _removeLocale = __webpack_require__(9781);
|
|
2283
|
+
|
|
2284
|
+
var _removeBasePath = __webpack_require__(5678);
|
|
2285
|
+
|
|
2286
|
+
var _addBasePath = __webpack_require__(227);
|
|
2287
|
+
|
|
2288
|
+
var _hasBasePath = __webpack_require__(8771);
|
|
2289
|
+
|
|
2290
|
+
var _getNextPathnameInfo = __webpack_require__(5789);
|
|
2291
|
+
|
|
2292
|
+
var _formatNextPathnameInfo = __webpack_require__(299);
|
|
2293
|
+
|
|
2294
|
+
var _compareStates = __webpack_require__(6220);
|
|
2295
|
+
|
|
2296
|
+
var _isBot = __webpack_require__(1897);
|
|
2297
|
+
|
|
2298
|
+
function buildCancellationError() {
|
|
2299
|
+
return Object.assign(new Error('Route Cancelled'), {
|
|
2300
|
+
cancelled: true
|
|
2301
|
+
});
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
function matchesMiddleware(options) {
|
|
2305
|
+
return _matchesMiddleware.apply(this, arguments);
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
function _matchesMiddleware() {
|
|
2309
|
+
_matchesMiddleware = _async_to_generator(function* (options) {
|
|
2310
|
+
const matchers = yield Promise.resolve(options.router.pageLoader.getMiddleware());
|
|
2311
|
+
if (!matchers) return false;
|
|
2312
|
+
const {
|
|
2313
|
+
pathname: asPathname
|
|
2314
|
+
} = (0, _parsePath).parsePath(options.asPath); // remove basePath first since path prefix has to be in the order of `/${basePath}/${locale}`
|
|
2315
|
+
|
|
2316
|
+
const cleanedAs = (0, _hasBasePath).hasBasePath(asPathname) ? (0, _removeBasePath).removeBasePath(asPathname) : asPathname;
|
|
2317
|
+
const asWithBasePathAndLocale = (0, _addBasePath).addBasePath((0, _addLocale).addLocale(cleanedAs, options.locale)); // Check only path match on client. Matching "has" should be done on server
|
|
2318
|
+
// where we can access more info such as headers, HttpOnly cookie, etc.
|
|
2319
|
+
|
|
2320
|
+
return matchers.some(m => new RegExp(m.regexp).test(asWithBasePathAndLocale));
|
|
2321
|
+
});
|
|
2322
|
+
return _matchesMiddleware.apply(this, arguments);
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
function stripOrigin(url) {
|
|
2326
|
+
const origin = (0, _utils).getLocationOrigin();
|
|
2327
|
+
return url.startsWith(origin) ? url.substring(origin.length) : url;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
function omit(object, keys) {
|
|
2331
|
+
const omitted = {};
|
|
2332
|
+
Object.keys(object).forEach(key => {
|
|
2333
|
+
if (!keys.includes(key)) {
|
|
2334
|
+
omitted[key] = object[key];
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
return omitted;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
function isLocalURL(url) {
|
|
2341
|
+
// prevent a hydration mismatch on href for url with anchor refs
|
|
2342
|
+
if (!(0, _utils).isAbsoluteUrl(url)) return true;
|
|
2343
|
+
|
|
2344
|
+
try {
|
|
2345
|
+
// absolute urls can be local if they are on the same origin
|
|
2346
|
+
const locationOrigin = (0, _utils).getLocationOrigin();
|
|
2347
|
+
const resolved = new URL(url, locationOrigin);
|
|
2348
|
+
return resolved.origin === locationOrigin && (0, _hasBasePath).hasBasePath(resolved.pathname);
|
|
2349
|
+
} catch (_) {
|
|
2350
|
+
return false;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
function interpolateAs(route, asPathname, query) {
|
|
2355
|
+
let interpolatedRoute = '';
|
|
2356
|
+
const dynamicRegex = (0, _routeRegex).getRouteRegex(route);
|
|
2357
|
+
const dynamicGroups = dynamicRegex.groups;
|
|
2358
|
+
const dynamicMatches = // Try to match the dynamic route against the asPath
|
|
2359
|
+
(asPathname !== route ? (0, _routeMatcher).getRouteMatcher(dynamicRegex)(asPathname) : '') || // Fall back to reading the values from the href
|
|
2360
|
+
// TODO: should this take priority; also need to change in the router.
|
|
2361
|
+
query;
|
|
2362
|
+
interpolatedRoute = route;
|
|
2363
|
+
const params = Object.keys(dynamicGroups);
|
|
2364
|
+
|
|
2365
|
+
if (!params.every(param => {
|
|
2366
|
+
let value = dynamicMatches[param] || '';
|
|
2367
|
+
const {
|
|
2368
|
+
repeat,
|
|
2369
|
+
optional
|
|
2370
|
+
} = dynamicGroups[param]; // support single-level catch-all
|
|
2371
|
+
// TODO: more robust handling for user-error (passing `/`)
|
|
2372
|
+
|
|
2373
|
+
let replaced = `[${repeat ? '...' : ''}${param}]`;
|
|
2374
|
+
|
|
2375
|
+
if (optional) {
|
|
2376
|
+
replaced = `${!value ? '/' : ''}[${replaced}]`;
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
if (repeat && !Array.isArray(value)) value = [value];
|
|
2380
|
+
return (optional || param in dynamicMatches) && ( // Interpolate group into data URL if present
|
|
2381
|
+
interpolatedRoute = interpolatedRoute.replace(replaced, repeat ? value.map( // these values should be fully encoded instead of just
|
|
2382
|
+
// path delimiter escaped since they are being inserted
|
|
2383
|
+
// into the URL and we expect URL encoded segments
|
|
2384
|
+
// when parsing dynamic route params
|
|
2385
|
+
segment => encodeURIComponent(segment)).join('/') : encodeURIComponent(value)) || '/');
|
|
2386
|
+
})) {
|
|
2387
|
+
interpolatedRoute = '' // did not satisfy all requirements
|
|
2388
|
+
; // n.b. We ignore this error because we handle warning for this case in
|
|
2389
|
+
// development in the `<Link>` component directly.
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
return {
|
|
2393
|
+
params,
|
|
2394
|
+
result: interpolatedRoute
|
|
2395
|
+
};
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
function resolveHref(router, href, resolveAs) {
|
|
2399
|
+
// we use a dummy base url for relative urls
|
|
2400
|
+
let base;
|
|
2401
|
+
let urlAsString = typeof href === 'string' ? href : (0, _formatUrl).formatWithValidation(href); // repeated slashes and backslashes in the URL are considered
|
|
2402
|
+
// invalid and will never match a Next.js page/file
|
|
2403
|
+
|
|
2404
|
+
const urlProtoMatch = urlAsString.match(/^[a-zA-Z]{1,}:\/\//);
|
|
2405
|
+
const urlAsStringNoProto = urlProtoMatch ? urlAsString.slice(urlProtoMatch[0].length) : urlAsString;
|
|
2406
|
+
const urlParts = urlAsStringNoProto.split('?');
|
|
2407
|
+
|
|
2408
|
+
if ((urlParts[0] || '').match(/(\/\/|\\)/)) {
|
|
2409
|
+
console.error(`Invalid href passed to next/router: ${urlAsString}, repeated forward-slashes (//) or backslashes \\ are not valid in the href`);
|
|
2410
|
+
const normalizedUrl = (0, _utils).normalizeRepeatedSlashes(urlAsStringNoProto);
|
|
2411
|
+
urlAsString = (urlProtoMatch ? urlProtoMatch[0] : '') + normalizedUrl;
|
|
2412
|
+
} // Return because it cannot be routed by the Next.js router
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
if (!isLocalURL(urlAsString)) {
|
|
2416
|
+
return resolveAs ? [urlAsString] : urlAsString;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
try {
|
|
2420
|
+
base = new URL(urlAsString.startsWith('#') ? router.asPath : router.pathname, 'http://n');
|
|
2421
|
+
} catch (_) {
|
|
2422
|
+
// fallback to / for invalid asPath values e.g. //
|
|
2423
|
+
base = new URL('/', 'http://n');
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
try {
|
|
2427
|
+
const finalUrl = new URL(urlAsString, base);
|
|
2428
|
+
finalUrl.pathname = (0, _normalizeTrailingSlash).normalizePathTrailingSlash(finalUrl.pathname);
|
|
2429
|
+
let interpolatedAs = '';
|
|
2430
|
+
|
|
2431
|
+
if ((0, _isDynamic).isDynamicRoute(finalUrl.pathname) && finalUrl.searchParams && resolveAs) {
|
|
2432
|
+
const query = (0, _querystring).searchParamsToUrlQuery(finalUrl.searchParams);
|
|
2433
|
+
const {
|
|
2434
|
+
result,
|
|
2435
|
+
params
|
|
2436
|
+
} = interpolateAs(finalUrl.pathname, finalUrl.pathname, query);
|
|
2437
|
+
|
|
2438
|
+
if (result) {
|
|
2439
|
+
interpolatedAs = (0, _formatUrl).formatWithValidation({
|
|
2440
|
+
pathname: result,
|
|
2441
|
+
hash: finalUrl.hash,
|
|
2442
|
+
query: omit(query, params)
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
} // if the origin didn't change, it means we received a relative href
|
|
2446
|
+
|
|
2447
|
+
|
|
2448
|
+
const resolvedHref = finalUrl.origin === base.origin ? finalUrl.href.slice(finalUrl.origin.length) : finalUrl.href;
|
|
2449
|
+
return resolveAs ? [resolvedHref, interpolatedAs || resolvedHref] : resolvedHref;
|
|
2450
|
+
} catch (_1) {
|
|
2451
|
+
return resolveAs ? [urlAsString] : urlAsString;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
function prepareUrlAs(router, url, as) {
|
|
2456
|
+
// If url and as provided as an object representation,
|
|
2457
|
+
// we'll format them into the string version here.
|
|
2458
|
+
let [resolvedHref, resolvedAs] = resolveHref(router, url, true);
|
|
2459
|
+
const origin = (0, _utils).getLocationOrigin();
|
|
2460
|
+
const hrefHadOrigin = resolvedHref.startsWith(origin);
|
|
2461
|
+
const asHadOrigin = resolvedAs && resolvedAs.startsWith(origin);
|
|
2462
|
+
resolvedHref = stripOrigin(resolvedHref);
|
|
2463
|
+
resolvedAs = resolvedAs ? stripOrigin(resolvedAs) : resolvedAs;
|
|
2464
|
+
const preparedUrl = hrefHadOrigin ? resolvedHref : (0, _addBasePath).addBasePath(resolvedHref);
|
|
2465
|
+
const preparedAs = as ? stripOrigin(resolveHref(router, as)) : resolvedAs || resolvedHref;
|
|
2466
|
+
return {
|
|
2467
|
+
url: preparedUrl,
|
|
2468
|
+
as: asHadOrigin ? preparedAs : (0, _addBasePath).addBasePath(preparedAs)
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
function resolveDynamicRoute(pathname, pages) {
|
|
2473
|
+
const cleanPathname = (0, _removeTrailingSlash).removeTrailingSlash((0, _denormalizePagePath).denormalizePagePath(pathname));
|
|
2474
|
+
|
|
2475
|
+
if (cleanPathname === '/404' || cleanPathname === '/_error') {
|
|
2476
|
+
return pathname;
|
|
2477
|
+
} // handle resolving href for dynamic routes
|
|
2478
|
+
|
|
2479
|
+
|
|
2480
|
+
if (!pages.includes(cleanPathname)) {
|
|
2481
|
+
// eslint-disable-next-line array-callback-return
|
|
2482
|
+
pages.some(page => {
|
|
2483
|
+
if ((0, _isDynamic).isDynamicRoute(page) && (0, _routeRegex).getRouteRegex(page).re.test(cleanPathname)) {
|
|
2484
|
+
pathname = page;
|
|
2485
|
+
return true;
|
|
2486
|
+
}
|
|
2487
|
+
});
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
return (0, _removeTrailingSlash).removeTrailingSlash(pathname);
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
function getMiddlewareData(source, response, options) {
|
|
2494
|
+
const nextConfig = {
|
|
2495
|
+
basePath: options.router.basePath,
|
|
2496
|
+
i18n: {
|
|
2497
|
+
locales: options.router.locales
|
|
2498
|
+
},
|
|
2499
|
+
trailingSlash: Boolean(false)
|
|
2500
|
+
};
|
|
2501
|
+
const rewriteHeader = response.headers.get('x-nextjs-rewrite');
|
|
2502
|
+
let rewriteTarget = rewriteHeader || response.headers.get('x-nextjs-matched-path');
|
|
2503
|
+
const matchedPath = response.headers.get('x-matched-path');
|
|
2504
|
+
|
|
2505
|
+
if (matchedPath && !rewriteTarget && !matchedPath.includes('__next_data_catchall') && !matchedPath.includes('/_error') && !matchedPath.includes('/404')) {
|
|
2506
|
+
// leverage x-matched-path to detect next.config.js rewrites
|
|
2507
|
+
rewriteTarget = matchedPath;
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
if (rewriteTarget) {
|
|
2511
|
+
if (rewriteTarget.startsWith('/')) {
|
|
2512
|
+
const parsedRewriteTarget = (0, _parseRelativeUrl).parseRelativeUrl(rewriteTarget);
|
|
2513
|
+
const pathnameInfo = (0, _getNextPathnameInfo).getNextPathnameInfo(parsedRewriteTarget.pathname, {
|
|
2514
|
+
nextConfig,
|
|
2515
|
+
parseData: true
|
|
2516
|
+
});
|
|
2517
|
+
let fsPathname = (0, _removeTrailingSlash).removeTrailingSlash(pathnameInfo.pathname);
|
|
2518
|
+
return Promise.all([options.router.pageLoader.getPageList(), (0, _routeLoader).getClientBuildManifest()]).then(([pages, {
|
|
2519
|
+
__rewrites: rewrites
|
|
2520
|
+
}]) => {
|
|
2521
|
+
let as = (0, _addLocale).addLocale(pathnameInfo.pathname, pathnameInfo.locale);
|
|
2522
|
+
|
|
2523
|
+
if ((0, _isDynamic).isDynamicRoute(as) || !rewriteHeader && pages.includes((0, _normalizeLocalePath).normalizeLocalePath((0, _removeBasePath).removeBasePath(as), options.router.locales).pathname)) {
|
|
2524
|
+
const parsedSource = (0, _getNextPathnameInfo).getNextPathnameInfo((0, _parseRelativeUrl).parseRelativeUrl(source).pathname, {
|
|
2525
|
+
parseData: true
|
|
2526
|
+
});
|
|
2527
|
+
as = (0, _addBasePath).addBasePath(parsedSource.pathname);
|
|
2528
|
+
parsedRewriteTarget.pathname = as;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
if (false) {} else if (!pages.includes(fsPathname)) {
|
|
2532
|
+
const resolvedPathname = resolveDynamicRoute(fsPathname, pages);
|
|
2533
|
+
|
|
2534
|
+
if (resolvedPathname !== fsPathname) {
|
|
2535
|
+
fsPathname = resolvedPathname;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
const resolvedHref = !pages.includes(fsPathname) ? resolveDynamicRoute((0, _normalizeLocalePath).normalizeLocalePath((0, _removeBasePath).removeBasePath(parsedRewriteTarget.pathname), options.router.locales).pathname, pages) : fsPathname;
|
|
2540
|
+
|
|
2541
|
+
if ((0, _isDynamic).isDynamicRoute(resolvedHref)) {
|
|
2542
|
+
const matches = (0, _routeMatcher).getRouteMatcher((0, _routeRegex).getRouteRegex(resolvedHref))(as);
|
|
2543
|
+
Object.assign(parsedRewriteTarget.query, matches || {});
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
return {
|
|
2547
|
+
type: 'rewrite',
|
|
2548
|
+
parsedAs: parsedRewriteTarget,
|
|
2549
|
+
resolvedHref
|
|
2550
|
+
};
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
const src = (0, _parsePath).parsePath(source);
|
|
2555
|
+
const pathname = (0, _formatNextPathnameInfo).formatNextPathnameInfo(_extends({}, (0, _getNextPathnameInfo).getNextPathnameInfo(src.pathname, {
|
|
2556
|
+
nextConfig,
|
|
2557
|
+
parseData: true
|
|
2558
|
+
}), {
|
|
2559
|
+
defaultLocale: options.router.defaultLocale,
|
|
2560
|
+
buildId: ''
|
|
2561
|
+
}));
|
|
2562
|
+
return Promise.resolve({
|
|
2563
|
+
type: 'redirect-external',
|
|
2564
|
+
destination: `${pathname}${src.query}${src.hash}`
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
const redirectTarget = response.headers.get('x-nextjs-redirect');
|
|
2569
|
+
|
|
2570
|
+
if (redirectTarget) {
|
|
2571
|
+
if (redirectTarget.startsWith('/')) {
|
|
2572
|
+
const src = (0, _parsePath).parsePath(redirectTarget);
|
|
2573
|
+
const pathname = (0, _formatNextPathnameInfo).formatNextPathnameInfo(_extends({}, (0, _getNextPathnameInfo).getNextPathnameInfo(src.pathname, {
|
|
2574
|
+
nextConfig,
|
|
2575
|
+
parseData: true
|
|
2576
|
+
}), {
|
|
2577
|
+
defaultLocale: options.router.defaultLocale,
|
|
2578
|
+
buildId: ''
|
|
2579
|
+
}));
|
|
2580
|
+
return Promise.resolve({
|
|
2581
|
+
type: 'redirect-internal',
|
|
2582
|
+
newAs: `${pathname}${src.query}${src.hash}`,
|
|
2583
|
+
newUrl: `${pathname}${src.query}${src.hash}`
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
return Promise.resolve({
|
|
2588
|
+
type: 'redirect-external',
|
|
2589
|
+
destination: redirectTarget
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
return Promise.resolve({
|
|
2594
|
+
type: 'next'
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
function withMiddlewareEffects(options) {
|
|
2599
|
+
return matchesMiddleware(options).then(matches => {
|
|
2600
|
+
if (matches && options.fetchData) {
|
|
2601
|
+
return options.fetchData().then(data => getMiddlewareData(data.dataHref, data.response, options).then(effect => ({
|
|
2602
|
+
dataHref: data.dataHref,
|
|
2603
|
+
cacheKey: data.cacheKey,
|
|
2604
|
+
json: data.json,
|
|
2605
|
+
response: data.response,
|
|
2606
|
+
text: data.text,
|
|
2607
|
+
effect
|
|
2608
|
+
}))).catch(_err => {
|
|
2609
|
+
/**
|
|
2610
|
+
* TODO: Revisit this in the future.
|
|
2611
|
+
* For now we will not consider middleware data errors to be fatal.
|
|
2612
|
+
* maybe we should revisit in the future.
|
|
2613
|
+
*/
|
|
2614
|
+
return null;
|
|
2615
|
+
});
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
return null;
|
|
2619
|
+
});
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
const manualScrollRestoration = false && 0;
|
|
2623
|
+
const SSG_DATA_NOT_FOUND = Symbol('SSG_DATA_NOT_FOUND');
|
|
2624
|
+
|
|
2625
|
+
function fetchRetry(url, attempts, options) {
|
|
2626
|
+
return fetch(url, {
|
|
2627
|
+
// Cookies are required to be present for Next.js' SSG "Preview Mode".
|
|
2628
|
+
// Cookies may also be required for `getServerSideProps`.
|
|
2629
|
+
//
|
|
2630
|
+
// > `fetch` won’t send cookies, unless you set the credentials init
|
|
2631
|
+
// > option.
|
|
2632
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
|
|
2633
|
+
//
|
|
2634
|
+
// > For maximum browser compatibility when it comes to sending &
|
|
2635
|
+
// > receiving cookies, always supply the `credentials: 'same-origin'`
|
|
2636
|
+
// > option instead of relying on the default.
|
|
2637
|
+
// https://github.com/github/fetch#caveats
|
|
2638
|
+
credentials: 'same-origin',
|
|
2639
|
+
method: options.method || 'GET',
|
|
2640
|
+
headers: Object.assign({}, options.headers, {
|
|
2641
|
+
'x-nextjs-data': '1'
|
|
2642
|
+
})
|
|
2643
|
+
}).then(response => {
|
|
2644
|
+
return !response.ok && attempts > 1 && response.status >= 500 ? fetchRetry(url, attempts - 1, options) : response;
|
|
2645
|
+
});
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
const backgroundCache = {};
|
|
2649
|
+
|
|
2650
|
+
function handleSmoothScroll(fn) {
|
|
2651
|
+
const htmlElement = document.documentElement;
|
|
2652
|
+
const existing = htmlElement.style.scrollBehavior;
|
|
2653
|
+
htmlElement.style.scrollBehavior = 'auto';
|
|
2654
|
+
fn();
|
|
2655
|
+
htmlElement.style.scrollBehavior = existing;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
function tryToParseAsJSON(text) {
|
|
2659
|
+
try {
|
|
2660
|
+
return JSON.parse(text);
|
|
2661
|
+
} catch (error) {
|
|
2662
|
+
return null;
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
function fetchNextData({
|
|
2667
|
+
dataHref,
|
|
2668
|
+
inflightCache,
|
|
2669
|
+
isPrefetch,
|
|
2670
|
+
hasMiddleware,
|
|
2671
|
+
isServerRender,
|
|
2672
|
+
parseJSON,
|
|
2673
|
+
persistCache,
|
|
2674
|
+
isBackground,
|
|
2675
|
+
unstable_skipClientCache
|
|
2676
|
+
}) {
|
|
2677
|
+
const {
|
|
2678
|
+
href: cacheKey
|
|
2679
|
+
} = new URL(dataHref, window.location.href);
|
|
2680
|
+
var ref1;
|
|
2681
|
+
|
|
2682
|
+
const getData = params => {
|
|
2683
|
+
return fetchRetry(dataHref, isServerRender ? 3 : 1, {
|
|
2684
|
+
headers: isPrefetch ? {
|
|
2685
|
+
purpose: 'prefetch'
|
|
2686
|
+
} : {},
|
|
2687
|
+
method: (ref1 = params == null ? void 0 : params.method) != null ? ref1 : 'GET'
|
|
2688
|
+
}).then(response => {
|
|
2689
|
+
if (response.ok && (params == null ? void 0 : params.method) === 'HEAD') {
|
|
2690
|
+
return {
|
|
2691
|
+
dataHref,
|
|
2692
|
+
response,
|
|
2693
|
+
text: '',
|
|
2694
|
+
json: {},
|
|
2695
|
+
cacheKey
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
return response.text().then(text => {
|
|
2700
|
+
if (!response.ok) {
|
|
2701
|
+
/**
|
|
2702
|
+
* When the data response is a redirect because of a middleware
|
|
2703
|
+
* we do not consider it an error. The headers must bring the
|
|
2704
|
+
* mapped location.
|
|
2705
|
+
* TODO: Change the status code in the handler.
|
|
2706
|
+
*/
|
|
2707
|
+
if (hasMiddleware && [301, 302, 307, 308].includes(response.status)) {
|
|
2708
|
+
return {
|
|
2709
|
+
dataHref,
|
|
2710
|
+
response,
|
|
2711
|
+
text,
|
|
2712
|
+
json: {},
|
|
2713
|
+
cacheKey
|
|
2714
|
+
};
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
if (!hasMiddleware && response.status === 404) {
|
|
2718
|
+
var ref;
|
|
2719
|
+
|
|
2720
|
+
if ((ref = tryToParseAsJSON(text)) == null ? void 0 : ref.notFound) {
|
|
2721
|
+
return {
|
|
2722
|
+
dataHref,
|
|
2723
|
+
json: {
|
|
2724
|
+
notFound: SSG_DATA_NOT_FOUND
|
|
2725
|
+
},
|
|
2726
|
+
response,
|
|
2727
|
+
text,
|
|
2728
|
+
cacheKey
|
|
2729
|
+
};
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
const error = new Error(`Failed to load static props`);
|
|
2734
|
+
/**
|
|
2735
|
+
* We should only trigger a server-side transition if this was
|
|
2736
|
+
* caused on a client-side transition. Otherwise, we'd get into
|
|
2737
|
+
* an infinite loop.
|
|
2738
|
+
*/
|
|
2739
|
+
|
|
2740
|
+
if (!isServerRender) {
|
|
2741
|
+
(0, _routeLoader).markAssetError(error);
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
throw error;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
return {
|
|
2748
|
+
dataHref,
|
|
2749
|
+
json: parseJSON ? tryToParseAsJSON(text) : null,
|
|
2750
|
+
response,
|
|
2751
|
+
text,
|
|
2752
|
+
cacheKey
|
|
2753
|
+
};
|
|
2754
|
+
});
|
|
2755
|
+
}).then(data => {
|
|
2756
|
+
if (!persistCache || false || data.response.headers.get('x-middleware-cache') === 'no-cache') {
|
|
2757
|
+
delete inflightCache[cacheKey];
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
return data;
|
|
2761
|
+
}).catch(err => {
|
|
2762
|
+
delete inflightCache[cacheKey];
|
|
2763
|
+
throw err;
|
|
2764
|
+
});
|
|
2765
|
+
}; // when skipping client cache we wait to update
|
|
2766
|
+
// inflight cache until successful data response
|
|
2767
|
+
// this allows racing click event with fetching newer data
|
|
2768
|
+
// without blocking navigation when stale data is available
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
if (unstable_skipClientCache && persistCache) {
|
|
2772
|
+
return getData({}).then(data => {
|
|
2773
|
+
inflightCache[cacheKey] = Promise.resolve(data);
|
|
2774
|
+
return data;
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2778
|
+
if (inflightCache[cacheKey] !== undefined) {
|
|
2779
|
+
return inflightCache[cacheKey];
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
return inflightCache[cacheKey] = getData(isBackground ? {
|
|
2783
|
+
method: 'HEAD'
|
|
2784
|
+
} : {});
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
function createKey() {
|
|
2788
|
+
return Math.random().toString(36).slice(2, 10);
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
function handleHardNavigation({
|
|
2792
|
+
url,
|
|
2793
|
+
router
|
|
2794
|
+
}) {
|
|
2795
|
+
// ensure we don't trigger a hard navigation to the same
|
|
2796
|
+
// URL as this can end up with an infinite refresh
|
|
2797
|
+
if (url === (0, _addBasePath).addBasePath((0, _addLocale).addLocale(router.asPath, router.locale))) {
|
|
2798
|
+
throw new Error(`Invariant: attempted to hard navigate to the same URL ${url} ${location.href}`);
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
window.location.href = url;
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
const getCancelledHandler = ({
|
|
2805
|
+
route,
|
|
2806
|
+
router
|
|
2807
|
+
}) => {
|
|
2808
|
+
let cancelled = false;
|
|
2809
|
+
|
|
2810
|
+
const cancel = router.clc = () => {
|
|
2811
|
+
cancelled = true;
|
|
2812
|
+
};
|
|
2813
|
+
|
|
2814
|
+
const handleCancelled = () => {
|
|
2815
|
+
if (cancelled) {
|
|
2816
|
+
const error = new Error(`Abort fetching component for route: "${route}"`);
|
|
2817
|
+
error.cancelled = true;
|
|
2818
|
+
throw error;
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
if (cancel === router.clc) {
|
|
2822
|
+
router.clc = null;
|
|
2823
|
+
}
|
|
2824
|
+
};
|
|
2825
|
+
|
|
2826
|
+
return handleCancelled;
|
|
2827
|
+
};
|
|
2828
|
+
|
|
2829
|
+
class Router {
|
|
2830
|
+
reload() {
|
|
2831
|
+
window.location.reload();
|
|
2832
|
+
}
|
|
2833
|
+
/**
|
|
2834
|
+
* Go back in history
|
|
2835
|
+
*/
|
|
2836
|
+
|
|
2837
|
+
|
|
2838
|
+
back() {
|
|
2839
|
+
window.history.back();
|
|
2840
|
+
}
|
|
2841
|
+
/**
|
|
2842
|
+
* Performs a `pushState` with arguments
|
|
2843
|
+
* @param url of the route
|
|
2844
|
+
* @param as masks `url` for the browser
|
|
2845
|
+
* @param options object you can define `shallow` and other options
|
|
2846
|
+
*/
|
|
2847
|
+
|
|
2848
|
+
|
|
2849
|
+
push(url, as, options = {}) {
|
|
2850
|
+
if (true) {
|
|
2851
|
+
// TODO: remove in the future when we update history before route change
|
|
2852
|
+
// is complete, as the popstate event should handle this capture.
|
|
2853
|
+
if (manualScrollRestoration) {
|
|
2854
|
+
try {
|
|
2855
|
+
// Snapshot scroll position right before navigating to a new page:
|
|
2856
|
+
sessionStorage.setItem('__next_scroll_' + this._key, JSON.stringify({
|
|
2857
|
+
x: self.pageXOffset,
|
|
2858
|
+
y: self.pageYOffset
|
|
2859
|
+
}));
|
|
2860
|
+
} catch (e) {}
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
({
|
|
2865
|
+
url,
|
|
2866
|
+
as
|
|
2867
|
+
} = prepareUrlAs(this, url, as));
|
|
2868
|
+
return this.change('pushState', url, as, options);
|
|
2869
|
+
}
|
|
2870
|
+
/**
|
|
2871
|
+
* Performs a `replaceState` with arguments
|
|
2872
|
+
* @param url of the route
|
|
2873
|
+
* @param as masks `url` for the browser
|
|
2874
|
+
* @param options object you can define `shallow` and other options
|
|
2875
|
+
*/
|
|
2876
|
+
|
|
2877
|
+
|
|
2878
|
+
replace(url, as, options = {}) {
|
|
2879
|
+
({
|
|
2880
|
+
url,
|
|
2881
|
+
as
|
|
2882
|
+
} = prepareUrlAs(this, url, as));
|
|
2883
|
+
return this.change('replaceState', url, as, options);
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
change(method, url, as, options, forcedScroll) {
|
|
2887
|
+
var _this = this;
|
|
2888
|
+
|
|
2889
|
+
return _async_to_generator(function* () {
|
|
2890
|
+
if (!isLocalURL(url)) {
|
|
2891
|
+
handleHardNavigation({
|
|
2892
|
+
url,
|
|
2893
|
+
router: _this
|
|
2894
|
+
});
|
|
2895
|
+
return false;
|
|
2896
|
+
} // WARNING: `_h` is an internal option for handing Next.js client-side
|
|
2897
|
+
// hydration. Your app should _never_ use this property. It may change at
|
|
2898
|
+
// any time without notice.
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
const isQueryUpdating = options._h;
|
|
2902
|
+
const shouldResolveHref = isQueryUpdating || options._shouldResolveHref || (0, _parsePath).parsePath(url).pathname === (0, _parsePath).parsePath(as).pathname;
|
|
2903
|
+
|
|
2904
|
+
const nextState = _extends({}, _this.state); // for static pages with query params in the URL we delay
|
|
2905
|
+
// marking the router ready until after the query is updated
|
|
2906
|
+
// or a navigation has occurred
|
|
2907
|
+
|
|
2908
|
+
|
|
2909
|
+
const readyStateChange = _this.isReady !== true;
|
|
2910
|
+
_this.isReady = true;
|
|
2911
|
+
const isSsr = _this.isSsr;
|
|
2912
|
+
|
|
2913
|
+
if (!isQueryUpdating) {
|
|
2914
|
+
_this.isSsr = false;
|
|
2915
|
+
} // if a route transition is already in progress before
|
|
2916
|
+
// the query updating is triggered ignore query updating
|
|
2917
|
+
|
|
2918
|
+
|
|
2919
|
+
if (isQueryUpdating && _this.clc) {
|
|
2920
|
+
return false;
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
const prevLocale = nextState.locale;
|
|
2924
|
+
|
|
2925
|
+
if (true) {
|
|
2926
|
+
nextState.locale = options.locale === false ? _this.defaultLocale : options.locale || nextState.locale;
|
|
2927
|
+
|
|
2928
|
+
if (typeof options.locale === 'undefined') {
|
|
2929
|
+
options.locale = nextState.locale;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
const parsedAs = (0, _parseRelativeUrl).parseRelativeUrl((0, _hasBasePath).hasBasePath(as) ? (0, _removeBasePath).removeBasePath(as) : as);
|
|
2933
|
+
const localePathResult = (0, _normalizeLocalePath).normalizeLocalePath(parsedAs.pathname, _this.locales);
|
|
2934
|
+
|
|
2935
|
+
if (localePathResult.detectedLocale) {
|
|
2936
|
+
nextState.locale = localePathResult.detectedLocale;
|
|
2937
|
+
parsedAs.pathname = (0, _addBasePath).addBasePath(parsedAs.pathname);
|
|
2938
|
+
as = (0, _formatUrl).formatWithValidation(parsedAs);
|
|
2939
|
+
url = (0, _addBasePath).addBasePath((0, _normalizeLocalePath).normalizeLocalePath((0, _hasBasePath).hasBasePath(url) ? (0, _removeBasePath).removeBasePath(url) : url, _this.locales).pathname);
|
|
2940
|
+
}
|
|
2941
|
+
|
|
2942
|
+
let didNavigate = false; // we need to wrap this in the env check again since regenerator runtime
|
|
2943
|
+
// moves this on its own due to the return
|
|
2944
|
+
|
|
2945
|
+
if (true) {
|
|
2946
|
+
var ref; // if the locale isn't configured hard navigate to show 404 page
|
|
2947
|
+
|
|
2948
|
+
if (!((ref = _this.locales) == null ? void 0 : ref.includes(nextState.locale))) {
|
|
2949
|
+
parsedAs.pathname = (0, _addLocale).addLocale(parsedAs.pathname, nextState.locale);
|
|
2950
|
+
handleHardNavigation({
|
|
2951
|
+
url: (0, _formatUrl).formatWithValidation(parsedAs),
|
|
2952
|
+
router: _this
|
|
2953
|
+
}); // this was previously a return but was removed in favor
|
|
2954
|
+
// of better dead code elimination with regenerator runtime
|
|
2955
|
+
|
|
2956
|
+
didNavigate = true;
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
const detectedDomain = (0, _detectDomainLocale).detectDomainLocale(_this.domainLocales, undefined, nextState.locale); // we need to wrap this in the env check again since regenerator runtime
|
|
2961
|
+
// moves this on its own due to the return
|
|
2962
|
+
|
|
2963
|
+
if (true) {
|
|
2964
|
+
// if we are navigating to a domain locale ensure we redirect to the
|
|
2965
|
+
// correct domain
|
|
2966
|
+
if (!didNavigate && detectedDomain && _this.isLocaleDomain && self.location.hostname !== detectedDomain.domain) {
|
|
2967
|
+
const asNoBasePath = (0, _removeBasePath).removeBasePath(as);
|
|
2968
|
+
handleHardNavigation({
|
|
2969
|
+
url: `http${detectedDomain.http ? '' : 's'}://${detectedDomain.domain}${(0, _addBasePath).addBasePath(`${nextState.locale === detectedDomain.defaultLocale ? '' : `/${nextState.locale}`}${asNoBasePath === '/' ? '' : asNoBasePath}` || '/')}`,
|
|
2970
|
+
router: _this
|
|
2971
|
+
}); // this was previously a return but was removed in favor
|
|
2972
|
+
// of better dead code elimination with regenerator runtime
|
|
2973
|
+
|
|
2974
|
+
didNavigate = true;
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
if (didNavigate) {
|
|
2979
|
+
return new Promise(() => {});
|
|
2980
|
+
}
|
|
2981
|
+
} // marking route changes as a navigation start entry
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
if (_utils.ST) {
|
|
2985
|
+
performance.mark('routeChange');
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
const {
|
|
2989
|
+
shallow = false,
|
|
2990
|
+
scroll = true
|
|
2991
|
+
} = options;
|
|
2992
|
+
const routeProps = {
|
|
2993
|
+
shallow
|
|
2994
|
+
};
|
|
2995
|
+
|
|
2996
|
+
if (_this._inFlightRoute && _this.clc) {
|
|
2997
|
+
if (!isSsr) {
|
|
2998
|
+
Router.events.emit('routeChangeError', buildCancellationError(), _this._inFlightRoute, routeProps);
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
_this.clc();
|
|
3002
|
+
|
|
3003
|
+
_this.clc = null;
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
as = (0, _addBasePath).addBasePath((0, _addLocale).addLocale((0, _hasBasePath).hasBasePath(as) ? (0, _removeBasePath).removeBasePath(as) : as, options.locale, _this.defaultLocale));
|
|
3007
|
+
const cleanedAs = (0, _removeLocale).removeLocale((0, _hasBasePath).hasBasePath(as) ? (0, _removeBasePath).removeBasePath(as) : as, nextState.locale);
|
|
3008
|
+
_this._inFlightRoute = as;
|
|
3009
|
+
const localeChange = prevLocale !== nextState.locale; // If the url change is only related to a hash change
|
|
3010
|
+
// We should not proceed. We should only change the state.
|
|
3011
|
+
|
|
3012
|
+
if (!isQueryUpdating && _this.onlyAHashChange(cleanedAs) && !localeChange) {
|
|
3013
|
+
nextState.asPath = cleanedAs;
|
|
3014
|
+
Router.events.emit('hashChangeStart', as, routeProps); // TODO: do we need the resolved href when only a hash change?
|
|
3015
|
+
|
|
3016
|
+
_this.changeState(method, url, as, _extends({}, options, {
|
|
3017
|
+
scroll: false
|
|
3018
|
+
}));
|
|
3019
|
+
|
|
3020
|
+
if (scroll) {
|
|
3021
|
+
_this.scrollToHash(cleanedAs);
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
try {
|
|
3025
|
+
yield _this.set(nextState, _this.components[nextState.route], null);
|
|
3026
|
+
} catch (err) {
|
|
3027
|
+
if ((0, _isError).default(err) && err.cancelled) {
|
|
3028
|
+
Router.events.emit('routeChangeError', err, cleanedAs, routeProps);
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
throw err;
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
Router.events.emit('hashChangeComplete', as, routeProps);
|
|
3035
|
+
return true;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
let parsed = (0, _parseRelativeUrl).parseRelativeUrl(url);
|
|
3039
|
+
let {
|
|
3040
|
+
pathname,
|
|
3041
|
+
query
|
|
3042
|
+
} = parsed; // The build manifest needs to be loaded before auto-static dynamic pages
|
|
3043
|
+
// get their query parameters to allow ensuring they can be parsed properly
|
|
3044
|
+
// when rewritten to
|
|
3045
|
+
|
|
3046
|
+
let pages, rewrites;
|
|
3047
|
+
|
|
3048
|
+
try {
|
|
3049
|
+
[pages, {
|
|
3050
|
+
__rewrites: rewrites
|
|
3051
|
+
}] = yield Promise.all([_this.pageLoader.getPageList(), (0, _routeLoader).getClientBuildManifest(), _this.pageLoader.getMiddleware()]);
|
|
3052
|
+
} catch (err) {
|
|
3053
|
+
// If we fail to resolve the page list or client-build manifest, we must
|
|
3054
|
+
// do a server-side transition:
|
|
3055
|
+
handleHardNavigation({
|
|
3056
|
+
url: as,
|
|
3057
|
+
router: _this
|
|
3058
|
+
});
|
|
3059
|
+
return false;
|
|
3060
|
+
} // If asked to change the current URL we should reload the current page
|
|
3061
|
+
// (not location.reload() but reload getInitialProps and other Next.js stuffs)
|
|
3062
|
+
// We also need to set the method = replaceState always
|
|
3063
|
+
// as this should not go into the history (That's how browsers work)
|
|
3064
|
+
// We should compare the new asPath to the current asPath, not the url
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
if (!_this.urlIsNew(cleanedAs) && !localeChange) {
|
|
3068
|
+
method = 'replaceState';
|
|
3069
|
+
} // we need to resolve the as value using rewrites for dynamic SSG
|
|
3070
|
+
// pages to allow building the data URL correctly
|
|
3071
|
+
|
|
3072
|
+
|
|
3073
|
+
let resolvedAs = as; // url and as should always be prefixed with basePath by this
|
|
3074
|
+
// point by either next/link or router.push/replace so strip the
|
|
3075
|
+
// basePath from the pathname to match the pages dir 1-to-1
|
|
3076
|
+
|
|
3077
|
+
pathname = pathname ? (0, _removeTrailingSlash).removeTrailingSlash((0, _removeBasePath).removeBasePath(pathname)) : pathname; // we don't attempt resolve asPath when we need to execute
|
|
3078
|
+
// middleware as the resolving will occur server-side
|
|
3079
|
+
|
|
3080
|
+
const isMiddlewareMatch = yield matchesMiddleware({
|
|
3081
|
+
asPath: as,
|
|
3082
|
+
locale: nextState.locale,
|
|
3083
|
+
router: _this
|
|
3084
|
+
});
|
|
3085
|
+
|
|
3086
|
+
if (options.shallow && isMiddlewareMatch) {
|
|
3087
|
+
pathname = _this.pathname;
|
|
3088
|
+
}
|
|
3089
|
+
|
|
3090
|
+
if (shouldResolveHref && pathname !== '/_error') {
|
|
3091
|
+
options._shouldResolveHref = true;
|
|
3092
|
+
|
|
3093
|
+
if (false) {} else {
|
|
3094
|
+
parsed.pathname = resolveDynamicRoute(pathname, pages);
|
|
3095
|
+
|
|
3096
|
+
if (parsed.pathname !== pathname) {
|
|
3097
|
+
pathname = parsed.pathname;
|
|
3098
|
+
parsed.pathname = (0, _addBasePath).addBasePath(pathname);
|
|
3099
|
+
|
|
3100
|
+
if (!isMiddlewareMatch) {
|
|
3101
|
+
url = (0, _formatUrl).formatWithValidation(parsed);
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
if (!isLocalURL(as)) {
|
|
3108
|
+
if (false) {}
|
|
3109
|
+
|
|
3110
|
+
handleHardNavigation({
|
|
3111
|
+
url: as,
|
|
3112
|
+
router: _this
|
|
3113
|
+
});
|
|
3114
|
+
return false;
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
resolvedAs = (0, _removeLocale).removeLocale((0, _removeBasePath).removeBasePath(resolvedAs), nextState.locale);
|
|
3118
|
+
let route = (0, _removeTrailingSlash).removeTrailingSlash(pathname);
|
|
3119
|
+
let routeMatch = false;
|
|
3120
|
+
|
|
3121
|
+
if ((0, _isDynamic).isDynamicRoute(route)) {
|
|
3122
|
+
const parsedAs = (0, _parseRelativeUrl).parseRelativeUrl(resolvedAs);
|
|
3123
|
+
const asPathname = parsedAs.pathname;
|
|
3124
|
+
const routeRegex = (0, _routeRegex).getRouteRegex(route);
|
|
3125
|
+
routeMatch = (0, _routeMatcher).getRouteMatcher(routeRegex)(asPathname);
|
|
3126
|
+
const shouldInterpolate = route === asPathname;
|
|
3127
|
+
const interpolatedAs = shouldInterpolate ? interpolateAs(route, asPathname, query) : {};
|
|
3128
|
+
|
|
3129
|
+
if (!routeMatch || shouldInterpolate && !interpolatedAs.result) {
|
|
3130
|
+
const missingParams = Object.keys(routeRegex.groups).filter(param => !query[param]);
|
|
3131
|
+
|
|
3132
|
+
if (missingParams.length > 0 && !isMiddlewareMatch) {
|
|
3133
|
+
if (false) {}
|
|
3134
|
+
|
|
3135
|
+
throw new Error((shouldInterpolate ? `The provided \`href\` (${url}) value is missing query values (${missingParams.join(', ')}) to be interpolated properly. ` : `The provided \`as\` value (${asPathname}) is incompatible with the \`href\` value (${route}). `) + `Read more: https://nextjs.org/docs/messages/${shouldInterpolate ? 'href-interpolation-failed' : 'incompatible-href-as'}`);
|
|
3136
|
+
}
|
|
3137
|
+
} else if (shouldInterpolate) {
|
|
3138
|
+
as = (0, _formatUrl).formatWithValidation(Object.assign({}, parsedAs, {
|
|
3139
|
+
pathname: interpolatedAs.result,
|
|
3140
|
+
query: omit(query, interpolatedAs.params)
|
|
3141
|
+
}));
|
|
3142
|
+
} else {
|
|
3143
|
+
// Merge params into `query`, overwriting any specified in search
|
|
3144
|
+
Object.assign(query, routeMatch);
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
if (!isQueryUpdating) {
|
|
3149
|
+
Router.events.emit('routeChangeStart', as, routeProps);
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
try {
|
|
3153
|
+
var ref2, ref3;
|
|
3154
|
+
let routeInfo = yield _this.getRouteInfo({
|
|
3155
|
+
route,
|
|
3156
|
+
pathname,
|
|
3157
|
+
query,
|
|
3158
|
+
as,
|
|
3159
|
+
resolvedAs,
|
|
3160
|
+
routeProps,
|
|
3161
|
+
locale: nextState.locale,
|
|
3162
|
+
isPreview: nextState.isPreview,
|
|
3163
|
+
hasMiddleware: isMiddlewareMatch
|
|
3164
|
+
});
|
|
3165
|
+
|
|
3166
|
+
if ('route' in routeInfo && isMiddlewareMatch) {
|
|
3167
|
+
pathname = routeInfo.route || route;
|
|
3168
|
+
route = pathname;
|
|
3169
|
+
|
|
3170
|
+
if (!routeProps.shallow) {
|
|
3171
|
+
query = Object.assign({}, routeInfo.query || {}, query);
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
const cleanedParsedPathname = (0, _hasBasePath).hasBasePath(parsed.pathname) ? (0, _removeBasePath).removeBasePath(parsed.pathname) : parsed.pathname;
|
|
3175
|
+
|
|
3176
|
+
if (routeMatch && pathname !== cleanedParsedPathname) {
|
|
3177
|
+
Object.keys(routeMatch).forEach(key => {
|
|
3178
|
+
if (routeMatch && query[key] === routeMatch[key]) {
|
|
3179
|
+
delete query[key];
|
|
3180
|
+
}
|
|
3181
|
+
});
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
if ((0, _isDynamic).isDynamicRoute(pathname)) {
|
|
3185
|
+
const prefixedAs = !routeProps.shallow && routeInfo.resolvedAs ? routeInfo.resolvedAs : (0, _addBasePath).addBasePath((0, _addLocale).addLocale(new URL(as, location.href).pathname, nextState.locale), true);
|
|
3186
|
+
let rewriteAs = prefixedAs;
|
|
3187
|
+
|
|
3188
|
+
if ((0, _hasBasePath).hasBasePath(rewriteAs)) {
|
|
3189
|
+
rewriteAs = (0, _removeBasePath).removeBasePath(rewriteAs);
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
if (true) {
|
|
3193
|
+
const localeResult = (0, _normalizeLocalePath).normalizeLocalePath(rewriteAs, _this.locales);
|
|
3194
|
+
nextState.locale = localeResult.detectedLocale || nextState.locale;
|
|
3195
|
+
rewriteAs = localeResult.pathname;
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
const routeRegex = (0, _routeRegex).getRouteRegex(pathname);
|
|
3199
|
+
const curRouteMatch = (0, _routeMatcher).getRouteMatcher(routeRegex)(rewriteAs);
|
|
3200
|
+
|
|
3201
|
+
if (curRouteMatch) {
|
|
3202
|
+
Object.assign(query, curRouteMatch);
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
} // If the routeInfo brings a redirect we simply apply it.
|
|
3206
|
+
|
|
3207
|
+
|
|
3208
|
+
if ('type' in routeInfo) {
|
|
3209
|
+
if (routeInfo.type === 'redirect-internal') {
|
|
3210
|
+
return _this.change(method, routeInfo.newUrl, routeInfo.newAs, options);
|
|
3211
|
+
} else {
|
|
3212
|
+
handleHardNavigation({
|
|
3213
|
+
url: routeInfo.destination,
|
|
3214
|
+
router: _this
|
|
3215
|
+
});
|
|
3216
|
+
return new Promise(() => {});
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
let {
|
|
3221
|
+
error,
|
|
3222
|
+
props,
|
|
3223
|
+
__N_SSG,
|
|
3224
|
+
__N_SSP
|
|
3225
|
+
} = routeInfo;
|
|
3226
|
+
const component = routeInfo.Component;
|
|
3227
|
+
|
|
3228
|
+
if (component && component.unstable_scriptLoader) {
|
|
3229
|
+
const scripts = [].concat(component.unstable_scriptLoader());
|
|
3230
|
+
scripts.forEach(script => {
|
|
3231
|
+
(0, _script).handleClientScriptLoad(script.props);
|
|
3232
|
+
});
|
|
3233
|
+
} // handle redirect on client-transition
|
|
3234
|
+
|
|
3235
|
+
|
|
3236
|
+
if ((__N_SSG || __N_SSP) && props) {
|
|
3237
|
+
if (props.pageProps && props.pageProps.__N_REDIRECT) {
|
|
3238
|
+
// Use the destination from redirect without adding locale
|
|
3239
|
+
options.locale = false;
|
|
3240
|
+
const destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
|
|
3241
|
+
// client-navigation if it is falling back to hard navigation if
|
|
3242
|
+
// it's not
|
|
3243
|
+
|
|
3244
|
+
if (destination.startsWith('/') && props.pageProps.__N_REDIRECT_BASE_PATH !== false) {
|
|
3245
|
+
const parsedHref = (0, _parseRelativeUrl).parseRelativeUrl(destination);
|
|
3246
|
+
parsedHref.pathname = resolveDynamicRoute(parsedHref.pathname, pages);
|
|
3247
|
+
const {
|
|
3248
|
+
url: newUrl,
|
|
3249
|
+
as: newAs
|
|
3250
|
+
} = prepareUrlAs(_this, destination, destination);
|
|
3251
|
+
return _this.change(method, newUrl, newAs, options);
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
handleHardNavigation({
|
|
3255
|
+
url: destination,
|
|
3256
|
+
router: _this
|
|
3257
|
+
});
|
|
3258
|
+
return new Promise(() => {});
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
nextState.isPreview = !!props.__N_PREVIEW; // handle SSG data 404
|
|
3262
|
+
|
|
3263
|
+
if (props.notFound === SSG_DATA_NOT_FOUND) {
|
|
3264
|
+
let notFoundRoute;
|
|
3265
|
+
|
|
3266
|
+
try {
|
|
3267
|
+
yield _this.fetchComponent('/404');
|
|
3268
|
+
notFoundRoute = '/404';
|
|
3269
|
+
} catch (_) {
|
|
3270
|
+
notFoundRoute = '/_error';
|
|
3271
|
+
}
|
|
3272
|
+
|
|
3273
|
+
routeInfo = yield _this.getRouteInfo({
|
|
3274
|
+
route: notFoundRoute,
|
|
3275
|
+
pathname: notFoundRoute,
|
|
3276
|
+
query,
|
|
3277
|
+
as,
|
|
3278
|
+
resolvedAs,
|
|
3279
|
+
routeProps: {
|
|
3280
|
+
shallow: false
|
|
3281
|
+
},
|
|
3282
|
+
locale: nextState.locale,
|
|
3283
|
+
isPreview: nextState.isPreview
|
|
3284
|
+
});
|
|
3285
|
+
|
|
3286
|
+
if ('type' in routeInfo) {
|
|
3287
|
+
throw new Error(`Unexpected middleware effect on /404`);
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
Router.events.emit('beforeHistoryChange', as, routeProps);
|
|
3293
|
+
|
|
3294
|
+
_this.changeState(method, url, as, options);
|
|
3295
|
+
|
|
3296
|
+
if (isQueryUpdating && pathname === '/_error' && ((ref2 = self.__NEXT_DATA__.props) == null ? void 0 : (ref3 = ref2.pageProps) == null ? void 0 : ref3.statusCode) === 500 && (props == null ? void 0 : props.pageProps)) {
|
|
3297
|
+
// ensure statusCode is still correct for static 500 page
|
|
3298
|
+
// when updating query information
|
|
3299
|
+
props.pageProps.statusCode = 500;
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
var _route; // shallow routing is only allowed for same page URL changes.
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
const isValidShallowRoute = options.shallow && nextState.route === ((_route = routeInfo.route) != null ? _route : route);
|
|
3306
|
+
|
|
3307
|
+
var _scroll;
|
|
3308
|
+
|
|
3309
|
+
const shouldScroll = (_scroll = options.scroll) != null ? _scroll : !options._h && !isValidShallowRoute;
|
|
3310
|
+
const resetScroll = shouldScroll ? {
|
|
3311
|
+
x: 0,
|
|
3312
|
+
y: 0
|
|
3313
|
+
} : null; // the new state that the router gonna set
|
|
3314
|
+
|
|
3315
|
+
const upcomingRouterState = _extends({}, nextState, {
|
|
3316
|
+
route,
|
|
3317
|
+
pathname,
|
|
3318
|
+
query,
|
|
3319
|
+
asPath: cleanedAs,
|
|
3320
|
+
isFallback: false
|
|
3321
|
+
});
|
|
3322
|
+
|
|
3323
|
+
const upcomingScrollState = forcedScroll != null ? forcedScroll : resetScroll; // for query updates we can skip it if the state is unchanged and we don't
|
|
3324
|
+
// need to scroll
|
|
3325
|
+
// https://github.com/vercel/next.js/issues/37139
|
|
3326
|
+
|
|
3327
|
+
const canSkipUpdating = options._h && !upcomingScrollState && !readyStateChange && !localeChange && (0, _compareStates).compareRouterStates(upcomingRouterState, _this.state);
|
|
3328
|
+
|
|
3329
|
+
if (!canSkipUpdating) {
|
|
3330
|
+
yield _this.set(upcomingRouterState, routeInfo, upcomingScrollState).catch(e => {
|
|
3331
|
+
if (e.cancelled) error = error || e;else throw e;
|
|
3332
|
+
});
|
|
3333
|
+
|
|
3334
|
+
if (error) {
|
|
3335
|
+
if (!isQueryUpdating) {
|
|
3336
|
+
Router.events.emit('routeChangeError', error, cleanedAs, routeProps);
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
throw error;
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
if (true) {
|
|
3343
|
+
if (nextState.locale) {
|
|
3344
|
+
document.documentElement.lang = nextState.locale;
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
if (!isQueryUpdating) {
|
|
3349
|
+
Router.events.emit('routeChangeComplete', as, routeProps);
|
|
3350
|
+
} // A hash mark # is the optional last part of a URL
|
|
3351
|
+
|
|
3352
|
+
|
|
3353
|
+
const hashRegex = /#.+$/;
|
|
3354
|
+
|
|
3355
|
+
if (shouldScroll && hashRegex.test(as)) {
|
|
3356
|
+
_this.scrollToHash(as);
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
return true;
|
|
3361
|
+
} catch (err1) {
|
|
3362
|
+
if ((0, _isError).default(err1) && err1.cancelled) {
|
|
3363
|
+
return false;
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
throw err1;
|
|
3367
|
+
}
|
|
3368
|
+
})();
|
|
3369
|
+
}
|
|
3370
|
+
|
|
3371
|
+
changeState(method, url, as, options = {}) {
|
|
3372
|
+
if (false) {}
|
|
3373
|
+
|
|
3374
|
+
if (method !== 'pushState' || (0, _utils).getURL() !== as) {
|
|
3375
|
+
this._shallow = options.shallow;
|
|
3376
|
+
window.history[method]({
|
|
3377
|
+
url,
|
|
3378
|
+
as,
|
|
3379
|
+
options,
|
|
3380
|
+
__N: true,
|
|
3381
|
+
key: this._key = method !== 'pushState' ? this._key : createKey()
|
|
3382
|
+
}, // Most browsers currently ignores this parameter, although they may use it in the future.
|
|
3383
|
+
// Passing the empty string here should be safe against future changes to the method.
|
|
3384
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
|
|
3385
|
+
'', as);
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
handleRouteInfoError(err, pathname, query, as, routeProps, loadErrorFail) {
|
|
3390
|
+
var _this = this;
|
|
3391
|
+
|
|
3392
|
+
return _async_to_generator(function* () {
|
|
3393
|
+
console.error(err);
|
|
3394
|
+
|
|
3395
|
+
if (err.cancelled) {
|
|
3396
|
+
// bubble up cancellation errors
|
|
3397
|
+
throw err;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
if ((0, _routeLoader).isAssetError(err) || loadErrorFail) {
|
|
3401
|
+
Router.events.emit('routeChangeError', err, as, routeProps); // If we can't load the page it could be one of following reasons
|
|
3402
|
+
// 1. Page doesn't exists
|
|
3403
|
+
// 2. Page does exist in a different zone
|
|
3404
|
+
// 3. Internal error while loading the page
|
|
3405
|
+
// So, doing a hard reload is the proper way to deal with this.
|
|
3406
|
+
|
|
3407
|
+
handleHardNavigation({
|
|
3408
|
+
url: as,
|
|
3409
|
+
router: _this
|
|
3410
|
+
}); // Changing the URL doesn't block executing the current code path.
|
|
3411
|
+
// So let's throw a cancellation error stop the routing logic.
|
|
3412
|
+
|
|
3413
|
+
throw buildCancellationError();
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3416
|
+
try {
|
|
3417
|
+
let props;
|
|
3418
|
+
const {
|
|
3419
|
+
page: Component,
|
|
3420
|
+
styleSheets
|
|
3421
|
+
} = yield _this.fetchComponent('/_error');
|
|
3422
|
+
const routeInfo = {
|
|
3423
|
+
props,
|
|
3424
|
+
Component,
|
|
3425
|
+
styleSheets,
|
|
3426
|
+
err,
|
|
3427
|
+
error: err
|
|
3428
|
+
};
|
|
3429
|
+
|
|
3430
|
+
if (!routeInfo.props) {
|
|
3431
|
+
try {
|
|
3432
|
+
routeInfo.props = yield _this.getInitialProps(Component, {
|
|
3433
|
+
err,
|
|
3434
|
+
pathname,
|
|
3435
|
+
query
|
|
3436
|
+
});
|
|
3437
|
+
} catch (gipErr) {
|
|
3438
|
+
console.error('Error in error page `getInitialProps`: ', gipErr);
|
|
3439
|
+
routeInfo.props = {};
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
return routeInfo;
|
|
3444
|
+
} catch (routeInfoErr) {
|
|
3445
|
+
return _this.handleRouteInfoError((0, _isError).default(routeInfoErr) ? routeInfoErr : new Error(routeInfoErr + ''), pathname, query, as, routeProps, true);
|
|
3446
|
+
}
|
|
3447
|
+
})();
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
getRouteInfo({
|
|
3451
|
+
route: requestedRoute,
|
|
3452
|
+
pathname,
|
|
3453
|
+
query,
|
|
3454
|
+
as,
|
|
3455
|
+
resolvedAs,
|
|
3456
|
+
routeProps,
|
|
3457
|
+
locale,
|
|
3458
|
+
hasMiddleware,
|
|
3459
|
+
isPreview,
|
|
3460
|
+
unstable_skipClientCache
|
|
3461
|
+
}) {
|
|
3462
|
+
var _this = this;
|
|
3463
|
+
|
|
3464
|
+
return _async_to_generator(function* () {
|
|
3465
|
+
/**
|
|
3466
|
+
* This `route` binding can change if there's a rewrite
|
|
3467
|
+
* so we keep a reference to the original requested route
|
|
3468
|
+
* so we can store the cache for it and avoid re-requesting every time
|
|
3469
|
+
* for shallow routing purposes.
|
|
3470
|
+
*/
|
|
3471
|
+
let route = requestedRoute;
|
|
3472
|
+
|
|
3473
|
+
try {
|
|
3474
|
+
var ref, ref4, ref5;
|
|
3475
|
+
const handleCancelled = getCancelledHandler({
|
|
3476
|
+
route,
|
|
3477
|
+
router: _this
|
|
3478
|
+
});
|
|
3479
|
+
let existingInfo = _this.components[route];
|
|
3480
|
+
|
|
3481
|
+
if (routeProps.shallow && existingInfo && _this.route === route) {
|
|
3482
|
+
return existingInfo;
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
if (hasMiddleware) {
|
|
3486
|
+
existingInfo = undefined;
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3489
|
+
let cachedRouteInfo = existingInfo && !('initial' in existingInfo) && true ? existingInfo : undefined;
|
|
3490
|
+
const fetchNextDataParams = {
|
|
3491
|
+
dataHref: _this.pageLoader.getDataHref({
|
|
3492
|
+
href: (0, _formatUrl).formatWithValidation({
|
|
3493
|
+
pathname,
|
|
3494
|
+
query
|
|
3495
|
+
}),
|
|
3496
|
+
skipInterpolation: true,
|
|
3497
|
+
asPath: resolvedAs,
|
|
3498
|
+
locale
|
|
3499
|
+
}),
|
|
3500
|
+
hasMiddleware: true,
|
|
3501
|
+
isServerRender: _this.isSsr,
|
|
3502
|
+
parseJSON: true,
|
|
3503
|
+
inflightCache: _this.sdc,
|
|
3504
|
+
persistCache: !isPreview,
|
|
3505
|
+
isPrefetch: false,
|
|
3506
|
+
unstable_skipClientCache
|
|
3507
|
+
};
|
|
3508
|
+
const data = yield withMiddlewareEffects({
|
|
3509
|
+
fetchData: () => fetchNextData(fetchNextDataParams),
|
|
3510
|
+
asPath: resolvedAs,
|
|
3511
|
+
locale: locale,
|
|
3512
|
+
router: _this
|
|
3513
|
+
});
|
|
3514
|
+
handleCancelled();
|
|
3515
|
+
|
|
3516
|
+
if ((data == null ? void 0 : (ref = data.effect) == null ? void 0 : ref.type) === 'redirect-internal' || (data == null ? void 0 : (ref4 = data.effect) == null ? void 0 : ref4.type) === 'redirect-external') {
|
|
3517
|
+
return data.effect;
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
if ((data == null ? void 0 : (ref5 = data.effect) == null ? void 0 : ref5.type) === 'rewrite') {
|
|
3521
|
+
route = (0, _removeTrailingSlash).removeTrailingSlash(data.effect.resolvedHref);
|
|
3522
|
+
pathname = data.effect.resolvedHref;
|
|
3523
|
+
query = _extends({}, query, data.effect.parsedAs.query);
|
|
3524
|
+
resolvedAs = (0, _removeBasePath).removeBasePath((0, _normalizeLocalePath).normalizeLocalePath(data.effect.parsedAs.pathname, _this.locales).pathname); // Check again the cache with the new destination.
|
|
3525
|
+
|
|
3526
|
+
existingInfo = _this.components[route];
|
|
3527
|
+
|
|
3528
|
+
if (routeProps.shallow && existingInfo && _this.route === route && !hasMiddleware) {
|
|
3529
|
+
// If we have a match with the current route due to rewrite,
|
|
3530
|
+
// we can copy the existing information to the rewritten one.
|
|
3531
|
+
// Then, we return the information along with the matched route.
|
|
3532
|
+
return _extends({}, existingInfo, {
|
|
3533
|
+
route
|
|
3534
|
+
});
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
if (route === '/api' || route.startsWith('/api/')) {
|
|
3539
|
+
handleHardNavigation({
|
|
3540
|
+
url: as,
|
|
3541
|
+
router: _this
|
|
3542
|
+
});
|
|
3543
|
+
return new Promise(() => {});
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
const routeInfo = cachedRouteInfo || (yield _this.fetchComponent(route).then(res => ({
|
|
3547
|
+
Component: res.page,
|
|
3548
|
+
styleSheets: res.styleSheets,
|
|
3549
|
+
__N_SSG: res.mod.__N_SSG,
|
|
3550
|
+
__N_SSP: res.mod.__N_SSP
|
|
3551
|
+
})));
|
|
3552
|
+
|
|
3553
|
+
if (false) {}
|
|
3554
|
+
|
|
3555
|
+
const shouldFetchData = routeInfo.__N_SSG || routeInfo.__N_SSP;
|
|
3556
|
+
const {
|
|
3557
|
+
props,
|
|
3558
|
+
cacheKey
|
|
3559
|
+
} = yield _this._getData(_async_to_generator(function* () {
|
|
3560
|
+
if (shouldFetchData) {
|
|
3561
|
+
const {
|
|
3562
|
+
json,
|
|
3563
|
+
cacheKey: _cacheKey
|
|
3564
|
+
} = (data == null ? void 0 : data.json) ? data : yield fetchNextData({
|
|
3565
|
+
dataHref: _this.pageLoader.getDataHref({
|
|
3566
|
+
href: (0, _formatUrl).formatWithValidation({
|
|
3567
|
+
pathname,
|
|
3568
|
+
query
|
|
3569
|
+
}),
|
|
3570
|
+
asPath: resolvedAs,
|
|
3571
|
+
locale
|
|
3572
|
+
}),
|
|
3573
|
+
isServerRender: _this.isSsr,
|
|
3574
|
+
parseJSON: true,
|
|
3575
|
+
inflightCache: _this.sdc,
|
|
3576
|
+
persistCache: !isPreview,
|
|
3577
|
+
isPrefetch: false,
|
|
3578
|
+
unstable_skipClientCache
|
|
3579
|
+
});
|
|
3580
|
+
return {
|
|
3581
|
+
cacheKey: _cacheKey,
|
|
3582
|
+
props: json || {}
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
return {
|
|
3587
|
+
headers: {},
|
|
3588
|
+
cacheKey: '',
|
|
3589
|
+
props: yield _this.getInitialProps(routeInfo.Component, // we provide AppTree later so this needs to be `any`
|
|
3590
|
+
{
|
|
3591
|
+
pathname,
|
|
3592
|
+
query,
|
|
3593
|
+
asPath: as,
|
|
3594
|
+
locale,
|
|
3595
|
+
locales: _this.locales,
|
|
3596
|
+
defaultLocale: _this.defaultLocale
|
|
3597
|
+
})
|
|
3598
|
+
};
|
|
3599
|
+
})); // Only bust the data cache for SSP routes although
|
|
3600
|
+
// middleware can skip cache per request with
|
|
3601
|
+
// x-middleware-cache: no-cache as well
|
|
3602
|
+
|
|
3603
|
+
if (routeInfo.__N_SSP && fetchNextDataParams.dataHref) {
|
|
3604
|
+
delete _this.sdc[cacheKey];
|
|
3605
|
+
} // we kick off a HEAD request in the background
|
|
3606
|
+
// when a non-prefetch request is made to signal revalidation
|
|
3607
|
+
|
|
3608
|
+
|
|
3609
|
+
if (!_this.isPreview && routeInfo.__N_SSG && true) {
|
|
3610
|
+
fetchNextData(Object.assign({}, fetchNextDataParams, {
|
|
3611
|
+
isBackground: true,
|
|
3612
|
+
persistCache: false,
|
|
3613
|
+
inflightCache: backgroundCache
|
|
3614
|
+
})).catch(() => {});
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
props.pageProps = Object.assign({}, props.pageProps);
|
|
3618
|
+
routeInfo.props = props;
|
|
3619
|
+
routeInfo.route = route;
|
|
3620
|
+
routeInfo.query = query;
|
|
3621
|
+
routeInfo.resolvedAs = resolvedAs;
|
|
3622
|
+
_this.components[route] = routeInfo;
|
|
3623
|
+
return routeInfo;
|
|
3624
|
+
} catch (err) {
|
|
3625
|
+
return _this.handleRouteInfoError((0, _isError).getProperError(err), pathname, query, as, routeProps);
|
|
3626
|
+
}
|
|
3627
|
+
})();
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
set(state, data, resetScroll) {
|
|
3631
|
+
this.state = state;
|
|
3632
|
+
return this.sub(data, this.components['/_app'].Component, resetScroll);
|
|
3633
|
+
}
|
|
3634
|
+
/**
|
|
3635
|
+
* Callback to execute before replacing router state
|
|
3636
|
+
* @param cb callback to be executed
|
|
3637
|
+
*/
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
beforePopState(cb) {
|
|
3641
|
+
this._bps = cb;
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
onlyAHashChange(as) {
|
|
3645
|
+
if (!this.asPath) return false;
|
|
3646
|
+
const [oldUrlNoHash, oldHash] = this.asPath.split('#');
|
|
3647
|
+
const [newUrlNoHash, newHash] = as.split('#'); // Makes sure we scroll to the provided hash if the url/hash are the same
|
|
3648
|
+
|
|
3649
|
+
if (newHash && oldUrlNoHash === newUrlNoHash && oldHash === newHash) {
|
|
3650
|
+
return true;
|
|
3651
|
+
} // If the urls are change, there's more than a hash change
|
|
3652
|
+
|
|
3653
|
+
|
|
3654
|
+
if (oldUrlNoHash !== newUrlNoHash) {
|
|
3655
|
+
return false;
|
|
3656
|
+
} // If the hash has changed, then it's a hash only change.
|
|
3657
|
+
// This check is necessary to handle both the enter and
|
|
3658
|
+
// leave hash === '' cases. The identity case falls through
|
|
3659
|
+
// and is treated as a next reload.
|
|
3660
|
+
|
|
3661
|
+
|
|
3662
|
+
return oldHash !== newHash;
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
scrollToHash(as) {
|
|
3666
|
+
const [, hash = ''] = as.split('#'); // Scroll to top if the hash is just `#` with no value or `#top`
|
|
3667
|
+
// To mirror browsers
|
|
3668
|
+
|
|
3669
|
+
if (hash === '' || hash === 'top') {
|
|
3670
|
+
handleSmoothScroll(() => window.scrollTo(0, 0));
|
|
3671
|
+
return;
|
|
3672
|
+
} // Decode hash to make non-latin anchor works.
|
|
3673
|
+
|
|
3674
|
+
|
|
3675
|
+
const rawHash = decodeURIComponent(hash); // First we check if the element by id is found
|
|
3676
|
+
|
|
3677
|
+
const idEl = document.getElementById(rawHash);
|
|
3678
|
+
|
|
3679
|
+
if (idEl) {
|
|
3680
|
+
handleSmoothScroll(() => idEl.scrollIntoView());
|
|
3681
|
+
return;
|
|
3682
|
+
} // If there's no element with the id, we check the `name` property
|
|
3683
|
+
// To mirror browsers
|
|
3684
|
+
|
|
3685
|
+
|
|
3686
|
+
const nameEl = document.getElementsByName(rawHash)[0];
|
|
3687
|
+
|
|
3688
|
+
if (nameEl) {
|
|
3689
|
+
handleSmoothScroll(() => nameEl.scrollIntoView());
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
urlIsNew(asPath) {
|
|
3694
|
+
return this.asPath !== asPath;
|
|
3695
|
+
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Prefetch page code, you may wait for the data during page rendering.
|
|
3698
|
+
* This feature only works in production!
|
|
3699
|
+
* @param url the href of prefetched page
|
|
3700
|
+
* @param asPath the as path of the prefetched page
|
|
3701
|
+
*/
|
|
3702
|
+
|
|
3703
|
+
|
|
3704
|
+
prefetch(url, asPath = url, options = {}) {
|
|
3705
|
+
var _this = this;
|
|
3706
|
+
|
|
3707
|
+
return _async_to_generator(function* () {
|
|
3708
|
+
if (false) {}
|
|
3709
|
+
|
|
3710
|
+
let parsed = (0, _parseRelativeUrl).parseRelativeUrl(url);
|
|
3711
|
+
let {
|
|
3712
|
+
pathname,
|
|
3713
|
+
query
|
|
3714
|
+
} = parsed;
|
|
3715
|
+
|
|
3716
|
+
if (true) {
|
|
3717
|
+
if (options.locale === false) {
|
|
3718
|
+
pathname = (0, _normalizeLocalePath).normalizeLocalePath(pathname, _this.locales).pathname;
|
|
3719
|
+
parsed.pathname = pathname;
|
|
3720
|
+
url = (0, _formatUrl).formatWithValidation(parsed);
|
|
3721
|
+
let parsedAs = (0, _parseRelativeUrl).parseRelativeUrl(asPath);
|
|
3722
|
+
const localePathResult = (0, _normalizeLocalePath).normalizeLocalePath(parsedAs.pathname, _this.locales);
|
|
3723
|
+
parsedAs.pathname = localePathResult.pathname;
|
|
3724
|
+
options.locale = localePathResult.detectedLocale || _this.defaultLocale;
|
|
3725
|
+
asPath = (0, _formatUrl).formatWithValidation(parsedAs);
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
|
|
3729
|
+
const pages = yield _this.pageLoader.getPageList();
|
|
3730
|
+
let resolvedAs = asPath;
|
|
3731
|
+
const locale = typeof options.locale !== 'undefined' ? options.locale || undefined : _this.locale;
|
|
3732
|
+
|
|
3733
|
+
if (false) {}
|
|
3734
|
+
|
|
3735
|
+
parsed.pathname = resolveDynamicRoute(parsed.pathname, pages);
|
|
3736
|
+
|
|
3737
|
+
if ((0, _isDynamic).isDynamicRoute(parsed.pathname)) {
|
|
3738
|
+
pathname = parsed.pathname;
|
|
3739
|
+
parsed.pathname = pathname;
|
|
3740
|
+
Object.assign(query, (0, _routeMatcher).getRouteMatcher((0, _routeRegex).getRouteRegex(parsed.pathname))((0, _parsePath).parsePath(asPath).pathname) || {});
|
|
3741
|
+
url = (0, _formatUrl).formatWithValidation(parsed);
|
|
3742
|
+
} // Prefetch is not supported in development mode because it would trigger on-demand-entries
|
|
3743
|
+
|
|
3744
|
+
|
|
3745
|
+
if (false) {}
|
|
3746
|
+
|
|
3747
|
+
const route = (0, _removeTrailingSlash).removeTrailingSlash(pathname);
|
|
3748
|
+
yield Promise.all([_this.pageLoader._isSsg(route).then(isSsg => {
|
|
3749
|
+
return isSsg ? fetchNextData({
|
|
3750
|
+
dataHref: _this.pageLoader.getDataHref({
|
|
3751
|
+
href: url,
|
|
3752
|
+
asPath: resolvedAs,
|
|
3753
|
+
locale: locale
|
|
3754
|
+
}),
|
|
3755
|
+
isServerRender: false,
|
|
3756
|
+
parseJSON: true,
|
|
3757
|
+
inflightCache: _this.sdc,
|
|
3758
|
+
persistCache: !_this.isPreview,
|
|
3759
|
+
isPrefetch: true,
|
|
3760
|
+
unstable_skipClientCache: options.unstable_skipClientCache || options.priority && !!true
|
|
3761
|
+
}).then(() => false) : false;
|
|
3762
|
+
}), _this.pageLoader[options.priority ? 'loadPage' : 'prefetch'](route)]);
|
|
3763
|
+
})();
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
fetchComponent(route) {
|
|
3767
|
+
var _this = this;
|
|
3768
|
+
|
|
3769
|
+
return _async_to_generator(function* () {
|
|
3770
|
+
const handleCancelled = getCancelledHandler({
|
|
3771
|
+
route,
|
|
3772
|
+
router: _this
|
|
3773
|
+
});
|
|
3774
|
+
|
|
3775
|
+
try {
|
|
3776
|
+
const componentResult = yield _this.pageLoader.loadPage(route);
|
|
3777
|
+
handleCancelled();
|
|
3778
|
+
return componentResult;
|
|
3779
|
+
} catch (err) {
|
|
3780
|
+
handleCancelled();
|
|
3781
|
+
throw err;
|
|
3782
|
+
}
|
|
3783
|
+
})();
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
_getData(fn) {
|
|
3787
|
+
let cancelled = false;
|
|
3788
|
+
|
|
3789
|
+
const cancel = () => {
|
|
3790
|
+
cancelled = true;
|
|
3791
|
+
};
|
|
3792
|
+
|
|
3793
|
+
this.clc = cancel;
|
|
3794
|
+
return fn().then(data => {
|
|
3795
|
+
if (cancel === this.clc) {
|
|
3796
|
+
this.clc = null;
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
if (cancelled) {
|
|
3800
|
+
const err = new Error('Loading initial props cancelled');
|
|
3801
|
+
err.cancelled = true;
|
|
3802
|
+
throw err;
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
return data;
|
|
3806
|
+
});
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
_getFlightData(dataHref) {
|
|
3810
|
+
// Do not cache RSC flight response since it's not a static resource
|
|
3811
|
+
return fetchNextData({
|
|
3812
|
+
dataHref,
|
|
3813
|
+
isServerRender: true,
|
|
3814
|
+
parseJSON: false,
|
|
3815
|
+
inflightCache: this.sdc,
|
|
3816
|
+
persistCache: false,
|
|
3817
|
+
isPrefetch: false
|
|
3818
|
+
}).then(({
|
|
3819
|
+
text
|
|
3820
|
+
}) => ({
|
|
3821
|
+
data: text
|
|
3822
|
+
}));
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
getInitialProps(Component, ctx) {
|
|
3826
|
+
const {
|
|
3827
|
+
Component: App
|
|
3828
|
+
} = this.components['/_app'];
|
|
3829
|
+
|
|
3830
|
+
const AppTree = this._wrapApp(App);
|
|
3831
|
+
|
|
3832
|
+
ctx.AppTree = AppTree;
|
|
3833
|
+
return (0, _utils).loadGetInitialProps(App, {
|
|
3834
|
+
AppTree,
|
|
3835
|
+
Component,
|
|
3836
|
+
router: this,
|
|
3837
|
+
ctx
|
|
3838
|
+
});
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
get route() {
|
|
3842
|
+
return this.state.route;
|
|
3843
|
+
}
|
|
3844
|
+
|
|
3845
|
+
get pathname() {
|
|
3846
|
+
return this.state.pathname;
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
get query() {
|
|
3850
|
+
return this.state.query;
|
|
3851
|
+
}
|
|
3852
|
+
|
|
3853
|
+
get asPath() {
|
|
3854
|
+
return this.state.asPath;
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
get locale() {
|
|
3858
|
+
return this.state.locale;
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
get isFallback() {
|
|
3862
|
+
return this.state.isFallback;
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
get isPreview() {
|
|
3866
|
+
return this.state.isPreview;
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
constructor(pathname1, query1, as1, {
|
|
3870
|
+
initialProps,
|
|
3871
|
+
pageLoader,
|
|
3872
|
+
App,
|
|
3873
|
+
wrapApp,
|
|
3874
|
+
Component,
|
|
3875
|
+
err,
|
|
3876
|
+
subscription,
|
|
3877
|
+
isFallback,
|
|
3878
|
+
locale,
|
|
3879
|
+
locales,
|
|
3880
|
+
defaultLocale,
|
|
3881
|
+
domainLocales,
|
|
3882
|
+
isPreview
|
|
3883
|
+
}) {
|
|
3884
|
+
// Server Data Cache
|
|
3885
|
+
this.sdc = {};
|
|
3886
|
+
this.isFirstPopStateEvent = true;
|
|
3887
|
+
this._key = createKey();
|
|
3888
|
+
|
|
3889
|
+
this.onPopState = e => {
|
|
3890
|
+
const {
|
|
3891
|
+
isFirstPopStateEvent
|
|
3892
|
+
} = this;
|
|
3893
|
+
this.isFirstPopStateEvent = false;
|
|
3894
|
+
const state = e.state;
|
|
3895
|
+
|
|
3896
|
+
if (!state) {
|
|
3897
|
+
// We get state as undefined for two reasons.
|
|
3898
|
+
// 1. With older safari (< 8) and older chrome (< 34)
|
|
3899
|
+
// 2. When the URL changed with #
|
|
3900
|
+
//
|
|
3901
|
+
// In the both cases, we don't need to proceed and change the route.
|
|
3902
|
+
// (as it's already changed)
|
|
3903
|
+
// But we can simply replace the state with the new changes.
|
|
3904
|
+
// Actually, for (1) we don't need to nothing. But it's hard to detect that event.
|
|
3905
|
+
// So, doing the following for (1) does no harm.
|
|
3906
|
+
const {
|
|
3907
|
+
pathname,
|
|
3908
|
+
query
|
|
3909
|
+
} = this;
|
|
3910
|
+
this.changeState('replaceState', (0, _formatUrl).formatWithValidation({
|
|
3911
|
+
pathname: (0, _addBasePath).addBasePath(pathname),
|
|
3912
|
+
query
|
|
3913
|
+
}), (0, _utils).getURL());
|
|
3914
|
+
return;
|
|
3915
|
+
} // __NA is used to identify if the history entry can be handled by the app-router.
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
if (state.__NA) {
|
|
3919
|
+
window.location.reload();
|
|
3920
|
+
return;
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
if (!state.__N) {
|
|
3924
|
+
return;
|
|
3925
|
+
} // Safari fires popstateevent when reopening the browser.
|
|
3926
|
+
|
|
3927
|
+
|
|
3928
|
+
if (isFirstPopStateEvent && this.locale === state.options.locale && state.as === this.asPath) {
|
|
3929
|
+
return;
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3932
|
+
let forcedScroll;
|
|
3933
|
+
const {
|
|
3934
|
+
url,
|
|
3935
|
+
as,
|
|
3936
|
+
options,
|
|
3937
|
+
key
|
|
3938
|
+
} = state;
|
|
3939
|
+
|
|
3940
|
+
if (true) {
|
|
3941
|
+
if (manualScrollRestoration) {
|
|
3942
|
+
if (this._key !== key) {
|
|
3943
|
+
// Snapshot current scroll position:
|
|
3944
|
+
try {
|
|
3945
|
+
sessionStorage.setItem('__next_scroll_' + this._key, JSON.stringify({
|
|
3946
|
+
x: self.pageXOffset,
|
|
3947
|
+
y: self.pageYOffset
|
|
3948
|
+
}));
|
|
3949
|
+
} catch (e) {} // Restore old scroll position:
|
|
3950
|
+
|
|
3951
|
+
|
|
3952
|
+
try {
|
|
3953
|
+
const v = sessionStorage.getItem('__next_scroll_' + key);
|
|
3954
|
+
forcedScroll = JSON.parse(v);
|
|
3955
|
+
} catch (e1) {
|
|
3956
|
+
forcedScroll = {
|
|
3957
|
+
x: 0,
|
|
3958
|
+
y: 0
|
|
3959
|
+
};
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
|
|
3965
|
+
this._key = key;
|
|
3966
|
+
const {
|
|
3967
|
+
pathname
|
|
3968
|
+
} = (0, _parseRelativeUrl).parseRelativeUrl(url); // Make sure we don't re-render on initial load,
|
|
3969
|
+
// can be caused by navigating back from an external site
|
|
3970
|
+
|
|
3971
|
+
if (this.isSsr && as === (0, _addBasePath).addBasePath(this.asPath) && pathname === (0, _addBasePath).addBasePath(this.pathname)) {
|
|
3972
|
+
return;
|
|
3973
|
+
} // If the downstream application returns falsy, return.
|
|
3974
|
+
// They will then be responsible for handling the event.
|
|
3975
|
+
|
|
3976
|
+
|
|
3977
|
+
if (this._bps && !this._bps(state)) {
|
|
3978
|
+
return;
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
this.change('replaceState', url, as, Object.assign({}, options, {
|
|
3982
|
+
shallow: options.shallow && this._shallow,
|
|
3983
|
+
locale: options.locale || this.defaultLocale,
|
|
3984
|
+
// @ts-ignore internal value not exposed on types
|
|
3985
|
+
_h: 0
|
|
3986
|
+
}), forcedScroll);
|
|
3987
|
+
}; // represents the current component key
|
|
3988
|
+
|
|
3989
|
+
|
|
3990
|
+
const route = (0, _removeTrailingSlash).removeTrailingSlash(pathname1); // set up the component cache (by route keys)
|
|
3991
|
+
|
|
3992
|
+
this.components = {}; // We should not keep the cache, if there's an error
|
|
3993
|
+
// Otherwise, this cause issues when when going back and
|
|
3994
|
+
// come again to the errored page.
|
|
3995
|
+
|
|
3996
|
+
if (pathname1 !== '/_error') {
|
|
3997
|
+
this.components[route] = {
|
|
3998
|
+
Component,
|
|
3999
|
+
initial: true,
|
|
4000
|
+
props: initialProps,
|
|
4001
|
+
err,
|
|
4002
|
+
__N_SSG: initialProps && initialProps.__N_SSG,
|
|
4003
|
+
__N_SSP: initialProps && initialProps.__N_SSP
|
|
4004
|
+
};
|
|
4005
|
+
}
|
|
4006
|
+
|
|
4007
|
+
this.components['/_app'] = {
|
|
4008
|
+
Component: App,
|
|
4009
|
+
styleSheets: []
|
|
4010
|
+
}; // Backwards compat for Router.router.events
|
|
4011
|
+
// TODO: Should be remove the following major version as it was never documented
|
|
4012
|
+
|
|
4013
|
+
this.events = Router.events;
|
|
4014
|
+
this.pageLoader = pageLoader; // if auto prerendered and dynamic route wait to update asPath
|
|
4015
|
+
// until after mount to prevent hydration mismatch
|
|
4016
|
+
|
|
4017
|
+
const autoExportDynamic = (0, _isDynamic).isDynamicRoute(pathname1) && self.__NEXT_DATA__.autoExport;
|
|
4018
|
+
|
|
4019
|
+
this.basePath = false || '';
|
|
4020
|
+
this.sub = subscription;
|
|
4021
|
+
this.clc = null;
|
|
4022
|
+
this._wrapApp = wrapApp; // make sure to ignore extra popState in safari on navigating
|
|
4023
|
+
// back from external site
|
|
4024
|
+
|
|
4025
|
+
this.isSsr = true;
|
|
4026
|
+
this.isLocaleDomain = false;
|
|
4027
|
+
this.isReady = !!(self.__NEXT_DATA__.gssp || self.__NEXT_DATA__.gip || self.__NEXT_DATA__.appGip && !self.__NEXT_DATA__.gsp || !autoExportDynamic && !self.location.search && !false);
|
|
4028
|
+
|
|
4029
|
+
if (true) {
|
|
4030
|
+
this.locales = locales;
|
|
4031
|
+
this.defaultLocale = defaultLocale;
|
|
4032
|
+
this.domainLocales = domainLocales;
|
|
4033
|
+
this.isLocaleDomain = !!(0, _detectDomainLocale).detectDomainLocale(domainLocales, self.location.hostname);
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
this.state = {
|
|
4037
|
+
route,
|
|
4038
|
+
pathname: pathname1,
|
|
4039
|
+
query: query1,
|
|
4040
|
+
asPath: autoExportDynamic ? pathname1 : as1,
|
|
4041
|
+
isPreview: !!isPreview,
|
|
4042
|
+
locale: true ? locale : 0,
|
|
4043
|
+
isFallback
|
|
4044
|
+
};
|
|
4045
|
+
this._initialMatchesMiddlewarePromise = Promise.resolve(false);
|
|
4046
|
+
|
|
4047
|
+
if (false) {}
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4052
|
+
Router.events = (0, _mitt).default();
|
|
4053
|
+
exports["default"] = Router;
|
|
4054
|
+
|
|
4055
|
+
/***/ }),
|
|
4056
|
+
|
|
4057
|
+
/***/ 1608:
|
|
4058
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
4059
|
+
|
|
4060
|
+
module.exports = __webpack_require__(1432)
|
|
4061
|
+
|
|
4062
|
+
|
|
4063
|
+
/***/ }),
|
|
4064
|
+
|
|
4065
|
+
/***/ 1664:
|
|
4066
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
4067
|
+
|
|
4068
|
+
module.exports = __webpack_require__(7942)
|
|
4069
|
+
|
|
4070
|
+
|
|
4071
|
+
/***/ })
|
|
4072
|
+
|
|
4073
|
+
};
|
|
4074
|
+
;
|