@moontra/moonui-pro 2.36.7 → 2.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/index.global.js +214 -214
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.d.ts +59 -66
- package/dist/index.mjs +1108 -1760
- package/dist/server.d.ts +103 -0
- package/dist/server.mjs +3158 -0
- package/package.json +9 -2
- package/templates/api-route.template.ts +157 -0
- package/templates/validate-pro-route.ts +336 -0
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,3158 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @moontra/moonui-pro v2.0.9
|
|
5
|
+
* Premium UI components for MoonUI
|
|
6
|
+
* (c) 2025 MoonUI. All rights reserved.
|
|
7
|
+
* @license Commercial - https://moonui.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
16
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
17
|
+
}) : x)(function(x) {
|
|
18
|
+
if (typeof require !== "undefined")
|
|
19
|
+
return require.apply(this, arguments);
|
|
20
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
21
|
+
});
|
|
22
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
23
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
41
|
+
|
|
42
|
+
// ../../node_modules/next/dist/compiled/@edge-runtime/cookies/index.js
|
|
43
|
+
var require_cookies = __commonJS({
|
|
44
|
+
"../../node_modules/next/dist/compiled/@edge-runtime/cookies/index.js"(exports, module) {
|
|
45
|
+
var __defProp2 = Object.defineProperty;
|
|
46
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
47
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
48
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
49
|
+
var __export = (target, all) => {
|
|
50
|
+
for (var name in all)
|
|
51
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
52
|
+
};
|
|
53
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
54
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
55
|
+
for (let key of __getOwnPropNames2(from))
|
|
56
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
57
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
58
|
+
}
|
|
59
|
+
return to;
|
|
60
|
+
};
|
|
61
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
62
|
+
var src_exports = {};
|
|
63
|
+
__export(src_exports, {
|
|
64
|
+
RequestCookies: () => RequestCookies,
|
|
65
|
+
ResponseCookies: () => ResponseCookies,
|
|
66
|
+
parseCookie: () => parseCookie,
|
|
67
|
+
parseSetCookie: () => parseSetCookie,
|
|
68
|
+
stringifyCookie: () => stringifyCookie
|
|
69
|
+
});
|
|
70
|
+
module.exports = __toCommonJS(src_exports);
|
|
71
|
+
function stringifyCookie(c) {
|
|
72
|
+
var _a;
|
|
73
|
+
const attrs = [
|
|
74
|
+
"path" in c && c.path && `Path=${c.path}`,
|
|
75
|
+
"expires" in c && (c.expires || c.expires === 0) && `Expires=${(typeof c.expires === "number" ? new Date(c.expires) : c.expires).toUTCString()}`,
|
|
76
|
+
"maxAge" in c && typeof c.maxAge === "number" && `Max-Age=${c.maxAge}`,
|
|
77
|
+
"domain" in c && c.domain && `Domain=${c.domain}`,
|
|
78
|
+
"secure" in c && c.secure && "Secure",
|
|
79
|
+
"httpOnly" in c && c.httpOnly && "HttpOnly",
|
|
80
|
+
"sameSite" in c && c.sameSite && `SameSite=${c.sameSite}`,
|
|
81
|
+
"partitioned" in c && c.partitioned && "Partitioned",
|
|
82
|
+
"priority" in c && c.priority && `Priority=${c.priority}`
|
|
83
|
+
].filter(Boolean);
|
|
84
|
+
const stringified = `${c.name}=${encodeURIComponent((_a = c.value) != null ? _a : "")}`;
|
|
85
|
+
return attrs.length === 0 ? stringified : `${stringified}; ${attrs.join("; ")}`;
|
|
86
|
+
}
|
|
87
|
+
function parseCookie(cookie) {
|
|
88
|
+
const map = /* @__PURE__ */ new Map();
|
|
89
|
+
for (const pair of cookie.split(/; */)) {
|
|
90
|
+
if (!pair)
|
|
91
|
+
continue;
|
|
92
|
+
const splitAt = pair.indexOf("=");
|
|
93
|
+
if (splitAt === -1) {
|
|
94
|
+
map.set(pair, "true");
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const [key, value] = [pair.slice(0, splitAt), pair.slice(splitAt + 1)];
|
|
98
|
+
try {
|
|
99
|
+
map.set(key, decodeURIComponent(value != null ? value : "true"));
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return map;
|
|
104
|
+
}
|
|
105
|
+
function parseSetCookie(setCookie) {
|
|
106
|
+
if (!setCookie) {
|
|
107
|
+
return void 0;
|
|
108
|
+
}
|
|
109
|
+
const [[name, value], ...attributes] = parseCookie(setCookie);
|
|
110
|
+
const {
|
|
111
|
+
domain,
|
|
112
|
+
expires,
|
|
113
|
+
httponly,
|
|
114
|
+
maxage,
|
|
115
|
+
path,
|
|
116
|
+
samesite,
|
|
117
|
+
secure,
|
|
118
|
+
partitioned,
|
|
119
|
+
priority
|
|
120
|
+
} = Object.fromEntries(
|
|
121
|
+
attributes.map(([key, value2]) => [
|
|
122
|
+
key.toLowerCase().replace(/-/g, ""),
|
|
123
|
+
value2
|
|
124
|
+
])
|
|
125
|
+
);
|
|
126
|
+
const cookie = {
|
|
127
|
+
name,
|
|
128
|
+
value: decodeURIComponent(value),
|
|
129
|
+
domain,
|
|
130
|
+
...expires && { expires: new Date(expires) },
|
|
131
|
+
...httponly && { httpOnly: true },
|
|
132
|
+
...typeof maxage === "string" && { maxAge: Number(maxage) },
|
|
133
|
+
path,
|
|
134
|
+
...samesite && { sameSite: parseSameSite(samesite) },
|
|
135
|
+
...secure && { secure: true },
|
|
136
|
+
...priority && { priority: parsePriority(priority) },
|
|
137
|
+
...partitioned && { partitioned: true }
|
|
138
|
+
};
|
|
139
|
+
return compact(cookie);
|
|
140
|
+
}
|
|
141
|
+
function compact(t) {
|
|
142
|
+
const newT = {};
|
|
143
|
+
for (const key in t) {
|
|
144
|
+
if (t[key]) {
|
|
145
|
+
newT[key] = t[key];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return newT;
|
|
149
|
+
}
|
|
150
|
+
var SAME_SITE = ["strict", "lax", "none"];
|
|
151
|
+
function parseSameSite(string) {
|
|
152
|
+
string = string.toLowerCase();
|
|
153
|
+
return SAME_SITE.includes(string) ? string : void 0;
|
|
154
|
+
}
|
|
155
|
+
var PRIORITY = ["low", "medium", "high"];
|
|
156
|
+
function parsePriority(string) {
|
|
157
|
+
string = string.toLowerCase();
|
|
158
|
+
return PRIORITY.includes(string) ? string : void 0;
|
|
159
|
+
}
|
|
160
|
+
function splitCookiesString(cookiesString) {
|
|
161
|
+
if (!cookiesString)
|
|
162
|
+
return [];
|
|
163
|
+
var cookiesStrings = [];
|
|
164
|
+
var pos = 0;
|
|
165
|
+
var start;
|
|
166
|
+
var ch;
|
|
167
|
+
var lastComma;
|
|
168
|
+
var nextStart;
|
|
169
|
+
var cookiesSeparatorFound;
|
|
170
|
+
function skipWhitespace() {
|
|
171
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
172
|
+
pos += 1;
|
|
173
|
+
}
|
|
174
|
+
return pos < cookiesString.length;
|
|
175
|
+
}
|
|
176
|
+
function notSpecialChar() {
|
|
177
|
+
ch = cookiesString.charAt(pos);
|
|
178
|
+
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
179
|
+
}
|
|
180
|
+
while (pos < cookiesString.length) {
|
|
181
|
+
start = pos;
|
|
182
|
+
cookiesSeparatorFound = false;
|
|
183
|
+
while (skipWhitespace()) {
|
|
184
|
+
ch = cookiesString.charAt(pos);
|
|
185
|
+
if (ch === ",") {
|
|
186
|
+
lastComma = pos;
|
|
187
|
+
pos += 1;
|
|
188
|
+
skipWhitespace();
|
|
189
|
+
nextStart = pos;
|
|
190
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
191
|
+
pos += 1;
|
|
192
|
+
}
|
|
193
|
+
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
194
|
+
cookiesSeparatorFound = true;
|
|
195
|
+
pos = nextStart;
|
|
196
|
+
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
197
|
+
start = pos;
|
|
198
|
+
} else {
|
|
199
|
+
pos = lastComma + 1;
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
pos += 1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
206
|
+
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return cookiesStrings;
|
|
210
|
+
}
|
|
211
|
+
var RequestCookies = class {
|
|
212
|
+
constructor(requestHeaders) {
|
|
213
|
+
this._parsed = /* @__PURE__ */ new Map();
|
|
214
|
+
this._headers = requestHeaders;
|
|
215
|
+
const header = requestHeaders.get("cookie");
|
|
216
|
+
if (header) {
|
|
217
|
+
const parsed = parseCookie(header);
|
|
218
|
+
for (const [name, value] of parsed) {
|
|
219
|
+
this._parsed.set(name, { name, value });
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
[Symbol.iterator]() {
|
|
224
|
+
return this._parsed[Symbol.iterator]();
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The amount of cookies received from the client
|
|
228
|
+
*/
|
|
229
|
+
get size() {
|
|
230
|
+
return this._parsed.size;
|
|
231
|
+
}
|
|
232
|
+
get(...args) {
|
|
233
|
+
const name = typeof args[0] === "string" ? args[0] : args[0].name;
|
|
234
|
+
return this._parsed.get(name);
|
|
235
|
+
}
|
|
236
|
+
getAll(...args) {
|
|
237
|
+
var _a;
|
|
238
|
+
const all = Array.from(this._parsed);
|
|
239
|
+
if (!args.length) {
|
|
240
|
+
return all.map(([_, value]) => value);
|
|
241
|
+
}
|
|
242
|
+
const name = typeof args[0] === "string" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name;
|
|
243
|
+
return all.filter(([n]) => n === name).map(([_, value]) => value);
|
|
244
|
+
}
|
|
245
|
+
has(name) {
|
|
246
|
+
return this._parsed.has(name);
|
|
247
|
+
}
|
|
248
|
+
set(...args) {
|
|
249
|
+
const [name, value] = args.length === 1 ? [args[0].name, args[0].value] : args;
|
|
250
|
+
const map = this._parsed;
|
|
251
|
+
map.set(name, { name, value });
|
|
252
|
+
this._headers.set(
|
|
253
|
+
"cookie",
|
|
254
|
+
Array.from(map).map(([_, value2]) => stringifyCookie(value2)).join("; ")
|
|
255
|
+
);
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Delete the cookies matching the passed name or names in the request.
|
|
260
|
+
*/
|
|
261
|
+
delete(names) {
|
|
262
|
+
const map = this._parsed;
|
|
263
|
+
const result = !Array.isArray(names) ? map.delete(names) : names.map((name) => map.delete(name));
|
|
264
|
+
this._headers.set(
|
|
265
|
+
"cookie",
|
|
266
|
+
Array.from(map).map(([_, value]) => stringifyCookie(value)).join("; ")
|
|
267
|
+
);
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Delete all the cookies in the cookies in the request.
|
|
272
|
+
*/
|
|
273
|
+
clear() {
|
|
274
|
+
this.delete(Array.from(this._parsed.keys()));
|
|
275
|
+
return this;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Format the cookies in the request as a string for logging
|
|
279
|
+
*/
|
|
280
|
+
[Symbol.for("edge-runtime.inspect.custom")]() {
|
|
281
|
+
return `RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`;
|
|
282
|
+
}
|
|
283
|
+
toString() {
|
|
284
|
+
return [...this._parsed.values()].map((v) => `${v.name}=${encodeURIComponent(v.value)}`).join("; ");
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
var ResponseCookies = class {
|
|
288
|
+
constructor(responseHeaders) {
|
|
289
|
+
this._parsed = /* @__PURE__ */ new Map();
|
|
290
|
+
var _a, _b, _c;
|
|
291
|
+
this._headers = responseHeaders;
|
|
292
|
+
const setCookie = (_c = (_b = (_a = responseHeaders.getSetCookie) == null ? void 0 : _a.call(responseHeaders)) != null ? _b : responseHeaders.get("set-cookie")) != null ? _c : [];
|
|
293
|
+
const cookieStrings = Array.isArray(setCookie) ? setCookie : splitCookiesString(setCookie);
|
|
294
|
+
for (const cookieString of cookieStrings) {
|
|
295
|
+
const parsed = parseSetCookie(cookieString);
|
|
296
|
+
if (parsed)
|
|
297
|
+
this._parsed.set(parsed.name, parsed);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* {@link https://wicg.github.io/cookie-store/#CookieStore-get CookieStore#get} without the Promise.
|
|
302
|
+
*/
|
|
303
|
+
get(...args) {
|
|
304
|
+
const key = typeof args[0] === "string" ? args[0] : args[0].name;
|
|
305
|
+
return this._parsed.get(key);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* {@link https://wicg.github.io/cookie-store/#CookieStore-getAll CookieStore#getAll} without the Promise.
|
|
309
|
+
*/
|
|
310
|
+
getAll(...args) {
|
|
311
|
+
var _a;
|
|
312
|
+
const all = Array.from(this._parsed.values());
|
|
313
|
+
if (!args.length) {
|
|
314
|
+
return all;
|
|
315
|
+
}
|
|
316
|
+
const key = typeof args[0] === "string" ? args[0] : (_a = args[0]) == null ? void 0 : _a.name;
|
|
317
|
+
return all.filter((c) => c.name === key);
|
|
318
|
+
}
|
|
319
|
+
has(name) {
|
|
320
|
+
return this._parsed.has(name);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* {@link https://wicg.github.io/cookie-store/#CookieStore-set CookieStore#set} without the Promise.
|
|
324
|
+
*/
|
|
325
|
+
set(...args) {
|
|
326
|
+
const [name, value, cookie] = args.length === 1 ? [args[0].name, args[0].value, args[0]] : args;
|
|
327
|
+
const map = this._parsed;
|
|
328
|
+
map.set(name, normalizeCookie({ name, value, ...cookie }));
|
|
329
|
+
replace(map, this._headers);
|
|
330
|
+
return this;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* {@link https://wicg.github.io/cookie-store/#CookieStore-delete CookieStore#delete} without the Promise.
|
|
334
|
+
*/
|
|
335
|
+
delete(...args) {
|
|
336
|
+
const [name, options] = typeof args[0] === "string" ? [args[0]] : [args[0].name, args[0]];
|
|
337
|
+
return this.set({ ...options, name, value: "", expires: /* @__PURE__ */ new Date(0) });
|
|
338
|
+
}
|
|
339
|
+
[Symbol.for("edge-runtime.inspect.custom")]() {
|
|
340
|
+
return `ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`;
|
|
341
|
+
}
|
|
342
|
+
toString() {
|
|
343
|
+
return [...this._parsed.values()].map(stringifyCookie).join("; ");
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
function replace(bag, headers2) {
|
|
347
|
+
headers2.delete("set-cookie");
|
|
348
|
+
for (const [, value] of bag) {
|
|
349
|
+
const serialized = stringifyCookie(value);
|
|
350
|
+
headers2.append("set-cookie", serialized);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function normalizeCookie(cookie = { name: "", value: "" }) {
|
|
354
|
+
if (typeof cookie.expires === "number") {
|
|
355
|
+
cookie.expires = new Date(cookie.expires);
|
|
356
|
+
}
|
|
357
|
+
if (cookie.maxAge) {
|
|
358
|
+
cookie.expires = new Date(Date.now() + cookie.maxAge * 1e3);
|
|
359
|
+
}
|
|
360
|
+
if (cookie.path === null || cookie.path === void 0) {
|
|
361
|
+
cookie.path = "/";
|
|
362
|
+
}
|
|
363
|
+
return cookie;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
// ../../node_modules/next/dist/server/web/spec-extension/cookies.js
|
|
369
|
+
var require_cookies2 = __commonJS({
|
|
370
|
+
"../../node_modules/next/dist/server/web/spec-extension/cookies.js"(exports) {
|
|
371
|
+
Object.defineProperty(exports, "__esModule", {
|
|
372
|
+
value: true
|
|
373
|
+
});
|
|
374
|
+
function _export(target, all) {
|
|
375
|
+
for (var name in all)
|
|
376
|
+
Object.defineProperty(target, name, {
|
|
377
|
+
enumerable: true,
|
|
378
|
+
get: all[name]
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
_export(exports, {
|
|
382
|
+
RequestCookies: function() {
|
|
383
|
+
return _cookies.RequestCookies;
|
|
384
|
+
},
|
|
385
|
+
ResponseCookies: function() {
|
|
386
|
+
return _cookies.ResponseCookies;
|
|
387
|
+
},
|
|
388
|
+
stringifyCookie: function() {
|
|
389
|
+
return _cookies.stringifyCookie;
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
var _cookies = require_cookies();
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// ../../node_modules/next/dist/server/web/spec-extension/adapters/reflect.js
|
|
397
|
+
var require_reflect = __commonJS({
|
|
398
|
+
"../../node_modules/next/dist/server/web/spec-extension/adapters/reflect.js"(exports) {
|
|
399
|
+
Object.defineProperty(exports, "__esModule", {
|
|
400
|
+
value: true
|
|
401
|
+
});
|
|
402
|
+
Object.defineProperty(exports, "ReflectAdapter", {
|
|
403
|
+
enumerable: true,
|
|
404
|
+
get: function() {
|
|
405
|
+
return ReflectAdapter;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
var ReflectAdapter = class {
|
|
409
|
+
static get(target, prop, receiver) {
|
|
410
|
+
const value = Reflect.get(target, prop, receiver);
|
|
411
|
+
if (typeof value === "function") {
|
|
412
|
+
return value.bind(target);
|
|
413
|
+
}
|
|
414
|
+
return value;
|
|
415
|
+
}
|
|
416
|
+
static set(target, prop, value, receiver) {
|
|
417
|
+
return Reflect.set(target, prop, value, receiver);
|
|
418
|
+
}
|
|
419
|
+
static has(target, prop) {
|
|
420
|
+
return Reflect.has(target, prop);
|
|
421
|
+
}
|
|
422
|
+
static deleteProperty(target, prop) {
|
|
423
|
+
return Reflect.deleteProperty(target, prop);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// ../../node_modules/next/dist/server/app-render/async-local-storage.js
|
|
430
|
+
var require_async_local_storage = __commonJS({
|
|
431
|
+
"../../node_modules/next/dist/server/app-render/async-local-storage.js"(exports) {
|
|
432
|
+
Object.defineProperty(exports, "__esModule", {
|
|
433
|
+
value: true
|
|
434
|
+
});
|
|
435
|
+
function _export(target, all) {
|
|
436
|
+
for (var name in all)
|
|
437
|
+
Object.defineProperty(target, name, {
|
|
438
|
+
enumerable: true,
|
|
439
|
+
get: all[name]
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
_export(exports, {
|
|
443
|
+
bindSnapshot: function() {
|
|
444
|
+
return bindSnapshot;
|
|
445
|
+
},
|
|
446
|
+
createAsyncLocalStorage: function() {
|
|
447
|
+
return createAsyncLocalStorage;
|
|
448
|
+
},
|
|
449
|
+
createSnapshot: function() {
|
|
450
|
+
return createSnapshot;
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
var sharedAsyncLocalStorageNotAvailableError = Object.defineProperty(new Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"), "__NEXT_ERROR_CODE", {
|
|
454
|
+
value: "E504",
|
|
455
|
+
enumerable: false,
|
|
456
|
+
configurable: true
|
|
457
|
+
});
|
|
458
|
+
var FakeAsyncLocalStorage = class {
|
|
459
|
+
disable() {
|
|
460
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
461
|
+
}
|
|
462
|
+
getStore() {
|
|
463
|
+
return void 0;
|
|
464
|
+
}
|
|
465
|
+
run() {
|
|
466
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
467
|
+
}
|
|
468
|
+
exit() {
|
|
469
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
470
|
+
}
|
|
471
|
+
enterWith() {
|
|
472
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
473
|
+
}
|
|
474
|
+
static bind(fn) {
|
|
475
|
+
return fn;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
var maybeGlobalAsyncLocalStorage = typeof globalThis !== "undefined" && globalThis.AsyncLocalStorage;
|
|
479
|
+
function createAsyncLocalStorage() {
|
|
480
|
+
if (maybeGlobalAsyncLocalStorage) {
|
|
481
|
+
return new maybeGlobalAsyncLocalStorage();
|
|
482
|
+
}
|
|
483
|
+
return new FakeAsyncLocalStorage();
|
|
484
|
+
}
|
|
485
|
+
function bindSnapshot(fn) {
|
|
486
|
+
if (maybeGlobalAsyncLocalStorage) {
|
|
487
|
+
return maybeGlobalAsyncLocalStorage.bind(fn);
|
|
488
|
+
}
|
|
489
|
+
return FakeAsyncLocalStorage.bind(fn);
|
|
490
|
+
}
|
|
491
|
+
function createSnapshot() {
|
|
492
|
+
if (maybeGlobalAsyncLocalStorage) {
|
|
493
|
+
return maybeGlobalAsyncLocalStorage.snapshot();
|
|
494
|
+
}
|
|
495
|
+
return function(fn, ...args) {
|
|
496
|
+
return fn(...args);
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
// ../../node_modules/next/dist/server/app-render/work-async-storage-instance.js
|
|
503
|
+
var require_work_async_storage_instance = __commonJS({
|
|
504
|
+
"../../node_modules/next/dist/server/app-render/work-async-storage-instance.js"(exports) {
|
|
505
|
+
Object.defineProperty(exports, "__esModule", {
|
|
506
|
+
value: true
|
|
507
|
+
});
|
|
508
|
+
Object.defineProperty(exports, "workAsyncStorageInstance", {
|
|
509
|
+
enumerable: true,
|
|
510
|
+
get: function() {
|
|
511
|
+
return workAsyncStorageInstance;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
var _asynclocalstorage = require_async_local_storage();
|
|
515
|
+
var workAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// ../../node_modules/next/dist/server/app-render/work-async-storage.external.js
|
|
520
|
+
var require_work_async_storage_external = __commonJS({
|
|
521
|
+
"../../node_modules/next/dist/server/app-render/work-async-storage.external.js"(exports) {
|
|
522
|
+
Object.defineProperty(exports, "__esModule", {
|
|
523
|
+
value: true
|
|
524
|
+
});
|
|
525
|
+
Object.defineProperty(exports, "workAsyncStorage", {
|
|
526
|
+
enumerable: true,
|
|
527
|
+
get: function() {
|
|
528
|
+
return _workasyncstorageinstance.workAsyncStorageInstance;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
var _workasyncstorageinstance = require_work_async_storage_instance();
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// ../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js
|
|
536
|
+
var require_work_unit_async_storage_instance = __commonJS({
|
|
537
|
+
"../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js"(exports) {
|
|
538
|
+
Object.defineProperty(exports, "__esModule", {
|
|
539
|
+
value: true
|
|
540
|
+
});
|
|
541
|
+
Object.defineProperty(exports, "workUnitAsyncStorageInstance", {
|
|
542
|
+
enumerable: true,
|
|
543
|
+
get: function() {
|
|
544
|
+
return workUnitAsyncStorageInstance;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
var _asynclocalstorage = require_async_local_storage();
|
|
548
|
+
var workUnitAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// ../../node_modules/next/dist/client/components/app-router-headers.js
|
|
553
|
+
var require_app_router_headers = __commonJS({
|
|
554
|
+
"../../node_modules/next/dist/client/components/app-router-headers.js"(exports, module) {
|
|
555
|
+
Object.defineProperty(exports, "__esModule", {
|
|
556
|
+
value: true
|
|
557
|
+
});
|
|
558
|
+
function _export(target, all) {
|
|
559
|
+
for (var name in all)
|
|
560
|
+
Object.defineProperty(target, name, {
|
|
561
|
+
enumerable: true,
|
|
562
|
+
get: all[name]
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
_export(exports, {
|
|
566
|
+
ACTION_HEADER: function() {
|
|
567
|
+
return ACTION_HEADER;
|
|
568
|
+
},
|
|
569
|
+
FLIGHT_HEADERS: function() {
|
|
570
|
+
return FLIGHT_HEADERS;
|
|
571
|
+
},
|
|
572
|
+
NEXT_DID_POSTPONE_HEADER: function() {
|
|
573
|
+
return NEXT_DID_POSTPONE_HEADER;
|
|
574
|
+
},
|
|
575
|
+
NEXT_HMR_REFRESH_HASH_COOKIE: function() {
|
|
576
|
+
return NEXT_HMR_REFRESH_HASH_COOKIE;
|
|
577
|
+
},
|
|
578
|
+
NEXT_HMR_REFRESH_HEADER: function() {
|
|
579
|
+
return NEXT_HMR_REFRESH_HEADER;
|
|
580
|
+
},
|
|
581
|
+
NEXT_IS_PRERENDER_HEADER: function() {
|
|
582
|
+
return NEXT_IS_PRERENDER_HEADER;
|
|
583
|
+
},
|
|
584
|
+
NEXT_REWRITTEN_PATH_HEADER: function() {
|
|
585
|
+
return NEXT_REWRITTEN_PATH_HEADER;
|
|
586
|
+
},
|
|
587
|
+
NEXT_REWRITTEN_QUERY_HEADER: function() {
|
|
588
|
+
return NEXT_REWRITTEN_QUERY_HEADER;
|
|
589
|
+
},
|
|
590
|
+
NEXT_ROUTER_PREFETCH_HEADER: function() {
|
|
591
|
+
return NEXT_ROUTER_PREFETCH_HEADER;
|
|
592
|
+
},
|
|
593
|
+
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: function() {
|
|
594
|
+
return NEXT_ROUTER_SEGMENT_PREFETCH_HEADER;
|
|
595
|
+
},
|
|
596
|
+
NEXT_ROUTER_STALE_TIME_HEADER: function() {
|
|
597
|
+
return NEXT_ROUTER_STALE_TIME_HEADER;
|
|
598
|
+
},
|
|
599
|
+
NEXT_ROUTER_STATE_TREE_HEADER: function() {
|
|
600
|
+
return NEXT_ROUTER_STATE_TREE_HEADER;
|
|
601
|
+
},
|
|
602
|
+
NEXT_RSC_UNION_QUERY: function() {
|
|
603
|
+
return NEXT_RSC_UNION_QUERY;
|
|
604
|
+
},
|
|
605
|
+
NEXT_URL: function() {
|
|
606
|
+
return NEXT_URL;
|
|
607
|
+
},
|
|
608
|
+
RSC_CONTENT_TYPE_HEADER: function() {
|
|
609
|
+
return RSC_CONTENT_TYPE_HEADER;
|
|
610
|
+
},
|
|
611
|
+
RSC_HEADER: function() {
|
|
612
|
+
return RSC_HEADER;
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
var RSC_HEADER = "RSC";
|
|
616
|
+
var ACTION_HEADER = "Next-Action";
|
|
617
|
+
var NEXT_ROUTER_STATE_TREE_HEADER = "Next-Router-State-Tree";
|
|
618
|
+
var NEXT_ROUTER_PREFETCH_HEADER = "Next-Router-Prefetch";
|
|
619
|
+
var NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = "Next-Router-Segment-Prefetch";
|
|
620
|
+
var NEXT_HMR_REFRESH_HEADER = "Next-HMR-Refresh";
|
|
621
|
+
var NEXT_HMR_REFRESH_HASH_COOKIE = "__next_hmr_refresh_hash__";
|
|
622
|
+
var NEXT_URL = "Next-Url";
|
|
623
|
+
var RSC_CONTENT_TYPE_HEADER = "text/x-component";
|
|
624
|
+
var FLIGHT_HEADERS = [
|
|
625
|
+
RSC_HEADER,
|
|
626
|
+
NEXT_ROUTER_STATE_TREE_HEADER,
|
|
627
|
+
NEXT_ROUTER_PREFETCH_HEADER,
|
|
628
|
+
NEXT_HMR_REFRESH_HEADER,
|
|
629
|
+
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER
|
|
630
|
+
];
|
|
631
|
+
var NEXT_RSC_UNION_QUERY = "_rsc";
|
|
632
|
+
var NEXT_ROUTER_STALE_TIME_HEADER = "x-nextjs-stale-time";
|
|
633
|
+
var NEXT_DID_POSTPONE_HEADER = "x-nextjs-postponed";
|
|
634
|
+
var NEXT_REWRITTEN_PATH_HEADER = "x-nextjs-rewritten-path";
|
|
635
|
+
var NEXT_REWRITTEN_QUERY_HEADER = "x-nextjs-rewritten-query";
|
|
636
|
+
var NEXT_IS_PRERENDER_HEADER = "x-nextjs-prerender";
|
|
637
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
638
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
639
|
+
Object.assign(exports.default, exports);
|
|
640
|
+
module.exports = exports.default;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
// ../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js
|
|
646
|
+
var require_work_unit_async_storage_external = __commonJS({
|
|
647
|
+
"../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js"(exports) {
|
|
648
|
+
Object.defineProperty(exports, "__esModule", {
|
|
649
|
+
value: true
|
|
650
|
+
});
|
|
651
|
+
function _export(target, all) {
|
|
652
|
+
for (var name in all)
|
|
653
|
+
Object.defineProperty(target, name, {
|
|
654
|
+
enumerable: true,
|
|
655
|
+
get: all[name]
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
_export(exports, {
|
|
659
|
+
getDraftModeProviderForCacheScope: function() {
|
|
660
|
+
return getDraftModeProviderForCacheScope;
|
|
661
|
+
},
|
|
662
|
+
getExpectedRequestStore: function() {
|
|
663
|
+
return getExpectedRequestStore;
|
|
664
|
+
},
|
|
665
|
+
getHmrRefreshHash: function() {
|
|
666
|
+
return getHmrRefreshHash;
|
|
667
|
+
},
|
|
668
|
+
getPrerenderResumeDataCache: function() {
|
|
669
|
+
return getPrerenderResumeDataCache;
|
|
670
|
+
},
|
|
671
|
+
getRenderResumeDataCache: function() {
|
|
672
|
+
return getRenderResumeDataCache;
|
|
673
|
+
},
|
|
674
|
+
throwForMissingRequestStore: function() {
|
|
675
|
+
return throwForMissingRequestStore;
|
|
676
|
+
},
|
|
677
|
+
workUnitAsyncStorage: function() {
|
|
678
|
+
return _workunitasyncstorageinstance.workUnitAsyncStorageInstance;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
var _workunitasyncstorageinstance = require_work_unit_async_storage_instance();
|
|
682
|
+
var _approuterheaders = require_app_router_headers();
|
|
683
|
+
function getExpectedRequestStore(callingExpression) {
|
|
684
|
+
const workUnitStore = _workunitasyncstorageinstance.workUnitAsyncStorageInstance.getStore();
|
|
685
|
+
if (!workUnitStore) {
|
|
686
|
+
throwForMissingRequestStore(callingExpression);
|
|
687
|
+
}
|
|
688
|
+
switch (workUnitStore.type) {
|
|
689
|
+
case "request":
|
|
690
|
+
return workUnitStore;
|
|
691
|
+
case "prerender":
|
|
692
|
+
case "prerender-ppr":
|
|
693
|
+
case "prerender-legacy":
|
|
694
|
+
throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside a prerender. This is a bug in Next.js.`), "__NEXT_ERROR_CODE", {
|
|
695
|
+
value: "E401",
|
|
696
|
+
enumerable: false,
|
|
697
|
+
configurable: true
|
|
698
|
+
});
|
|
699
|
+
case "cache":
|
|
700
|
+
throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside "use cache". Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
701
|
+
value: "E37",
|
|
702
|
+
enumerable: false,
|
|
703
|
+
configurable: true
|
|
704
|
+
});
|
|
705
|
+
case "unstable-cache":
|
|
706
|
+
throw Object.defineProperty(new Error(`\`${callingExpression}\` cannot be called inside unstable_cache. Call it outside and pass an argument instead. Read more: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
707
|
+
value: "E69",
|
|
708
|
+
enumerable: false,
|
|
709
|
+
configurable: true
|
|
710
|
+
});
|
|
711
|
+
default:
|
|
712
|
+
const _exhaustiveCheck = workUnitStore;
|
|
713
|
+
return _exhaustiveCheck;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
function throwForMissingRequestStore(callingExpression) {
|
|
717
|
+
throw Object.defineProperty(new Error(`\`${callingExpression}\` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context`), "__NEXT_ERROR_CODE", {
|
|
718
|
+
value: "E251",
|
|
719
|
+
enumerable: false,
|
|
720
|
+
configurable: true
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
function getPrerenderResumeDataCache(workUnitStore) {
|
|
724
|
+
if (workUnitStore.type === "prerender" || workUnitStore.type === "prerender-ppr") {
|
|
725
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
726
|
+
}
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
function getRenderResumeDataCache(workUnitStore) {
|
|
730
|
+
if (workUnitStore.type !== "prerender-legacy" && workUnitStore.type !== "cache" && workUnitStore.type !== "unstable-cache") {
|
|
731
|
+
if (workUnitStore.type === "request") {
|
|
732
|
+
return workUnitStore.renderResumeDataCache;
|
|
733
|
+
}
|
|
734
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
735
|
+
}
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
function getHmrRefreshHash(workStore, workUnitStore) {
|
|
739
|
+
var _workUnitStore_cookies_get;
|
|
740
|
+
if (!workStore.dev) {
|
|
741
|
+
return void 0;
|
|
742
|
+
}
|
|
743
|
+
return workUnitStore.type === "cache" || workUnitStore.type === "prerender" ? workUnitStore.hmrRefreshHash : workUnitStore.type === "request" ? (_workUnitStore_cookies_get = workUnitStore.cookies.get(_approuterheaders.NEXT_HMR_REFRESH_HASH_COOKIE)) == null ? void 0 : _workUnitStore_cookies_get.value : void 0;
|
|
744
|
+
}
|
|
745
|
+
function getDraftModeProviderForCacheScope(workStore, workUnitStore) {
|
|
746
|
+
if (workStore.isDraftMode) {
|
|
747
|
+
switch (workUnitStore.type) {
|
|
748
|
+
case "cache":
|
|
749
|
+
case "unstable-cache":
|
|
750
|
+
case "request":
|
|
751
|
+
return workUnitStore.draftMode;
|
|
752
|
+
default:
|
|
753
|
+
return void 0;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return void 0;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
// ../../node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js
|
|
762
|
+
var require_request_cookies = __commonJS({
|
|
763
|
+
"../../node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js"(exports) {
|
|
764
|
+
Object.defineProperty(exports, "__esModule", {
|
|
765
|
+
value: true
|
|
766
|
+
});
|
|
767
|
+
function _export(target, all) {
|
|
768
|
+
for (var name in all)
|
|
769
|
+
Object.defineProperty(target, name, {
|
|
770
|
+
enumerable: true,
|
|
771
|
+
get: all[name]
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
_export(exports, {
|
|
775
|
+
MutableRequestCookiesAdapter: function() {
|
|
776
|
+
return MutableRequestCookiesAdapter;
|
|
777
|
+
},
|
|
778
|
+
ReadonlyRequestCookiesError: function() {
|
|
779
|
+
return ReadonlyRequestCookiesError;
|
|
780
|
+
},
|
|
781
|
+
RequestCookiesAdapter: function() {
|
|
782
|
+
return RequestCookiesAdapter;
|
|
783
|
+
},
|
|
784
|
+
appendMutableCookies: function() {
|
|
785
|
+
return appendMutableCookies;
|
|
786
|
+
},
|
|
787
|
+
areCookiesMutableInCurrentPhase: function() {
|
|
788
|
+
return areCookiesMutableInCurrentPhase;
|
|
789
|
+
},
|
|
790
|
+
getModifiedCookieValues: function() {
|
|
791
|
+
return getModifiedCookieValues;
|
|
792
|
+
},
|
|
793
|
+
responseCookiesToRequestCookies: function() {
|
|
794
|
+
return responseCookiesToRequestCookies;
|
|
795
|
+
},
|
|
796
|
+
wrapWithMutableAccessCheck: function() {
|
|
797
|
+
return wrapWithMutableAccessCheck;
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
var _cookies = require_cookies2();
|
|
801
|
+
var _reflect = require_reflect();
|
|
802
|
+
var _workasyncstorageexternal = require_work_async_storage_external();
|
|
803
|
+
var _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
804
|
+
var ReadonlyRequestCookiesError = class extends Error {
|
|
805
|
+
constructor() {
|
|
806
|
+
super("Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options");
|
|
807
|
+
}
|
|
808
|
+
static callable() {
|
|
809
|
+
throw new ReadonlyRequestCookiesError();
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
var RequestCookiesAdapter = class {
|
|
813
|
+
static seal(cookies2) {
|
|
814
|
+
return new Proxy(cookies2, {
|
|
815
|
+
get(target, prop, receiver) {
|
|
816
|
+
switch (prop) {
|
|
817
|
+
case "clear":
|
|
818
|
+
case "delete":
|
|
819
|
+
case "set":
|
|
820
|
+
return ReadonlyRequestCookiesError.callable;
|
|
821
|
+
default:
|
|
822
|
+
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
var SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for("next.mutated.cookies");
|
|
829
|
+
function getModifiedCookieValues(cookies2) {
|
|
830
|
+
const modified = cookies2[SYMBOL_MODIFY_COOKIE_VALUES];
|
|
831
|
+
if (!modified || !Array.isArray(modified) || modified.length === 0) {
|
|
832
|
+
return [];
|
|
833
|
+
}
|
|
834
|
+
return modified;
|
|
835
|
+
}
|
|
836
|
+
function appendMutableCookies(headers2, mutableCookies) {
|
|
837
|
+
const modifiedCookieValues = getModifiedCookieValues(mutableCookies);
|
|
838
|
+
if (modifiedCookieValues.length === 0) {
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
const resCookies = new _cookies.ResponseCookies(headers2);
|
|
842
|
+
const returnedCookies = resCookies.getAll();
|
|
843
|
+
for (const cookie of modifiedCookieValues) {
|
|
844
|
+
resCookies.set(cookie);
|
|
845
|
+
}
|
|
846
|
+
for (const cookie of returnedCookies) {
|
|
847
|
+
resCookies.set(cookie);
|
|
848
|
+
}
|
|
849
|
+
return true;
|
|
850
|
+
}
|
|
851
|
+
var MutableRequestCookiesAdapter = class {
|
|
852
|
+
static wrap(cookies2, onUpdateCookies) {
|
|
853
|
+
const responseCookies = new _cookies.ResponseCookies(new Headers());
|
|
854
|
+
for (const cookie of cookies2.getAll()) {
|
|
855
|
+
responseCookies.set(cookie);
|
|
856
|
+
}
|
|
857
|
+
let modifiedValues = [];
|
|
858
|
+
const modifiedCookies = /* @__PURE__ */ new Set();
|
|
859
|
+
const updateResponseCookies = () => {
|
|
860
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
861
|
+
if (workStore) {
|
|
862
|
+
workStore.pathWasRevalidated = true;
|
|
863
|
+
}
|
|
864
|
+
const allCookies = responseCookies.getAll();
|
|
865
|
+
modifiedValues = allCookies.filter((c) => modifiedCookies.has(c.name));
|
|
866
|
+
if (onUpdateCookies) {
|
|
867
|
+
const serializedCookies = [];
|
|
868
|
+
for (const cookie of modifiedValues) {
|
|
869
|
+
const tempCookies = new _cookies.ResponseCookies(new Headers());
|
|
870
|
+
tempCookies.set(cookie);
|
|
871
|
+
serializedCookies.push(tempCookies.toString());
|
|
872
|
+
}
|
|
873
|
+
onUpdateCookies(serializedCookies);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
const wrappedCookies = new Proxy(responseCookies, {
|
|
877
|
+
get(target, prop, receiver) {
|
|
878
|
+
switch (prop) {
|
|
879
|
+
case SYMBOL_MODIFY_COOKIE_VALUES:
|
|
880
|
+
return modifiedValues;
|
|
881
|
+
case "delete":
|
|
882
|
+
return function(...args) {
|
|
883
|
+
modifiedCookies.add(typeof args[0] === "string" ? args[0] : args[0].name);
|
|
884
|
+
try {
|
|
885
|
+
target.delete(...args);
|
|
886
|
+
return wrappedCookies;
|
|
887
|
+
} finally {
|
|
888
|
+
updateResponseCookies();
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
case "set":
|
|
892
|
+
return function(...args) {
|
|
893
|
+
modifiedCookies.add(typeof args[0] === "string" ? args[0] : args[0].name);
|
|
894
|
+
try {
|
|
895
|
+
target.set(...args);
|
|
896
|
+
return wrappedCookies;
|
|
897
|
+
} finally {
|
|
898
|
+
updateResponseCookies();
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
default:
|
|
902
|
+
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
return wrappedCookies;
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
function wrapWithMutableAccessCheck(responseCookies) {
|
|
910
|
+
const wrappedCookies = new Proxy(responseCookies, {
|
|
911
|
+
get(target, prop, receiver) {
|
|
912
|
+
switch (prop) {
|
|
913
|
+
case "delete":
|
|
914
|
+
return function(...args) {
|
|
915
|
+
ensureCookiesAreStillMutable("cookies().delete");
|
|
916
|
+
target.delete(...args);
|
|
917
|
+
return wrappedCookies;
|
|
918
|
+
};
|
|
919
|
+
case "set":
|
|
920
|
+
return function(...args) {
|
|
921
|
+
ensureCookiesAreStillMutable("cookies().set");
|
|
922
|
+
target.set(...args);
|
|
923
|
+
return wrappedCookies;
|
|
924
|
+
};
|
|
925
|
+
default:
|
|
926
|
+
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
return wrappedCookies;
|
|
931
|
+
}
|
|
932
|
+
function areCookiesMutableInCurrentPhase(requestStore) {
|
|
933
|
+
return requestStore.phase === "action";
|
|
934
|
+
}
|
|
935
|
+
function ensureCookiesAreStillMutable(callingExpression) {
|
|
936
|
+
const requestStore = (0, _workunitasyncstorageexternal.getExpectedRequestStore)(callingExpression);
|
|
937
|
+
if (!areCookiesMutableInCurrentPhase(requestStore)) {
|
|
938
|
+
throw new ReadonlyRequestCookiesError();
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function responseCookiesToRequestCookies(responseCookies) {
|
|
942
|
+
const requestCookies = new _cookies.RequestCookies(new Headers());
|
|
943
|
+
for (const cookie of responseCookies.getAll()) {
|
|
944
|
+
requestCookies.set(cookie);
|
|
945
|
+
}
|
|
946
|
+
return requestCookies;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
// ../../node_modules/next/dist/client/components/hooks-server-context.js
|
|
952
|
+
var require_hooks_server_context = __commonJS({
|
|
953
|
+
"../../node_modules/next/dist/client/components/hooks-server-context.js"(exports, module) {
|
|
954
|
+
Object.defineProperty(exports, "__esModule", {
|
|
955
|
+
value: true
|
|
956
|
+
});
|
|
957
|
+
function _export(target, all) {
|
|
958
|
+
for (var name in all)
|
|
959
|
+
Object.defineProperty(target, name, {
|
|
960
|
+
enumerable: true,
|
|
961
|
+
get: all[name]
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
_export(exports, {
|
|
965
|
+
DynamicServerError: function() {
|
|
966
|
+
return DynamicServerError;
|
|
967
|
+
},
|
|
968
|
+
isDynamicServerError: function() {
|
|
969
|
+
return isDynamicServerError;
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
var DYNAMIC_ERROR_CODE = "DYNAMIC_SERVER_USAGE";
|
|
973
|
+
var DynamicServerError = class extends Error {
|
|
974
|
+
constructor(description) {
|
|
975
|
+
super("Dynamic server usage: " + description), this.description = description, this.digest = DYNAMIC_ERROR_CODE;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
function isDynamicServerError(err) {
|
|
979
|
+
if (typeof err !== "object" || err === null || !("digest" in err) || typeof err.digest !== "string") {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
return err.digest === DYNAMIC_ERROR_CODE;
|
|
983
|
+
}
|
|
984
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
985
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
986
|
+
Object.assign(exports.default, exports);
|
|
987
|
+
module.exports = exports.default;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
|
|
992
|
+
// ../../node_modules/next/dist/client/components/static-generation-bailout.js
|
|
993
|
+
var require_static_generation_bailout = __commonJS({
|
|
994
|
+
"../../node_modules/next/dist/client/components/static-generation-bailout.js"(exports, module) {
|
|
995
|
+
Object.defineProperty(exports, "__esModule", {
|
|
996
|
+
value: true
|
|
997
|
+
});
|
|
998
|
+
function _export(target, all) {
|
|
999
|
+
for (var name in all)
|
|
1000
|
+
Object.defineProperty(target, name, {
|
|
1001
|
+
enumerable: true,
|
|
1002
|
+
get: all[name]
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
_export(exports, {
|
|
1006
|
+
StaticGenBailoutError: function() {
|
|
1007
|
+
return StaticGenBailoutError;
|
|
1008
|
+
},
|
|
1009
|
+
isStaticGenBailoutError: function() {
|
|
1010
|
+
return isStaticGenBailoutError;
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
var NEXT_STATIC_GEN_BAILOUT = "NEXT_STATIC_GEN_BAILOUT";
|
|
1014
|
+
var StaticGenBailoutError = class extends Error {
|
|
1015
|
+
constructor(...args) {
|
|
1016
|
+
super(...args), this.code = NEXT_STATIC_GEN_BAILOUT;
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
function isStaticGenBailoutError(error) {
|
|
1020
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
1021
|
+
return false;
|
|
1022
|
+
}
|
|
1023
|
+
return error.code === NEXT_STATIC_GEN_BAILOUT;
|
|
1024
|
+
}
|
|
1025
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
1026
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
1027
|
+
Object.assign(exports.default, exports);
|
|
1028
|
+
module.exports = exports.default;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
// ../../node_modules/next/dist/server/dynamic-rendering-utils.js
|
|
1034
|
+
var require_dynamic_rendering_utils = __commonJS({
|
|
1035
|
+
"../../node_modules/next/dist/server/dynamic-rendering-utils.js"(exports) {
|
|
1036
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1037
|
+
value: true
|
|
1038
|
+
});
|
|
1039
|
+
function _export(target, all) {
|
|
1040
|
+
for (var name in all)
|
|
1041
|
+
Object.defineProperty(target, name, {
|
|
1042
|
+
enumerable: true,
|
|
1043
|
+
get: all[name]
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
_export(exports, {
|
|
1047
|
+
isHangingPromiseRejectionError: function() {
|
|
1048
|
+
return isHangingPromiseRejectionError;
|
|
1049
|
+
},
|
|
1050
|
+
makeHangingPromise: function() {
|
|
1051
|
+
return makeHangingPromise;
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
function isHangingPromiseRejectionError(err) {
|
|
1055
|
+
if (typeof err !== "object" || err === null || !("digest" in err)) {
|
|
1056
|
+
return false;
|
|
1057
|
+
}
|
|
1058
|
+
return err.digest === HANGING_PROMISE_REJECTION;
|
|
1059
|
+
}
|
|
1060
|
+
var HANGING_PROMISE_REJECTION = "HANGING_PROMISE_REJECTION";
|
|
1061
|
+
var HangingPromiseRejectionError = class extends Error {
|
|
1062
|
+
constructor(expression) {
|
|
1063
|
+
super(`During prerendering, ${expression} rejects when the prerender is complete. Typically these errors are handled by React but if you move ${expression} to a different context by using \`setTimeout\`, \`after\`, or similar functions you may observe this error and you should handle it in that context.`), this.expression = expression, this.digest = HANGING_PROMISE_REJECTION;
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
var abortListenersBySignal = /* @__PURE__ */ new WeakMap();
|
|
1067
|
+
function makeHangingPromise(signal, expression) {
|
|
1068
|
+
if (signal.aborted) {
|
|
1069
|
+
return Promise.reject(new HangingPromiseRejectionError(expression));
|
|
1070
|
+
} else {
|
|
1071
|
+
const hangingPromise = new Promise((_, reject) => {
|
|
1072
|
+
const boundRejection = reject.bind(null, new HangingPromiseRejectionError(expression));
|
|
1073
|
+
let currentListeners = abortListenersBySignal.get(signal);
|
|
1074
|
+
if (currentListeners) {
|
|
1075
|
+
currentListeners.push(boundRejection);
|
|
1076
|
+
} else {
|
|
1077
|
+
const listeners = [
|
|
1078
|
+
boundRejection
|
|
1079
|
+
];
|
|
1080
|
+
abortListenersBySignal.set(signal, listeners);
|
|
1081
|
+
signal.addEventListener("abort", () => {
|
|
1082
|
+
for (let i = 0; i < listeners.length; i++) {
|
|
1083
|
+
listeners[i]();
|
|
1084
|
+
}
|
|
1085
|
+
}, {
|
|
1086
|
+
once: true
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
hangingPromise.catch(ignoreReject);
|
|
1091
|
+
return hangingPromise;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
function ignoreReject() {
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
// ../../node_modules/next/dist/lib/metadata/metadata-constants.js
|
|
1100
|
+
var require_metadata_constants = __commonJS({
|
|
1101
|
+
"../../node_modules/next/dist/lib/metadata/metadata-constants.js"(exports) {
|
|
1102
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1103
|
+
value: true
|
|
1104
|
+
});
|
|
1105
|
+
function _export(target, all) {
|
|
1106
|
+
for (var name in all)
|
|
1107
|
+
Object.defineProperty(target, name, {
|
|
1108
|
+
enumerable: true,
|
|
1109
|
+
get: all[name]
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
_export(exports, {
|
|
1113
|
+
METADATA_BOUNDARY_NAME: function() {
|
|
1114
|
+
return METADATA_BOUNDARY_NAME;
|
|
1115
|
+
},
|
|
1116
|
+
OUTLET_BOUNDARY_NAME: function() {
|
|
1117
|
+
return OUTLET_BOUNDARY_NAME;
|
|
1118
|
+
},
|
|
1119
|
+
VIEWPORT_BOUNDARY_NAME: function() {
|
|
1120
|
+
return VIEWPORT_BOUNDARY_NAME;
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
var METADATA_BOUNDARY_NAME = "__next_metadata_boundary__";
|
|
1124
|
+
var VIEWPORT_BOUNDARY_NAME = "__next_viewport_boundary__";
|
|
1125
|
+
var OUTLET_BOUNDARY_NAME = "__next_outlet_boundary__";
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1128
|
+
|
|
1129
|
+
// ../../node_modules/next/dist/lib/scheduler.js
|
|
1130
|
+
var require_scheduler = __commonJS({
|
|
1131
|
+
"../../node_modules/next/dist/lib/scheduler.js"(exports) {
|
|
1132
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1133
|
+
value: true
|
|
1134
|
+
});
|
|
1135
|
+
function _export(target, all) {
|
|
1136
|
+
for (var name in all)
|
|
1137
|
+
Object.defineProperty(target, name, {
|
|
1138
|
+
enumerable: true,
|
|
1139
|
+
get: all[name]
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
_export(exports, {
|
|
1143
|
+
atLeastOneTask: function() {
|
|
1144
|
+
return atLeastOneTask;
|
|
1145
|
+
},
|
|
1146
|
+
scheduleImmediate: function() {
|
|
1147
|
+
return scheduleImmediate;
|
|
1148
|
+
},
|
|
1149
|
+
scheduleOnNextTick: function() {
|
|
1150
|
+
return scheduleOnNextTick;
|
|
1151
|
+
},
|
|
1152
|
+
waitAtLeastOneReactRenderTask: function() {
|
|
1153
|
+
return waitAtLeastOneReactRenderTask;
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
var scheduleOnNextTick = (cb) => {
|
|
1157
|
+
Promise.resolve().then(() => {
|
|
1158
|
+
if (process.env.NEXT_RUNTIME === "edge") {
|
|
1159
|
+
setTimeout(cb, 0);
|
|
1160
|
+
} else {
|
|
1161
|
+
process.nextTick(cb);
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
};
|
|
1165
|
+
var scheduleImmediate = (cb) => {
|
|
1166
|
+
if (process.env.NEXT_RUNTIME === "edge") {
|
|
1167
|
+
setTimeout(cb, 0);
|
|
1168
|
+
} else {
|
|
1169
|
+
setImmediate(cb);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
function atLeastOneTask() {
|
|
1173
|
+
return new Promise((resolve) => scheduleImmediate(resolve));
|
|
1174
|
+
}
|
|
1175
|
+
function waitAtLeastOneReactRenderTask() {
|
|
1176
|
+
if (process.env.NEXT_RUNTIME === "edge") {
|
|
1177
|
+
return new Promise((r) => setTimeout(r, 0));
|
|
1178
|
+
} else {
|
|
1179
|
+
return new Promise((r) => setImmediate(r));
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
// ../../node_modules/next/dist/server/app-render/dynamic-rendering.js
|
|
1186
|
+
var require_dynamic_rendering = __commonJS({
|
|
1187
|
+
"../../node_modules/next/dist/server/app-render/dynamic-rendering.js"(exports) {
|
|
1188
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1189
|
+
value: true
|
|
1190
|
+
});
|
|
1191
|
+
function _export(target, all) {
|
|
1192
|
+
for (var name in all)
|
|
1193
|
+
Object.defineProperty(target, name, {
|
|
1194
|
+
enumerable: true,
|
|
1195
|
+
get: all[name]
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
_export(exports, {
|
|
1199
|
+
Postpone: function() {
|
|
1200
|
+
return Postpone;
|
|
1201
|
+
},
|
|
1202
|
+
abortAndThrowOnSynchronousRequestDataAccess: function() {
|
|
1203
|
+
return abortAndThrowOnSynchronousRequestDataAccess;
|
|
1204
|
+
},
|
|
1205
|
+
abortOnSynchronousPlatformIOAccess: function() {
|
|
1206
|
+
return abortOnSynchronousPlatformIOAccess;
|
|
1207
|
+
},
|
|
1208
|
+
accessedDynamicData: function() {
|
|
1209
|
+
return accessedDynamicData;
|
|
1210
|
+
},
|
|
1211
|
+
annotateDynamicAccess: function() {
|
|
1212
|
+
return annotateDynamicAccess;
|
|
1213
|
+
},
|
|
1214
|
+
consumeDynamicAccess: function() {
|
|
1215
|
+
return consumeDynamicAccess;
|
|
1216
|
+
},
|
|
1217
|
+
createDynamicTrackingState: function() {
|
|
1218
|
+
return createDynamicTrackingState;
|
|
1219
|
+
},
|
|
1220
|
+
createDynamicValidationState: function() {
|
|
1221
|
+
return createDynamicValidationState;
|
|
1222
|
+
},
|
|
1223
|
+
createHangingInputAbortSignal: function() {
|
|
1224
|
+
return createHangingInputAbortSignal;
|
|
1225
|
+
},
|
|
1226
|
+
createPostponedAbortSignal: function() {
|
|
1227
|
+
return createPostponedAbortSignal;
|
|
1228
|
+
},
|
|
1229
|
+
formatDynamicAPIAccesses: function() {
|
|
1230
|
+
return formatDynamicAPIAccesses;
|
|
1231
|
+
},
|
|
1232
|
+
getFirstDynamicReason: function() {
|
|
1233
|
+
return getFirstDynamicReason;
|
|
1234
|
+
},
|
|
1235
|
+
isDynamicPostpone: function() {
|
|
1236
|
+
return isDynamicPostpone;
|
|
1237
|
+
},
|
|
1238
|
+
isPrerenderInterruptedError: function() {
|
|
1239
|
+
return isPrerenderInterruptedError;
|
|
1240
|
+
},
|
|
1241
|
+
markCurrentScopeAsDynamic: function() {
|
|
1242
|
+
return markCurrentScopeAsDynamic;
|
|
1243
|
+
},
|
|
1244
|
+
postponeWithTracking: function() {
|
|
1245
|
+
return postponeWithTracking;
|
|
1246
|
+
},
|
|
1247
|
+
throwIfDisallowedDynamic: function() {
|
|
1248
|
+
return throwIfDisallowedDynamic;
|
|
1249
|
+
},
|
|
1250
|
+
throwToInterruptStaticGeneration: function() {
|
|
1251
|
+
return throwToInterruptStaticGeneration;
|
|
1252
|
+
},
|
|
1253
|
+
trackAllowedDynamicAccess: function() {
|
|
1254
|
+
return trackAllowedDynamicAccess;
|
|
1255
|
+
},
|
|
1256
|
+
trackDynamicDataInDynamicRender: function() {
|
|
1257
|
+
return trackDynamicDataInDynamicRender;
|
|
1258
|
+
},
|
|
1259
|
+
trackFallbackParamAccessed: function() {
|
|
1260
|
+
return trackFallbackParamAccessed;
|
|
1261
|
+
},
|
|
1262
|
+
trackSynchronousPlatformIOAccessInDev: function() {
|
|
1263
|
+
return trackSynchronousPlatformIOAccessInDev;
|
|
1264
|
+
},
|
|
1265
|
+
trackSynchronousRequestDataAccessInDev: function() {
|
|
1266
|
+
return trackSynchronousRequestDataAccessInDev;
|
|
1267
|
+
},
|
|
1268
|
+
useDynamicRouteParams: function() {
|
|
1269
|
+
return useDynamicRouteParams;
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
var _react = /* @__PURE__ */ _interop_require_default(__require("react"));
|
|
1273
|
+
var _hooksservercontext = require_hooks_server_context();
|
|
1274
|
+
var _staticgenerationbailout = require_static_generation_bailout();
|
|
1275
|
+
var _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
1276
|
+
var _workasyncstorageexternal = require_work_async_storage_external();
|
|
1277
|
+
var _dynamicrenderingutils = require_dynamic_rendering_utils();
|
|
1278
|
+
var _metadataconstants = require_metadata_constants();
|
|
1279
|
+
var _scheduler = require_scheduler();
|
|
1280
|
+
function _interop_require_default(obj) {
|
|
1281
|
+
return obj && obj.__esModule ? obj : {
|
|
1282
|
+
default: obj
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
var hasPostpone = typeof _react.default.unstable_postpone === "function";
|
|
1286
|
+
function createDynamicTrackingState(isDebugDynamicAccesses) {
|
|
1287
|
+
return {
|
|
1288
|
+
isDebugDynamicAccesses,
|
|
1289
|
+
dynamicAccesses: [],
|
|
1290
|
+
syncDynamicExpression: void 0,
|
|
1291
|
+
syncDynamicErrorWithStack: null
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
function createDynamicValidationState() {
|
|
1295
|
+
return {
|
|
1296
|
+
hasSuspendedDynamic: false,
|
|
1297
|
+
hasDynamicMetadata: false,
|
|
1298
|
+
hasDynamicViewport: false,
|
|
1299
|
+
hasSyncDynamicErrors: false,
|
|
1300
|
+
dynamicErrors: []
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
function getFirstDynamicReason(trackingState) {
|
|
1304
|
+
var _trackingState_dynamicAccesses_;
|
|
1305
|
+
return (_trackingState_dynamicAccesses_ = trackingState.dynamicAccesses[0]) == null ? void 0 : _trackingState_dynamicAccesses_.expression;
|
|
1306
|
+
}
|
|
1307
|
+
function markCurrentScopeAsDynamic(store, workUnitStore, expression) {
|
|
1308
|
+
if (workUnitStore) {
|
|
1309
|
+
if (workUnitStore.type === "cache" || workUnitStore.type === "unstable-cache") {
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (store.forceDynamic || store.forceStatic)
|
|
1314
|
+
return;
|
|
1315
|
+
if (store.dynamicShouldError) {
|
|
1316
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${store.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
1317
|
+
value: "E553",
|
|
1318
|
+
enumerable: false,
|
|
1319
|
+
configurable: true
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
if (workUnitStore) {
|
|
1323
|
+
if (workUnitStore.type === "prerender-ppr") {
|
|
1324
|
+
postponeWithTracking(store.route, expression, workUnitStore.dynamicTracking);
|
|
1325
|
+
} else if (workUnitStore.type === "prerender-legacy") {
|
|
1326
|
+
workUnitStore.revalidate = 0;
|
|
1327
|
+
const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
|
|
1328
|
+
value: "E550",
|
|
1329
|
+
enumerable: false,
|
|
1330
|
+
configurable: true
|
|
1331
|
+
});
|
|
1332
|
+
store.dynamicUsageDescription = expression;
|
|
1333
|
+
store.dynamicUsageStack = err.stack;
|
|
1334
|
+
throw err;
|
|
1335
|
+
} else if (workUnitStore && workUnitStore.type === "request") {
|
|
1336
|
+
workUnitStore.usedDynamic = true;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function trackFallbackParamAccessed(store, expression) {
|
|
1341
|
+
const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
1342
|
+
if (!prerenderStore || prerenderStore.type !== "prerender-ppr")
|
|
1343
|
+
return;
|
|
1344
|
+
postponeWithTracking(store.route, expression, prerenderStore.dynamicTracking);
|
|
1345
|
+
}
|
|
1346
|
+
function throwToInterruptStaticGeneration(expression, store, prerenderStore) {
|
|
1347
|
+
const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
|
|
1348
|
+
value: "E558",
|
|
1349
|
+
enumerable: false,
|
|
1350
|
+
configurable: true
|
|
1351
|
+
});
|
|
1352
|
+
prerenderStore.revalidate = 0;
|
|
1353
|
+
store.dynamicUsageDescription = expression;
|
|
1354
|
+
store.dynamicUsageStack = err.stack;
|
|
1355
|
+
throw err;
|
|
1356
|
+
}
|
|
1357
|
+
function trackDynamicDataInDynamicRender(_store, workUnitStore) {
|
|
1358
|
+
if (workUnitStore) {
|
|
1359
|
+
if (workUnitStore.type === "cache" || workUnitStore.type === "unstable-cache") {
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
if (workUnitStore.type === "prerender" || workUnitStore.type === "prerender-legacy") {
|
|
1363
|
+
workUnitStore.revalidate = 0;
|
|
1364
|
+
}
|
|
1365
|
+
if (workUnitStore.type === "request") {
|
|
1366
|
+
workUnitStore.usedDynamic = true;
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
function abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore) {
|
|
1371
|
+
const reason = `Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`;
|
|
1372
|
+
const error = createPrerenderInterruptedError(reason);
|
|
1373
|
+
prerenderStore.controller.abort(error);
|
|
1374
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1375
|
+
if (dynamicTracking) {
|
|
1376
|
+
dynamicTracking.dynamicAccesses.push({
|
|
1377
|
+
// When we aren't debugging, we don't need to create another error for the
|
|
1378
|
+
// stack trace.
|
|
1379
|
+
stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : void 0,
|
|
1380
|
+
expression
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
function abortOnSynchronousPlatformIOAccess(route, expression, errorWithStack, prerenderStore) {
|
|
1385
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1386
|
+
if (dynamicTracking) {
|
|
1387
|
+
if (dynamicTracking.syncDynamicErrorWithStack === null) {
|
|
1388
|
+
dynamicTracking.syncDynamicExpression = expression;
|
|
1389
|
+
dynamicTracking.syncDynamicErrorWithStack = errorWithStack;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);
|
|
1393
|
+
}
|
|
1394
|
+
function trackSynchronousPlatformIOAccessInDev(requestStore) {
|
|
1395
|
+
requestStore.prerenderPhase = false;
|
|
1396
|
+
}
|
|
1397
|
+
function abortAndThrowOnSynchronousRequestDataAccess(route, expression, errorWithStack, prerenderStore) {
|
|
1398
|
+
const prerenderSignal = prerenderStore.controller.signal;
|
|
1399
|
+
if (prerenderSignal.aborted === false) {
|
|
1400
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1401
|
+
if (dynamicTracking) {
|
|
1402
|
+
if (dynamicTracking.syncDynamicErrorWithStack === null) {
|
|
1403
|
+
dynamicTracking.syncDynamicExpression = expression;
|
|
1404
|
+
dynamicTracking.syncDynamicErrorWithStack = errorWithStack;
|
|
1405
|
+
if (prerenderStore.validating === true) {
|
|
1406
|
+
dynamicTracking.syncDynamicLogged = true;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);
|
|
1411
|
+
}
|
|
1412
|
+
throw createPrerenderInterruptedError(`Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`);
|
|
1413
|
+
}
|
|
1414
|
+
var trackSynchronousRequestDataAccessInDev = trackSynchronousPlatformIOAccessInDev;
|
|
1415
|
+
function Postpone({ reason, route }) {
|
|
1416
|
+
const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
1417
|
+
const dynamicTracking = prerenderStore && prerenderStore.type === "prerender-ppr" ? prerenderStore.dynamicTracking : null;
|
|
1418
|
+
postponeWithTracking(route, reason, dynamicTracking);
|
|
1419
|
+
}
|
|
1420
|
+
function postponeWithTracking(route, expression, dynamicTracking) {
|
|
1421
|
+
assertPostpone();
|
|
1422
|
+
if (dynamicTracking) {
|
|
1423
|
+
dynamicTracking.dynamicAccesses.push({
|
|
1424
|
+
// When we aren't debugging, we don't need to create another error for the
|
|
1425
|
+
// stack trace.
|
|
1426
|
+
stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : void 0,
|
|
1427
|
+
expression
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
_react.default.unstable_postpone(createPostponeReason(route, expression));
|
|
1431
|
+
}
|
|
1432
|
+
function createPostponeReason(route, expression) {
|
|
1433
|
+
return `Route ${route} needs to bail out of prerendering at this point because it used ${expression}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;
|
|
1434
|
+
}
|
|
1435
|
+
function isDynamicPostpone(err) {
|
|
1436
|
+
if (typeof err === "object" && err !== null && typeof err.message === "string") {
|
|
1437
|
+
return isDynamicPostponeReason(err.message);
|
|
1438
|
+
}
|
|
1439
|
+
return false;
|
|
1440
|
+
}
|
|
1441
|
+
function isDynamicPostponeReason(reason) {
|
|
1442
|
+
return reason.includes("needs to bail out of prerendering at this point because it used") && reason.includes("Learn more: https://nextjs.org/docs/messages/ppr-caught-error");
|
|
1443
|
+
}
|
|
1444
|
+
if (isDynamicPostponeReason(createPostponeReason("%%%", "^^^")) === false) {
|
|
1445
|
+
throw Object.defineProperty(new Error("Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js"), "__NEXT_ERROR_CODE", {
|
|
1446
|
+
value: "E296",
|
|
1447
|
+
enumerable: false,
|
|
1448
|
+
configurable: true
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
var NEXT_PRERENDER_INTERRUPTED = "NEXT_PRERENDER_INTERRUPTED";
|
|
1452
|
+
function createPrerenderInterruptedError(message) {
|
|
1453
|
+
const error = Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
|
|
1454
|
+
value: "E394",
|
|
1455
|
+
enumerable: false,
|
|
1456
|
+
configurable: true
|
|
1457
|
+
});
|
|
1458
|
+
error.digest = NEXT_PRERENDER_INTERRUPTED;
|
|
1459
|
+
return error;
|
|
1460
|
+
}
|
|
1461
|
+
function isPrerenderInterruptedError(error) {
|
|
1462
|
+
return typeof error === "object" && error !== null && error.digest === NEXT_PRERENDER_INTERRUPTED && "name" in error && "message" in error && error instanceof Error;
|
|
1463
|
+
}
|
|
1464
|
+
function accessedDynamicData(dynamicAccesses) {
|
|
1465
|
+
return dynamicAccesses.length > 0;
|
|
1466
|
+
}
|
|
1467
|
+
function consumeDynamicAccess(serverDynamic, clientDynamic) {
|
|
1468
|
+
serverDynamic.dynamicAccesses.push(...clientDynamic.dynamicAccesses);
|
|
1469
|
+
return serverDynamic.dynamicAccesses;
|
|
1470
|
+
}
|
|
1471
|
+
function formatDynamicAPIAccesses(dynamicAccesses) {
|
|
1472
|
+
return dynamicAccesses.filter((access) => typeof access.stack === "string" && access.stack.length > 0).map(({ expression, stack }) => {
|
|
1473
|
+
stack = stack.split("\n").slice(4).filter((line) => {
|
|
1474
|
+
if (line.includes("node_modules/next/")) {
|
|
1475
|
+
return false;
|
|
1476
|
+
}
|
|
1477
|
+
if (line.includes(" (<anonymous>)")) {
|
|
1478
|
+
return false;
|
|
1479
|
+
}
|
|
1480
|
+
if (line.includes(" (node:")) {
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
return true;
|
|
1484
|
+
}).join("\n");
|
|
1485
|
+
return `Dynamic API Usage Debug - ${expression}:
|
|
1486
|
+
${stack}`;
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
function assertPostpone() {
|
|
1490
|
+
if (!hasPostpone) {
|
|
1491
|
+
throw Object.defineProperty(new Error(`Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js`), "__NEXT_ERROR_CODE", {
|
|
1492
|
+
value: "E224",
|
|
1493
|
+
enumerable: false,
|
|
1494
|
+
configurable: true
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
function createPostponedAbortSignal(reason) {
|
|
1499
|
+
assertPostpone();
|
|
1500
|
+
const controller = new AbortController();
|
|
1501
|
+
try {
|
|
1502
|
+
_react.default.unstable_postpone(reason);
|
|
1503
|
+
} catch (x) {
|
|
1504
|
+
controller.abort(x);
|
|
1505
|
+
}
|
|
1506
|
+
return controller.signal;
|
|
1507
|
+
}
|
|
1508
|
+
function createHangingInputAbortSignal(workUnitStore) {
|
|
1509
|
+
const controller = new AbortController();
|
|
1510
|
+
if (workUnitStore.cacheSignal) {
|
|
1511
|
+
workUnitStore.cacheSignal.inputReady().then(() => {
|
|
1512
|
+
controller.abort();
|
|
1513
|
+
});
|
|
1514
|
+
} else {
|
|
1515
|
+
(0, _scheduler.scheduleOnNextTick)(() => controller.abort());
|
|
1516
|
+
}
|
|
1517
|
+
return controller.signal;
|
|
1518
|
+
}
|
|
1519
|
+
function annotateDynamicAccess(expression, prerenderStore) {
|
|
1520
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1521
|
+
if (dynamicTracking) {
|
|
1522
|
+
dynamicTracking.dynamicAccesses.push({
|
|
1523
|
+
stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : void 0,
|
|
1524
|
+
expression
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
function useDynamicRouteParams(expression) {
|
|
1529
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
1530
|
+
if (workStore && workStore.isStaticGeneration && workStore.fallbackRouteParams && workStore.fallbackRouteParams.size > 0) {
|
|
1531
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
1532
|
+
if (workUnitStore) {
|
|
1533
|
+
if (workUnitStore.type === "prerender") {
|
|
1534
|
+
_react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, expression));
|
|
1535
|
+
} else if (workUnitStore.type === "prerender-ppr") {
|
|
1536
|
+
postponeWithTracking(workStore.route, expression, workUnitStore.dynamicTracking);
|
|
1537
|
+
} else if (workUnitStore.type === "prerender-legacy") {
|
|
1538
|
+
throwToInterruptStaticGeneration(expression, workStore, workUnitStore);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
var hasSuspenseRegex = /\n\s+at Suspense \(<anonymous>\)/;
|
|
1544
|
+
var hasMetadataRegex = new RegExp(`\\n\\s+at ${_metadataconstants.METADATA_BOUNDARY_NAME}[\\n\\s]`);
|
|
1545
|
+
var hasViewportRegex = new RegExp(`\\n\\s+at ${_metadataconstants.VIEWPORT_BOUNDARY_NAME}[\\n\\s]`);
|
|
1546
|
+
var hasOutletRegex = new RegExp(`\\n\\s+at ${_metadataconstants.OUTLET_BOUNDARY_NAME}[\\n\\s]`);
|
|
1547
|
+
function trackAllowedDynamicAccess(route, componentStack, dynamicValidation, serverDynamic, clientDynamic) {
|
|
1548
|
+
if (hasOutletRegex.test(componentStack)) {
|
|
1549
|
+
return;
|
|
1550
|
+
} else if (hasMetadataRegex.test(componentStack)) {
|
|
1551
|
+
dynamicValidation.hasDynamicMetadata = true;
|
|
1552
|
+
return;
|
|
1553
|
+
} else if (hasViewportRegex.test(componentStack)) {
|
|
1554
|
+
dynamicValidation.hasDynamicViewport = true;
|
|
1555
|
+
return;
|
|
1556
|
+
} else if (hasSuspenseRegex.test(componentStack)) {
|
|
1557
|
+
dynamicValidation.hasSuspendedDynamic = true;
|
|
1558
|
+
return;
|
|
1559
|
+
} else if (serverDynamic.syncDynamicErrorWithStack || clientDynamic.syncDynamicErrorWithStack) {
|
|
1560
|
+
dynamicValidation.hasSyncDynamicErrors = true;
|
|
1561
|
+
return;
|
|
1562
|
+
} else {
|
|
1563
|
+
const message = `Route "${route}": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don't have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense`;
|
|
1564
|
+
const error = createErrorWithComponentStack(message, componentStack);
|
|
1565
|
+
dynamicValidation.dynamicErrors.push(error);
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
function createErrorWithComponentStack(message, componentStack) {
|
|
1570
|
+
const error = Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
|
|
1571
|
+
value: "E394",
|
|
1572
|
+
enumerable: false,
|
|
1573
|
+
configurable: true
|
|
1574
|
+
});
|
|
1575
|
+
error.stack = "Error: " + message + componentStack;
|
|
1576
|
+
return error;
|
|
1577
|
+
}
|
|
1578
|
+
function throwIfDisallowedDynamic(route, dynamicValidation, serverDynamic, clientDynamic) {
|
|
1579
|
+
let syncError;
|
|
1580
|
+
let syncExpression;
|
|
1581
|
+
let syncLogged;
|
|
1582
|
+
if (serverDynamic.syncDynamicErrorWithStack) {
|
|
1583
|
+
syncError = serverDynamic.syncDynamicErrorWithStack;
|
|
1584
|
+
syncExpression = serverDynamic.syncDynamicExpression;
|
|
1585
|
+
syncLogged = serverDynamic.syncDynamicLogged === true;
|
|
1586
|
+
} else if (clientDynamic.syncDynamicErrorWithStack) {
|
|
1587
|
+
syncError = clientDynamic.syncDynamicErrorWithStack;
|
|
1588
|
+
syncExpression = clientDynamic.syncDynamicExpression;
|
|
1589
|
+
syncLogged = clientDynamic.syncDynamicLogged === true;
|
|
1590
|
+
} else {
|
|
1591
|
+
syncError = null;
|
|
1592
|
+
syncExpression = void 0;
|
|
1593
|
+
syncLogged = false;
|
|
1594
|
+
}
|
|
1595
|
+
if (dynamicValidation.hasSyncDynamicErrors && syncError) {
|
|
1596
|
+
if (!syncLogged) {
|
|
1597
|
+
console.error(syncError);
|
|
1598
|
+
}
|
|
1599
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
1600
|
+
}
|
|
1601
|
+
const dynamicErrors = dynamicValidation.dynamicErrors;
|
|
1602
|
+
if (dynamicErrors.length) {
|
|
1603
|
+
for (let i = 0; i < dynamicErrors.length; i++) {
|
|
1604
|
+
console.error(dynamicErrors[i]);
|
|
1605
|
+
}
|
|
1606
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
1607
|
+
}
|
|
1608
|
+
if (!dynamicValidation.hasSuspendedDynamic) {
|
|
1609
|
+
if (dynamicValidation.hasDynamicMetadata) {
|
|
1610
|
+
if (syncError) {
|
|
1611
|
+
console.error(syncError);
|
|
1612
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateMetadata\` that could not finish rendering before ${syncExpression} was used. Follow the instructions in the error for this expression to resolve.`), "__NEXT_ERROR_CODE", {
|
|
1613
|
+
value: "E608",
|
|
1614
|
+
enumerable: false,
|
|
1615
|
+
configurable: true
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateMetadata\` that depends on Request data (\`cookies()\`, etc...) or external data (\`fetch(...)\`, etc...) but the rest of the route was static or only used cached data (\`"use cache"\`). If you expected this route to be prerenderable update your \`generateMetadata\` to not use Request data and only use cached external data. Otherwise, add \`await connection()\` somewhere within this route to indicate explicitly it should not be prerendered.`), "__NEXT_ERROR_CODE", {
|
|
1619
|
+
value: "E534",
|
|
1620
|
+
enumerable: false,
|
|
1621
|
+
configurable: true
|
|
1622
|
+
});
|
|
1623
|
+
} else if (dynamicValidation.hasDynamicViewport) {
|
|
1624
|
+
if (syncError) {
|
|
1625
|
+
console.error(syncError);
|
|
1626
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateViewport\` that could not finish rendering before ${syncExpression} was used. Follow the instructions in the error for this expression to resolve.`), "__NEXT_ERROR_CODE", {
|
|
1627
|
+
value: "E573",
|
|
1628
|
+
enumerable: false,
|
|
1629
|
+
configurable: true
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route "${route}" has a \`generateViewport\` that depends on Request data (\`cookies()\`, etc...) or external data (\`fetch(...)\`, etc...) but the rest of the route was static or only used cached data (\`"use cache"\`). If you expected this route to be prerenderable update your \`generateViewport\` to not use Request data and only use cached external data. Otherwise, add \`await connection()\` somewhere within this route to indicate explicitly it should not be prerendered.`), "__NEXT_ERROR_CODE", {
|
|
1633
|
+
value: "E590",
|
|
1634
|
+
enumerable: false,
|
|
1635
|
+
configurable: true
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
// ../../node_modules/next/dist/server/create-deduped-by-callsite-server-error-logger.js
|
|
1644
|
+
var require_create_deduped_by_callsite_server_error_logger = __commonJS({
|
|
1645
|
+
"../../node_modules/next/dist/server/create-deduped-by-callsite-server-error-logger.js"(exports) {
|
|
1646
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1647
|
+
value: true
|
|
1648
|
+
});
|
|
1649
|
+
Object.defineProperty(exports, "createDedupedByCallsiteServerErrorLoggerDev", {
|
|
1650
|
+
enumerable: true,
|
|
1651
|
+
get: function() {
|
|
1652
|
+
return createDedupedByCallsiteServerErrorLoggerDev;
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
var _react = /* @__PURE__ */ _interop_require_wildcard(__require("react"));
|
|
1656
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
1657
|
+
if (typeof WeakMap !== "function")
|
|
1658
|
+
return null;
|
|
1659
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
1660
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
1661
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
1662
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
1663
|
+
})(nodeInterop);
|
|
1664
|
+
}
|
|
1665
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
1666
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
1667
|
+
return obj;
|
|
1668
|
+
}
|
|
1669
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
1670
|
+
return {
|
|
1671
|
+
default: obj
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
var cache2 = _getRequireWildcardCache(nodeInterop);
|
|
1675
|
+
if (cache2 && cache2.has(obj)) {
|
|
1676
|
+
return cache2.get(obj);
|
|
1677
|
+
}
|
|
1678
|
+
var newObj = {
|
|
1679
|
+
__proto__: null
|
|
1680
|
+
};
|
|
1681
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
1682
|
+
for (var key in obj) {
|
|
1683
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1684
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
1685
|
+
if (desc && (desc.get || desc.set)) {
|
|
1686
|
+
Object.defineProperty(newObj, key, desc);
|
|
1687
|
+
} else {
|
|
1688
|
+
newObj[key] = obj[key];
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
newObj.default = obj;
|
|
1693
|
+
if (cache2) {
|
|
1694
|
+
cache2.set(obj, newObj);
|
|
1695
|
+
}
|
|
1696
|
+
return newObj;
|
|
1697
|
+
}
|
|
1698
|
+
var errorRef = {
|
|
1699
|
+
current: null
|
|
1700
|
+
};
|
|
1701
|
+
var cache = typeof _react.cache === "function" ? _react.cache : (fn) => fn;
|
|
1702
|
+
var logErrorOrWarn = process.env.__NEXT_DYNAMIC_IO ? console.error : console.warn;
|
|
1703
|
+
var flushCurrentErrorIfNew = cache(
|
|
1704
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- cache key
|
|
1705
|
+
(key) => {
|
|
1706
|
+
try {
|
|
1707
|
+
logErrorOrWarn(errorRef.current);
|
|
1708
|
+
} finally {
|
|
1709
|
+
errorRef.current = null;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
);
|
|
1713
|
+
function createDedupedByCallsiteServerErrorLoggerDev(getMessage) {
|
|
1714
|
+
return function logDedupedError(...args) {
|
|
1715
|
+
const message = getMessage(...args);
|
|
1716
|
+
{
|
|
1717
|
+
var _stack;
|
|
1718
|
+
const callStackFrames = (_stack = new Error().stack) == null ? void 0 : _stack.split("\n");
|
|
1719
|
+
if (callStackFrames === void 0 || callStackFrames.length < 4) {
|
|
1720
|
+
logErrorOrWarn(message);
|
|
1721
|
+
} else {
|
|
1722
|
+
const key = callStackFrames[4];
|
|
1723
|
+
errorRef.current = message;
|
|
1724
|
+
flushCurrentErrorIfNew(key);
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
// ../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js
|
|
1733
|
+
var require_after_task_async_storage_instance = __commonJS({
|
|
1734
|
+
"../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js"(exports) {
|
|
1735
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1736
|
+
value: true
|
|
1737
|
+
});
|
|
1738
|
+
Object.defineProperty(exports, "afterTaskAsyncStorageInstance", {
|
|
1739
|
+
enumerable: true,
|
|
1740
|
+
get: function() {
|
|
1741
|
+
return afterTaskAsyncStorageInstance;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
var _asynclocalstorage = require_async_local_storage();
|
|
1745
|
+
var afterTaskAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
|
|
1749
|
+
// ../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js
|
|
1750
|
+
var require_after_task_async_storage_external = __commonJS({
|
|
1751
|
+
"../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js"(exports) {
|
|
1752
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1753
|
+
value: true
|
|
1754
|
+
});
|
|
1755
|
+
Object.defineProperty(exports, "afterTaskAsyncStorage", {
|
|
1756
|
+
enumerable: true,
|
|
1757
|
+
get: function() {
|
|
1758
|
+
return _aftertaskasyncstorageinstance.afterTaskAsyncStorageInstance;
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
var _aftertaskasyncstorageinstance = require_after_task_async_storage_instance();
|
|
1762
|
+
}
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
// ../../node_modules/next/dist/server/request/utils.js
|
|
1766
|
+
var require_utils = __commonJS({
|
|
1767
|
+
"../../node_modules/next/dist/server/request/utils.js"(exports) {
|
|
1768
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1769
|
+
value: true
|
|
1770
|
+
});
|
|
1771
|
+
function _export(target, all) {
|
|
1772
|
+
for (var name in all)
|
|
1773
|
+
Object.defineProperty(target, name, {
|
|
1774
|
+
enumerable: true,
|
|
1775
|
+
get: all[name]
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
_export(exports, {
|
|
1779
|
+
isRequestAPICallableInsideAfter: function() {
|
|
1780
|
+
return isRequestAPICallableInsideAfter;
|
|
1781
|
+
},
|
|
1782
|
+
throwForSearchParamsAccessInUseCache: function() {
|
|
1783
|
+
return throwForSearchParamsAccessInUseCache;
|
|
1784
|
+
},
|
|
1785
|
+
throwWithStaticGenerationBailoutError: function() {
|
|
1786
|
+
return throwWithStaticGenerationBailoutError;
|
|
1787
|
+
},
|
|
1788
|
+
throwWithStaticGenerationBailoutErrorWithDynamicError: function() {
|
|
1789
|
+
return throwWithStaticGenerationBailoutErrorWithDynamicError;
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
var _staticgenerationbailout = require_static_generation_bailout();
|
|
1793
|
+
var _aftertaskasyncstorageexternal = require_after_task_async_storage_external();
|
|
1794
|
+
function throwWithStaticGenerationBailoutError(route, expression) {
|
|
1795
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
1796
|
+
value: "E576",
|
|
1797
|
+
enumerable: false,
|
|
1798
|
+
configurable: true
|
|
1799
|
+
});
|
|
1800
|
+
}
|
|
1801
|
+
function throwWithStaticGenerationBailoutErrorWithDynamicError(route, expression) {
|
|
1802
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${route} with \`dynamic = "error"\` couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
1803
|
+
value: "E543",
|
|
1804
|
+
enumerable: false,
|
|
1805
|
+
configurable: true
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
function throwForSearchParamsAccessInUseCache(workStore) {
|
|
1809
|
+
const error = Object.defineProperty(new Error(`Route ${workStore.route} used "searchParams" inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "searchParams" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
1810
|
+
value: "E634",
|
|
1811
|
+
enumerable: false,
|
|
1812
|
+
configurable: true
|
|
1813
|
+
});
|
|
1814
|
+
workStore.invalidUsageError ?? (workStore.invalidUsageError = error);
|
|
1815
|
+
throw error;
|
|
1816
|
+
}
|
|
1817
|
+
function isRequestAPICallableInsideAfter() {
|
|
1818
|
+
const afterTaskStore = _aftertaskasyncstorageexternal.afterTaskAsyncStorage.getStore();
|
|
1819
|
+
return (afterTaskStore == null ? void 0 : afterTaskStore.rootTaskSpawnPhase) === "action";
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1824
|
+
// ../../node_modules/next/dist/server/request/cookies.js
|
|
1825
|
+
var require_cookies3 = __commonJS({
|
|
1826
|
+
"../../node_modules/next/dist/server/request/cookies.js"(exports) {
|
|
1827
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1828
|
+
value: true
|
|
1829
|
+
});
|
|
1830
|
+
Object.defineProperty(exports, "cookies", {
|
|
1831
|
+
enumerable: true,
|
|
1832
|
+
get: function() {
|
|
1833
|
+
return cookies2;
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
var _requestcookies = require_request_cookies();
|
|
1837
|
+
var _cookies = require_cookies2();
|
|
1838
|
+
var _workasyncstorageexternal = require_work_async_storage_external();
|
|
1839
|
+
var _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
1840
|
+
var _dynamicrendering = require_dynamic_rendering();
|
|
1841
|
+
var _staticgenerationbailout = require_static_generation_bailout();
|
|
1842
|
+
var _dynamicrenderingutils = require_dynamic_rendering_utils();
|
|
1843
|
+
var _creatededupedbycallsiteservererrorlogger = require_create_deduped_by_callsite_server_error_logger();
|
|
1844
|
+
var _scheduler = require_scheduler();
|
|
1845
|
+
var _utils = require_utils();
|
|
1846
|
+
function cookies2() {
|
|
1847
|
+
const callingExpression = "cookies";
|
|
1848
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
1849
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
1850
|
+
if (workStore) {
|
|
1851
|
+
if (workUnitStore && workUnitStore.phase === "after" && !(0, _utils.isRequestAPICallableInsideAfter)()) {
|
|
1852
|
+
throw Object.defineProperty(new Error(
|
|
1853
|
+
// TODO(after): clarify that this only applies to pages?
|
|
1854
|
+
`Route ${workStore.route} used "cookies" inside "after(...)". This is not supported. If you need this data inside an "after" callback, use "cookies" outside of the callback. See more info here: https://nextjs.org/docs/canary/app/api-reference/functions/after`
|
|
1855
|
+
), "__NEXT_ERROR_CODE", {
|
|
1856
|
+
value: "E88",
|
|
1857
|
+
enumerable: false,
|
|
1858
|
+
configurable: true
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
if (workStore.forceStatic) {
|
|
1862
|
+
const underlyingCookies2 = createEmptyCookies();
|
|
1863
|
+
return makeUntrackedExoticCookies(underlyingCookies2);
|
|
1864
|
+
}
|
|
1865
|
+
if (workUnitStore) {
|
|
1866
|
+
if (workUnitStore.type === "cache") {
|
|
1867
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used "cookies" inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "cookies" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
1868
|
+
value: "E398",
|
|
1869
|
+
enumerable: false,
|
|
1870
|
+
configurable: true
|
|
1871
|
+
});
|
|
1872
|
+
} else if (workUnitStore.type === "unstable-cache") {
|
|
1873
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used "cookies" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "cookies" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
1874
|
+
value: "E157",
|
|
1875
|
+
enumerable: false,
|
|
1876
|
+
configurable: true
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
if (workStore.dynamicShouldError) {
|
|
1881
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`cookies\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
1882
|
+
value: "E549",
|
|
1883
|
+
enumerable: false,
|
|
1884
|
+
configurable: true
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
if (workUnitStore) {
|
|
1888
|
+
if (workUnitStore.type === "prerender") {
|
|
1889
|
+
return makeDynamicallyTrackedExoticCookies(workStore.route, workUnitStore);
|
|
1890
|
+
} else if (workUnitStore.type === "prerender-ppr") {
|
|
1891
|
+
(0, _dynamicrendering.postponeWithTracking)(workStore.route, callingExpression, workUnitStore.dynamicTracking);
|
|
1892
|
+
} else if (workUnitStore.type === "prerender-legacy") {
|
|
1893
|
+
(0, _dynamicrendering.throwToInterruptStaticGeneration)(callingExpression, workStore, workUnitStore);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
(0, _dynamicrendering.trackDynamicDataInDynamicRender)(workStore, workUnitStore);
|
|
1897
|
+
}
|
|
1898
|
+
const requestStore = (0, _workunitasyncstorageexternal.getExpectedRequestStore)(callingExpression);
|
|
1899
|
+
let underlyingCookies;
|
|
1900
|
+
if ((0, _requestcookies.areCookiesMutableInCurrentPhase)(requestStore)) {
|
|
1901
|
+
underlyingCookies = requestStore.userspaceMutableCookies;
|
|
1902
|
+
} else {
|
|
1903
|
+
underlyingCookies = requestStore.cookies;
|
|
1904
|
+
}
|
|
1905
|
+
if (!(workStore == null ? void 0 : workStore.isPrefetchRequest)) {
|
|
1906
|
+
return makeUntrackedExoticCookiesWithDevWarnings(underlyingCookies, workStore == null ? void 0 : workStore.route);
|
|
1907
|
+
} else {
|
|
1908
|
+
return makeUntrackedExoticCookies(underlyingCookies);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
function createEmptyCookies() {
|
|
1912
|
+
return _requestcookies.RequestCookiesAdapter.seal(new _cookies.RequestCookies(new Headers({})));
|
|
1913
|
+
}
|
|
1914
|
+
var CachedCookies = /* @__PURE__ */ new WeakMap();
|
|
1915
|
+
function makeDynamicallyTrackedExoticCookies(route, prerenderStore) {
|
|
1916
|
+
const cachedPromise = CachedCookies.get(prerenderStore);
|
|
1917
|
+
if (cachedPromise) {
|
|
1918
|
+
return cachedPromise;
|
|
1919
|
+
}
|
|
1920
|
+
const promise = (0, _dynamicrenderingutils.makeHangingPromise)(prerenderStore.renderSignal, "`cookies()`");
|
|
1921
|
+
CachedCookies.set(prerenderStore, promise);
|
|
1922
|
+
Object.defineProperties(promise, {
|
|
1923
|
+
[Symbol.iterator]: {
|
|
1924
|
+
value: function() {
|
|
1925
|
+
const expression = "`cookies()[Symbol.iterator]()`";
|
|
1926
|
+
const error = createCookiesAccessError(route, expression);
|
|
1927
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
size: {
|
|
1931
|
+
get() {
|
|
1932
|
+
const expression = "`cookies().size`";
|
|
1933
|
+
const error = createCookiesAccessError(route, expression);
|
|
1934
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
1935
|
+
}
|
|
1936
|
+
},
|
|
1937
|
+
get: {
|
|
1938
|
+
value: function get() {
|
|
1939
|
+
let expression;
|
|
1940
|
+
if (arguments.length === 0) {
|
|
1941
|
+
expression = "`cookies().get()`";
|
|
1942
|
+
} else {
|
|
1943
|
+
expression = `\`cookies().get(${describeNameArg(arguments[0])})\``;
|
|
1944
|
+
}
|
|
1945
|
+
const error = createCookiesAccessError(route, expression);
|
|
1946
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
1947
|
+
}
|
|
1948
|
+
},
|
|
1949
|
+
getAll: {
|
|
1950
|
+
value: function getAll() {
|
|
1951
|
+
let expression;
|
|
1952
|
+
if (arguments.length === 0) {
|
|
1953
|
+
expression = "`cookies().getAll()`";
|
|
1954
|
+
} else {
|
|
1955
|
+
expression = `\`cookies().getAll(${describeNameArg(arguments[0])})\``;
|
|
1956
|
+
}
|
|
1957
|
+
const error = createCookiesAccessError(route, expression);
|
|
1958
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
1959
|
+
}
|
|
1960
|
+
},
|
|
1961
|
+
has: {
|
|
1962
|
+
value: function has() {
|
|
1963
|
+
let expression;
|
|
1964
|
+
if (arguments.length === 0) {
|
|
1965
|
+
expression = "`cookies().has()`";
|
|
1966
|
+
} else {
|
|
1967
|
+
expression = `\`cookies().has(${describeNameArg(arguments[0])})\``;
|
|
1968
|
+
}
|
|
1969
|
+
const error = createCookiesAccessError(route, expression);
|
|
1970
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
1971
|
+
}
|
|
1972
|
+
},
|
|
1973
|
+
set: {
|
|
1974
|
+
value: function set() {
|
|
1975
|
+
let expression;
|
|
1976
|
+
if (arguments.length === 0) {
|
|
1977
|
+
expression = "`cookies().set()`";
|
|
1978
|
+
} else {
|
|
1979
|
+
const arg = arguments[0];
|
|
1980
|
+
if (arg) {
|
|
1981
|
+
expression = `\`cookies().set(${describeNameArg(arg)}, ...)\``;
|
|
1982
|
+
} else {
|
|
1983
|
+
expression = "`cookies().set(...)`";
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
const error = createCookiesAccessError(route, expression);
|
|
1987
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
delete: {
|
|
1991
|
+
value: function() {
|
|
1992
|
+
let expression;
|
|
1993
|
+
if (arguments.length === 0) {
|
|
1994
|
+
expression = "`cookies().delete()`";
|
|
1995
|
+
} else if (arguments.length === 1) {
|
|
1996
|
+
expression = `\`cookies().delete(${describeNameArg(arguments[0])})\``;
|
|
1997
|
+
} else {
|
|
1998
|
+
expression = `\`cookies().delete(${describeNameArg(arguments[0])}, ...)\``;
|
|
1999
|
+
}
|
|
2000
|
+
const error = createCookiesAccessError(route, expression);
|
|
2001
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2002
|
+
}
|
|
2003
|
+
},
|
|
2004
|
+
clear: {
|
|
2005
|
+
value: function clear() {
|
|
2006
|
+
const expression = "`cookies().clear()`";
|
|
2007
|
+
const error = createCookiesAccessError(route, expression);
|
|
2008
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
2011
|
+
toString: {
|
|
2012
|
+
value: function toString() {
|
|
2013
|
+
const expression = "`cookies().toString()`";
|
|
2014
|
+
const error = createCookiesAccessError(route, expression);
|
|
2015
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
});
|
|
2019
|
+
return promise;
|
|
2020
|
+
}
|
|
2021
|
+
function makeUntrackedExoticCookies(underlyingCookies) {
|
|
2022
|
+
const cachedCookies = CachedCookies.get(underlyingCookies);
|
|
2023
|
+
if (cachedCookies) {
|
|
2024
|
+
return cachedCookies;
|
|
2025
|
+
}
|
|
2026
|
+
const promise = Promise.resolve(underlyingCookies);
|
|
2027
|
+
CachedCookies.set(underlyingCookies, promise);
|
|
2028
|
+
Object.defineProperties(promise, {
|
|
2029
|
+
[Symbol.iterator]: {
|
|
2030
|
+
value: underlyingCookies[Symbol.iterator] ? underlyingCookies[Symbol.iterator].bind(underlyingCookies) : (
|
|
2031
|
+
// We should remove this and unify our cookies types. We could just let this continue to throw lazily
|
|
2032
|
+
// but that's already a hard thing to debug so we may as well implement it consistently. The biggest problem with
|
|
2033
|
+
// implementing this in this way is the underlying cookie type is a ResponseCookie and not a RequestCookie and so it
|
|
2034
|
+
// has extra properties not available on RequestCookie instances.
|
|
2035
|
+
polyfilledResponseCookiesIterator.bind(underlyingCookies)
|
|
2036
|
+
)
|
|
2037
|
+
},
|
|
2038
|
+
size: {
|
|
2039
|
+
get() {
|
|
2040
|
+
return underlyingCookies.size;
|
|
2041
|
+
}
|
|
2042
|
+
},
|
|
2043
|
+
get: {
|
|
2044
|
+
value: underlyingCookies.get.bind(underlyingCookies)
|
|
2045
|
+
},
|
|
2046
|
+
getAll: {
|
|
2047
|
+
value: underlyingCookies.getAll.bind(underlyingCookies)
|
|
2048
|
+
},
|
|
2049
|
+
has: {
|
|
2050
|
+
value: underlyingCookies.has.bind(underlyingCookies)
|
|
2051
|
+
},
|
|
2052
|
+
set: {
|
|
2053
|
+
value: underlyingCookies.set.bind(underlyingCookies)
|
|
2054
|
+
},
|
|
2055
|
+
delete: {
|
|
2056
|
+
value: underlyingCookies.delete.bind(underlyingCookies)
|
|
2057
|
+
},
|
|
2058
|
+
clear: {
|
|
2059
|
+
value: (
|
|
2060
|
+
// @ts-expect-error clear is defined in RequestCookies implementation but not in the type
|
|
2061
|
+
typeof underlyingCookies.clear === "function" ? underlyingCookies.clear.bind(underlyingCookies) : (
|
|
2062
|
+
// We should remove this and unify our cookies types. We could just let this continue to throw lazily
|
|
2063
|
+
// but that's already a hard thing to debug so we may as well implement it consistently. The biggest problem with
|
|
2064
|
+
// implementing this in this way is the underlying cookie type is a ResponseCookie and not a RequestCookie and so it
|
|
2065
|
+
// has extra properties not available on RequestCookie instances.
|
|
2066
|
+
polyfilledResponseCookiesClear.bind(underlyingCookies, promise)
|
|
2067
|
+
)
|
|
2068
|
+
)
|
|
2069
|
+
},
|
|
2070
|
+
toString: {
|
|
2071
|
+
value: underlyingCookies.toString.bind(underlyingCookies)
|
|
2072
|
+
}
|
|
2073
|
+
});
|
|
2074
|
+
return promise;
|
|
2075
|
+
}
|
|
2076
|
+
function makeUntrackedExoticCookiesWithDevWarnings(underlyingCookies, route) {
|
|
2077
|
+
const cachedCookies = CachedCookies.get(underlyingCookies);
|
|
2078
|
+
if (cachedCookies) {
|
|
2079
|
+
return cachedCookies;
|
|
2080
|
+
}
|
|
2081
|
+
const promise = new Promise((resolve) => (0, _scheduler.scheduleImmediate)(() => resolve(underlyingCookies)));
|
|
2082
|
+
CachedCookies.set(underlyingCookies, promise);
|
|
2083
|
+
Object.defineProperties(promise, {
|
|
2084
|
+
[Symbol.iterator]: {
|
|
2085
|
+
value: function() {
|
|
2086
|
+
const expression = "`...cookies()` or similar iteration";
|
|
2087
|
+
syncIODev(route, expression);
|
|
2088
|
+
return underlyingCookies[Symbol.iterator] ? underlyingCookies[Symbol.iterator].apply(underlyingCookies, arguments) : (
|
|
2089
|
+
// We should remove this and unify our cookies types. We could just let this continue to throw lazily
|
|
2090
|
+
// but that's already a hard thing to debug so we may as well implement it consistently. The biggest problem with
|
|
2091
|
+
// implementing this in this way is the underlying cookie type is a ResponseCookie and not a RequestCookie and so it
|
|
2092
|
+
// has extra properties not available on RequestCookie instances.
|
|
2093
|
+
polyfilledResponseCookiesIterator.call(underlyingCookies)
|
|
2094
|
+
);
|
|
2095
|
+
},
|
|
2096
|
+
writable: false
|
|
2097
|
+
},
|
|
2098
|
+
size: {
|
|
2099
|
+
get() {
|
|
2100
|
+
const expression = "`cookies().size`";
|
|
2101
|
+
syncIODev(route, expression);
|
|
2102
|
+
return underlyingCookies.size;
|
|
2103
|
+
}
|
|
2104
|
+
},
|
|
2105
|
+
get: {
|
|
2106
|
+
value: function get() {
|
|
2107
|
+
let expression;
|
|
2108
|
+
if (arguments.length === 0) {
|
|
2109
|
+
expression = "`cookies().get()`";
|
|
2110
|
+
} else {
|
|
2111
|
+
expression = `\`cookies().get(${describeNameArg(arguments[0])})\``;
|
|
2112
|
+
}
|
|
2113
|
+
syncIODev(route, expression);
|
|
2114
|
+
return underlyingCookies.get.apply(underlyingCookies, arguments);
|
|
2115
|
+
},
|
|
2116
|
+
writable: false
|
|
2117
|
+
},
|
|
2118
|
+
getAll: {
|
|
2119
|
+
value: function getAll() {
|
|
2120
|
+
let expression;
|
|
2121
|
+
if (arguments.length === 0) {
|
|
2122
|
+
expression = "`cookies().getAll()`";
|
|
2123
|
+
} else {
|
|
2124
|
+
expression = `\`cookies().getAll(${describeNameArg(arguments[0])})\``;
|
|
2125
|
+
}
|
|
2126
|
+
syncIODev(route, expression);
|
|
2127
|
+
return underlyingCookies.getAll.apply(underlyingCookies, arguments);
|
|
2128
|
+
},
|
|
2129
|
+
writable: false
|
|
2130
|
+
},
|
|
2131
|
+
has: {
|
|
2132
|
+
value: function get() {
|
|
2133
|
+
let expression;
|
|
2134
|
+
if (arguments.length === 0) {
|
|
2135
|
+
expression = "`cookies().has()`";
|
|
2136
|
+
} else {
|
|
2137
|
+
expression = `\`cookies().has(${describeNameArg(arguments[0])})\``;
|
|
2138
|
+
}
|
|
2139
|
+
syncIODev(route, expression);
|
|
2140
|
+
return underlyingCookies.has.apply(underlyingCookies, arguments);
|
|
2141
|
+
},
|
|
2142
|
+
writable: false
|
|
2143
|
+
},
|
|
2144
|
+
set: {
|
|
2145
|
+
value: function set() {
|
|
2146
|
+
let expression;
|
|
2147
|
+
if (arguments.length === 0) {
|
|
2148
|
+
expression = "`cookies().set()`";
|
|
2149
|
+
} else {
|
|
2150
|
+
const arg = arguments[0];
|
|
2151
|
+
if (arg) {
|
|
2152
|
+
expression = `\`cookies().set(${describeNameArg(arg)}, ...)\``;
|
|
2153
|
+
} else {
|
|
2154
|
+
expression = "`cookies().set(...)`";
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
syncIODev(route, expression);
|
|
2158
|
+
return underlyingCookies.set.apply(underlyingCookies, arguments);
|
|
2159
|
+
},
|
|
2160
|
+
writable: false
|
|
2161
|
+
},
|
|
2162
|
+
delete: {
|
|
2163
|
+
value: function() {
|
|
2164
|
+
let expression;
|
|
2165
|
+
if (arguments.length === 0) {
|
|
2166
|
+
expression = "`cookies().delete()`";
|
|
2167
|
+
} else if (arguments.length === 1) {
|
|
2168
|
+
expression = `\`cookies().delete(${describeNameArg(arguments[0])})\``;
|
|
2169
|
+
} else {
|
|
2170
|
+
expression = `\`cookies().delete(${describeNameArg(arguments[0])}, ...)\``;
|
|
2171
|
+
}
|
|
2172
|
+
syncIODev(route, expression);
|
|
2173
|
+
return underlyingCookies.delete.apply(underlyingCookies, arguments);
|
|
2174
|
+
},
|
|
2175
|
+
writable: false
|
|
2176
|
+
},
|
|
2177
|
+
clear: {
|
|
2178
|
+
value: function clear() {
|
|
2179
|
+
const expression = "`cookies().clear()`";
|
|
2180
|
+
syncIODev(route, expression);
|
|
2181
|
+
return typeof underlyingCookies.clear === "function" ? underlyingCookies.clear.apply(underlyingCookies, arguments) : (
|
|
2182
|
+
// We should remove this and unify our cookies types. We could just let this continue to throw lazily
|
|
2183
|
+
// but that's already a hard thing to debug so we may as well implement it consistently. The biggest problem with
|
|
2184
|
+
// implementing this in this way is the underlying cookie type is a ResponseCookie and not a RequestCookie and so it
|
|
2185
|
+
// has extra properties not available on RequestCookie instances.
|
|
2186
|
+
polyfilledResponseCookiesClear.call(underlyingCookies, promise)
|
|
2187
|
+
);
|
|
2188
|
+
},
|
|
2189
|
+
writable: false
|
|
2190
|
+
},
|
|
2191
|
+
toString: {
|
|
2192
|
+
value: function toString() {
|
|
2193
|
+
const expression = "`cookies().toString()` or implicit casting";
|
|
2194
|
+
syncIODev(route, expression);
|
|
2195
|
+
return underlyingCookies.toString.apply(underlyingCookies, arguments);
|
|
2196
|
+
},
|
|
2197
|
+
writable: false
|
|
2198
|
+
}
|
|
2199
|
+
});
|
|
2200
|
+
return promise;
|
|
2201
|
+
}
|
|
2202
|
+
function describeNameArg(arg) {
|
|
2203
|
+
return typeof arg === "object" && arg !== null && typeof arg.name === "string" ? `'${arg.name}'` : typeof arg === "string" ? `'${arg}'` : "...";
|
|
2204
|
+
}
|
|
2205
|
+
function syncIODev(route, expression) {
|
|
2206
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2207
|
+
if (workUnitStore && workUnitStore.type === "request" && workUnitStore.prerenderPhase === true) {
|
|
2208
|
+
const requestStore = workUnitStore;
|
|
2209
|
+
(0, _dynamicrendering.trackSynchronousRequestDataAccessInDev)(requestStore);
|
|
2210
|
+
}
|
|
2211
|
+
warnForSyncAccess(route, expression);
|
|
2212
|
+
}
|
|
2213
|
+
var warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createCookiesAccessError);
|
|
2214
|
+
function createCookiesAccessError(route, expression) {
|
|
2215
|
+
const prefix = route ? `Route "${route}" ` : "This route ";
|
|
2216
|
+
return Object.defineProperty(new Error(`${prefix}used ${expression}. \`cookies()\` should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`), "__NEXT_ERROR_CODE", {
|
|
2217
|
+
value: "E223",
|
|
2218
|
+
enumerable: false,
|
|
2219
|
+
configurable: true
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
function polyfilledResponseCookiesIterator() {
|
|
2223
|
+
return this.getAll().map((c) => [
|
|
2224
|
+
c.name,
|
|
2225
|
+
c
|
|
2226
|
+
]).values();
|
|
2227
|
+
}
|
|
2228
|
+
function polyfilledResponseCookiesClear(returnable) {
|
|
2229
|
+
for (const cookie of this.getAll()) {
|
|
2230
|
+
this.delete(cookie.name);
|
|
2231
|
+
}
|
|
2232
|
+
return returnable;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
|
|
2237
|
+
// ../../node_modules/next/dist/server/web/spec-extension/adapters/headers.js
|
|
2238
|
+
var require_headers = __commonJS({
|
|
2239
|
+
"../../node_modules/next/dist/server/web/spec-extension/adapters/headers.js"(exports) {
|
|
2240
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2241
|
+
value: true
|
|
2242
|
+
});
|
|
2243
|
+
function _export(target, all) {
|
|
2244
|
+
for (var name in all)
|
|
2245
|
+
Object.defineProperty(target, name, {
|
|
2246
|
+
enumerable: true,
|
|
2247
|
+
get: all[name]
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
_export(exports, {
|
|
2251
|
+
HeadersAdapter: function() {
|
|
2252
|
+
return HeadersAdapter;
|
|
2253
|
+
},
|
|
2254
|
+
ReadonlyHeadersError: function() {
|
|
2255
|
+
return ReadonlyHeadersError;
|
|
2256
|
+
}
|
|
2257
|
+
});
|
|
2258
|
+
var _reflect = require_reflect();
|
|
2259
|
+
var ReadonlyHeadersError = class extends Error {
|
|
2260
|
+
constructor() {
|
|
2261
|
+
super("Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers");
|
|
2262
|
+
}
|
|
2263
|
+
static callable() {
|
|
2264
|
+
throw new ReadonlyHeadersError();
|
|
2265
|
+
}
|
|
2266
|
+
};
|
|
2267
|
+
var HeadersAdapter = class extends Headers {
|
|
2268
|
+
constructor(headers2) {
|
|
2269
|
+
super();
|
|
2270
|
+
this.headers = new Proxy(headers2, {
|
|
2271
|
+
get(target, prop, receiver) {
|
|
2272
|
+
if (typeof prop === "symbol") {
|
|
2273
|
+
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
|
2274
|
+
}
|
|
2275
|
+
const lowercased = prop.toLowerCase();
|
|
2276
|
+
const original = Object.keys(headers2).find((o) => o.toLowerCase() === lowercased);
|
|
2277
|
+
if (typeof original === "undefined")
|
|
2278
|
+
return;
|
|
2279
|
+
return _reflect.ReflectAdapter.get(target, original, receiver);
|
|
2280
|
+
},
|
|
2281
|
+
set(target, prop, value, receiver) {
|
|
2282
|
+
if (typeof prop === "symbol") {
|
|
2283
|
+
return _reflect.ReflectAdapter.set(target, prop, value, receiver);
|
|
2284
|
+
}
|
|
2285
|
+
const lowercased = prop.toLowerCase();
|
|
2286
|
+
const original = Object.keys(headers2).find((o) => o.toLowerCase() === lowercased);
|
|
2287
|
+
return _reflect.ReflectAdapter.set(target, original ?? prop, value, receiver);
|
|
2288
|
+
},
|
|
2289
|
+
has(target, prop) {
|
|
2290
|
+
if (typeof prop === "symbol")
|
|
2291
|
+
return _reflect.ReflectAdapter.has(target, prop);
|
|
2292
|
+
const lowercased = prop.toLowerCase();
|
|
2293
|
+
const original = Object.keys(headers2).find((o) => o.toLowerCase() === lowercased);
|
|
2294
|
+
if (typeof original === "undefined")
|
|
2295
|
+
return false;
|
|
2296
|
+
return _reflect.ReflectAdapter.has(target, original);
|
|
2297
|
+
},
|
|
2298
|
+
deleteProperty(target, prop) {
|
|
2299
|
+
if (typeof prop === "symbol")
|
|
2300
|
+
return _reflect.ReflectAdapter.deleteProperty(target, prop);
|
|
2301
|
+
const lowercased = prop.toLowerCase();
|
|
2302
|
+
const original = Object.keys(headers2).find((o) => o.toLowerCase() === lowercased);
|
|
2303
|
+
if (typeof original === "undefined")
|
|
2304
|
+
return true;
|
|
2305
|
+
return _reflect.ReflectAdapter.deleteProperty(target, original);
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Seals a Headers instance to prevent modification by throwing an error when
|
|
2311
|
+
* any mutating method is called.
|
|
2312
|
+
*/
|
|
2313
|
+
static seal(headers2) {
|
|
2314
|
+
return new Proxy(headers2, {
|
|
2315
|
+
get(target, prop, receiver) {
|
|
2316
|
+
switch (prop) {
|
|
2317
|
+
case "append":
|
|
2318
|
+
case "delete":
|
|
2319
|
+
case "set":
|
|
2320
|
+
return ReadonlyHeadersError.callable;
|
|
2321
|
+
default:
|
|
2322
|
+
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Merges a header value into a string. This stores multiple values as an
|
|
2329
|
+
* array, so we need to merge them into a string.
|
|
2330
|
+
*
|
|
2331
|
+
* @param value a header value
|
|
2332
|
+
* @returns a merged header value (a string)
|
|
2333
|
+
*/
|
|
2334
|
+
merge(value) {
|
|
2335
|
+
if (Array.isArray(value))
|
|
2336
|
+
return value.join(", ");
|
|
2337
|
+
return value;
|
|
2338
|
+
}
|
|
2339
|
+
/**
|
|
2340
|
+
* Creates a Headers instance from a plain object or a Headers instance.
|
|
2341
|
+
*
|
|
2342
|
+
* @param headers a plain object or a Headers instance
|
|
2343
|
+
* @returns a headers instance
|
|
2344
|
+
*/
|
|
2345
|
+
static from(headers2) {
|
|
2346
|
+
if (headers2 instanceof Headers)
|
|
2347
|
+
return headers2;
|
|
2348
|
+
return new HeadersAdapter(headers2);
|
|
2349
|
+
}
|
|
2350
|
+
append(name, value) {
|
|
2351
|
+
const existing = this.headers[name];
|
|
2352
|
+
if (typeof existing === "string") {
|
|
2353
|
+
this.headers[name] = [
|
|
2354
|
+
existing,
|
|
2355
|
+
value
|
|
2356
|
+
];
|
|
2357
|
+
} else if (Array.isArray(existing)) {
|
|
2358
|
+
existing.push(value);
|
|
2359
|
+
} else {
|
|
2360
|
+
this.headers[name] = value;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
delete(name) {
|
|
2364
|
+
delete this.headers[name];
|
|
2365
|
+
}
|
|
2366
|
+
get(name) {
|
|
2367
|
+
const value = this.headers[name];
|
|
2368
|
+
if (typeof value !== "undefined")
|
|
2369
|
+
return this.merge(value);
|
|
2370
|
+
return null;
|
|
2371
|
+
}
|
|
2372
|
+
has(name) {
|
|
2373
|
+
return typeof this.headers[name] !== "undefined";
|
|
2374
|
+
}
|
|
2375
|
+
set(name, value) {
|
|
2376
|
+
this.headers[name] = value;
|
|
2377
|
+
}
|
|
2378
|
+
forEach(callbackfn, thisArg) {
|
|
2379
|
+
for (const [name, value] of this.entries()) {
|
|
2380
|
+
callbackfn.call(thisArg, value, name, this);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
*entries() {
|
|
2384
|
+
for (const key of Object.keys(this.headers)) {
|
|
2385
|
+
const name = key.toLowerCase();
|
|
2386
|
+
const value = this.get(name);
|
|
2387
|
+
yield [
|
|
2388
|
+
name,
|
|
2389
|
+
value
|
|
2390
|
+
];
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
*keys() {
|
|
2394
|
+
for (const key of Object.keys(this.headers)) {
|
|
2395
|
+
const name = key.toLowerCase();
|
|
2396
|
+
yield name;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
*values() {
|
|
2400
|
+
for (const key of Object.keys(this.headers)) {
|
|
2401
|
+
const value = this.get(key);
|
|
2402
|
+
yield value;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
[Symbol.iterator]() {
|
|
2406
|
+
return this.entries();
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
|
|
2412
|
+
// ../../node_modules/next/dist/server/request/headers.js
|
|
2413
|
+
var require_headers2 = __commonJS({
|
|
2414
|
+
"../../node_modules/next/dist/server/request/headers.js"(exports) {
|
|
2415
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2416
|
+
value: true
|
|
2417
|
+
});
|
|
2418
|
+
Object.defineProperty(exports, "headers", {
|
|
2419
|
+
enumerable: true,
|
|
2420
|
+
get: function() {
|
|
2421
|
+
return headers2;
|
|
2422
|
+
}
|
|
2423
|
+
});
|
|
2424
|
+
var _headers = require_headers();
|
|
2425
|
+
var _workasyncstorageexternal = require_work_async_storage_external();
|
|
2426
|
+
var _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
2427
|
+
var _dynamicrendering = require_dynamic_rendering();
|
|
2428
|
+
var _staticgenerationbailout = require_static_generation_bailout();
|
|
2429
|
+
var _dynamicrenderingutils = require_dynamic_rendering_utils();
|
|
2430
|
+
var _creatededupedbycallsiteservererrorlogger = require_create_deduped_by_callsite_server_error_logger();
|
|
2431
|
+
var _scheduler = require_scheduler();
|
|
2432
|
+
var _utils = require_utils();
|
|
2433
|
+
function headers2() {
|
|
2434
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
2435
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2436
|
+
if (workStore) {
|
|
2437
|
+
if (workUnitStore && workUnitStore.phase === "after" && !(0, _utils.isRequestAPICallableInsideAfter)()) {
|
|
2438
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used "headers" inside "after(...)". This is not supported. If you need this data inside an "after" callback, use "headers" outside of the callback. See more info here: https://nextjs.org/docs/canary/app/api-reference/functions/after`), "__NEXT_ERROR_CODE", {
|
|
2439
|
+
value: "E367",
|
|
2440
|
+
enumerable: false,
|
|
2441
|
+
configurable: true
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
if (workStore.forceStatic) {
|
|
2445
|
+
const underlyingHeaders = _headers.HeadersAdapter.seal(new Headers({}));
|
|
2446
|
+
return makeUntrackedExoticHeaders(underlyingHeaders);
|
|
2447
|
+
}
|
|
2448
|
+
if (workUnitStore) {
|
|
2449
|
+
if (workUnitStore.type === "cache") {
|
|
2450
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used "headers" inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "headers" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
2451
|
+
value: "E304",
|
|
2452
|
+
enumerable: false,
|
|
2453
|
+
configurable: true
|
|
2454
|
+
});
|
|
2455
|
+
} else if (workUnitStore.type === "unstable-cache") {
|
|
2456
|
+
throw Object.defineProperty(new Error(`Route ${workStore.route} used "headers" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "headers" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
2457
|
+
value: "E127",
|
|
2458
|
+
enumerable: false,
|
|
2459
|
+
configurable: true
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
if (workStore.dynamicShouldError) {
|
|
2464
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${workStore.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`headers\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
2465
|
+
value: "E525",
|
|
2466
|
+
enumerable: false,
|
|
2467
|
+
configurable: true
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
if (workUnitStore) {
|
|
2471
|
+
if (workUnitStore.type === "prerender") {
|
|
2472
|
+
return makeDynamicallyTrackedExoticHeaders(workStore.route, workUnitStore);
|
|
2473
|
+
} else if (workUnitStore.type === "prerender-ppr") {
|
|
2474
|
+
(0, _dynamicrendering.postponeWithTracking)(workStore.route, "headers", workUnitStore.dynamicTracking);
|
|
2475
|
+
} else if (workUnitStore.type === "prerender-legacy") {
|
|
2476
|
+
(0, _dynamicrendering.throwToInterruptStaticGeneration)("headers", workStore, workUnitStore);
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
(0, _dynamicrendering.trackDynamicDataInDynamicRender)(workStore, workUnitStore);
|
|
2480
|
+
}
|
|
2481
|
+
const requestStore = (0, _workunitasyncstorageexternal.getExpectedRequestStore)("headers");
|
|
2482
|
+
if (!(workStore == null ? void 0 : workStore.isPrefetchRequest)) {
|
|
2483
|
+
return makeUntrackedExoticHeadersWithDevWarnings(requestStore.headers, workStore == null ? void 0 : workStore.route);
|
|
2484
|
+
} else {
|
|
2485
|
+
return makeUntrackedExoticHeaders(requestStore.headers);
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
var CachedHeaders = /* @__PURE__ */ new WeakMap();
|
|
2489
|
+
function makeDynamicallyTrackedExoticHeaders(route, prerenderStore) {
|
|
2490
|
+
const cachedHeaders = CachedHeaders.get(prerenderStore);
|
|
2491
|
+
if (cachedHeaders) {
|
|
2492
|
+
return cachedHeaders;
|
|
2493
|
+
}
|
|
2494
|
+
const promise = (0, _dynamicrenderingutils.makeHangingPromise)(prerenderStore.renderSignal, "`headers()`");
|
|
2495
|
+
CachedHeaders.set(prerenderStore, promise);
|
|
2496
|
+
Object.defineProperties(promise, {
|
|
2497
|
+
append: {
|
|
2498
|
+
value: function append() {
|
|
2499
|
+
const expression = `\`headers().append(${describeNameArg(arguments[0])}, ...)\``;
|
|
2500
|
+
const error = createHeadersAccessError(route, expression);
|
|
2501
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2502
|
+
}
|
|
2503
|
+
},
|
|
2504
|
+
delete: {
|
|
2505
|
+
value: function _delete() {
|
|
2506
|
+
const expression = `\`headers().delete(${describeNameArg(arguments[0])})\``;
|
|
2507
|
+
const error = createHeadersAccessError(route, expression);
|
|
2508
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2509
|
+
}
|
|
2510
|
+
},
|
|
2511
|
+
get: {
|
|
2512
|
+
value: function get() {
|
|
2513
|
+
const expression = `\`headers().get(${describeNameArg(arguments[0])})\``;
|
|
2514
|
+
const error = createHeadersAccessError(route, expression);
|
|
2515
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2516
|
+
}
|
|
2517
|
+
},
|
|
2518
|
+
has: {
|
|
2519
|
+
value: function has() {
|
|
2520
|
+
const expression = `\`headers().has(${describeNameArg(arguments[0])})\``;
|
|
2521
|
+
const error = createHeadersAccessError(route, expression);
|
|
2522
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2523
|
+
}
|
|
2524
|
+
},
|
|
2525
|
+
set: {
|
|
2526
|
+
value: function set() {
|
|
2527
|
+
const expression = `\`headers().set(${describeNameArg(arguments[0])}, ...)\``;
|
|
2528
|
+
const error = createHeadersAccessError(route, expression);
|
|
2529
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2530
|
+
}
|
|
2531
|
+
},
|
|
2532
|
+
getSetCookie: {
|
|
2533
|
+
value: function getSetCookie() {
|
|
2534
|
+
const expression = "`headers().getSetCookie()`";
|
|
2535
|
+
const error = createHeadersAccessError(route, expression);
|
|
2536
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2537
|
+
}
|
|
2538
|
+
},
|
|
2539
|
+
forEach: {
|
|
2540
|
+
value: function forEach() {
|
|
2541
|
+
const expression = "`headers().forEach(...)`";
|
|
2542
|
+
const error = createHeadersAccessError(route, expression);
|
|
2543
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
keys: {
|
|
2547
|
+
value: function keys() {
|
|
2548
|
+
const expression = "`headers().keys()`";
|
|
2549
|
+
const error = createHeadersAccessError(route, expression);
|
|
2550
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2551
|
+
}
|
|
2552
|
+
},
|
|
2553
|
+
values: {
|
|
2554
|
+
value: function values() {
|
|
2555
|
+
const expression = "`headers().values()`";
|
|
2556
|
+
const error = createHeadersAccessError(route, expression);
|
|
2557
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2558
|
+
}
|
|
2559
|
+
},
|
|
2560
|
+
entries: {
|
|
2561
|
+
value: function entries() {
|
|
2562
|
+
const expression = "`headers().entries()`";
|
|
2563
|
+
const error = createHeadersAccessError(route, expression);
|
|
2564
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2565
|
+
}
|
|
2566
|
+
},
|
|
2567
|
+
[Symbol.iterator]: {
|
|
2568
|
+
value: function() {
|
|
2569
|
+
const expression = "`headers()[Symbol.iterator]()`";
|
|
2570
|
+
const error = createHeadersAccessError(route, expression);
|
|
2571
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(route, expression, error, prerenderStore);
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
});
|
|
2575
|
+
return promise;
|
|
2576
|
+
}
|
|
2577
|
+
function makeUntrackedExoticHeaders(underlyingHeaders) {
|
|
2578
|
+
const cachedHeaders = CachedHeaders.get(underlyingHeaders);
|
|
2579
|
+
if (cachedHeaders) {
|
|
2580
|
+
return cachedHeaders;
|
|
2581
|
+
}
|
|
2582
|
+
const promise = Promise.resolve(underlyingHeaders);
|
|
2583
|
+
CachedHeaders.set(underlyingHeaders, promise);
|
|
2584
|
+
Object.defineProperties(promise, {
|
|
2585
|
+
append: {
|
|
2586
|
+
value: underlyingHeaders.append.bind(underlyingHeaders)
|
|
2587
|
+
},
|
|
2588
|
+
delete: {
|
|
2589
|
+
value: underlyingHeaders.delete.bind(underlyingHeaders)
|
|
2590
|
+
},
|
|
2591
|
+
get: {
|
|
2592
|
+
value: underlyingHeaders.get.bind(underlyingHeaders)
|
|
2593
|
+
},
|
|
2594
|
+
has: {
|
|
2595
|
+
value: underlyingHeaders.has.bind(underlyingHeaders)
|
|
2596
|
+
},
|
|
2597
|
+
set: {
|
|
2598
|
+
value: underlyingHeaders.set.bind(underlyingHeaders)
|
|
2599
|
+
},
|
|
2600
|
+
getSetCookie: {
|
|
2601
|
+
value: underlyingHeaders.getSetCookie.bind(underlyingHeaders)
|
|
2602
|
+
},
|
|
2603
|
+
forEach: {
|
|
2604
|
+
value: underlyingHeaders.forEach.bind(underlyingHeaders)
|
|
2605
|
+
},
|
|
2606
|
+
keys: {
|
|
2607
|
+
value: underlyingHeaders.keys.bind(underlyingHeaders)
|
|
2608
|
+
},
|
|
2609
|
+
values: {
|
|
2610
|
+
value: underlyingHeaders.values.bind(underlyingHeaders)
|
|
2611
|
+
},
|
|
2612
|
+
entries: {
|
|
2613
|
+
value: underlyingHeaders.entries.bind(underlyingHeaders)
|
|
2614
|
+
},
|
|
2615
|
+
[Symbol.iterator]: {
|
|
2616
|
+
value: underlyingHeaders[Symbol.iterator].bind(underlyingHeaders)
|
|
2617
|
+
}
|
|
2618
|
+
});
|
|
2619
|
+
return promise;
|
|
2620
|
+
}
|
|
2621
|
+
function makeUntrackedExoticHeadersWithDevWarnings(underlyingHeaders, route) {
|
|
2622
|
+
const cachedHeaders = CachedHeaders.get(underlyingHeaders);
|
|
2623
|
+
if (cachedHeaders) {
|
|
2624
|
+
return cachedHeaders;
|
|
2625
|
+
}
|
|
2626
|
+
const promise = new Promise((resolve) => (0, _scheduler.scheduleImmediate)(() => resolve(underlyingHeaders)));
|
|
2627
|
+
CachedHeaders.set(underlyingHeaders, promise);
|
|
2628
|
+
Object.defineProperties(promise, {
|
|
2629
|
+
append: {
|
|
2630
|
+
value: function append() {
|
|
2631
|
+
const expression = `\`headers().append(${describeNameArg(arguments[0])}, ...)\``;
|
|
2632
|
+
syncIODev(route, expression);
|
|
2633
|
+
return underlyingHeaders.append.apply(underlyingHeaders, arguments);
|
|
2634
|
+
}
|
|
2635
|
+
},
|
|
2636
|
+
delete: {
|
|
2637
|
+
value: function _delete() {
|
|
2638
|
+
const expression = `\`headers().delete(${describeNameArg(arguments[0])})\``;
|
|
2639
|
+
syncIODev(route, expression);
|
|
2640
|
+
return underlyingHeaders.delete.apply(underlyingHeaders, arguments);
|
|
2641
|
+
}
|
|
2642
|
+
},
|
|
2643
|
+
get: {
|
|
2644
|
+
value: function get() {
|
|
2645
|
+
const expression = `\`headers().get(${describeNameArg(arguments[0])})\``;
|
|
2646
|
+
syncIODev(route, expression);
|
|
2647
|
+
return underlyingHeaders.get.apply(underlyingHeaders, arguments);
|
|
2648
|
+
}
|
|
2649
|
+
},
|
|
2650
|
+
has: {
|
|
2651
|
+
value: function has() {
|
|
2652
|
+
const expression = `\`headers().has(${describeNameArg(arguments[0])})\``;
|
|
2653
|
+
syncIODev(route, expression);
|
|
2654
|
+
return underlyingHeaders.has.apply(underlyingHeaders, arguments);
|
|
2655
|
+
}
|
|
2656
|
+
},
|
|
2657
|
+
set: {
|
|
2658
|
+
value: function set() {
|
|
2659
|
+
const expression = `\`headers().set(${describeNameArg(arguments[0])}, ...)\``;
|
|
2660
|
+
syncIODev(route, expression);
|
|
2661
|
+
return underlyingHeaders.set.apply(underlyingHeaders, arguments);
|
|
2662
|
+
}
|
|
2663
|
+
},
|
|
2664
|
+
getSetCookie: {
|
|
2665
|
+
value: function getSetCookie() {
|
|
2666
|
+
const expression = "`headers().getSetCookie()`";
|
|
2667
|
+
syncIODev(route, expression);
|
|
2668
|
+
return underlyingHeaders.getSetCookie.apply(underlyingHeaders, arguments);
|
|
2669
|
+
}
|
|
2670
|
+
},
|
|
2671
|
+
forEach: {
|
|
2672
|
+
value: function forEach() {
|
|
2673
|
+
const expression = "`headers().forEach(...)`";
|
|
2674
|
+
syncIODev(route, expression);
|
|
2675
|
+
return underlyingHeaders.forEach.apply(underlyingHeaders, arguments);
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
keys: {
|
|
2679
|
+
value: function keys() {
|
|
2680
|
+
const expression = "`headers().keys()`";
|
|
2681
|
+
syncIODev(route, expression);
|
|
2682
|
+
return underlyingHeaders.keys.apply(underlyingHeaders, arguments);
|
|
2683
|
+
}
|
|
2684
|
+
},
|
|
2685
|
+
values: {
|
|
2686
|
+
value: function values() {
|
|
2687
|
+
const expression = "`headers().values()`";
|
|
2688
|
+
syncIODev(route, expression);
|
|
2689
|
+
return underlyingHeaders.values.apply(underlyingHeaders, arguments);
|
|
2690
|
+
}
|
|
2691
|
+
},
|
|
2692
|
+
entries: {
|
|
2693
|
+
value: function entries() {
|
|
2694
|
+
const expression = "`headers().entries()`";
|
|
2695
|
+
syncIODev(route, expression);
|
|
2696
|
+
return underlyingHeaders.entries.apply(underlyingHeaders, arguments);
|
|
2697
|
+
}
|
|
2698
|
+
},
|
|
2699
|
+
[Symbol.iterator]: {
|
|
2700
|
+
value: function() {
|
|
2701
|
+
const expression = "`...headers()` or similar iteration";
|
|
2702
|
+
syncIODev(route, expression);
|
|
2703
|
+
return underlyingHeaders[Symbol.iterator].apply(underlyingHeaders, arguments);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
});
|
|
2707
|
+
return promise;
|
|
2708
|
+
}
|
|
2709
|
+
function describeNameArg(arg) {
|
|
2710
|
+
return typeof arg === "string" ? `'${arg}'` : "...";
|
|
2711
|
+
}
|
|
2712
|
+
function syncIODev(route, expression) {
|
|
2713
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2714
|
+
if (workUnitStore && workUnitStore.type === "request" && workUnitStore.prerenderPhase === true) {
|
|
2715
|
+
const requestStore = workUnitStore;
|
|
2716
|
+
(0, _dynamicrendering.trackSynchronousRequestDataAccessInDev)(requestStore);
|
|
2717
|
+
}
|
|
2718
|
+
warnForSyncAccess(route, expression);
|
|
2719
|
+
}
|
|
2720
|
+
var warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createHeadersAccessError);
|
|
2721
|
+
function createHeadersAccessError(route, expression) {
|
|
2722
|
+
const prefix = route ? `Route "${route}" ` : "This route ";
|
|
2723
|
+
return Object.defineProperty(new Error(`${prefix}used ${expression}. \`headers()\` should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`), "__NEXT_ERROR_CODE", {
|
|
2724
|
+
value: "E277",
|
|
2725
|
+
enumerable: false,
|
|
2726
|
+
configurable: true
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
});
|
|
2731
|
+
|
|
2732
|
+
// ../../node_modules/next/dist/server/request/draft-mode.js
|
|
2733
|
+
var require_draft_mode = __commonJS({
|
|
2734
|
+
"../../node_modules/next/dist/server/request/draft-mode.js"(exports) {
|
|
2735
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2736
|
+
value: true
|
|
2737
|
+
});
|
|
2738
|
+
Object.defineProperty(exports, "draftMode", {
|
|
2739
|
+
enumerable: true,
|
|
2740
|
+
get: function() {
|
|
2741
|
+
return draftMode;
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
var _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
2745
|
+
var _workasyncstorageexternal = require_work_async_storage_external();
|
|
2746
|
+
var _dynamicrendering = require_dynamic_rendering();
|
|
2747
|
+
var _creatededupedbycallsiteservererrorlogger = require_create_deduped_by_callsite_server_error_logger();
|
|
2748
|
+
var _staticgenerationbailout = require_static_generation_bailout();
|
|
2749
|
+
var _hooksservercontext = require_hooks_server_context();
|
|
2750
|
+
function draftMode() {
|
|
2751
|
+
const callingExpression = "draftMode";
|
|
2752
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
2753
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2754
|
+
if (!workStore || !workUnitStore) {
|
|
2755
|
+
(0, _workunitasyncstorageexternal.throwForMissingRequestStore)(callingExpression);
|
|
2756
|
+
}
|
|
2757
|
+
switch (workUnitStore.type) {
|
|
2758
|
+
case "request":
|
|
2759
|
+
return createOrGetCachedExoticDraftMode(workUnitStore.draftMode, workStore);
|
|
2760
|
+
case "cache":
|
|
2761
|
+
case "unstable-cache":
|
|
2762
|
+
const draftModeProvider = (0, _workunitasyncstorageexternal.getDraftModeProviderForCacheScope)(workStore, workUnitStore);
|
|
2763
|
+
if (draftModeProvider) {
|
|
2764
|
+
return createOrGetCachedExoticDraftMode(draftModeProvider, workStore);
|
|
2765
|
+
}
|
|
2766
|
+
case "prerender":
|
|
2767
|
+
case "prerender-ppr":
|
|
2768
|
+
case "prerender-legacy":
|
|
2769
|
+
if (!(workStore == null ? void 0 : workStore.isPrefetchRequest)) {
|
|
2770
|
+
const route = workStore == null ? void 0 : workStore.route;
|
|
2771
|
+
return createExoticDraftModeWithDevWarnings(null, route);
|
|
2772
|
+
} else {
|
|
2773
|
+
return createExoticDraftMode(null);
|
|
2774
|
+
}
|
|
2775
|
+
default:
|
|
2776
|
+
const _exhaustiveCheck = workUnitStore;
|
|
2777
|
+
return _exhaustiveCheck;
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
function createOrGetCachedExoticDraftMode(draftModeProvider, workStore) {
|
|
2781
|
+
const cachedDraftMode = CachedDraftModes.get(draftMode);
|
|
2782
|
+
if (cachedDraftMode) {
|
|
2783
|
+
return cachedDraftMode;
|
|
2784
|
+
}
|
|
2785
|
+
let promise;
|
|
2786
|
+
if (!(workStore == null ? void 0 : workStore.isPrefetchRequest)) {
|
|
2787
|
+
const route = workStore == null ? void 0 : workStore.route;
|
|
2788
|
+
promise = createExoticDraftModeWithDevWarnings(draftModeProvider, route);
|
|
2789
|
+
} else {
|
|
2790
|
+
promise = createExoticDraftMode(draftModeProvider);
|
|
2791
|
+
}
|
|
2792
|
+
CachedDraftModes.set(draftModeProvider, promise);
|
|
2793
|
+
return promise;
|
|
2794
|
+
}
|
|
2795
|
+
var CachedDraftModes = /* @__PURE__ */ new WeakMap();
|
|
2796
|
+
function createExoticDraftMode(underlyingProvider) {
|
|
2797
|
+
const instance = new DraftMode(underlyingProvider);
|
|
2798
|
+
const promise = Promise.resolve(instance);
|
|
2799
|
+
Object.defineProperty(promise, "isEnabled", {
|
|
2800
|
+
get() {
|
|
2801
|
+
return instance.isEnabled;
|
|
2802
|
+
},
|
|
2803
|
+
set(newValue) {
|
|
2804
|
+
Object.defineProperty(promise, "isEnabled", {
|
|
2805
|
+
value: newValue,
|
|
2806
|
+
writable: true,
|
|
2807
|
+
enumerable: true
|
|
2808
|
+
});
|
|
2809
|
+
},
|
|
2810
|
+
enumerable: true,
|
|
2811
|
+
configurable: true
|
|
2812
|
+
});
|
|
2813
|
+
promise.enable = instance.enable.bind(instance);
|
|
2814
|
+
promise.disable = instance.disable.bind(instance);
|
|
2815
|
+
return promise;
|
|
2816
|
+
}
|
|
2817
|
+
function createExoticDraftModeWithDevWarnings(underlyingProvider, route) {
|
|
2818
|
+
const instance = new DraftMode(underlyingProvider);
|
|
2819
|
+
const promise = Promise.resolve(instance);
|
|
2820
|
+
Object.defineProperty(promise, "isEnabled", {
|
|
2821
|
+
get() {
|
|
2822
|
+
const expression = "`draftMode().isEnabled`";
|
|
2823
|
+
syncIODev(route, expression);
|
|
2824
|
+
return instance.isEnabled;
|
|
2825
|
+
},
|
|
2826
|
+
set(newValue) {
|
|
2827
|
+
Object.defineProperty(promise, "isEnabled", {
|
|
2828
|
+
value: newValue,
|
|
2829
|
+
writable: true,
|
|
2830
|
+
enumerable: true
|
|
2831
|
+
});
|
|
2832
|
+
},
|
|
2833
|
+
enumerable: true,
|
|
2834
|
+
configurable: true
|
|
2835
|
+
});
|
|
2836
|
+
Object.defineProperty(promise, "enable", {
|
|
2837
|
+
value: function get() {
|
|
2838
|
+
const expression = "`draftMode().enable()`";
|
|
2839
|
+
syncIODev(route, expression);
|
|
2840
|
+
return instance.enable.apply(instance, arguments);
|
|
2841
|
+
}
|
|
2842
|
+
});
|
|
2843
|
+
Object.defineProperty(promise, "disable", {
|
|
2844
|
+
value: function get() {
|
|
2845
|
+
const expression = "`draftMode().disable()`";
|
|
2846
|
+
syncIODev(route, expression);
|
|
2847
|
+
return instance.disable.apply(instance, arguments);
|
|
2848
|
+
}
|
|
2849
|
+
});
|
|
2850
|
+
return promise;
|
|
2851
|
+
}
|
|
2852
|
+
var DraftMode = class {
|
|
2853
|
+
constructor(provider) {
|
|
2854
|
+
this._provider = provider;
|
|
2855
|
+
}
|
|
2856
|
+
get isEnabled() {
|
|
2857
|
+
if (this._provider !== null) {
|
|
2858
|
+
return this._provider.isEnabled;
|
|
2859
|
+
}
|
|
2860
|
+
return false;
|
|
2861
|
+
}
|
|
2862
|
+
enable() {
|
|
2863
|
+
trackDynamicDraftMode("draftMode().enable()");
|
|
2864
|
+
if (this._provider !== null) {
|
|
2865
|
+
this._provider.enable();
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
disable() {
|
|
2869
|
+
trackDynamicDraftMode("draftMode().disable()");
|
|
2870
|
+
if (this._provider !== null) {
|
|
2871
|
+
this._provider.disable();
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
function syncIODev(route, expression) {
|
|
2876
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2877
|
+
if (workUnitStore && workUnitStore.type === "request" && workUnitStore.prerenderPhase === true) {
|
|
2878
|
+
const requestStore = workUnitStore;
|
|
2879
|
+
(0, _dynamicrendering.trackSynchronousRequestDataAccessInDev)(requestStore);
|
|
2880
|
+
}
|
|
2881
|
+
warnForSyncAccess(route, expression);
|
|
2882
|
+
}
|
|
2883
|
+
var warnForSyncAccess = (0, _creatededupedbycallsiteservererrorlogger.createDedupedByCallsiteServerErrorLoggerDev)(createDraftModeAccessError);
|
|
2884
|
+
function createDraftModeAccessError(route, expression) {
|
|
2885
|
+
const prefix = route ? `Route "${route}" ` : "This route ";
|
|
2886
|
+
return Object.defineProperty(new Error(`${prefix}used ${expression}. \`draftMode()\` should be awaited before using its value. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis`), "__NEXT_ERROR_CODE", {
|
|
2887
|
+
value: "E377",
|
|
2888
|
+
enumerable: false,
|
|
2889
|
+
configurable: true
|
|
2890
|
+
});
|
|
2891
|
+
}
|
|
2892
|
+
function trackDynamicDraftMode(expression) {
|
|
2893
|
+
const store = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
2894
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2895
|
+
if (store) {
|
|
2896
|
+
if (workUnitStore) {
|
|
2897
|
+
if (workUnitStore.type === "cache") {
|
|
2898
|
+
throw Object.defineProperty(new Error(`Route ${store.route} used "${expression}" inside "use cache". The enabled status of draftMode can be read in caches but you must not enable or disable draftMode inside a cache. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache`), "__NEXT_ERROR_CODE", {
|
|
2899
|
+
value: "E246",
|
|
2900
|
+
enumerable: false,
|
|
2901
|
+
configurable: true
|
|
2902
|
+
});
|
|
2903
|
+
} else if (workUnitStore.type === "unstable-cache") {
|
|
2904
|
+
throw Object.defineProperty(new Error(`Route ${store.route} used "${expression}" inside a function cached with "unstable_cache(...)". The enabled status of draftMode can be read in caches but you must not enable or disable draftMode inside a cache. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`), "__NEXT_ERROR_CODE", {
|
|
2905
|
+
value: "E259",
|
|
2906
|
+
enumerable: false,
|
|
2907
|
+
configurable: true
|
|
2908
|
+
});
|
|
2909
|
+
} else if (workUnitStore.phase === "after") {
|
|
2910
|
+
throw Object.defineProperty(new Error(`Route ${store.route} used "${expression}" inside \`after\`. The enabled status of draftMode can be read inside \`after\` but you cannot enable or disable draftMode. See more info here: https://nextjs.org/docs/app/api-reference/functions/after`), "__NEXT_ERROR_CODE", {
|
|
2911
|
+
value: "E348",
|
|
2912
|
+
enumerable: false,
|
|
2913
|
+
configurable: true
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
if (store.dynamicShouldError) {
|
|
2918
|
+
throw Object.defineProperty(new _staticgenerationbailout.StaticGenBailoutError(`Route ${store.route} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`), "__NEXT_ERROR_CODE", {
|
|
2919
|
+
value: "E553",
|
|
2920
|
+
enumerable: false,
|
|
2921
|
+
configurable: true
|
|
2922
|
+
});
|
|
2923
|
+
}
|
|
2924
|
+
if (workUnitStore) {
|
|
2925
|
+
if (workUnitStore.type === "prerender") {
|
|
2926
|
+
const error = Object.defineProperty(new Error(`Route ${store.route} used ${expression} without first calling \`await connection()\`. See more info here: https://nextjs.org/docs/messages/next-prerender-sync-headers`), "__NEXT_ERROR_CODE", {
|
|
2927
|
+
value: "E126",
|
|
2928
|
+
enumerable: false,
|
|
2929
|
+
configurable: true
|
|
2930
|
+
});
|
|
2931
|
+
(0, _dynamicrendering.abortAndThrowOnSynchronousRequestDataAccess)(store.route, expression, error, workUnitStore);
|
|
2932
|
+
} else if (workUnitStore.type === "prerender-ppr") {
|
|
2933
|
+
(0, _dynamicrendering.postponeWithTracking)(store.route, expression, workUnitStore.dynamicTracking);
|
|
2934
|
+
} else if (workUnitStore.type === "prerender-legacy") {
|
|
2935
|
+
workUnitStore.revalidate = 0;
|
|
2936
|
+
const err = Object.defineProperty(new _hooksservercontext.DynamicServerError(`Route ${store.route} couldn't be rendered statically because it used \`${expression}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`), "__NEXT_ERROR_CODE", {
|
|
2937
|
+
value: "E558",
|
|
2938
|
+
enumerable: false,
|
|
2939
|
+
configurable: true
|
|
2940
|
+
});
|
|
2941
|
+
store.dynamicUsageDescription = expression;
|
|
2942
|
+
store.dynamicUsageStack = err.stack;
|
|
2943
|
+
throw err;
|
|
2944
|
+
} else if (workUnitStore && workUnitStore.type === "request") {
|
|
2945
|
+
workUnitStore.usedDynamic = true;
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
// ../../node_modules/next/headers.js
|
|
2954
|
+
var require_headers3 = __commonJS({
|
|
2955
|
+
"../../node_modules/next/headers.js"(exports, module) {
|
|
2956
|
+
module.exports.cookies = require_cookies3().cookies;
|
|
2957
|
+
module.exports.headers = require_headers2().headers;
|
|
2958
|
+
module.exports.draftMode = require_draft_mode().draftMode;
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
|
|
2962
|
+
// src/lib/server-auth.ts
|
|
2963
|
+
var import_headers = __toESM(require_headers3(), 1);
|
|
2964
|
+
|
|
2965
|
+
// src/lib/auth-config.ts
|
|
2966
|
+
var IS_PRODUCTION = false;
|
|
2967
|
+
var AUTH_CONFIG = {
|
|
2968
|
+
// Internal API endpoint (never external)
|
|
2969
|
+
// Developers will implement this endpoint in their own project
|
|
2970
|
+
internalEndpoint: "/api/moonui/validate-pro",
|
|
2971
|
+
// Cache configuration
|
|
2972
|
+
cache: {
|
|
2973
|
+
// Server-side cache duration
|
|
2974
|
+
serverCacheDuration: 60 * 60 * 1e3,
|
|
2975
|
+
// 1 hour in development
|
|
2976
|
+
// Cookie expiry
|
|
2977
|
+
cookieMaxAge: 24 * 60 * 60,
|
|
2978
|
+
// 1 day in development (seconds)
|
|
2979
|
+
// Validation refresh threshold (when to refresh in background)
|
|
2980
|
+
refreshThreshold: 0.5
|
|
2981
|
+
// Refresh when 50% of cache time passed
|
|
2982
|
+
},
|
|
2983
|
+
// Security configuration
|
|
2984
|
+
security: {
|
|
2985
|
+
// Device fingerprint validation
|
|
2986
|
+
enforceDeviceFingerprint: true,
|
|
2987
|
+
// Maximum devices per license
|
|
2988
|
+
maxDevicesPerLicense: 5,
|
|
2989
|
+
// Session timeout
|
|
2990
|
+
sessionTimeout: 7 * 24 * 60 * 60 * 1e3,
|
|
2991
|
+
// 7 days
|
|
2992
|
+
// Cookie settings
|
|
2993
|
+
cookieOptions: {
|
|
2994
|
+
httpOnly: true,
|
|
2995
|
+
secure: IS_PRODUCTION,
|
|
2996
|
+
sameSite: "lax",
|
|
2997
|
+
path: "/"
|
|
2998
|
+
}
|
|
2999
|
+
},
|
|
3000
|
+
// API configuration for server-to-server calls
|
|
3001
|
+
api: {
|
|
3002
|
+
// MoonUI validation server (only called from server-side)
|
|
3003
|
+
moonuiValidationEndpoint: "https://api.moonui.dev/v1/license/validate",
|
|
3004
|
+
// Timeout for server-to-server calls
|
|
3005
|
+
timeout: 1e4,
|
|
3006
|
+
// 10 seconds
|
|
3007
|
+
// Retry configuration
|
|
3008
|
+
retry: {
|
|
3009
|
+
attempts: 1,
|
|
3010
|
+
delay: 1e3
|
|
3011
|
+
// 1 second between retries
|
|
3012
|
+
}
|
|
3013
|
+
},
|
|
3014
|
+
// Cookie names
|
|
3015
|
+
cookies: {
|
|
3016
|
+
validation: "moonui_pro_validation",
|
|
3017
|
+
session: "moonui_pro_session",
|
|
3018
|
+
device: "moonui_pro_device"
|
|
3019
|
+
},
|
|
3020
|
+
// Header names for server communication
|
|
3021
|
+
headers: {
|
|
3022
|
+
validation: "x-moonui-pro-validation",
|
|
3023
|
+
device: "x-moonui-device-id",
|
|
3024
|
+
session: "x-moonui-session-id"
|
|
3025
|
+
}
|
|
3026
|
+
};
|
|
3027
|
+
var ENCRYPTION_KEY = process.env.MOONUI_ENCRYPTION_KEY || "moonui-pro-default-key-change-in-production";
|
|
3028
|
+
function encryptData(data) {
|
|
3029
|
+
const cipher = crypto.createCipher("aes-256-cbc", ENCRYPTION_KEY);
|
|
3030
|
+
let encrypted = cipher.update(JSON.stringify(data), "utf8", "hex");
|
|
3031
|
+
encrypted += cipher.final("hex");
|
|
3032
|
+
return encrypted;
|
|
3033
|
+
}
|
|
3034
|
+
function decryptData(encryptedData) {
|
|
3035
|
+
try {
|
|
3036
|
+
const decipher = crypto.createDecipher("aes-256-cbc", ENCRYPTION_KEY);
|
|
3037
|
+
let decrypted = decipher.update(encryptedData, "hex", "utf8");
|
|
3038
|
+
decrypted += decipher.final("utf8");
|
|
3039
|
+
return JSON.parse(decrypted);
|
|
3040
|
+
} catch (error) {
|
|
3041
|
+
console.error("[Server Auth] Decryption failed:", error);
|
|
3042
|
+
return null;
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
async function generateServerDeviceFingerprint() {
|
|
3046
|
+
const headersList = await (0, import_headers.headers)();
|
|
3047
|
+
const components = [
|
|
3048
|
+
headersList.get("user-agent") || "unknown",
|
|
3049
|
+
headersList.get("accept-language") || "unknown",
|
|
3050
|
+
headersList.get("accept-encoding") || "unknown",
|
|
3051
|
+
headersList.get("x-forwarded-for") || headersList.get("x-real-ip") || "unknown"
|
|
3052
|
+
];
|
|
3053
|
+
const fingerprint = crypto.createHash("sha256").update(components.join("|")).digest("hex");
|
|
3054
|
+
return fingerprint;
|
|
3055
|
+
}
|
|
3056
|
+
async function validateWithMoonUIServer(token, deviceId) {
|
|
3057
|
+
try {
|
|
3058
|
+
const response = await fetch(AUTH_CONFIG.api.moonuiValidationEndpoint, {
|
|
3059
|
+
method: "POST",
|
|
3060
|
+
headers: {
|
|
3061
|
+
"Content-Type": "application/json",
|
|
3062
|
+
"Authorization": `Bearer ${token}`,
|
|
3063
|
+
"X-Device-ID": deviceId,
|
|
3064
|
+
"X-API-Key": process.env.MOONUI_SERVER_API_KEY || ""
|
|
3065
|
+
},
|
|
3066
|
+
body: JSON.stringify({
|
|
3067
|
+
token,
|
|
3068
|
+
deviceId,
|
|
3069
|
+
timestamp: Date.now()
|
|
3070
|
+
}),
|
|
3071
|
+
signal: AbortSignal.timeout(AUTH_CONFIG.api.timeout)
|
|
3072
|
+
});
|
|
3073
|
+
if (!response.ok) {
|
|
3074
|
+
console.error("[Server Auth] Validation failed:", response.status);
|
|
3075
|
+
return { valid: false, hasProAccess: false, error: "Validation failed" };
|
|
3076
|
+
}
|
|
3077
|
+
const data = await response.json();
|
|
3078
|
+
return {
|
|
3079
|
+
valid: data.valid,
|
|
3080
|
+
hasProAccess: data.valid && (data.user?.hasLifetimeAccess || data.user?.features?.includes("pro_components") || false),
|
|
3081
|
+
plan: data.user?.plan
|
|
3082
|
+
};
|
|
3083
|
+
} catch (error) {
|
|
3084
|
+
console.error("[Server Auth] Server validation error:", error);
|
|
3085
|
+
return {
|
|
3086
|
+
valid: false,
|
|
3087
|
+
hasProAccess: false,
|
|
3088
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
3089
|
+
};
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
async function getValidationFromCookies() {
|
|
3093
|
+
const cookieStore = await (0, import_headers.cookies)();
|
|
3094
|
+
const validationCookie = cookieStore.get(AUTH_CONFIG.cookies.validation);
|
|
3095
|
+
if (!validationCookie) {
|
|
3096
|
+
return null;
|
|
3097
|
+
}
|
|
3098
|
+
const decrypted = decryptData(validationCookie.value);
|
|
3099
|
+
if (!decrypted) {
|
|
3100
|
+
return null;
|
|
3101
|
+
}
|
|
3102
|
+
const age = Date.now() - decrypted.timestamp;
|
|
3103
|
+
if (age > AUTH_CONFIG.cache.serverCacheDuration) {
|
|
3104
|
+
return null;
|
|
3105
|
+
}
|
|
3106
|
+
return decrypted;
|
|
3107
|
+
}
|
|
3108
|
+
async function setValidationInCookies(validation) {
|
|
3109
|
+
const cookieStore = await (0, import_headers.cookies)();
|
|
3110
|
+
const data = {
|
|
3111
|
+
...validation,
|
|
3112
|
+
timestamp: Date.now()
|
|
3113
|
+
};
|
|
3114
|
+
const encrypted = encryptData(data);
|
|
3115
|
+
cookieStore.set(
|
|
3116
|
+
AUTH_CONFIG.cookies.validation,
|
|
3117
|
+
encrypted,
|
|
3118
|
+
{
|
|
3119
|
+
...AUTH_CONFIG.security.cookieOptions,
|
|
3120
|
+
maxAge: AUTH_CONFIG.cache.cookieMaxAge
|
|
3121
|
+
}
|
|
3122
|
+
);
|
|
3123
|
+
}
|
|
3124
|
+
async function clearValidationCookies() {
|
|
3125
|
+
const cookieStore = await (0, import_headers.cookies)();
|
|
3126
|
+
cookieStore.delete(AUTH_CONFIG.cookies.validation);
|
|
3127
|
+
cookieStore.delete(AUTH_CONFIG.cookies.session);
|
|
3128
|
+
cookieStore.delete(AUTH_CONFIG.cookies.device);
|
|
3129
|
+
}
|
|
3130
|
+
async function performServerValidation() {
|
|
3131
|
+
const cached = await getValidationFromCookies();
|
|
3132
|
+
if (cached) {
|
|
3133
|
+
console.log("[Server Auth] Using cached validation");
|
|
3134
|
+
return { ...cached, cached: true };
|
|
3135
|
+
}
|
|
3136
|
+
const cookieStore = await (0, import_headers.cookies)();
|
|
3137
|
+
const token = cookieStore.get("moonui_auth_token")?.value || process.env.MOONUI_LICENSE_KEY || "";
|
|
3138
|
+
if (!token) {
|
|
3139
|
+
console.log("[Server Auth] No token found");
|
|
3140
|
+
return { valid: false, hasProAccess: false };
|
|
3141
|
+
}
|
|
3142
|
+
const deviceId = await generateServerDeviceFingerprint();
|
|
3143
|
+
console.log("[Server Auth] Performing server validation...");
|
|
3144
|
+
const result = await validateWithMoonUIServer(token, deviceId);
|
|
3145
|
+
if (result.valid) {
|
|
3146
|
+
await setValidationInCookies(result);
|
|
3147
|
+
}
|
|
3148
|
+
return { ...result, cached: false };
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
// src/server.ts
|
|
3152
|
+
if (typeof window !== "undefined") {
|
|
3153
|
+
console.warn(
|
|
3154
|
+
"[MoonUI Pro] Warning: Server utilities imported in client environment. These utilities should only be used in server components or API routes."
|
|
3155
|
+
);
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
export { AUTH_CONFIG, clearValidationCookies, decryptData, encryptData, generateServerDeviceFingerprint, getValidationFromCookies, performServerValidation, setValidationInCookies, validateWithMoonUIServer };
|