@nexushub/client 0.0.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/README.md +1105 -0
- package/dist/index.d.mts +356 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.js +4301 -0
- package/dist/index.mjs +4281 -0
- package/package.json +76 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,4281 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs
|
|
34
|
+
var require_interop_require_wildcard = __commonJS({
|
|
35
|
+
"node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs"(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
38
|
+
if (typeof WeakMap !== "function") return null;
|
|
39
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
40
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
42
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
43
|
+
})(nodeInterop);
|
|
44
|
+
}
|
|
45
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
46
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
47
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj };
|
|
48
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
49
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
50
|
+
var newObj = { __proto__: null };
|
|
51
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
|
+
for (var key in obj) {
|
|
53
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
54
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
55
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
56
|
+
else newObj[key] = obj[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
newObj.default = obj;
|
|
60
|
+
if (cache) cache.set(obj, newObj);
|
|
61
|
+
return newObj;
|
|
62
|
+
}
|
|
63
|
+
exports._ = _interop_require_wildcard;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// node_modules/@swc/helpers/cjs/_interop_require_default.cjs
|
|
68
|
+
var require_interop_require_default = __commonJS({
|
|
69
|
+
"node_modules/@swc/helpers/cjs/_interop_require_default.cjs"(exports) {
|
|
70
|
+
"use strict";
|
|
71
|
+
function _interop_require_default(obj) {
|
|
72
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
73
|
+
}
|
|
74
|
+
exports._ = _interop_require_default;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js
|
|
79
|
+
var require_app_router_context_shared_runtime = __commonJS({
|
|
80
|
+
"node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js"(exports) {
|
|
81
|
+
"use strict";
|
|
82
|
+
"use client";
|
|
83
|
+
Object.defineProperty(exports, "__esModule", {
|
|
84
|
+
value: true
|
|
85
|
+
});
|
|
86
|
+
function _export(target, all) {
|
|
87
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: all[name]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
_export(exports, {
|
|
93
|
+
AppRouterContext: function() {
|
|
94
|
+
return AppRouterContext;
|
|
95
|
+
},
|
|
96
|
+
GlobalLayoutRouterContext: function() {
|
|
97
|
+
return GlobalLayoutRouterContext;
|
|
98
|
+
},
|
|
99
|
+
LayoutRouterContext: function() {
|
|
100
|
+
return LayoutRouterContext;
|
|
101
|
+
},
|
|
102
|
+
MissingSlotContext: function() {
|
|
103
|
+
return MissingSlotContext;
|
|
104
|
+
},
|
|
105
|
+
TemplateContext: function() {
|
|
106
|
+
return TemplateContext;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
var _interop_require_default = require_interop_require_default();
|
|
110
|
+
var _react = /* @__PURE__ */ _interop_require_default._(__require("react"));
|
|
111
|
+
var AppRouterContext = _react.default.createContext(null);
|
|
112
|
+
var LayoutRouterContext = _react.default.createContext(null);
|
|
113
|
+
var GlobalLayoutRouterContext = _react.default.createContext(null);
|
|
114
|
+
var TemplateContext = _react.default.createContext(null);
|
|
115
|
+
if (process.env.NODE_ENV !== "production") {
|
|
116
|
+
AppRouterContext.displayName = "AppRouterContext";
|
|
117
|
+
LayoutRouterContext.displayName = "LayoutRouterContext";
|
|
118
|
+
GlobalLayoutRouterContext.displayName = "GlobalLayoutRouterContext";
|
|
119
|
+
TemplateContext.displayName = "TemplateContext";
|
|
120
|
+
}
|
|
121
|
+
var MissingSlotContext = _react.default.createContext(/* @__PURE__ */ new Set());
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// node_modules/next/dist/client/components/readonly-url-search-params.js
|
|
126
|
+
var require_readonly_url_search_params = __commonJS({
|
|
127
|
+
"node_modules/next/dist/client/components/readonly-url-search-params.js"(exports, module) {
|
|
128
|
+
"use strict";
|
|
129
|
+
Object.defineProperty(exports, "__esModule", {
|
|
130
|
+
value: true
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "ReadonlyURLSearchParams", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return ReadonlyURLSearchParams;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
var ReadonlyURLSearchParamsError = class extends Error {
|
|
139
|
+
constructor() {
|
|
140
|
+
super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams");
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var ReadonlyURLSearchParams = class extends URLSearchParams {
|
|
144
|
+
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
|
|
145
|
+
append() {
|
|
146
|
+
throw new ReadonlyURLSearchParamsError();
|
|
147
|
+
}
|
|
148
|
+
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
|
|
149
|
+
delete() {
|
|
150
|
+
throw new ReadonlyURLSearchParamsError();
|
|
151
|
+
}
|
|
152
|
+
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
|
|
153
|
+
set() {
|
|
154
|
+
throw new ReadonlyURLSearchParamsError();
|
|
155
|
+
}
|
|
156
|
+
/** @deprecated Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams */
|
|
157
|
+
sort() {
|
|
158
|
+
throw new ReadonlyURLSearchParamsError();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
162
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
163
|
+
Object.assign(exports.default, exports);
|
|
164
|
+
module.exports = exports.default;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js
|
|
170
|
+
var require_hooks_client_context_shared_runtime = __commonJS({
|
|
171
|
+
"node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js"(exports) {
|
|
172
|
+
"use strict";
|
|
173
|
+
"use client";
|
|
174
|
+
Object.defineProperty(exports, "__esModule", {
|
|
175
|
+
value: true
|
|
176
|
+
});
|
|
177
|
+
function _export(target, all) {
|
|
178
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: all[name]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
_export(exports, {
|
|
184
|
+
NavigationPromisesContext: function() {
|
|
185
|
+
return NavigationPromisesContext;
|
|
186
|
+
},
|
|
187
|
+
PathParamsContext: function() {
|
|
188
|
+
return PathParamsContext;
|
|
189
|
+
},
|
|
190
|
+
PathnameContext: function() {
|
|
191
|
+
return PathnameContext;
|
|
192
|
+
},
|
|
193
|
+
ReadonlyURLSearchParams: function() {
|
|
194
|
+
return _readonlyurlsearchparams.ReadonlyURLSearchParams;
|
|
195
|
+
},
|
|
196
|
+
SearchParamsContext: function() {
|
|
197
|
+
return SearchParamsContext;
|
|
198
|
+
},
|
|
199
|
+
createDevToolsInstrumentedPromise: function() {
|
|
200
|
+
return createDevToolsInstrumentedPromise;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
var _react = __require("react");
|
|
204
|
+
var _readonlyurlsearchparams = require_readonly_url_search_params();
|
|
205
|
+
var SearchParamsContext = (0, _react.createContext)(null);
|
|
206
|
+
var PathnameContext = (0, _react.createContext)(null);
|
|
207
|
+
var PathParamsContext = (0, _react.createContext)(null);
|
|
208
|
+
var NavigationPromisesContext = (0, _react.createContext)(null);
|
|
209
|
+
function createDevToolsInstrumentedPromise(displayName, value) {
|
|
210
|
+
const promise = Promise.resolve(value);
|
|
211
|
+
promise.status = "fulfilled";
|
|
212
|
+
promise.value = value;
|
|
213
|
+
promise.displayName = `${displayName} (SSR)`;
|
|
214
|
+
return promise;
|
|
215
|
+
}
|
|
216
|
+
if (process.env.NODE_ENV !== "production") {
|
|
217
|
+
SearchParamsContext.displayName = "SearchParamsContext";
|
|
218
|
+
PathnameContext.displayName = "PathnameContext";
|
|
219
|
+
PathParamsContext.displayName = "PathParamsContext";
|
|
220
|
+
NavigationPromisesContext.displayName = "NavigationPromisesContext";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// node_modules/next/dist/shared/lib/segment.js
|
|
226
|
+
var require_segment = __commonJS({
|
|
227
|
+
"node_modules/next/dist/shared/lib/segment.js"(exports) {
|
|
228
|
+
"use strict";
|
|
229
|
+
Object.defineProperty(exports, "__esModule", {
|
|
230
|
+
value: true
|
|
231
|
+
});
|
|
232
|
+
function _export(target, all) {
|
|
233
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: all[name]
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
_export(exports, {
|
|
239
|
+
DEFAULT_SEGMENT_KEY: function() {
|
|
240
|
+
return DEFAULT_SEGMENT_KEY;
|
|
241
|
+
},
|
|
242
|
+
NOT_FOUND_SEGMENT_KEY: function() {
|
|
243
|
+
return NOT_FOUND_SEGMENT_KEY;
|
|
244
|
+
},
|
|
245
|
+
PAGE_SEGMENT_KEY: function() {
|
|
246
|
+
return PAGE_SEGMENT_KEY;
|
|
247
|
+
},
|
|
248
|
+
addSearchParamsIfPageSegment: function() {
|
|
249
|
+
return addSearchParamsIfPageSegment;
|
|
250
|
+
},
|
|
251
|
+
computeSelectedLayoutSegment: function() {
|
|
252
|
+
return computeSelectedLayoutSegment;
|
|
253
|
+
},
|
|
254
|
+
getSegmentValue: function() {
|
|
255
|
+
return getSegmentValue;
|
|
256
|
+
},
|
|
257
|
+
getSelectedLayoutSegmentPath: function() {
|
|
258
|
+
return getSelectedLayoutSegmentPath;
|
|
259
|
+
},
|
|
260
|
+
isGroupSegment: function() {
|
|
261
|
+
return isGroupSegment;
|
|
262
|
+
},
|
|
263
|
+
isParallelRouteSegment: function() {
|
|
264
|
+
return isParallelRouteSegment;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
function getSegmentValue(segment) {
|
|
268
|
+
return Array.isArray(segment) ? segment[1] : segment;
|
|
269
|
+
}
|
|
270
|
+
function isGroupSegment(segment) {
|
|
271
|
+
return segment[0] === "(" && segment.endsWith(")");
|
|
272
|
+
}
|
|
273
|
+
function isParallelRouteSegment(segment) {
|
|
274
|
+
return segment.startsWith("@") && segment !== "@children";
|
|
275
|
+
}
|
|
276
|
+
function addSearchParamsIfPageSegment(segment, searchParams) {
|
|
277
|
+
const isPageSegment = segment.includes(PAGE_SEGMENT_KEY);
|
|
278
|
+
if (isPageSegment) {
|
|
279
|
+
const stringifiedQuery = JSON.stringify(searchParams);
|
|
280
|
+
return stringifiedQuery !== "{}" ? PAGE_SEGMENT_KEY + "?" + stringifiedQuery : PAGE_SEGMENT_KEY;
|
|
281
|
+
}
|
|
282
|
+
return segment;
|
|
283
|
+
}
|
|
284
|
+
function computeSelectedLayoutSegment(segments, parallelRouteKey) {
|
|
285
|
+
if (!segments || segments.length === 0) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
const rawSegment = parallelRouteKey === "children" ? segments[0] : segments[segments.length - 1];
|
|
289
|
+
return rawSegment === DEFAULT_SEGMENT_KEY ? null : rawSegment;
|
|
290
|
+
}
|
|
291
|
+
function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first = true, segmentPath = []) {
|
|
292
|
+
let node;
|
|
293
|
+
if (first) {
|
|
294
|
+
node = tree[1][parallelRouteKey];
|
|
295
|
+
} else {
|
|
296
|
+
const parallelRoutes = tree[1];
|
|
297
|
+
node = parallelRoutes.children ?? Object.values(parallelRoutes)[0];
|
|
298
|
+
}
|
|
299
|
+
if (!node) return segmentPath;
|
|
300
|
+
const segment = node[0];
|
|
301
|
+
let segmentValue = getSegmentValue(segment);
|
|
302
|
+
if (!segmentValue || segmentValue.startsWith(PAGE_SEGMENT_KEY)) {
|
|
303
|
+
return segmentPath;
|
|
304
|
+
}
|
|
305
|
+
segmentPath.push(segmentValue);
|
|
306
|
+
return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath);
|
|
307
|
+
}
|
|
308
|
+
var PAGE_SEGMENT_KEY = "__PAGE__";
|
|
309
|
+
var DEFAULT_SEGMENT_KEY = "__DEFAULT__";
|
|
310
|
+
var NOT_FOUND_SEGMENT_KEY = "/_not-found";
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
// node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js
|
|
315
|
+
var require_server_inserted_html_shared_runtime = __commonJS({
|
|
316
|
+
"node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js"(exports) {
|
|
317
|
+
"use strict";
|
|
318
|
+
"use client";
|
|
319
|
+
Object.defineProperty(exports, "__esModule", {
|
|
320
|
+
value: true
|
|
321
|
+
});
|
|
322
|
+
function _export(target, all) {
|
|
323
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
324
|
+
enumerable: true,
|
|
325
|
+
get: all[name]
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
_export(exports, {
|
|
329
|
+
ServerInsertedHTMLContext: function() {
|
|
330
|
+
return ServerInsertedHTMLContext;
|
|
331
|
+
},
|
|
332
|
+
useServerInsertedHTML: function() {
|
|
333
|
+
return useServerInsertedHTML;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
var _interop_require_wildcard = require_interop_require_wildcard();
|
|
337
|
+
var _react = /* @__PURE__ */ _interop_require_wildcard._(__require("react"));
|
|
338
|
+
var ServerInsertedHTMLContext = /* @__PURE__ */ _react.default.createContext(null);
|
|
339
|
+
function useServerInsertedHTML(callback) {
|
|
340
|
+
const addInsertedServerHTMLCallback = (0, _react.useContext)(ServerInsertedHTMLContext);
|
|
341
|
+
if (addInsertedServerHTMLCallback) {
|
|
342
|
+
addInsertedServerHTMLCallback(callback);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// node_modules/next/dist/client/components/unrecognized-action-error.js
|
|
349
|
+
var require_unrecognized_action_error = __commonJS({
|
|
350
|
+
"node_modules/next/dist/client/components/unrecognized-action-error.js"(exports, module) {
|
|
351
|
+
"use strict";
|
|
352
|
+
Object.defineProperty(exports, "__esModule", {
|
|
353
|
+
value: true
|
|
354
|
+
});
|
|
355
|
+
function _export(target, all) {
|
|
356
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: all[name]
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
_export(exports, {
|
|
362
|
+
UnrecognizedActionError: function() {
|
|
363
|
+
return UnrecognizedActionError;
|
|
364
|
+
},
|
|
365
|
+
unstable_isUnrecognizedActionError: function() {
|
|
366
|
+
return unstable_isUnrecognizedActionError;
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
var UnrecognizedActionError = class extends Error {
|
|
370
|
+
constructor(...args) {
|
|
371
|
+
super(...args);
|
|
372
|
+
this.name = "UnrecognizedActionError";
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
function unstable_isUnrecognizedActionError(error) {
|
|
376
|
+
return !!(error && typeof error === "object" && error instanceof UnrecognizedActionError);
|
|
377
|
+
}
|
|
378
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
379
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
380
|
+
Object.assign(exports.default, exports);
|
|
381
|
+
module.exports = exports.default;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// node_modules/next/dist/client/components/redirect-status-code.js
|
|
387
|
+
var require_redirect_status_code = __commonJS({
|
|
388
|
+
"node_modules/next/dist/client/components/redirect-status-code.js"(exports, module) {
|
|
389
|
+
"use strict";
|
|
390
|
+
Object.defineProperty(exports, "__esModule", {
|
|
391
|
+
value: true
|
|
392
|
+
});
|
|
393
|
+
Object.defineProperty(exports, "RedirectStatusCode", {
|
|
394
|
+
enumerable: true,
|
|
395
|
+
get: function() {
|
|
396
|
+
return RedirectStatusCode;
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
var RedirectStatusCode = /* @__PURE__ */ (function(RedirectStatusCode2) {
|
|
400
|
+
RedirectStatusCode2[RedirectStatusCode2["SeeOther"] = 303] = "SeeOther";
|
|
401
|
+
RedirectStatusCode2[RedirectStatusCode2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
402
|
+
RedirectStatusCode2[RedirectStatusCode2["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
403
|
+
return RedirectStatusCode2;
|
|
404
|
+
})({});
|
|
405
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
406
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
407
|
+
Object.assign(exports.default, exports);
|
|
408
|
+
module.exports = exports.default;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// node_modules/next/dist/client/components/redirect-error.js
|
|
414
|
+
var require_redirect_error = __commonJS({
|
|
415
|
+
"node_modules/next/dist/client/components/redirect-error.js"(exports, module) {
|
|
416
|
+
"use strict";
|
|
417
|
+
Object.defineProperty(exports, "__esModule", {
|
|
418
|
+
value: true
|
|
419
|
+
});
|
|
420
|
+
function _export(target, all) {
|
|
421
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
422
|
+
enumerable: true,
|
|
423
|
+
get: all[name]
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
_export(exports, {
|
|
427
|
+
REDIRECT_ERROR_CODE: function() {
|
|
428
|
+
return REDIRECT_ERROR_CODE;
|
|
429
|
+
},
|
|
430
|
+
RedirectType: function() {
|
|
431
|
+
return RedirectType;
|
|
432
|
+
},
|
|
433
|
+
isRedirectError: function() {
|
|
434
|
+
return isRedirectError;
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
var _redirectstatuscode = require_redirect_status_code();
|
|
438
|
+
var REDIRECT_ERROR_CODE = "NEXT_REDIRECT";
|
|
439
|
+
var RedirectType = /* @__PURE__ */ (function(RedirectType2) {
|
|
440
|
+
RedirectType2["push"] = "push";
|
|
441
|
+
RedirectType2["replace"] = "replace";
|
|
442
|
+
return RedirectType2;
|
|
443
|
+
})({});
|
|
444
|
+
function isRedirectError(error) {
|
|
445
|
+
if (typeof error !== "object" || error === null || !("digest" in error) || typeof error.digest !== "string") {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
const digest = error.digest.split(";");
|
|
449
|
+
const [errorCode, type] = digest;
|
|
450
|
+
const destination = digest.slice(2, -2).join(";");
|
|
451
|
+
const status = digest.at(-2);
|
|
452
|
+
const statusCode = Number(status);
|
|
453
|
+
return errorCode === REDIRECT_ERROR_CODE && (type === "replace" || type === "push") && typeof destination === "string" && !isNaN(statusCode) && statusCode in _redirectstatuscode.RedirectStatusCode;
|
|
454
|
+
}
|
|
455
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
456
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
457
|
+
Object.assign(exports.default, exports);
|
|
458
|
+
module.exports = exports.default;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// node_modules/next/dist/server/app-render/async-local-storage.js
|
|
464
|
+
var require_async_local_storage = __commonJS({
|
|
465
|
+
"node_modules/next/dist/server/app-render/async-local-storage.js"(exports) {
|
|
466
|
+
"use strict";
|
|
467
|
+
Object.defineProperty(exports, "__esModule", {
|
|
468
|
+
value: true
|
|
469
|
+
});
|
|
470
|
+
function _export(target, all) {
|
|
471
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
472
|
+
enumerable: true,
|
|
473
|
+
get: all[name]
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
_export(exports, {
|
|
477
|
+
bindSnapshot: function() {
|
|
478
|
+
return bindSnapshot;
|
|
479
|
+
},
|
|
480
|
+
createAsyncLocalStorage: function() {
|
|
481
|
+
return createAsyncLocalStorage;
|
|
482
|
+
},
|
|
483
|
+
createSnapshot: function() {
|
|
484
|
+
return createSnapshot;
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
var sharedAsyncLocalStorageNotAvailableError = Object.defineProperty(new Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"), "__NEXT_ERROR_CODE", {
|
|
488
|
+
value: "E504",
|
|
489
|
+
enumerable: false,
|
|
490
|
+
configurable: true
|
|
491
|
+
});
|
|
492
|
+
var FakeAsyncLocalStorage = class {
|
|
493
|
+
disable() {
|
|
494
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
495
|
+
}
|
|
496
|
+
getStore() {
|
|
497
|
+
return void 0;
|
|
498
|
+
}
|
|
499
|
+
run() {
|
|
500
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
501
|
+
}
|
|
502
|
+
exit() {
|
|
503
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
504
|
+
}
|
|
505
|
+
enterWith() {
|
|
506
|
+
throw sharedAsyncLocalStorageNotAvailableError;
|
|
507
|
+
}
|
|
508
|
+
static bind(fn) {
|
|
509
|
+
return fn;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
var maybeGlobalAsyncLocalStorage = typeof globalThis !== "undefined" && globalThis.AsyncLocalStorage;
|
|
513
|
+
function createAsyncLocalStorage() {
|
|
514
|
+
if (maybeGlobalAsyncLocalStorage) {
|
|
515
|
+
return new maybeGlobalAsyncLocalStorage();
|
|
516
|
+
}
|
|
517
|
+
return new FakeAsyncLocalStorage();
|
|
518
|
+
}
|
|
519
|
+
function bindSnapshot(fn) {
|
|
520
|
+
if (maybeGlobalAsyncLocalStorage) {
|
|
521
|
+
return maybeGlobalAsyncLocalStorage.bind(fn);
|
|
522
|
+
}
|
|
523
|
+
return FakeAsyncLocalStorage.bind(fn);
|
|
524
|
+
}
|
|
525
|
+
function createSnapshot() {
|
|
526
|
+
if (maybeGlobalAsyncLocalStorage) {
|
|
527
|
+
return maybeGlobalAsyncLocalStorage.snapshot();
|
|
528
|
+
}
|
|
529
|
+
return function(fn, ...args) {
|
|
530
|
+
return fn(...args);
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// node_modules/next/dist/server/app-render/action-async-storage-instance.js
|
|
537
|
+
var require_action_async_storage_instance = __commonJS({
|
|
538
|
+
"node_modules/next/dist/server/app-render/action-async-storage-instance.js"(exports) {
|
|
539
|
+
"use strict";
|
|
540
|
+
Object.defineProperty(exports, "__esModule", {
|
|
541
|
+
value: true
|
|
542
|
+
});
|
|
543
|
+
Object.defineProperty(exports, "actionAsyncStorageInstance", {
|
|
544
|
+
enumerable: true,
|
|
545
|
+
get: function() {
|
|
546
|
+
return actionAsyncStorageInstance;
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
var _asynclocalstorage = require_async_local_storage();
|
|
550
|
+
var actionAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
// node_modules/next/dist/server/app-render/action-async-storage.external.js
|
|
555
|
+
var require_action_async_storage_external = __commonJS({
|
|
556
|
+
"node_modules/next/dist/server/app-render/action-async-storage.external.js"(exports) {
|
|
557
|
+
"use strict";
|
|
558
|
+
Object.defineProperty(exports, "__esModule", {
|
|
559
|
+
value: true
|
|
560
|
+
});
|
|
561
|
+
Object.defineProperty(exports, "actionAsyncStorage", {
|
|
562
|
+
enumerable: true,
|
|
563
|
+
get: function() {
|
|
564
|
+
return _actionasyncstorageinstance.actionAsyncStorageInstance;
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
var _actionasyncstorageinstance = require_action_async_storage_instance();
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// node_modules/next/dist/client/components/redirect.js
|
|
572
|
+
var require_redirect = __commonJS({
|
|
573
|
+
"node_modules/next/dist/client/components/redirect.js"(exports, module) {
|
|
574
|
+
"use strict";
|
|
575
|
+
Object.defineProperty(exports, "__esModule", {
|
|
576
|
+
value: true
|
|
577
|
+
});
|
|
578
|
+
function _export(target, all) {
|
|
579
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
580
|
+
enumerable: true,
|
|
581
|
+
get: all[name]
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
_export(exports, {
|
|
585
|
+
getRedirectError: function() {
|
|
586
|
+
return getRedirectError;
|
|
587
|
+
},
|
|
588
|
+
getRedirectStatusCodeFromError: function() {
|
|
589
|
+
return getRedirectStatusCodeFromError;
|
|
590
|
+
},
|
|
591
|
+
getRedirectTypeFromError: function() {
|
|
592
|
+
return getRedirectTypeFromError;
|
|
593
|
+
},
|
|
594
|
+
getURLFromRedirectError: function() {
|
|
595
|
+
return getURLFromRedirectError;
|
|
596
|
+
},
|
|
597
|
+
permanentRedirect: function() {
|
|
598
|
+
return permanentRedirect;
|
|
599
|
+
},
|
|
600
|
+
redirect: function() {
|
|
601
|
+
return redirect;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
var _redirectstatuscode = require_redirect_status_code();
|
|
605
|
+
var _redirecterror = require_redirect_error();
|
|
606
|
+
var actionAsyncStorage = typeof window === "undefined" ? require_action_async_storage_external().actionAsyncStorage : void 0;
|
|
607
|
+
function getRedirectError(url, type, statusCode = _redirectstatuscode.RedirectStatusCode.TemporaryRedirect) {
|
|
608
|
+
const error = Object.defineProperty(new Error(_redirecterror.REDIRECT_ERROR_CODE), "__NEXT_ERROR_CODE", {
|
|
609
|
+
value: "E394",
|
|
610
|
+
enumerable: false,
|
|
611
|
+
configurable: true
|
|
612
|
+
});
|
|
613
|
+
error.digest = `${_redirecterror.REDIRECT_ERROR_CODE};${type};${url};${statusCode};`;
|
|
614
|
+
return error;
|
|
615
|
+
}
|
|
616
|
+
function redirect(url, type) {
|
|
617
|
+
type ?? (type = actionAsyncStorage?.getStore()?.isAction ? _redirecterror.RedirectType.push : _redirecterror.RedirectType.replace);
|
|
618
|
+
throw getRedirectError(url, type, _redirectstatuscode.RedirectStatusCode.TemporaryRedirect);
|
|
619
|
+
}
|
|
620
|
+
function permanentRedirect(url, type = _redirecterror.RedirectType.replace) {
|
|
621
|
+
throw getRedirectError(url, type, _redirectstatuscode.RedirectStatusCode.PermanentRedirect);
|
|
622
|
+
}
|
|
623
|
+
function getURLFromRedirectError(error) {
|
|
624
|
+
if (!(0, _redirecterror.isRedirectError)(error)) return null;
|
|
625
|
+
return error.digest.split(";").slice(2, -2).join(";");
|
|
626
|
+
}
|
|
627
|
+
function getRedirectTypeFromError(error) {
|
|
628
|
+
if (!(0, _redirecterror.isRedirectError)(error)) {
|
|
629
|
+
throw Object.defineProperty(new Error("Not a redirect error"), "__NEXT_ERROR_CODE", {
|
|
630
|
+
value: "E260",
|
|
631
|
+
enumerable: false,
|
|
632
|
+
configurable: true
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
return error.digest.split(";", 2)[1];
|
|
636
|
+
}
|
|
637
|
+
function getRedirectStatusCodeFromError(error) {
|
|
638
|
+
if (!(0, _redirecterror.isRedirectError)(error)) {
|
|
639
|
+
throw Object.defineProperty(new Error("Not a redirect error"), "__NEXT_ERROR_CODE", {
|
|
640
|
+
value: "E260",
|
|
641
|
+
enumerable: false,
|
|
642
|
+
configurable: true
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
return Number(error.digest.split(";").at(-2));
|
|
646
|
+
}
|
|
647
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
648
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
649
|
+
Object.assign(exports.default, exports);
|
|
650
|
+
module.exports = exports.default;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js
|
|
656
|
+
var require_http_access_fallback = __commonJS({
|
|
657
|
+
"node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js"(exports, module) {
|
|
658
|
+
"use strict";
|
|
659
|
+
Object.defineProperty(exports, "__esModule", {
|
|
660
|
+
value: true
|
|
661
|
+
});
|
|
662
|
+
function _export(target, all) {
|
|
663
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
664
|
+
enumerable: true,
|
|
665
|
+
get: all[name]
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
_export(exports, {
|
|
669
|
+
HTTPAccessErrorStatus: function() {
|
|
670
|
+
return HTTPAccessErrorStatus;
|
|
671
|
+
},
|
|
672
|
+
HTTP_ERROR_FALLBACK_ERROR_CODE: function() {
|
|
673
|
+
return HTTP_ERROR_FALLBACK_ERROR_CODE;
|
|
674
|
+
},
|
|
675
|
+
getAccessFallbackErrorTypeByStatus: function() {
|
|
676
|
+
return getAccessFallbackErrorTypeByStatus;
|
|
677
|
+
},
|
|
678
|
+
getAccessFallbackHTTPStatus: function() {
|
|
679
|
+
return getAccessFallbackHTTPStatus;
|
|
680
|
+
},
|
|
681
|
+
isHTTPAccessFallbackError: function() {
|
|
682
|
+
return isHTTPAccessFallbackError;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
var HTTPAccessErrorStatus = {
|
|
686
|
+
NOT_FOUND: 404,
|
|
687
|
+
FORBIDDEN: 403,
|
|
688
|
+
UNAUTHORIZED: 401
|
|
689
|
+
};
|
|
690
|
+
var ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus));
|
|
691
|
+
var HTTP_ERROR_FALLBACK_ERROR_CODE = "NEXT_HTTP_ERROR_FALLBACK";
|
|
692
|
+
function isHTTPAccessFallbackError(error) {
|
|
693
|
+
if (typeof error !== "object" || error === null || !("digest" in error) || typeof error.digest !== "string") {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
const [prefix, httpStatus] = error.digest.split(";");
|
|
697
|
+
return prefix === HTTP_ERROR_FALLBACK_ERROR_CODE && ALLOWED_CODES.has(Number(httpStatus));
|
|
698
|
+
}
|
|
699
|
+
function getAccessFallbackHTTPStatus(error) {
|
|
700
|
+
const httpStatus = error.digest.split(";")[1];
|
|
701
|
+
return Number(httpStatus);
|
|
702
|
+
}
|
|
703
|
+
function getAccessFallbackErrorTypeByStatus(status) {
|
|
704
|
+
switch (status) {
|
|
705
|
+
case 401:
|
|
706
|
+
return "unauthorized";
|
|
707
|
+
case 403:
|
|
708
|
+
return "forbidden";
|
|
709
|
+
case 404:
|
|
710
|
+
return "not-found";
|
|
711
|
+
default:
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
716
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
717
|
+
Object.assign(exports.default, exports);
|
|
718
|
+
module.exports = exports.default;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// node_modules/next/dist/client/components/not-found.js
|
|
724
|
+
var require_not_found = __commonJS({
|
|
725
|
+
"node_modules/next/dist/client/components/not-found.js"(exports, module) {
|
|
726
|
+
"use strict";
|
|
727
|
+
Object.defineProperty(exports, "__esModule", {
|
|
728
|
+
value: true
|
|
729
|
+
});
|
|
730
|
+
Object.defineProperty(exports, "notFound", {
|
|
731
|
+
enumerable: true,
|
|
732
|
+
get: function() {
|
|
733
|
+
return notFound;
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
var _httpaccessfallback = require_http_access_fallback();
|
|
737
|
+
var DIGEST = `${_httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE};404`;
|
|
738
|
+
function notFound() {
|
|
739
|
+
const error = Object.defineProperty(new Error(DIGEST), "__NEXT_ERROR_CODE", {
|
|
740
|
+
value: "E394",
|
|
741
|
+
enumerable: false,
|
|
742
|
+
configurable: true
|
|
743
|
+
});
|
|
744
|
+
error.digest = DIGEST;
|
|
745
|
+
throw error;
|
|
746
|
+
}
|
|
747
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
748
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
749
|
+
Object.assign(exports.default, exports);
|
|
750
|
+
module.exports = exports.default;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
// node_modules/next/dist/client/components/forbidden.js
|
|
756
|
+
var require_forbidden = __commonJS({
|
|
757
|
+
"node_modules/next/dist/client/components/forbidden.js"(exports, module) {
|
|
758
|
+
"use strict";
|
|
759
|
+
Object.defineProperty(exports, "__esModule", {
|
|
760
|
+
value: true
|
|
761
|
+
});
|
|
762
|
+
Object.defineProperty(exports, "forbidden", {
|
|
763
|
+
enumerable: true,
|
|
764
|
+
get: function() {
|
|
765
|
+
return forbidden;
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
var _httpaccessfallback = require_http_access_fallback();
|
|
769
|
+
var DIGEST = `${_httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE};403`;
|
|
770
|
+
function forbidden() {
|
|
771
|
+
if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
|
|
772
|
+
throw Object.defineProperty(new Error(`\`forbidden()\` is experimental and only allowed to be enabled when \`experimental.authInterrupts\` is enabled.`), "__NEXT_ERROR_CODE", {
|
|
773
|
+
value: "E488",
|
|
774
|
+
enumerable: false,
|
|
775
|
+
configurable: true
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
const error = Object.defineProperty(new Error(DIGEST), "__NEXT_ERROR_CODE", {
|
|
779
|
+
value: "E394",
|
|
780
|
+
enumerable: false,
|
|
781
|
+
configurable: true
|
|
782
|
+
});
|
|
783
|
+
error.digest = DIGEST;
|
|
784
|
+
throw error;
|
|
785
|
+
}
|
|
786
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
787
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
788
|
+
Object.assign(exports.default, exports);
|
|
789
|
+
module.exports = exports.default;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
// node_modules/next/dist/client/components/unauthorized.js
|
|
795
|
+
var require_unauthorized = __commonJS({
|
|
796
|
+
"node_modules/next/dist/client/components/unauthorized.js"(exports, module) {
|
|
797
|
+
"use strict";
|
|
798
|
+
Object.defineProperty(exports, "__esModule", {
|
|
799
|
+
value: true
|
|
800
|
+
});
|
|
801
|
+
Object.defineProperty(exports, "unauthorized", {
|
|
802
|
+
enumerable: true,
|
|
803
|
+
get: function() {
|
|
804
|
+
return unauthorized;
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
var _httpaccessfallback = require_http_access_fallback();
|
|
808
|
+
var DIGEST = `${_httpaccessfallback.HTTP_ERROR_FALLBACK_ERROR_CODE};401`;
|
|
809
|
+
function unauthorized() {
|
|
810
|
+
if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
|
|
811
|
+
throw Object.defineProperty(new Error(`\`unauthorized()\` is experimental and only allowed to be used when \`experimental.authInterrupts\` is enabled.`), "__NEXT_ERROR_CODE", {
|
|
812
|
+
value: "E411",
|
|
813
|
+
enumerable: false,
|
|
814
|
+
configurable: true
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
const error = Object.defineProperty(new Error(DIGEST), "__NEXT_ERROR_CODE", {
|
|
818
|
+
value: "E394",
|
|
819
|
+
enumerable: false,
|
|
820
|
+
configurable: true
|
|
821
|
+
});
|
|
822
|
+
error.digest = DIGEST;
|
|
823
|
+
throw error;
|
|
824
|
+
}
|
|
825
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
826
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
827
|
+
Object.assign(exports.default, exports);
|
|
828
|
+
module.exports = exports.default;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
// node_modules/next/dist/server/dynamic-rendering-utils.js
|
|
834
|
+
var require_dynamic_rendering_utils = __commonJS({
|
|
835
|
+
"node_modules/next/dist/server/dynamic-rendering-utils.js"(exports) {
|
|
836
|
+
"use strict";
|
|
837
|
+
Object.defineProperty(exports, "__esModule", {
|
|
838
|
+
value: true
|
|
839
|
+
});
|
|
840
|
+
function _export(target, all) {
|
|
841
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
842
|
+
enumerable: true,
|
|
843
|
+
get: all[name]
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
_export(exports, {
|
|
847
|
+
isHangingPromiseRejectionError: function() {
|
|
848
|
+
return isHangingPromiseRejectionError;
|
|
849
|
+
},
|
|
850
|
+
makeDevtoolsIOAwarePromise: function() {
|
|
851
|
+
return makeDevtoolsIOAwarePromise;
|
|
852
|
+
},
|
|
853
|
+
makeHangingPromise: function() {
|
|
854
|
+
return makeHangingPromise;
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
function isHangingPromiseRejectionError(err) {
|
|
858
|
+
if (typeof err !== "object" || err === null || !("digest" in err)) {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
return err.digest === HANGING_PROMISE_REJECTION;
|
|
862
|
+
}
|
|
863
|
+
var HANGING_PROMISE_REJECTION = "HANGING_PROMISE_REJECTION";
|
|
864
|
+
var HangingPromiseRejectionError = class extends Error {
|
|
865
|
+
constructor(route, expression) {
|
|
866
|
+
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 occurred at route "${route}".`), this.route = route, this.expression = expression, this.digest = HANGING_PROMISE_REJECTION;
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
var abortListenersBySignal = /* @__PURE__ */ new WeakMap();
|
|
870
|
+
function makeHangingPromise(signal, route, expression) {
|
|
871
|
+
if (signal.aborted) {
|
|
872
|
+
return Promise.reject(new HangingPromiseRejectionError(route, expression));
|
|
873
|
+
} else {
|
|
874
|
+
const hangingPromise = new Promise((_, reject) => {
|
|
875
|
+
const boundRejection = reject.bind(null, new HangingPromiseRejectionError(route, expression));
|
|
876
|
+
let currentListeners = abortListenersBySignal.get(signal);
|
|
877
|
+
if (currentListeners) {
|
|
878
|
+
currentListeners.push(boundRejection);
|
|
879
|
+
} else {
|
|
880
|
+
const listeners = [
|
|
881
|
+
boundRejection
|
|
882
|
+
];
|
|
883
|
+
abortListenersBySignal.set(signal, listeners);
|
|
884
|
+
signal.addEventListener("abort", () => {
|
|
885
|
+
for (let i = 0; i < listeners.length; i++) {
|
|
886
|
+
listeners[i]();
|
|
887
|
+
}
|
|
888
|
+
}, {
|
|
889
|
+
once: true
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
hangingPromise.catch(ignoreReject);
|
|
894
|
+
return hangingPromise;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
function ignoreReject() {
|
|
898
|
+
}
|
|
899
|
+
function makeDevtoolsIOAwarePromise(underlying, requestStore, stage) {
|
|
900
|
+
if (requestStore.stagedRendering) {
|
|
901
|
+
return requestStore.stagedRendering.delayUntilStage(stage, void 0, underlying);
|
|
902
|
+
}
|
|
903
|
+
return new Promise((resolve) => {
|
|
904
|
+
setTimeout(() => {
|
|
905
|
+
resolve(underlying);
|
|
906
|
+
}, 0);
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
// node_modules/next/dist/server/lib/router-utils/is-postpone.js
|
|
913
|
+
var require_is_postpone = __commonJS({
|
|
914
|
+
"node_modules/next/dist/server/lib/router-utils/is-postpone.js"(exports) {
|
|
915
|
+
"use strict";
|
|
916
|
+
Object.defineProperty(exports, "__esModule", {
|
|
917
|
+
value: true
|
|
918
|
+
});
|
|
919
|
+
Object.defineProperty(exports, "isPostpone", {
|
|
920
|
+
enumerable: true,
|
|
921
|
+
get: function() {
|
|
922
|
+
return isPostpone;
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
var REACT_POSTPONE_TYPE = /* @__PURE__ */ Symbol.for("react.postpone");
|
|
926
|
+
function isPostpone(error) {
|
|
927
|
+
return typeof error === "object" && error !== null && error.$$typeof === REACT_POSTPONE_TYPE;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
// node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js
|
|
933
|
+
var require_bailout_to_csr = __commonJS({
|
|
934
|
+
"node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js"(exports) {
|
|
935
|
+
"use strict";
|
|
936
|
+
Object.defineProperty(exports, "__esModule", {
|
|
937
|
+
value: true
|
|
938
|
+
});
|
|
939
|
+
function _export(target, all) {
|
|
940
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
941
|
+
enumerable: true,
|
|
942
|
+
get: all[name]
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
_export(exports, {
|
|
946
|
+
BailoutToCSRError: function() {
|
|
947
|
+
return BailoutToCSRError;
|
|
948
|
+
},
|
|
949
|
+
isBailoutToCSRError: function() {
|
|
950
|
+
return isBailoutToCSRError;
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
var BAILOUT_TO_CSR = "BAILOUT_TO_CLIENT_SIDE_RENDERING";
|
|
954
|
+
var BailoutToCSRError = class extends Error {
|
|
955
|
+
constructor(reason) {
|
|
956
|
+
super(`Bail out to client-side rendering: ${reason}`), this.reason = reason, this.digest = BAILOUT_TO_CSR;
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
function isBailoutToCSRError(err) {
|
|
960
|
+
if (typeof err !== "object" || err === null || !("digest" in err)) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
return err.digest === BAILOUT_TO_CSR;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
// node_modules/next/dist/client/components/is-next-router-error.js
|
|
969
|
+
var require_is_next_router_error = __commonJS({
|
|
970
|
+
"node_modules/next/dist/client/components/is-next-router-error.js"(exports, module) {
|
|
971
|
+
"use strict";
|
|
972
|
+
Object.defineProperty(exports, "__esModule", {
|
|
973
|
+
value: true
|
|
974
|
+
});
|
|
975
|
+
Object.defineProperty(exports, "isNextRouterError", {
|
|
976
|
+
enumerable: true,
|
|
977
|
+
get: function() {
|
|
978
|
+
return isNextRouterError;
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
var _httpaccessfallback = require_http_access_fallback();
|
|
982
|
+
var _redirecterror = require_redirect_error();
|
|
983
|
+
function isNextRouterError(error) {
|
|
984
|
+
return (0, _redirecterror.isRedirectError)(error) || (0, _httpaccessfallback.isHTTPAccessFallbackError)(error);
|
|
985
|
+
}
|
|
986
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
987
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
988
|
+
Object.assign(exports.default, exports);
|
|
989
|
+
module.exports = exports.default;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
// node_modules/next/dist/client/components/hooks-server-context.js
|
|
995
|
+
var require_hooks_server_context = __commonJS({
|
|
996
|
+
"node_modules/next/dist/client/components/hooks-server-context.js"(exports, module) {
|
|
997
|
+
"use strict";
|
|
998
|
+
Object.defineProperty(exports, "__esModule", {
|
|
999
|
+
value: true
|
|
1000
|
+
});
|
|
1001
|
+
function _export(target, all) {
|
|
1002
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1003
|
+
enumerable: true,
|
|
1004
|
+
get: all[name]
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
_export(exports, {
|
|
1008
|
+
DynamicServerError: function() {
|
|
1009
|
+
return DynamicServerError;
|
|
1010
|
+
},
|
|
1011
|
+
isDynamicServerError: function() {
|
|
1012
|
+
return isDynamicServerError;
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
var DYNAMIC_ERROR_CODE = "DYNAMIC_SERVER_USAGE";
|
|
1016
|
+
var DynamicServerError = class extends Error {
|
|
1017
|
+
constructor(description) {
|
|
1018
|
+
super(`Dynamic server usage: ${description}`), this.description = description, this.digest = DYNAMIC_ERROR_CODE;
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
function isDynamicServerError(err) {
|
|
1022
|
+
if (typeof err !== "object" || err === null || !("digest" in err) || typeof err.digest !== "string") {
|
|
1023
|
+
return false;
|
|
1024
|
+
}
|
|
1025
|
+
return err.digest === DYNAMIC_ERROR_CODE;
|
|
1026
|
+
}
|
|
1027
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
1028
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
1029
|
+
Object.assign(exports.default, exports);
|
|
1030
|
+
module.exports = exports.default;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
// node_modules/next/dist/client/components/static-generation-bailout.js
|
|
1036
|
+
var require_static_generation_bailout = __commonJS({
|
|
1037
|
+
"node_modules/next/dist/client/components/static-generation-bailout.js"(exports, module) {
|
|
1038
|
+
"use strict";
|
|
1039
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1040
|
+
value: true
|
|
1041
|
+
});
|
|
1042
|
+
function _export(target, all) {
|
|
1043
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1044
|
+
enumerable: true,
|
|
1045
|
+
get: all[name]
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
_export(exports, {
|
|
1049
|
+
StaticGenBailoutError: function() {
|
|
1050
|
+
return StaticGenBailoutError;
|
|
1051
|
+
},
|
|
1052
|
+
isStaticGenBailoutError: function() {
|
|
1053
|
+
return isStaticGenBailoutError;
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
var NEXT_STATIC_GEN_BAILOUT = "NEXT_STATIC_GEN_BAILOUT";
|
|
1057
|
+
var StaticGenBailoutError = class extends Error {
|
|
1058
|
+
constructor(...args) {
|
|
1059
|
+
super(...args), this.code = NEXT_STATIC_GEN_BAILOUT;
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
function isStaticGenBailoutError(error) {
|
|
1063
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
1064
|
+
return false;
|
|
1065
|
+
}
|
|
1066
|
+
return error.code === NEXT_STATIC_GEN_BAILOUT;
|
|
1067
|
+
}
|
|
1068
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
1069
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
1070
|
+
Object.assign(exports.default, exports);
|
|
1071
|
+
module.exports = exports.default;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
// node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js
|
|
1077
|
+
var require_work_unit_async_storage_instance = __commonJS({
|
|
1078
|
+
"node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js"(exports) {
|
|
1079
|
+
"use strict";
|
|
1080
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1081
|
+
value: true
|
|
1082
|
+
});
|
|
1083
|
+
Object.defineProperty(exports, "workUnitAsyncStorageInstance", {
|
|
1084
|
+
enumerable: true,
|
|
1085
|
+
get: function() {
|
|
1086
|
+
return workUnitAsyncStorageInstance;
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
var _asynclocalstorage = require_async_local_storage();
|
|
1090
|
+
var workUnitAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
|
|
1094
|
+
// node_modules/next/dist/client/components/app-router-headers.js
|
|
1095
|
+
var require_app_router_headers = __commonJS({
|
|
1096
|
+
"node_modules/next/dist/client/components/app-router-headers.js"(exports, module) {
|
|
1097
|
+
"use strict";
|
|
1098
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1099
|
+
value: true
|
|
1100
|
+
});
|
|
1101
|
+
function _export(target, all) {
|
|
1102
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1103
|
+
enumerable: true,
|
|
1104
|
+
get: all[name]
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
_export(exports, {
|
|
1108
|
+
ACTION_HEADER: function() {
|
|
1109
|
+
return ACTION_HEADER;
|
|
1110
|
+
},
|
|
1111
|
+
FLIGHT_HEADERS: function() {
|
|
1112
|
+
return FLIGHT_HEADERS;
|
|
1113
|
+
},
|
|
1114
|
+
NEXT_ACTION_NOT_FOUND_HEADER: function() {
|
|
1115
|
+
return NEXT_ACTION_NOT_FOUND_HEADER;
|
|
1116
|
+
},
|
|
1117
|
+
NEXT_ACTION_REVALIDATED_HEADER: function() {
|
|
1118
|
+
return NEXT_ACTION_REVALIDATED_HEADER;
|
|
1119
|
+
},
|
|
1120
|
+
NEXT_DID_POSTPONE_HEADER: function() {
|
|
1121
|
+
return NEXT_DID_POSTPONE_HEADER;
|
|
1122
|
+
},
|
|
1123
|
+
NEXT_HMR_REFRESH_HASH_COOKIE: function() {
|
|
1124
|
+
return NEXT_HMR_REFRESH_HASH_COOKIE;
|
|
1125
|
+
},
|
|
1126
|
+
NEXT_HMR_REFRESH_HEADER: function() {
|
|
1127
|
+
return NEXT_HMR_REFRESH_HEADER;
|
|
1128
|
+
},
|
|
1129
|
+
NEXT_HTML_REQUEST_ID_HEADER: function() {
|
|
1130
|
+
return NEXT_HTML_REQUEST_ID_HEADER;
|
|
1131
|
+
},
|
|
1132
|
+
NEXT_IS_PRERENDER_HEADER: function() {
|
|
1133
|
+
return NEXT_IS_PRERENDER_HEADER;
|
|
1134
|
+
},
|
|
1135
|
+
NEXT_REQUEST_ID_HEADER: function() {
|
|
1136
|
+
return NEXT_REQUEST_ID_HEADER;
|
|
1137
|
+
},
|
|
1138
|
+
NEXT_REWRITTEN_PATH_HEADER: function() {
|
|
1139
|
+
return NEXT_REWRITTEN_PATH_HEADER;
|
|
1140
|
+
},
|
|
1141
|
+
NEXT_REWRITTEN_QUERY_HEADER: function() {
|
|
1142
|
+
return NEXT_REWRITTEN_QUERY_HEADER;
|
|
1143
|
+
},
|
|
1144
|
+
NEXT_ROUTER_PREFETCH_HEADER: function() {
|
|
1145
|
+
return NEXT_ROUTER_PREFETCH_HEADER;
|
|
1146
|
+
},
|
|
1147
|
+
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER: function() {
|
|
1148
|
+
return NEXT_ROUTER_SEGMENT_PREFETCH_HEADER;
|
|
1149
|
+
},
|
|
1150
|
+
NEXT_ROUTER_STALE_TIME_HEADER: function() {
|
|
1151
|
+
return NEXT_ROUTER_STALE_TIME_HEADER;
|
|
1152
|
+
},
|
|
1153
|
+
NEXT_ROUTER_STATE_TREE_HEADER: function() {
|
|
1154
|
+
return NEXT_ROUTER_STATE_TREE_HEADER;
|
|
1155
|
+
},
|
|
1156
|
+
NEXT_RSC_UNION_QUERY: function() {
|
|
1157
|
+
return NEXT_RSC_UNION_QUERY;
|
|
1158
|
+
},
|
|
1159
|
+
NEXT_URL: function() {
|
|
1160
|
+
return NEXT_URL;
|
|
1161
|
+
},
|
|
1162
|
+
RSC_CONTENT_TYPE_HEADER: function() {
|
|
1163
|
+
return RSC_CONTENT_TYPE_HEADER;
|
|
1164
|
+
},
|
|
1165
|
+
RSC_HEADER: function() {
|
|
1166
|
+
return RSC_HEADER;
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
var RSC_HEADER = "rsc";
|
|
1170
|
+
var ACTION_HEADER = "next-action";
|
|
1171
|
+
var NEXT_ROUTER_STATE_TREE_HEADER = "next-router-state-tree";
|
|
1172
|
+
var NEXT_ROUTER_PREFETCH_HEADER = "next-router-prefetch";
|
|
1173
|
+
var NEXT_ROUTER_SEGMENT_PREFETCH_HEADER = "next-router-segment-prefetch";
|
|
1174
|
+
var NEXT_HMR_REFRESH_HEADER = "next-hmr-refresh";
|
|
1175
|
+
var NEXT_HMR_REFRESH_HASH_COOKIE = "__next_hmr_refresh_hash__";
|
|
1176
|
+
var NEXT_URL = "next-url";
|
|
1177
|
+
var RSC_CONTENT_TYPE_HEADER = "text/x-component";
|
|
1178
|
+
var FLIGHT_HEADERS = [
|
|
1179
|
+
RSC_HEADER,
|
|
1180
|
+
NEXT_ROUTER_STATE_TREE_HEADER,
|
|
1181
|
+
NEXT_ROUTER_PREFETCH_HEADER,
|
|
1182
|
+
NEXT_HMR_REFRESH_HEADER,
|
|
1183
|
+
NEXT_ROUTER_SEGMENT_PREFETCH_HEADER
|
|
1184
|
+
];
|
|
1185
|
+
var NEXT_RSC_UNION_QUERY = "_rsc";
|
|
1186
|
+
var NEXT_ROUTER_STALE_TIME_HEADER = "x-nextjs-stale-time";
|
|
1187
|
+
var NEXT_DID_POSTPONE_HEADER = "x-nextjs-postponed";
|
|
1188
|
+
var NEXT_REWRITTEN_PATH_HEADER = "x-nextjs-rewritten-path";
|
|
1189
|
+
var NEXT_REWRITTEN_QUERY_HEADER = "x-nextjs-rewritten-query";
|
|
1190
|
+
var NEXT_IS_PRERENDER_HEADER = "x-nextjs-prerender";
|
|
1191
|
+
var NEXT_ACTION_NOT_FOUND_HEADER = "x-nextjs-action-not-found";
|
|
1192
|
+
var NEXT_REQUEST_ID_HEADER = "x-nextjs-request-id";
|
|
1193
|
+
var NEXT_HTML_REQUEST_ID_HEADER = "x-nextjs-html-request-id";
|
|
1194
|
+
var NEXT_ACTION_REVALIDATED_HEADER = "x-action-revalidated";
|
|
1195
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
1196
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
1197
|
+
Object.assign(exports.default, exports);
|
|
1198
|
+
module.exports = exports.default;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
// node_modules/next/dist/shared/lib/invariant-error.js
|
|
1204
|
+
var require_invariant_error = __commonJS({
|
|
1205
|
+
"node_modules/next/dist/shared/lib/invariant-error.js"(exports) {
|
|
1206
|
+
"use strict";
|
|
1207
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1208
|
+
value: true
|
|
1209
|
+
});
|
|
1210
|
+
Object.defineProperty(exports, "InvariantError", {
|
|
1211
|
+
enumerable: true,
|
|
1212
|
+
get: function() {
|
|
1213
|
+
return InvariantError;
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
var InvariantError = class extends Error {
|
|
1217
|
+
constructor(message, options) {
|
|
1218
|
+
super(`Invariant: ${message.endsWith(".") ? message : message + "."} This is a bug in Next.js.`, options);
|
|
1219
|
+
this.name = "InvariantError";
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
});
|
|
1224
|
+
|
|
1225
|
+
// node_modules/next/dist/server/app-render/work-unit-async-storage.external.js
|
|
1226
|
+
var require_work_unit_async_storage_external = __commonJS({
|
|
1227
|
+
"node_modules/next/dist/server/app-render/work-unit-async-storage.external.js"(exports) {
|
|
1228
|
+
"use strict";
|
|
1229
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1230
|
+
value: true
|
|
1231
|
+
});
|
|
1232
|
+
function _export(target, all) {
|
|
1233
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1234
|
+
enumerable: true,
|
|
1235
|
+
get: all[name]
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
_export(exports, {
|
|
1239
|
+
getCacheSignal: function() {
|
|
1240
|
+
return getCacheSignal;
|
|
1241
|
+
},
|
|
1242
|
+
getDraftModeProviderForCacheScope: function() {
|
|
1243
|
+
return getDraftModeProviderForCacheScope;
|
|
1244
|
+
},
|
|
1245
|
+
getHmrRefreshHash: function() {
|
|
1246
|
+
return getHmrRefreshHash;
|
|
1247
|
+
},
|
|
1248
|
+
getPrerenderResumeDataCache: function() {
|
|
1249
|
+
return getPrerenderResumeDataCache;
|
|
1250
|
+
},
|
|
1251
|
+
getRenderResumeDataCache: function() {
|
|
1252
|
+
return getRenderResumeDataCache;
|
|
1253
|
+
},
|
|
1254
|
+
getRuntimeStagePromise: function() {
|
|
1255
|
+
return getRuntimeStagePromise;
|
|
1256
|
+
},
|
|
1257
|
+
getServerComponentsHmrCache: function() {
|
|
1258
|
+
return getServerComponentsHmrCache;
|
|
1259
|
+
},
|
|
1260
|
+
isHmrRefresh: function() {
|
|
1261
|
+
return isHmrRefresh;
|
|
1262
|
+
},
|
|
1263
|
+
throwForMissingRequestStore: function() {
|
|
1264
|
+
return throwForMissingRequestStore;
|
|
1265
|
+
},
|
|
1266
|
+
throwInvariantForMissingStore: function() {
|
|
1267
|
+
return throwInvariantForMissingStore;
|
|
1268
|
+
},
|
|
1269
|
+
workUnitAsyncStorage: function() {
|
|
1270
|
+
return _workunitasyncstorageinstance.workUnitAsyncStorageInstance;
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
var _workunitasyncstorageinstance = require_work_unit_async_storage_instance();
|
|
1274
|
+
var _approuterheaders = require_app_router_headers();
|
|
1275
|
+
var _invarianterror = require_invariant_error();
|
|
1276
|
+
function throwForMissingRequestStore(callingExpression) {
|
|
1277
|
+
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", {
|
|
1278
|
+
value: "E251",
|
|
1279
|
+
enumerable: false,
|
|
1280
|
+
configurable: true
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
function throwInvariantForMissingStore() {
|
|
1284
|
+
throw Object.defineProperty(new _invarianterror.InvariantError("Expected workUnitAsyncStorage to have a store."), "__NEXT_ERROR_CODE", {
|
|
1285
|
+
value: "E696",
|
|
1286
|
+
enumerable: false,
|
|
1287
|
+
configurable: true
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
function getPrerenderResumeDataCache(workUnitStore) {
|
|
1291
|
+
switch (workUnitStore.type) {
|
|
1292
|
+
case "prerender":
|
|
1293
|
+
case "prerender-runtime":
|
|
1294
|
+
case "prerender-ppr":
|
|
1295
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
1296
|
+
case "prerender-client":
|
|
1297
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
1298
|
+
case "request": {
|
|
1299
|
+
if (workUnitStore.prerenderResumeDataCache) {
|
|
1300
|
+
return workUnitStore.prerenderResumeDataCache;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
case "prerender-legacy":
|
|
1304
|
+
case "cache":
|
|
1305
|
+
case "private-cache":
|
|
1306
|
+
case "unstable-cache":
|
|
1307
|
+
return null;
|
|
1308
|
+
default:
|
|
1309
|
+
return workUnitStore;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
function getRenderResumeDataCache(workUnitStore) {
|
|
1313
|
+
switch (workUnitStore.type) {
|
|
1314
|
+
case "request":
|
|
1315
|
+
case "prerender":
|
|
1316
|
+
case "prerender-runtime":
|
|
1317
|
+
case "prerender-client":
|
|
1318
|
+
if (workUnitStore.renderResumeDataCache) {
|
|
1319
|
+
return workUnitStore.renderResumeDataCache;
|
|
1320
|
+
}
|
|
1321
|
+
// fallthrough
|
|
1322
|
+
case "prerender-ppr":
|
|
1323
|
+
return workUnitStore.prerenderResumeDataCache ?? null;
|
|
1324
|
+
case "cache":
|
|
1325
|
+
case "private-cache":
|
|
1326
|
+
case "unstable-cache":
|
|
1327
|
+
case "prerender-legacy":
|
|
1328
|
+
return null;
|
|
1329
|
+
default:
|
|
1330
|
+
return workUnitStore;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
function getHmrRefreshHash(workStore, workUnitStore) {
|
|
1334
|
+
if (workStore.dev) {
|
|
1335
|
+
switch (workUnitStore.type) {
|
|
1336
|
+
case "cache":
|
|
1337
|
+
case "private-cache":
|
|
1338
|
+
case "prerender":
|
|
1339
|
+
case "prerender-runtime":
|
|
1340
|
+
return workUnitStore.hmrRefreshHash;
|
|
1341
|
+
case "request":
|
|
1342
|
+
var _workUnitStore_cookies_get;
|
|
1343
|
+
return (_workUnitStore_cookies_get = workUnitStore.cookies.get(_approuterheaders.NEXT_HMR_REFRESH_HASH_COOKIE)) == null ? void 0 : _workUnitStore_cookies_get.value;
|
|
1344
|
+
case "prerender-client":
|
|
1345
|
+
case "prerender-ppr":
|
|
1346
|
+
case "prerender-legacy":
|
|
1347
|
+
case "unstable-cache":
|
|
1348
|
+
break;
|
|
1349
|
+
default:
|
|
1350
|
+
workUnitStore;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
return void 0;
|
|
1354
|
+
}
|
|
1355
|
+
function isHmrRefresh(workStore, workUnitStore) {
|
|
1356
|
+
if (workStore.dev) {
|
|
1357
|
+
switch (workUnitStore.type) {
|
|
1358
|
+
case "cache":
|
|
1359
|
+
case "private-cache":
|
|
1360
|
+
case "request":
|
|
1361
|
+
return workUnitStore.isHmrRefresh ?? false;
|
|
1362
|
+
case "prerender":
|
|
1363
|
+
case "prerender-client":
|
|
1364
|
+
case "prerender-runtime":
|
|
1365
|
+
case "prerender-ppr":
|
|
1366
|
+
case "prerender-legacy":
|
|
1367
|
+
case "unstable-cache":
|
|
1368
|
+
break;
|
|
1369
|
+
default:
|
|
1370
|
+
workUnitStore;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return false;
|
|
1374
|
+
}
|
|
1375
|
+
function getServerComponentsHmrCache(workStore, workUnitStore) {
|
|
1376
|
+
if (workStore.dev) {
|
|
1377
|
+
switch (workUnitStore.type) {
|
|
1378
|
+
case "cache":
|
|
1379
|
+
case "private-cache":
|
|
1380
|
+
case "request":
|
|
1381
|
+
return workUnitStore.serverComponentsHmrCache;
|
|
1382
|
+
case "prerender":
|
|
1383
|
+
case "prerender-client":
|
|
1384
|
+
case "prerender-runtime":
|
|
1385
|
+
case "prerender-ppr":
|
|
1386
|
+
case "prerender-legacy":
|
|
1387
|
+
case "unstable-cache":
|
|
1388
|
+
break;
|
|
1389
|
+
default:
|
|
1390
|
+
workUnitStore;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return void 0;
|
|
1394
|
+
}
|
|
1395
|
+
function getDraftModeProviderForCacheScope(workStore, workUnitStore) {
|
|
1396
|
+
if (workStore.isDraftMode) {
|
|
1397
|
+
switch (workUnitStore.type) {
|
|
1398
|
+
case "cache":
|
|
1399
|
+
case "private-cache":
|
|
1400
|
+
case "unstable-cache":
|
|
1401
|
+
case "prerender-runtime":
|
|
1402
|
+
case "request":
|
|
1403
|
+
return workUnitStore.draftMode;
|
|
1404
|
+
case "prerender":
|
|
1405
|
+
case "prerender-client":
|
|
1406
|
+
case "prerender-ppr":
|
|
1407
|
+
case "prerender-legacy":
|
|
1408
|
+
break;
|
|
1409
|
+
default:
|
|
1410
|
+
workUnitStore;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
return void 0;
|
|
1414
|
+
}
|
|
1415
|
+
function getCacheSignal(workUnitStore) {
|
|
1416
|
+
switch (workUnitStore.type) {
|
|
1417
|
+
case "prerender":
|
|
1418
|
+
case "prerender-client":
|
|
1419
|
+
case "prerender-runtime":
|
|
1420
|
+
return workUnitStore.cacheSignal;
|
|
1421
|
+
case "request": {
|
|
1422
|
+
if (workUnitStore.cacheSignal) {
|
|
1423
|
+
return workUnitStore.cacheSignal;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
case "prerender-ppr":
|
|
1427
|
+
case "prerender-legacy":
|
|
1428
|
+
case "cache":
|
|
1429
|
+
case "private-cache":
|
|
1430
|
+
case "unstable-cache":
|
|
1431
|
+
return null;
|
|
1432
|
+
default:
|
|
1433
|
+
return workUnitStore;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function getRuntimeStagePromise(workUnitStore) {
|
|
1437
|
+
switch (workUnitStore.type) {
|
|
1438
|
+
case "prerender-runtime":
|
|
1439
|
+
case "private-cache":
|
|
1440
|
+
return workUnitStore.runtimeStagePromise;
|
|
1441
|
+
case "prerender":
|
|
1442
|
+
case "prerender-client":
|
|
1443
|
+
case "prerender-ppr":
|
|
1444
|
+
case "prerender-legacy":
|
|
1445
|
+
case "request":
|
|
1446
|
+
case "cache":
|
|
1447
|
+
case "unstable-cache":
|
|
1448
|
+
return null;
|
|
1449
|
+
default:
|
|
1450
|
+
return workUnitStore;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
// node_modules/next/dist/server/app-render/work-async-storage-instance.js
|
|
1457
|
+
var require_work_async_storage_instance = __commonJS({
|
|
1458
|
+
"node_modules/next/dist/server/app-render/work-async-storage-instance.js"(exports) {
|
|
1459
|
+
"use strict";
|
|
1460
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1461
|
+
value: true
|
|
1462
|
+
});
|
|
1463
|
+
Object.defineProperty(exports, "workAsyncStorageInstance", {
|
|
1464
|
+
enumerable: true,
|
|
1465
|
+
get: function() {
|
|
1466
|
+
return workAsyncStorageInstance;
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
var _asynclocalstorage = require_async_local_storage();
|
|
1470
|
+
var workAsyncStorageInstance = (0, _asynclocalstorage.createAsyncLocalStorage)();
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
// node_modules/next/dist/server/app-render/work-async-storage.external.js
|
|
1475
|
+
var require_work_async_storage_external = __commonJS({
|
|
1476
|
+
"node_modules/next/dist/server/app-render/work-async-storage.external.js"(exports) {
|
|
1477
|
+
"use strict";
|
|
1478
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1479
|
+
value: true
|
|
1480
|
+
});
|
|
1481
|
+
Object.defineProperty(exports, "workAsyncStorage", {
|
|
1482
|
+
enumerable: true,
|
|
1483
|
+
get: function() {
|
|
1484
|
+
return _workasyncstorageinstance.workAsyncStorageInstance;
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
var _workasyncstorageinstance = require_work_async_storage_instance();
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
// node_modules/next/dist/lib/framework/boundary-constants.js
|
|
1492
|
+
var require_boundary_constants = __commonJS({
|
|
1493
|
+
"node_modules/next/dist/lib/framework/boundary-constants.js"(exports) {
|
|
1494
|
+
"use strict";
|
|
1495
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1496
|
+
value: true
|
|
1497
|
+
});
|
|
1498
|
+
function _export(target, all) {
|
|
1499
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1500
|
+
enumerable: true,
|
|
1501
|
+
get: all[name]
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
_export(exports, {
|
|
1505
|
+
METADATA_BOUNDARY_NAME: function() {
|
|
1506
|
+
return METADATA_BOUNDARY_NAME;
|
|
1507
|
+
},
|
|
1508
|
+
OUTLET_BOUNDARY_NAME: function() {
|
|
1509
|
+
return OUTLET_BOUNDARY_NAME;
|
|
1510
|
+
},
|
|
1511
|
+
ROOT_LAYOUT_BOUNDARY_NAME: function() {
|
|
1512
|
+
return ROOT_LAYOUT_BOUNDARY_NAME;
|
|
1513
|
+
},
|
|
1514
|
+
VIEWPORT_BOUNDARY_NAME: function() {
|
|
1515
|
+
return VIEWPORT_BOUNDARY_NAME;
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
var METADATA_BOUNDARY_NAME = "__next_metadata_boundary__";
|
|
1519
|
+
var VIEWPORT_BOUNDARY_NAME = "__next_viewport_boundary__";
|
|
1520
|
+
var OUTLET_BOUNDARY_NAME = "__next_outlet_boundary__";
|
|
1521
|
+
var ROOT_LAYOUT_BOUNDARY_NAME = "__next_root_layout_boundary__";
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
// node_modules/next/dist/lib/scheduler.js
|
|
1526
|
+
var require_scheduler = __commonJS({
|
|
1527
|
+
"node_modules/next/dist/lib/scheduler.js"(exports) {
|
|
1528
|
+
"use strict";
|
|
1529
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1530
|
+
value: true
|
|
1531
|
+
});
|
|
1532
|
+
function _export(target, all) {
|
|
1533
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1534
|
+
enumerable: true,
|
|
1535
|
+
get: all[name]
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
_export(exports, {
|
|
1539
|
+
atLeastOneTask: function() {
|
|
1540
|
+
return atLeastOneTask;
|
|
1541
|
+
},
|
|
1542
|
+
scheduleImmediate: function() {
|
|
1543
|
+
return scheduleImmediate;
|
|
1544
|
+
},
|
|
1545
|
+
scheduleOnNextTick: function() {
|
|
1546
|
+
return scheduleOnNextTick;
|
|
1547
|
+
},
|
|
1548
|
+
waitAtLeastOneReactRenderTask: function() {
|
|
1549
|
+
return waitAtLeastOneReactRenderTask;
|
|
1550
|
+
}
|
|
1551
|
+
});
|
|
1552
|
+
var scheduleOnNextTick = (cb) => {
|
|
1553
|
+
Promise.resolve().then(() => {
|
|
1554
|
+
if (process.env.NEXT_RUNTIME === "edge") {
|
|
1555
|
+
setTimeout(cb, 0);
|
|
1556
|
+
} else {
|
|
1557
|
+
process.nextTick(cb);
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
};
|
|
1561
|
+
var scheduleImmediate = (cb) => {
|
|
1562
|
+
if (process.env.NEXT_RUNTIME === "edge") {
|
|
1563
|
+
setTimeout(cb, 0);
|
|
1564
|
+
} else {
|
|
1565
|
+
setImmediate(cb);
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
function atLeastOneTask() {
|
|
1569
|
+
return new Promise((resolve) => scheduleImmediate(resolve));
|
|
1570
|
+
}
|
|
1571
|
+
function waitAtLeastOneReactRenderTask() {
|
|
1572
|
+
if (process.env.NEXT_RUNTIME === "edge") {
|
|
1573
|
+
return new Promise((r) => setTimeout(r, 0));
|
|
1574
|
+
} else {
|
|
1575
|
+
return new Promise((r) => setImmediate(r));
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
|
|
1581
|
+
// node_modules/next/dist/server/app-render/dynamic-rendering.js
|
|
1582
|
+
var require_dynamic_rendering = __commonJS({
|
|
1583
|
+
"node_modules/next/dist/server/app-render/dynamic-rendering.js"(exports) {
|
|
1584
|
+
"use strict";
|
|
1585
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1586
|
+
value: true
|
|
1587
|
+
});
|
|
1588
|
+
function _export(target, all) {
|
|
1589
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
1590
|
+
enumerable: true,
|
|
1591
|
+
get: all[name]
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
_export(exports, {
|
|
1595
|
+
Postpone: function() {
|
|
1596
|
+
return Postpone;
|
|
1597
|
+
},
|
|
1598
|
+
PreludeState: function() {
|
|
1599
|
+
return PreludeState;
|
|
1600
|
+
},
|
|
1601
|
+
abortAndThrowOnSynchronousRequestDataAccess: function() {
|
|
1602
|
+
return abortAndThrowOnSynchronousRequestDataAccess;
|
|
1603
|
+
},
|
|
1604
|
+
abortOnSynchronousPlatformIOAccess: function() {
|
|
1605
|
+
return abortOnSynchronousPlatformIOAccess;
|
|
1606
|
+
},
|
|
1607
|
+
accessedDynamicData: function() {
|
|
1608
|
+
return accessedDynamicData;
|
|
1609
|
+
},
|
|
1610
|
+
annotateDynamicAccess: function() {
|
|
1611
|
+
return annotateDynamicAccess;
|
|
1612
|
+
},
|
|
1613
|
+
consumeDynamicAccess: function() {
|
|
1614
|
+
return consumeDynamicAccess;
|
|
1615
|
+
},
|
|
1616
|
+
createDynamicTrackingState: function() {
|
|
1617
|
+
return createDynamicTrackingState;
|
|
1618
|
+
},
|
|
1619
|
+
createDynamicValidationState: function() {
|
|
1620
|
+
return createDynamicValidationState;
|
|
1621
|
+
},
|
|
1622
|
+
createHangingInputAbortSignal: function() {
|
|
1623
|
+
return createHangingInputAbortSignal;
|
|
1624
|
+
},
|
|
1625
|
+
createRenderInBrowserAbortSignal: function() {
|
|
1626
|
+
return createRenderInBrowserAbortSignal;
|
|
1627
|
+
},
|
|
1628
|
+
delayUntilRuntimeStage: function() {
|
|
1629
|
+
return delayUntilRuntimeStage;
|
|
1630
|
+
},
|
|
1631
|
+
formatDynamicAPIAccesses: function() {
|
|
1632
|
+
return formatDynamicAPIAccesses;
|
|
1633
|
+
},
|
|
1634
|
+
getFirstDynamicReason: function() {
|
|
1635
|
+
return getFirstDynamicReason;
|
|
1636
|
+
},
|
|
1637
|
+
getStaticShellDisallowedDynamicReasons: function() {
|
|
1638
|
+
return getStaticShellDisallowedDynamicReasons;
|
|
1639
|
+
},
|
|
1640
|
+
isDynamicPostpone: function() {
|
|
1641
|
+
return isDynamicPostpone;
|
|
1642
|
+
},
|
|
1643
|
+
isPrerenderInterruptedError: function() {
|
|
1644
|
+
return isPrerenderInterruptedError;
|
|
1645
|
+
},
|
|
1646
|
+
logDisallowedDynamicError: function() {
|
|
1647
|
+
return logDisallowedDynamicError;
|
|
1648
|
+
},
|
|
1649
|
+
markCurrentScopeAsDynamic: function() {
|
|
1650
|
+
return markCurrentScopeAsDynamic;
|
|
1651
|
+
},
|
|
1652
|
+
postponeWithTracking: function() {
|
|
1653
|
+
return postponeWithTracking;
|
|
1654
|
+
},
|
|
1655
|
+
throwIfDisallowedDynamic: function() {
|
|
1656
|
+
return throwIfDisallowedDynamic;
|
|
1657
|
+
},
|
|
1658
|
+
throwToInterruptStaticGeneration: function() {
|
|
1659
|
+
return throwToInterruptStaticGeneration;
|
|
1660
|
+
},
|
|
1661
|
+
trackAllowedDynamicAccess: function() {
|
|
1662
|
+
return trackAllowedDynamicAccess;
|
|
1663
|
+
},
|
|
1664
|
+
trackDynamicDataInDynamicRender: function() {
|
|
1665
|
+
return trackDynamicDataInDynamicRender;
|
|
1666
|
+
},
|
|
1667
|
+
trackDynamicHoleInRuntimeShell: function() {
|
|
1668
|
+
return trackDynamicHoleInRuntimeShell;
|
|
1669
|
+
},
|
|
1670
|
+
trackDynamicHoleInStaticShell: function() {
|
|
1671
|
+
return trackDynamicHoleInStaticShell;
|
|
1672
|
+
},
|
|
1673
|
+
useDynamicRouteParams: function() {
|
|
1674
|
+
return useDynamicRouteParams;
|
|
1675
|
+
},
|
|
1676
|
+
useDynamicSearchParams: function() {
|
|
1677
|
+
return useDynamicSearchParams;
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
var _react = /* @__PURE__ */ _interop_require_default(__require("react"));
|
|
1681
|
+
var _hooksservercontext = require_hooks_server_context();
|
|
1682
|
+
var _staticgenerationbailout = require_static_generation_bailout();
|
|
1683
|
+
var _workunitasyncstorageexternal = require_work_unit_async_storage_external();
|
|
1684
|
+
var _workasyncstorageexternal = require_work_async_storage_external();
|
|
1685
|
+
var _dynamicrenderingutils = require_dynamic_rendering_utils();
|
|
1686
|
+
var _boundaryconstants = require_boundary_constants();
|
|
1687
|
+
var _scheduler = require_scheduler();
|
|
1688
|
+
var _bailouttocsr = require_bailout_to_csr();
|
|
1689
|
+
var _invarianterror = require_invariant_error();
|
|
1690
|
+
function _interop_require_default(obj) {
|
|
1691
|
+
return obj && obj.__esModule ? obj : {
|
|
1692
|
+
default: obj
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
var hasPostpone = typeof _react.default.unstable_postpone === "function";
|
|
1696
|
+
function createDynamicTrackingState(isDebugDynamicAccesses) {
|
|
1697
|
+
return {
|
|
1698
|
+
isDebugDynamicAccesses,
|
|
1699
|
+
dynamicAccesses: [],
|
|
1700
|
+
syncDynamicErrorWithStack: null
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
function createDynamicValidationState() {
|
|
1704
|
+
return {
|
|
1705
|
+
hasSuspenseAboveBody: false,
|
|
1706
|
+
hasDynamicMetadata: false,
|
|
1707
|
+
dynamicMetadata: null,
|
|
1708
|
+
hasDynamicViewport: false,
|
|
1709
|
+
hasAllowedDynamic: false,
|
|
1710
|
+
dynamicErrors: []
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
function getFirstDynamicReason(trackingState) {
|
|
1714
|
+
var _trackingState_dynamicAccesses_;
|
|
1715
|
+
return (_trackingState_dynamicAccesses_ = trackingState.dynamicAccesses[0]) == null ? void 0 : _trackingState_dynamicAccesses_.expression;
|
|
1716
|
+
}
|
|
1717
|
+
function markCurrentScopeAsDynamic(store, workUnitStore, expression) {
|
|
1718
|
+
if (workUnitStore) {
|
|
1719
|
+
switch (workUnitStore.type) {
|
|
1720
|
+
case "cache":
|
|
1721
|
+
case "unstable-cache":
|
|
1722
|
+
return;
|
|
1723
|
+
case "private-cache":
|
|
1724
|
+
return;
|
|
1725
|
+
case "prerender-legacy":
|
|
1726
|
+
case "prerender-ppr":
|
|
1727
|
+
case "request":
|
|
1728
|
+
break;
|
|
1729
|
+
default:
|
|
1730
|
+
workUnitStore;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
if (store.forceDynamic || store.forceStatic) return;
|
|
1734
|
+
if (store.dynamicShouldError) {
|
|
1735
|
+
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", {
|
|
1736
|
+
value: "E553",
|
|
1737
|
+
enumerable: false,
|
|
1738
|
+
configurable: true
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
if (workUnitStore) {
|
|
1742
|
+
switch (workUnitStore.type) {
|
|
1743
|
+
case "prerender-ppr":
|
|
1744
|
+
return postponeWithTracking(store.route, expression, workUnitStore.dynamicTracking);
|
|
1745
|
+
case "prerender-legacy":
|
|
1746
|
+
workUnitStore.revalidate = 0;
|
|
1747
|
+
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", {
|
|
1748
|
+
value: "E550",
|
|
1749
|
+
enumerable: false,
|
|
1750
|
+
configurable: true
|
|
1751
|
+
});
|
|
1752
|
+
store.dynamicUsageDescription = expression;
|
|
1753
|
+
store.dynamicUsageStack = err.stack;
|
|
1754
|
+
throw err;
|
|
1755
|
+
case "request":
|
|
1756
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1757
|
+
workUnitStore.usedDynamic = true;
|
|
1758
|
+
}
|
|
1759
|
+
break;
|
|
1760
|
+
default:
|
|
1761
|
+
workUnitStore;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
function throwToInterruptStaticGeneration(expression, store, prerenderStore) {
|
|
1766
|
+
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", {
|
|
1767
|
+
value: "E558",
|
|
1768
|
+
enumerable: false,
|
|
1769
|
+
configurable: true
|
|
1770
|
+
});
|
|
1771
|
+
prerenderStore.revalidate = 0;
|
|
1772
|
+
store.dynamicUsageDescription = expression;
|
|
1773
|
+
store.dynamicUsageStack = err.stack;
|
|
1774
|
+
throw err;
|
|
1775
|
+
}
|
|
1776
|
+
function trackDynamicDataInDynamicRender(workUnitStore) {
|
|
1777
|
+
switch (workUnitStore.type) {
|
|
1778
|
+
case "cache":
|
|
1779
|
+
case "unstable-cache":
|
|
1780
|
+
return;
|
|
1781
|
+
case "private-cache":
|
|
1782
|
+
return;
|
|
1783
|
+
case "prerender":
|
|
1784
|
+
case "prerender-runtime":
|
|
1785
|
+
case "prerender-legacy":
|
|
1786
|
+
case "prerender-ppr":
|
|
1787
|
+
case "prerender-client":
|
|
1788
|
+
break;
|
|
1789
|
+
case "request":
|
|
1790
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1791
|
+
workUnitStore.usedDynamic = true;
|
|
1792
|
+
}
|
|
1793
|
+
break;
|
|
1794
|
+
default:
|
|
1795
|
+
workUnitStore;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
function abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore) {
|
|
1799
|
+
const reason = `Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`;
|
|
1800
|
+
const error = createPrerenderInterruptedError(reason);
|
|
1801
|
+
prerenderStore.controller.abort(error);
|
|
1802
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1803
|
+
if (dynamicTracking) {
|
|
1804
|
+
dynamicTracking.dynamicAccesses.push({
|
|
1805
|
+
// When we aren't debugging, we don't need to create another error for the
|
|
1806
|
+
// stack trace.
|
|
1807
|
+
stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : void 0,
|
|
1808
|
+
expression
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
function abortOnSynchronousPlatformIOAccess(route, expression, errorWithStack, prerenderStore) {
|
|
1813
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1814
|
+
abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);
|
|
1815
|
+
if (dynamicTracking) {
|
|
1816
|
+
if (dynamicTracking.syncDynamicErrorWithStack === null) {
|
|
1817
|
+
dynamicTracking.syncDynamicErrorWithStack = errorWithStack;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
function abortAndThrowOnSynchronousRequestDataAccess(route, expression, errorWithStack, prerenderStore) {
|
|
1822
|
+
const prerenderSignal = prerenderStore.controller.signal;
|
|
1823
|
+
if (prerenderSignal.aborted === false) {
|
|
1824
|
+
abortOnSynchronousDynamicDataAccess(route, expression, prerenderStore);
|
|
1825
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1826
|
+
if (dynamicTracking) {
|
|
1827
|
+
if (dynamicTracking.syncDynamicErrorWithStack === null) {
|
|
1828
|
+
dynamicTracking.syncDynamicErrorWithStack = errorWithStack;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
throw createPrerenderInterruptedError(`Route ${route} needs to bail out of prerendering at this point because it used ${expression}.`);
|
|
1833
|
+
}
|
|
1834
|
+
function Postpone({ reason, route }) {
|
|
1835
|
+
const prerenderStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
1836
|
+
const dynamicTracking = prerenderStore && prerenderStore.type === "prerender-ppr" ? prerenderStore.dynamicTracking : null;
|
|
1837
|
+
postponeWithTracking(route, reason, dynamicTracking);
|
|
1838
|
+
}
|
|
1839
|
+
function postponeWithTracking(route, expression, dynamicTracking) {
|
|
1840
|
+
assertPostpone();
|
|
1841
|
+
if (dynamicTracking) {
|
|
1842
|
+
dynamicTracking.dynamicAccesses.push({
|
|
1843
|
+
// When we aren't debugging, we don't need to create another error for the
|
|
1844
|
+
// stack trace.
|
|
1845
|
+
stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : void 0,
|
|
1846
|
+
expression
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
_react.default.unstable_postpone(createPostponeReason(route, expression));
|
|
1850
|
+
}
|
|
1851
|
+
function createPostponeReason(route, expression) {
|
|
1852
|
+
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`;
|
|
1853
|
+
}
|
|
1854
|
+
function isDynamicPostpone(err) {
|
|
1855
|
+
if (typeof err === "object" && err !== null && typeof err.message === "string") {
|
|
1856
|
+
return isDynamicPostponeReason(err.message);
|
|
1857
|
+
}
|
|
1858
|
+
return false;
|
|
1859
|
+
}
|
|
1860
|
+
function isDynamicPostponeReason(reason) {
|
|
1861
|
+
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");
|
|
1862
|
+
}
|
|
1863
|
+
if (isDynamicPostponeReason(createPostponeReason("%%%", "^^^")) === false) {
|
|
1864
|
+
throw Object.defineProperty(new Error("Invariant: isDynamicPostpone misidentified a postpone reason. This is a bug in Next.js"), "__NEXT_ERROR_CODE", {
|
|
1865
|
+
value: "E296",
|
|
1866
|
+
enumerable: false,
|
|
1867
|
+
configurable: true
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
var NEXT_PRERENDER_INTERRUPTED = "NEXT_PRERENDER_INTERRUPTED";
|
|
1871
|
+
function createPrerenderInterruptedError(message) {
|
|
1872
|
+
const error = Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
|
|
1873
|
+
value: "E394",
|
|
1874
|
+
enumerable: false,
|
|
1875
|
+
configurable: true
|
|
1876
|
+
});
|
|
1877
|
+
error.digest = NEXT_PRERENDER_INTERRUPTED;
|
|
1878
|
+
return error;
|
|
1879
|
+
}
|
|
1880
|
+
function isPrerenderInterruptedError(error) {
|
|
1881
|
+
return typeof error === "object" && error !== null && error.digest === NEXT_PRERENDER_INTERRUPTED && "name" in error && "message" in error && error instanceof Error;
|
|
1882
|
+
}
|
|
1883
|
+
function accessedDynamicData(dynamicAccesses) {
|
|
1884
|
+
return dynamicAccesses.length > 0;
|
|
1885
|
+
}
|
|
1886
|
+
function consumeDynamicAccess(serverDynamic, clientDynamic) {
|
|
1887
|
+
serverDynamic.dynamicAccesses.push(...clientDynamic.dynamicAccesses);
|
|
1888
|
+
return serverDynamic.dynamicAccesses;
|
|
1889
|
+
}
|
|
1890
|
+
function formatDynamicAPIAccesses(dynamicAccesses) {
|
|
1891
|
+
return dynamicAccesses.filter((access) => typeof access.stack === "string" && access.stack.length > 0).map(({ expression, stack }) => {
|
|
1892
|
+
stack = stack.split("\n").slice(4).filter((line) => {
|
|
1893
|
+
if (line.includes("node_modules/next/")) {
|
|
1894
|
+
return false;
|
|
1895
|
+
}
|
|
1896
|
+
if (line.includes(" (<anonymous>)")) {
|
|
1897
|
+
return false;
|
|
1898
|
+
}
|
|
1899
|
+
if (line.includes(" (node:")) {
|
|
1900
|
+
return false;
|
|
1901
|
+
}
|
|
1902
|
+
return true;
|
|
1903
|
+
}).join("\n");
|
|
1904
|
+
return `Dynamic API Usage Debug - ${expression}:
|
|
1905
|
+
${stack}`;
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
function assertPostpone() {
|
|
1909
|
+
if (!hasPostpone) {
|
|
1910
|
+
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", {
|
|
1911
|
+
value: "E224",
|
|
1912
|
+
enumerable: false,
|
|
1913
|
+
configurable: true
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function createRenderInBrowserAbortSignal() {
|
|
1918
|
+
const controller = new AbortController();
|
|
1919
|
+
controller.abort(Object.defineProperty(new _bailouttocsr.BailoutToCSRError("Render in Browser"), "__NEXT_ERROR_CODE", {
|
|
1920
|
+
value: "E721",
|
|
1921
|
+
enumerable: false,
|
|
1922
|
+
configurable: true
|
|
1923
|
+
}));
|
|
1924
|
+
return controller.signal;
|
|
1925
|
+
}
|
|
1926
|
+
function createHangingInputAbortSignal(workUnitStore) {
|
|
1927
|
+
switch (workUnitStore.type) {
|
|
1928
|
+
case "prerender":
|
|
1929
|
+
case "prerender-runtime":
|
|
1930
|
+
const controller = new AbortController();
|
|
1931
|
+
if (workUnitStore.cacheSignal) {
|
|
1932
|
+
workUnitStore.cacheSignal.inputReady().then(() => {
|
|
1933
|
+
controller.abort();
|
|
1934
|
+
});
|
|
1935
|
+
} else {
|
|
1936
|
+
const runtimeStagePromise = (0, _workunitasyncstorageexternal.getRuntimeStagePromise)(workUnitStore);
|
|
1937
|
+
if (runtimeStagePromise) {
|
|
1938
|
+
runtimeStagePromise.then(() => (0, _scheduler.scheduleOnNextTick)(() => controller.abort()));
|
|
1939
|
+
} else {
|
|
1940
|
+
(0, _scheduler.scheduleOnNextTick)(() => controller.abort());
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
return controller.signal;
|
|
1944
|
+
case "prerender-client":
|
|
1945
|
+
case "prerender-ppr":
|
|
1946
|
+
case "prerender-legacy":
|
|
1947
|
+
case "request":
|
|
1948
|
+
case "cache":
|
|
1949
|
+
case "private-cache":
|
|
1950
|
+
case "unstable-cache":
|
|
1951
|
+
return void 0;
|
|
1952
|
+
default:
|
|
1953
|
+
workUnitStore;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
function annotateDynamicAccess(expression, prerenderStore) {
|
|
1957
|
+
const dynamicTracking = prerenderStore.dynamicTracking;
|
|
1958
|
+
if (dynamicTracking) {
|
|
1959
|
+
dynamicTracking.dynamicAccesses.push({
|
|
1960
|
+
stack: dynamicTracking.isDebugDynamicAccesses ? new Error().stack : void 0,
|
|
1961
|
+
expression
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
function useDynamicRouteParams(expression) {
|
|
1966
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
1967
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
1968
|
+
if (workStore && workUnitStore) {
|
|
1969
|
+
switch (workUnitStore.type) {
|
|
1970
|
+
case "prerender-client":
|
|
1971
|
+
case "prerender": {
|
|
1972
|
+
const fallbackParams = workUnitStore.fallbackRouteParams;
|
|
1973
|
+
if (fallbackParams && fallbackParams.size > 0) {
|
|
1974
|
+
_react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression));
|
|
1975
|
+
}
|
|
1976
|
+
break;
|
|
1977
|
+
}
|
|
1978
|
+
case "prerender-ppr": {
|
|
1979
|
+
const fallbackParams = workUnitStore.fallbackRouteParams;
|
|
1980
|
+
if (fallbackParams && fallbackParams.size > 0) {
|
|
1981
|
+
return postponeWithTracking(workStore.route, expression, workUnitStore.dynamicTracking);
|
|
1982
|
+
}
|
|
1983
|
+
break;
|
|
1984
|
+
}
|
|
1985
|
+
case "prerender-runtime":
|
|
1986
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called during a runtime prerender. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
1987
|
+
value: "E771",
|
|
1988
|
+
enumerable: false,
|
|
1989
|
+
configurable: true
|
|
1990
|
+
});
|
|
1991
|
+
case "cache":
|
|
1992
|
+
case "private-cache":
|
|
1993
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
1994
|
+
value: "E745",
|
|
1995
|
+
enumerable: false,
|
|
1996
|
+
configurable: true
|
|
1997
|
+
});
|
|
1998
|
+
case "prerender-legacy":
|
|
1999
|
+
case "request":
|
|
2000
|
+
case "unstable-cache":
|
|
2001
|
+
break;
|
|
2002
|
+
default:
|
|
2003
|
+
workUnitStore;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
function useDynamicSearchParams(expression) {
|
|
2008
|
+
const workStore = _workasyncstorageexternal.workAsyncStorage.getStore();
|
|
2009
|
+
const workUnitStore = _workunitasyncstorageexternal.workUnitAsyncStorage.getStore();
|
|
2010
|
+
if (!workStore) {
|
|
2011
|
+
return;
|
|
2012
|
+
}
|
|
2013
|
+
if (!workUnitStore) {
|
|
2014
|
+
(0, _workunitasyncstorageexternal.throwForMissingRequestStore)(expression);
|
|
2015
|
+
}
|
|
2016
|
+
switch (workUnitStore.type) {
|
|
2017
|
+
case "prerender-client": {
|
|
2018
|
+
_react.default.use((0, _dynamicrenderingutils.makeHangingPromise)(workUnitStore.renderSignal, workStore.route, expression));
|
|
2019
|
+
break;
|
|
2020
|
+
}
|
|
2021
|
+
case "prerender-legacy":
|
|
2022
|
+
case "prerender-ppr": {
|
|
2023
|
+
if (workStore.forceStatic) {
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
throw Object.defineProperty(new _bailouttocsr.BailoutToCSRError(expression), "__NEXT_ERROR_CODE", {
|
|
2027
|
+
value: "E394",
|
|
2028
|
+
enumerable: false,
|
|
2029
|
+
configurable: true
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
case "prerender":
|
|
2033
|
+
case "prerender-runtime":
|
|
2034
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called from a Server Component. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
2035
|
+
value: "E795",
|
|
2036
|
+
enumerable: false,
|
|
2037
|
+
configurable: true
|
|
2038
|
+
});
|
|
2039
|
+
case "cache":
|
|
2040
|
+
case "unstable-cache":
|
|
2041
|
+
case "private-cache":
|
|
2042
|
+
throw Object.defineProperty(new _invarianterror.InvariantError(`\`${expression}\` was called inside a cache scope. Next.js should be preventing ${expression} from being included in server components statically, but did not in this case.`), "__NEXT_ERROR_CODE", {
|
|
2043
|
+
value: "E745",
|
|
2044
|
+
enumerable: false,
|
|
2045
|
+
configurable: true
|
|
2046
|
+
});
|
|
2047
|
+
case "request":
|
|
2048
|
+
return;
|
|
2049
|
+
default:
|
|
2050
|
+
workUnitStore;
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
var hasSuspenseRegex = /\n\s+at Suspense \(<anonymous>\)/;
|
|
2054
|
+
var bodyAndImplicitTags = "body|div|main|section|article|aside|header|footer|nav|form|p|span|h1|h2|h3|h4|h5|h6";
|
|
2055
|
+
var hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex = new RegExp(`\\n\\s+at Suspense \\(<anonymous>\\)(?:(?!\\n\\s+at (?:${bodyAndImplicitTags}) \\(<anonymous>\\))[\\s\\S])*?\\n\\s+at ${_boundaryconstants.ROOT_LAYOUT_BOUNDARY_NAME} \\([^\\n]*\\)`);
|
|
2056
|
+
var hasMetadataRegex = new RegExp(`\\n\\s+at ${_boundaryconstants.METADATA_BOUNDARY_NAME}[\\n\\s]`);
|
|
2057
|
+
var hasViewportRegex = new RegExp(`\\n\\s+at ${_boundaryconstants.VIEWPORT_BOUNDARY_NAME}[\\n\\s]`);
|
|
2058
|
+
var hasOutletRegex = new RegExp(`\\n\\s+at ${_boundaryconstants.OUTLET_BOUNDARY_NAME}[\\n\\s]`);
|
|
2059
|
+
function trackAllowedDynamicAccess(workStore, componentStack, dynamicValidation, clientDynamic) {
|
|
2060
|
+
if (hasOutletRegex.test(componentStack)) {
|
|
2061
|
+
return;
|
|
2062
|
+
} else if (hasMetadataRegex.test(componentStack)) {
|
|
2063
|
+
dynamicValidation.hasDynamicMetadata = true;
|
|
2064
|
+
return;
|
|
2065
|
+
} else if (hasViewportRegex.test(componentStack)) {
|
|
2066
|
+
dynamicValidation.hasDynamicViewport = true;
|
|
2067
|
+
return;
|
|
2068
|
+
} else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {
|
|
2069
|
+
dynamicValidation.hasAllowedDynamic = true;
|
|
2070
|
+
dynamicValidation.hasSuspenseAboveBody = true;
|
|
2071
|
+
return;
|
|
2072
|
+
} else if (hasSuspenseRegex.test(componentStack)) {
|
|
2073
|
+
dynamicValidation.hasAllowedDynamic = true;
|
|
2074
|
+
return;
|
|
2075
|
+
} else if (clientDynamic.syncDynamicErrorWithStack) {
|
|
2076
|
+
dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);
|
|
2077
|
+
return;
|
|
2078
|
+
} else {
|
|
2079
|
+
const message = `Route "${workStore.route}": Uncached data was accessed outside of <Suspense>. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`;
|
|
2080
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2081
|
+
dynamicValidation.dynamicErrors.push(error);
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
function trackDynamicHoleInRuntimeShell(workStore, componentStack, dynamicValidation, clientDynamic) {
|
|
2086
|
+
if (hasOutletRegex.test(componentStack)) {
|
|
2087
|
+
return;
|
|
2088
|
+
} else if (hasMetadataRegex.test(componentStack)) {
|
|
2089
|
+
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed inside \`generateMetadata\`. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`;
|
|
2090
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2091
|
+
dynamicValidation.dynamicMetadata = error;
|
|
2092
|
+
return;
|
|
2093
|
+
} else if (hasViewportRegex.test(componentStack)) {
|
|
2094
|
+
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`;
|
|
2095
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2096
|
+
dynamicValidation.dynamicErrors.push(error);
|
|
2097
|
+
return;
|
|
2098
|
+
} else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {
|
|
2099
|
+
dynamicValidation.hasAllowedDynamic = true;
|
|
2100
|
+
dynamicValidation.hasSuspenseAboveBody = true;
|
|
2101
|
+
return;
|
|
2102
|
+
} else if (hasSuspenseRegex.test(componentStack)) {
|
|
2103
|
+
dynamicValidation.hasAllowedDynamic = true;
|
|
2104
|
+
return;
|
|
2105
|
+
} else if (clientDynamic.syncDynamicErrorWithStack) {
|
|
2106
|
+
dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);
|
|
2107
|
+
return;
|
|
2108
|
+
} else {
|
|
2109
|
+
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`;
|
|
2110
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2111
|
+
dynamicValidation.dynamicErrors.push(error);
|
|
2112
|
+
return;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
function trackDynamicHoleInStaticShell(workStore, componentStack, dynamicValidation, clientDynamic) {
|
|
2116
|
+
if (hasOutletRegex.test(componentStack)) {
|
|
2117
|
+
return;
|
|
2118
|
+
} else if (hasMetadataRegex.test(componentStack)) {
|
|
2119
|
+
const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateMetadata\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`;
|
|
2120
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2121
|
+
dynamicValidation.dynamicMetadata = error;
|
|
2122
|
+
return;
|
|
2123
|
+
} else if (hasViewportRegex.test(componentStack)) {
|
|
2124
|
+
const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed inside \`generateViewport\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`;
|
|
2125
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2126
|
+
dynamicValidation.dynamicErrors.push(error);
|
|
2127
|
+
return;
|
|
2128
|
+
} else if (hasSuspenseBeforeRootLayoutWithoutBodyOrImplicitBodyRegex.test(componentStack)) {
|
|
2129
|
+
dynamicValidation.hasAllowedDynamic = true;
|
|
2130
|
+
dynamicValidation.hasSuspenseAboveBody = true;
|
|
2131
|
+
return;
|
|
2132
|
+
} else if (hasSuspenseRegex.test(componentStack)) {
|
|
2133
|
+
dynamicValidation.hasAllowedDynamic = true;
|
|
2134
|
+
return;
|
|
2135
|
+
} else if (clientDynamic.syncDynamicErrorWithStack) {
|
|
2136
|
+
dynamicValidation.dynamicErrors.push(clientDynamic.syncDynamicErrorWithStack);
|
|
2137
|
+
return;
|
|
2138
|
+
} else {
|
|
2139
|
+
const message = `Route "${workStore.route}": Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`;
|
|
2140
|
+
const error = createErrorWithComponentOrOwnerStack(message, componentStack);
|
|
2141
|
+
dynamicValidation.dynamicErrors.push(error);
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
function createErrorWithComponentOrOwnerStack(message, componentStack) {
|
|
2146
|
+
const ownerStack = process.env.NODE_ENV !== "production" && _react.default.captureOwnerStack ? _react.default.captureOwnerStack() : null;
|
|
2147
|
+
const error = Object.defineProperty(new Error(message), "__NEXT_ERROR_CODE", {
|
|
2148
|
+
value: "E394",
|
|
2149
|
+
enumerable: false,
|
|
2150
|
+
configurable: true
|
|
2151
|
+
});
|
|
2152
|
+
error.stack = error.name + ": " + message + (ownerStack || componentStack);
|
|
2153
|
+
return error;
|
|
2154
|
+
}
|
|
2155
|
+
var PreludeState = /* @__PURE__ */ (function(PreludeState2) {
|
|
2156
|
+
PreludeState2[PreludeState2["Full"] = 0] = "Full";
|
|
2157
|
+
PreludeState2[PreludeState2["Empty"] = 1] = "Empty";
|
|
2158
|
+
PreludeState2[PreludeState2["Errored"] = 2] = "Errored";
|
|
2159
|
+
return PreludeState2;
|
|
2160
|
+
})({});
|
|
2161
|
+
function logDisallowedDynamicError(workStore, error) {
|
|
2162
|
+
console.error(error);
|
|
2163
|
+
if (!workStore.dev) {
|
|
2164
|
+
if (workStore.hasReadableErrorStacks) {
|
|
2165
|
+
console.error(`To get a more detailed stack trace and pinpoint the issue, start the app in development mode by running \`next dev\`, then open "${workStore.route}" in your browser to investigate the error.`);
|
|
2166
|
+
} else {
|
|
2167
|
+
console.error(`To get a more detailed stack trace and pinpoint the issue, try one of the following:
|
|
2168
|
+
- Start the app in development mode by running \`next dev\`, then open "${workStore.route}" in your browser to investigate the error.
|
|
2169
|
+
- Rerun the production build with \`next build --debug-prerender\` to generate better stack traces.`);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
function throwIfDisallowedDynamic(workStore, prelude, dynamicValidation, serverDynamic) {
|
|
2174
|
+
if (serverDynamic.syncDynamicErrorWithStack) {
|
|
2175
|
+
logDisallowedDynamicError(workStore, serverDynamic.syncDynamicErrorWithStack);
|
|
2176
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
2177
|
+
}
|
|
2178
|
+
if (prelude !== 0) {
|
|
2179
|
+
if (dynamicValidation.hasSuspenseAboveBody) {
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2182
|
+
const dynamicErrors = dynamicValidation.dynamicErrors;
|
|
2183
|
+
if (dynamicErrors.length > 0) {
|
|
2184
|
+
for (let i = 0; i < dynamicErrors.length; i++) {
|
|
2185
|
+
logDisallowedDynamicError(workStore, dynamicErrors[i]);
|
|
2186
|
+
}
|
|
2187
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
2188
|
+
}
|
|
2189
|
+
if (dynamicValidation.hasDynamicViewport) {
|
|
2190
|
+
console.error(`Route "${workStore.route}" has a \`generateViewport\` that depends on Request data (\`cookies()\`, etc...) or uncached external data (\`fetch(...)\`, etc...) without explicitly allowing fully dynamic rendering. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport`);
|
|
2191
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
2192
|
+
}
|
|
2193
|
+
if (prelude === 1) {
|
|
2194
|
+
console.error(`Route "${workStore.route}" did not produce a static shell and Next.js was unable to determine a reason. This is a bug in Next.js.`);
|
|
2195
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
2196
|
+
}
|
|
2197
|
+
} else {
|
|
2198
|
+
if (dynamicValidation.hasAllowedDynamic === false && dynamicValidation.hasDynamicMetadata) {
|
|
2199
|
+
console.error(`Route "${workStore.route}" has a \`generateMetadata\` that depends on Request data (\`cookies()\`, etc...) or uncached external data (\`fetch(...)\`, etc...) when the rest of the route does not. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata`);
|
|
2200
|
+
throw new _staticgenerationbailout.StaticGenBailoutError();
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
function getStaticShellDisallowedDynamicReasons(workStore, prelude, dynamicValidation) {
|
|
2205
|
+
if (dynamicValidation.hasSuspenseAboveBody) {
|
|
2206
|
+
return [];
|
|
2207
|
+
}
|
|
2208
|
+
if (prelude !== 0) {
|
|
2209
|
+
const dynamicErrors = dynamicValidation.dynamicErrors;
|
|
2210
|
+
if (dynamicErrors.length > 0) {
|
|
2211
|
+
return dynamicErrors;
|
|
2212
|
+
}
|
|
2213
|
+
if (prelude === 1) {
|
|
2214
|
+
return [
|
|
2215
|
+
Object.defineProperty(new _invarianterror.InvariantError(`Route "${workStore.route}" did not produce a static shell and Next.js was unable to determine a reason.`), "__NEXT_ERROR_CODE", {
|
|
2216
|
+
value: "E936",
|
|
2217
|
+
enumerable: false,
|
|
2218
|
+
configurable: true
|
|
2219
|
+
})
|
|
2220
|
+
];
|
|
2221
|
+
}
|
|
2222
|
+
} else {
|
|
2223
|
+
if (dynamicValidation.hasAllowedDynamic === false && dynamicValidation.dynamicErrors.length === 0 && dynamicValidation.dynamicMetadata) {
|
|
2224
|
+
return [
|
|
2225
|
+
dynamicValidation.dynamicMetadata
|
|
2226
|
+
];
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
return [];
|
|
2230
|
+
}
|
|
2231
|
+
function delayUntilRuntimeStage(prerenderStore, result) {
|
|
2232
|
+
if (prerenderStore.runtimeStagePromise) {
|
|
2233
|
+
return prerenderStore.runtimeStagePromise.then(() => result);
|
|
2234
|
+
}
|
|
2235
|
+
return result;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
});
|
|
2239
|
+
|
|
2240
|
+
// node_modules/next/dist/client/components/unstable-rethrow.server.js
|
|
2241
|
+
var require_unstable_rethrow_server = __commonJS({
|
|
2242
|
+
"node_modules/next/dist/client/components/unstable-rethrow.server.js"(exports, module) {
|
|
2243
|
+
"use strict";
|
|
2244
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2245
|
+
value: true
|
|
2246
|
+
});
|
|
2247
|
+
Object.defineProperty(exports, "unstable_rethrow", {
|
|
2248
|
+
enumerable: true,
|
|
2249
|
+
get: function() {
|
|
2250
|
+
return unstable_rethrow;
|
|
2251
|
+
}
|
|
2252
|
+
});
|
|
2253
|
+
var _dynamicrenderingutils = require_dynamic_rendering_utils();
|
|
2254
|
+
var _ispostpone = require_is_postpone();
|
|
2255
|
+
var _bailouttocsr = require_bailout_to_csr();
|
|
2256
|
+
var _isnextroutererror = require_is_next_router_error();
|
|
2257
|
+
var _dynamicrendering = require_dynamic_rendering();
|
|
2258
|
+
var _hooksservercontext = require_hooks_server_context();
|
|
2259
|
+
function unstable_rethrow(error) {
|
|
2260
|
+
if ((0, _isnextroutererror.isNextRouterError)(error) || (0, _bailouttocsr.isBailoutToCSRError)(error) || (0, _hooksservercontext.isDynamicServerError)(error) || (0, _dynamicrendering.isDynamicPostpone)(error) || (0, _ispostpone.isPostpone)(error) || (0, _dynamicrenderingutils.isHangingPromiseRejectionError)(error) || (0, _dynamicrendering.isPrerenderInterruptedError)(error)) {
|
|
2261
|
+
throw error;
|
|
2262
|
+
}
|
|
2263
|
+
if (error instanceof Error && "cause" in error) {
|
|
2264
|
+
unstable_rethrow(error.cause);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
2268
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
2269
|
+
Object.assign(exports.default, exports);
|
|
2270
|
+
module.exports = exports.default;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
});
|
|
2274
|
+
|
|
2275
|
+
// node_modules/next/dist/client/components/unstable-rethrow.browser.js
|
|
2276
|
+
var require_unstable_rethrow_browser = __commonJS({
|
|
2277
|
+
"node_modules/next/dist/client/components/unstable-rethrow.browser.js"(exports, module) {
|
|
2278
|
+
"use strict";
|
|
2279
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2280
|
+
value: true
|
|
2281
|
+
});
|
|
2282
|
+
Object.defineProperty(exports, "unstable_rethrow", {
|
|
2283
|
+
enumerable: true,
|
|
2284
|
+
get: function() {
|
|
2285
|
+
return unstable_rethrow;
|
|
2286
|
+
}
|
|
2287
|
+
});
|
|
2288
|
+
var _bailouttocsr = require_bailout_to_csr();
|
|
2289
|
+
var _isnextroutererror = require_is_next_router_error();
|
|
2290
|
+
function unstable_rethrow(error) {
|
|
2291
|
+
if ((0, _isnextroutererror.isNextRouterError)(error) || (0, _bailouttocsr.isBailoutToCSRError)(error)) {
|
|
2292
|
+
throw error;
|
|
2293
|
+
}
|
|
2294
|
+
if (error instanceof Error && "cause" in error) {
|
|
2295
|
+
unstable_rethrow(error.cause);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
2299
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
2300
|
+
Object.assign(exports.default, exports);
|
|
2301
|
+
module.exports = exports.default;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
});
|
|
2305
|
+
|
|
2306
|
+
// node_modules/next/dist/client/components/unstable-rethrow.js
|
|
2307
|
+
var require_unstable_rethrow = __commonJS({
|
|
2308
|
+
"node_modules/next/dist/client/components/unstable-rethrow.js"(exports, module) {
|
|
2309
|
+
"use strict";
|
|
2310
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2311
|
+
value: true
|
|
2312
|
+
});
|
|
2313
|
+
Object.defineProperty(exports, "unstable_rethrow", {
|
|
2314
|
+
enumerable: true,
|
|
2315
|
+
get: function() {
|
|
2316
|
+
return unstable_rethrow;
|
|
2317
|
+
}
|
|
2318
|
+
});
|
|
2319
|
+
var unstable_rethrow = typeof window === "undefined" ? require_unstable_rethrow_server().unstable_rethrow : require_unstable_rethrow_browser().unstable_rethrow;
|
|
2320
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
2321
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
2322
|
+
Object.assign(exports.default, exports);
|
|
2323
|
+
module.exports = exports.default;
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
});
|
|
2327
|
+
|
|
2328
|
+
// node_modules/next/dist/client/components/navigation.react-server.js
|
|
2329
|
+
var require_navigation_react_server = __commonJS({
|
|
2330
|
+
"node_modules/next/dist/client/components/navigation.react-server.js"(exports, module) {
|
|
2331
|
+
"use strict";
|
|
2332
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2333
|
+
value: true
|
|
2334
|
+
});
|
|
2335
|
+
function _export(target, all) {
|
|
2336
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
2337
|
+
enumerable: true,
|
|
2338
|
+
get: all[name]
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
_export(exports, {
|
|
2342
|
+
ReadonlyURLSearchParams: function() {
|
|
2343
|
+
return _readonlyurlsearchparams.ReadonlyURLSearchParams;
|
|
2344
|
+
},
|
|
2345
|
+
RedirectType: function() {
|
|
2346
|
+
return _redirecterror.RedirectType;
|
|
2347
|
+
},
|
|
2348
|
+
forbidden: function() {
|
|
2349
|
+
return _forbidden.forbidden;
|
|
2350
|
+
},
|
|
2351
|
+
notFound: function() {
|
|
2352
|
+
return _notfound.notFound;
|
|
2353
|
+
},
|
|
2354
|
+
permanentRedirect: function() {
|
|
2355
|
+
return _redirect.permanentRedirect;
|
|
2356
|
+
},
|
|
2357
|
+
redirect: function() {
|
|
2358
|
+
return _redirect.redirect;
|
|
2359
|
+
},
|
|
2360
|
+
unauthorized: function() {
|
|
2361
|
+
return _unauthorized.unauthorized;
|
|
2362
|
+
},
|
|
2363
|
+
unstable_isUnrecognizedActionError: function() {
|
|
2364
|
+
return unstable_isUnrecognizedActionError;
|
|
2365
|
+
},
|
|
2366
|
+
unstable_rethrow: function() {
|
|
2367
|
+
return _unstablerethrow.unstable_rethrow;
|
|
2368
|
+
}
|
|
2369
|
+
});
|
|
2370
|
+
var _readonlyurlsearchparams = require_readonly_url_search_params();
|
|
2371
|
+
var _redirect = require_redirect();
|
|
2372
|
+
var _redirecterror = require_redirect_error();
|
|
2373
|
+
var _notfound = require_not_found();
|
|
2374
|
+
var _forbidden = require_forbidden();
|
|
2375
|
+
var _unauthorized = require_unauthorized();
|
|
2376
|
+
var _unstablerethrow = require_unstable_rethrow();
|
|
2377
|
+
function unstable_isUnrecognizedActionError() {
|
|
2378
|
+
throw Object.defineProperty(new Error("`unstable_isUnrecognizedActionError` can only be used on the client."), "__NEXT_ERROR_CODE", {
|
|
2379
|
+
value: "E776",
|
|
2380
|
+
enumerable: false,
|
|
2381
|
+
configurable: true
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2384
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
2385
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
2386
|
+
Object.assign(exports.default, exports);
|
|
2387
|
+
module.exports = exports.default;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
});
|
|
2391
|
+
|
|
2392
|
+
// node_modules/next/dist/client/components/navigation.js
|
|
2393
|
+
var require_navigation = __commonJS({
|
|
2394
|
+
"node_modules/next/dist/client/components/navigation.js"(exports, module) {
|
|
2395
|
+
"use strict";
|
|
2396
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2397
|
+
value: true
|
|
2398
|
+
});
|
|
2399
|
+
function _export(target, all) {
|
|
2400
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
2401
|
+
enumerable: true,
|
|
2402
|
+
get: all[name]
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
_export(exports, {
|
|
2406
|
+
// We need the same class that was used to instantiate the context value
|
|
2407
|
+
// Otherwise instanceof checks will fail in usercode
|
|
2408
|
+
ReadonlyURLSearchParams: function() {
|
|
2409
|
+
return _hooksclientcontextsharedruntime.ReadonlyURLSearchParams;
|
|
2410
|
+
},
|
|
2411
|
+
RedirectType: function() {
|
|
2412
|
+
return _navigationreactserver.RedirectType;
|
|
2413
|
+
},
|
|
2414
|
+
ServerInsertedHTMLContext: function() {
|
|
2415
|
+
return _serverinsertedhtmlsharedruntime.ServerInsertedHTMLContext;
|
|
2416
|
+
},
|
|
2417
|
+
forbidden: function() {
|
|
2418
|
+
return _navigationreactserver.forbidden;
|
|
2419
|
+
},
|
|
2420
|
+
notFound: function() {
|
|
2421
|
+
return _navigationreactserver.notFound;
|
|
2422
|
+
},
|
|
2423
|
+
permanentRedirect: function() {
|
|
2424
|
+
return _navigationreactserver.permanentRedirect;
|
|
2425
|
+
},
|
|
2426
|
+
redirect: function() {
|
|
2427
|
+
return _navigationreactserver.redirect;
|
|
2428
|
+
},
|
|
2429
|
+
unauthorized: function() {
|
|
2430
|
+
return _navigationreactserver.unauthorized;
|
|
2431
|
+
},
|
|
2432
|
+
unstable_isUnrecognizedActionError: function() {
|
|
2433
|
+
return _unrecognizedactionerror.unstable_isUnrecognizedActionError;
|
|
2434
|
+
},
|
|
2435
|
+
unstable_rethrow: function() {
|
|
2436
|
+
return _navigationreactserver.unstable_rethrow;
|
|
2437
|
+
},
|
|
2438
|
+
useParams: function() {
|
|
2439
|
+
return useParams;
|
|
2440
|
+
},
|
|
2441
|
+
usePathname: function() {
|
|
2442
|
+
return usePathname2;
|
|
2443
|
+
},
|
|
2444
|
+
useRouter: function() {
|
|
2445
|
+
return useRouter;
|
|
2446
|
+
},
|
|
2447
|
+
useSearchParams: function() {
|
|
2448
|
+
return useSearchParams2;
|
|
2449
|
+
},
|
|
2450
|
+
useSelectedLayoutSegment: function() {
|
|
2451
|
+
return useSelectedLayoutSegment;
|
|
2452
|
+
},
|
|
2453
|
+
useSelectedLayoutSegments: function() {
|
|
2454
|
+
return useSelectedLayoutSegments;
|
|
2455
|
+
},
|
|
2456
|
+
useServerInsertedHTML: function() {
|
|
2457
|
+
return _serverinsertedhtmlsharedruntime.useServerInsertedHTML;
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
var _interop_require_wildcard = require_interop_require_wildcard();
|
|
2461
|
+
var _react = /* @__PURE__ */ _interop_require_wildcard._(__require("react"));
|
|
2462
|
+
var _approutercontextsharedruntime = require_app_router_context_shared_runtime();
|
|
2463
|
+
var _hooksclientcontextsharedruntime = require_hooks_client_context_shared_runtime();
|
|
2464
|
+
var _segment = require_segment();
|
|
2465
|
+
var _serverinsertedhtmlsharedruntime = require_server_inserted_html_shared_runtime();
|
|
2466
|
+
var _unrecognizedactionerror = require_unrecognized_action_error();
|
|
2467
|
+
var _navigationreactserver = require_navigation_react_server();
|
|
2468
|
+
var useDynamicRouteParams = typeof window === "undefined" ? require_dynamic_rendering().useDynamicRouteParams : void 0;
|
|
2469
|
+
var useDynamicSearchParams = typeof window === "undefined" ? require_dynamic_rendering().useDynamicSearchParams : void 0;
|
|
2470
|
+
function useSearchParams2() {
|
|
2471
|
+
useDynamicSearchParams?.("useSearchParams()");
|
|
2472
|
+
const searchParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.SearchParamsContext);
|
|
2473
|
+
const readonlySearchParams = (0, _react.useMemo)(() => {
|
|
2474
|
+
if (!searchParams) {
|
|
2475
|
+
return null;
|
|
2476
|
+
}
|
|
2477
|
+
return new _hooksclientcontextsharedruntime.ReadonlyURLSearchParams(searchParams);
|
|
2478
|
+
}, [
|
|
2479
|
+
searchParams
|
|
2480
|
+
]);
|
|
2481
|
+
if (process.env.NODE_ENV !== "production" && "use" in _react.default) {
|
|
2482
|
+
const navigationPromises = (0, _react.use)(_hooksclientcontextsharedruntime.NavigationPromisesContext);
|
|
2483
|
+
if (navigationPromises) {
|
|
2484
|
+
return (0, _react.use)(navigationPromises.searchParams);
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
return readonlySearchParams;
|
|
2488
|
+
}
|
|
2489
|
+
function usePathname2() {
|
|
2490
|
+
useDynamicRouteParams?.("usePathname()");
|
|
2491
|
+
const pathname = (0, _react.useContext)(_hooksclientcontextsharedruntime.PathnameContext);
|
|
2492
|
+
if (process.env.NODE_ENV !== "production" && "use" in _react.default) {
|
|
2493
|
+
const navigationPromises = (0, _react.use)(_hooksclientcontextsharedruntime.NavigationPromisesContext);
|
|
2494
|
+
if (navigationPromises) {
|
|
2495
|
+
return (0, _react.use)(navigationPromises.pathname);
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
return pathname;
|
|
2499
|
+
}
|
|
2500
|
+
function useRouter() {
|
|
2501
|
+
const router = (0, _react.useContext)(_approutercontextsharedruntime.AppRouterContext);
|
|
2502
|
+
if (router === null) {
|
|
2503
|
+
throw Object.defineProperty(new Error("invariant expected app router to be mounted"), "__NEXT_ERROR_CODE", {
|
|
2504
|
+
value: "E238",
|
|
2505
|
+
enumerable: false,
|
|
2506
|
+
configurable: true
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
return router;
|
|
2510
|
+
}
|
|
2511
|
+
function useParams() {
|
|
2512
|
+
useDynamicRouteParams?.("useParams()");
|
|
2513
|
+
const params = (0, _react.useContext)(_hooksclientcontextsharedruntime.PathParamsContext);
|
|
2514
|
+
if (process.env.NODE_ENV !== "production" && "use" in _react.default) {
|
|
2515
|
+
const navigationPromises = (0, _react.use)(_hooksclientcontextsharedruntime.NavigationPromisesContext);
|
|
2516
|
+
if (navigationPromises) {
|
|
2517
|
+
return (0, _react.use)(navigationPromises.params);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return params;
|
|
2521
|
+
}
|
|
2522
|
+
function useSelectedLayoutSegments(parallelRouteKey = "children") {
|
|
2523
|
+
useDynamicRouteParams?.("useSelectedLayoutSegments()");
|
|
2524
|
+
const context = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
|
|
2525
|
+
if (!context) return null;
|
|
2526
|
+
if (process.env.NODE_ENV !== "production" && "use" in _react.default) {
|
|
2527
|
+
const navigationPromises = (0, _react.use)(_hooksclientcontextsharedruntime.NavigationPromisesContext);
|
|
2528
|
+
if (navigationPromises) {
|
|
2529
|
+
const promise = navigationPromises.selectedLayoutSegmentsPromises?.get(parallelRouteKey);
|
|
2530
|
+
if (promise) {
|
|
2531
|
+
return (0, _react.use)(promise);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
return (0, _segment.getSelectedLayoutSegmentPath)(context.parentTree, parallelRouteKey);
|
|
2536
|
+
}
|
|
2537
|
+
function useSelectedLayoutSegment(parallelRouteKey = "children") {
|
|
2538
|
+
useDynamicRouteParams?.("useSelectedLayoutSegment()");
|
|
2539
|
+
const navigationPromises = (0, _react.useContext)(_hooksclientcontextsharedruntime.NavigationPromisesContext);
|
|
2540
|
+
const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey);
|
|
2541
|
+
if (process.env.NODE_ENV !== "production" && navigationPromises && "use" in _react.default) {
|
|
2542
|
+
const promise = navigationPromises.selectedLayoutSegmentPromises?.get(parallelRouteKey);
|
|
2543
|
+
if (promise) {
|
|
2544
|
+
return (0, _react.use)(promise);
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
return (0, _segment.computeSelectedLayoutSegment)(selectedLayoutSegments, parallelRouteKey);
|
|
2548
|
+
}
|
|
2549
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
2550
|
+
Object.defineProperty(exports.default, "__esModule", { value: true });
|
|
2551
|
+
Object.assign(exports.default, exports);
|
|
2552
|
+
module.exports = exports.default;
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
});
|
|
2556
|
+
|
|
2557
|
+
// node_modules/next/navigation.js
|
|
2558
|
+
var require_navigation2 = __commonJS({
|
|
2559
|
+
"node_modules/next/navigation.js"(exports, module) {
|
|
2560
|
+
"use strict";
|
|
2561
|
+
module.exports = require_navigation();
|
|
2562
|
+
}
|
|
2563
|
+
});
|
|
2564
|
+
|
|
2565
|
+
// src/config.ts
|
|
2566
|
+
var DEFAULT_API_URL = "https://api.nexushub.com/v1";
|
|
2567
|
+
var hasEnv = () => {
|
|
2568
|
+
return typeof process !== "undefined" && typeof process.env !== "undefined" && Object.keys(process.env).length > 0;
|
|
2569
|
+
};
|
|
2570
|
+
var getEnvConfig = () => {
|
|
2571
|
+
if (!hasEnv()) {
|
|
2572
|
+
return {
|
|
2573
|
+
apiUrl: DEFAULT_API_URL
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
const env = process.env;
|
|
2577
|
+
const projectId = env.NEXT_PUBLIC_NEXUS_ID ?? env.NEXUS_PROJECT_ID ?? env.NEXUS_PROJECT_ID;
|
|
2578
|
+
const apiKey = env.NEXT_PUBLIC_NEXUS_KEY ?? env.NEXUS_API_KEY ?? env.NEXUS_API_KEY;
|
|
2579
|
+
const apiUrl = env.NEXT_PUBLIC_NEXUS_API_URL ?? env.NEXUS_API_URL ?? DEFAULT_API_URL;
|
|
2580
|
+
return {
|
|
2581
|
+
projectId,
|
|
2582
|
+
apiKey,
|
|
2583
|
+
apiUrl
|
|
2584
|
+
};
|
|
2585
|
+
};
|
|
2586
|
+
var mergeConfigs = (base, override) => {
|
|
2587
|
+
return {
|
|
2588
|
+
...base,
|
|
2589
|
+
...override,
|
|
2590
|
+
apiUrl: override.apiUrl || base.apiUrl || DEFAULT_API_URL,
|
|
2591
|
+
projectId: override.projectId || base.projectId
|
|
2592
|
+
};
|
|
2593
|
+
};
|
|
2594
|
+
var getFullConfig = (partialConfig) => {
|
|
2595
|
+
const envConfig = getEnvConfig();
|
|
2596
|
+
const merged = mergeConfigs(envConfig, partialConfig || {});
|
|
2597
|
+
if (!merged.apiUrl) {
|
|
2598
|
+
merged.apiUrl = DEFAULT_API_URL;
|
|
2599
|
+
}
|
|
2600
|
+
return merged;
|
|
2601
|
+
};
|
|
2602
|
+
var validateConfig = (config) => {
|
|
2603
|
+
const errors = [];
|
|
2604
|
+
if (!config.projectId) {
|
|
2605
|
+
errors.push("Missing projectId");
|
|
2606
|
+
}
|
|
2607
|
+
if (!config.apiUrl) {
|
|
2608
|
+
errors.push("Missing apiUrl");
|
|
2609
|
+
}
|
|
2610
|
+
if (config.apiUrl && !config.apiUrl.startsWith("http")) {
|
|
2611
|
+
errors.push("apiUrl must be a valid URL starting with http:// or https://");
|
|
2612
|
+
}
|
|
2613
|
+
return errors;
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2616
|
+
// src/content/cache.ts
|
|
2617
|
+
var CacheTags = {
|
|
2618
|
+
project: (projectId) => `nexus_project_${projectId}`,
|
|
2619
|
+
content: (slug) => `content_${slug}`,
|
|
2620
|
+
collection: (collectionId) => `collection_${collectionId}`,
|
|
2621
|
+
global: "nexus_global_config",
|
|
2622
|
+
user: (userId) => `user_${userId}`,
|
|
2623
|
+
media: (mediaId) => `media_${mediaId}`
|
|
2624
|
+
};
|
|
2625
|
+
var MemoryCache = class {
|
|
2626
|
+
constructor(options = {}) {
|
|
2627
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
2628
|
+
this.tagIndex = /* @__PURE__ */ new Map();
|
|
2629
|
+
this.stats = {
|
|
2630
|
+
size: 0,
|
|
2631
|
+
hits: 0,
|
|
2632
|
+
misses: 0,
|
|
2633
|
+
hitRate: 0,
|
|
2634
|
+
evictions: 0
|
|
2635
|
+
};
|
|
2636
|
+
this.maxSize = options.maxSize || 1e3;
|
|
2637
|
+
this.defaultTTL = options.ttl || 5 * 60 * 1e3;
|
|
2638
|
+
}
|
|
2639
|
+
set(key, data, options = {}) {
|
|
2640
|
+
if (this.cache.size >= this.maxSize) {
|
|
2641
|
+
this.evictLRU();
|
|
2642
|
+
}
|
|
2643
|
+
const metadata = {
|
|
2644
|
+
timestamp: Date.now(),
|
|
2645
|
+
expiresAt: Date.now() + (options.ttl || this.defaultTTL),
|
|
2646
|
+
tags: options.tags || [],
|
|
2647
|
+
size: this.calculateSize(data)
|
|
2648
|
+
};
|
|
2649
|
+
this.cache.set(key, { data, metadata });
|
|
2650
|
+
this.stats.size = this.cache.size;
|
|
2651
|
+
metadata.tags.forEach((tag) => {
|
|
2652
|
+
if (!this.tagIndex.has(tag)) {
|
|
2653
|
+
this.tagIndex.set(tag, /* @__PURE__ */ new Set());
|
|
2654
|
+
}
|
|
2655
|
+
this.tagIndex.get(tag).add(key);
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
get(key) {
|
|
2659
|
+
const entry = this.cache.get(key);
|
|
2660
|
+
if (!entry) {
|
|
2661
|
+
this.stats.misses++;
|
|
2662
|
+
this.updateHitRate();
|
|
2663
|
+
return null;
|
|
2664
|
+
}
|
|
2665
|
+
if (Date.now() > entry.metadata.expiresAt) {
|
|
2666
|
+
this.delete(key);
|
|
2667
|
+
this.stats.misses++;
|
|
2668
|
+
this.updateHitRate();
|
|
2669
|
+
return null;
|
|
2670
|
+
}
|
|
2671
|
+
entry.metadata.timestamp = Date.now();
|
|
2672
|
+
this.stats.hits++;
|
|
2673
|
+
this.updateHitRate();
|
|
2674
|
+
return entry;
|
|
2675
|
+
}
|
|
2676
|
+
delete(key) {
|
|
2677
|
+
const entry = this.cache.get(key);
|
|
2678
|
+
if (!entry) return false;
|
|
2679
|
+
entry.metadata.tags.forEach((tag) => {
|
|
2680
|
+
const keys = this.tagIndex.get(tag);
|
|
2681
|
+
if (keys) {
|
|
2682
|
+
keys.delete(key);
|
|
2683
|
+
if (keys.size === 0) {
|
|
2684
|
+
this.tagIndex.delete(tag);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
});
|
|
2688
|
+
this.cache.delete(key);
|
|
2689
|
+
this.stats.size = this.cache.size;
|
|
2690
|
+
return true;
|
|
2691
|
+
}
|
|
2692
|
+
invalidateByTags(tags) {
|
|
2693
|
+
const keysToDelete = /* @__PURE__ */ new Set();
|
|
2694
|
+
tags.forEach((tag) => {
|
|
2695
|
+
const keys = this.tagIndex.get(tag);
|
|
2696
|
+
if (keys) {
|
|
2697
|
+
keys.forEach((key) => keysToDelete.add(key));
|
|
2698
|
+
this.tagIndex.delete(tag);
|
|
2699
|
+
}
|
|
2700
|
+
});
|
|
2701
|
+
keysToDelete.forEach((key) => this.delete(key));
|
|
2702
|
+
if (process.env.NODE_ENV === "development") {
|
|
2703
|
+
console.log(`[MemoryCache] Invalidated ${keysToDelete.size} entries by tags: ${tags.join(", ")}`);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
clear() {
|
|
2707
|
+
this.cache.clear();
|
|
2708
|
+
this.tagIndex.clear();
|
|
2709
|
+
this.stats = {
|
|
2710
|
+
size: 0,
|
|
2711
|
+
hits: 0,
|
|
2712
|
+
misses: 0,
|
|
2713
|
+
hitRate: 0,
|
|
2714
|
+
evictions: 0
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
getStats() {
|
|
2718
|
+
return { ...this.stats };
|
|
2719
|
+
}
|
|
2720
|
+
evictLRU() {
|
|
2721
|
+
let oldestKey = null;
|
|
2722
|
+
let oldestTime = Infinity;
|
|
2723
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
2724
|
+
if (entry.metadata.timestamp < oldestTime) {
|
|
2725
|
+
oldestTime = entry.metadata.timestamp;
|
|
2726
|
+
oldestKey = key;
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
if (oldestKey) {
|
|
2730
|
+
this.delete(oldestKey);
|
|
2731
|
+
this.stats.evictions++;
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
calculateSize(data) {
|
|
2735
|
+
try {
|
|
2736
|
+
const jsonString = JSON.stringify(data);
|
|
2737
|
+
return new Blob([jsonString]).size;
|
|
2738
|
+
} catch {
|
|
2739
|
+
return 0;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
updateHitRate() {
|
|
2743
|
+
const total = this.stats.hits + this.stats.misses;
|
|
2744
|
+
this.stats.hitRate = total > 0 ? this.stats.hits / total : 0;
|
|
2745
|
+
}
|
|
2746
|
+
};
|
|
2747
|
+
var LocalCache = class {
|
|
2748
|
+
constructor(customPath) {
|
|
2749
|
+
this.data = null;
|
|
2750
|
+
this.hasLoaded = false;
|
|
2751
|
+
this.cachePath = customPath || ".nexus/cache.json";
|
|
2752
|
+
}
|
|
2753
|
+
isLoaded() {
|
|
2754
|
+
return this.hasLoaded;
|
|
2755
|
+
}
|
|
2756
|
+
load() {
|
|
2757
|
+
if (typeof window !== "undefined") return;
|
|
2758
|
+
if (process.env.NODE_ENV !== "development") return;
|
|
2759
|
+
if (this.hasLoaded) return;
|
|
2760
|
+
try {
|
|
2761
|
+
const fs = __require("fs");
|
|
2762
|
+
const path = __require("path");
|
|
2763
|
+
const fullPath = path.resolve(process.cwd(), this.cachePath);
|
|
2764
|
+
if (fs.existsSync(fullPath)) {
|
|
2765
|
+
const fileContent = fs.readFileSync(fullPath, "utf-8");
|
|
2766
|
+
this.data = JSON.parse(fileContent);
|
|
2767
|
+
this.hasLoaded = true;
|
|
2768
|
+
console.log(`\u26A1 NexusHub: Serving content from local cache (${this.cachePath})`);
|
|
2769
|
+
console.log(` - Pages: ${this.data.pages?.length || 0}`);
|
|
2770
|
+
console.log(` - Collections: ${Object.keys(this.data.collections || {}).length}`);
|
|
2771
|
+
console.log(` - Globals: ${this.data.globals ? "Loaded" : "Not found"}`);
|
|
2772
|
+
}
|
|
2773
|
+
} catch (error) {
|
|
2774
|
+
if (this.shouldWarnAboutMissingCache(error)) {
|
|
2775
|
+
console.warn(
|
|
2776
|
+
`\u26A0\uFE0F NexusHub: Local cache not found at ${this.cachePath}
|
|
2777
|
+
Run \`npx nexus pull\` to generate seed data or
|
|
2778
|
+
Use the Dashboard to create content first.`
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
getPage(slug) {
|
|
2784
|
+
this.load();
|
|
2785
|
+
if (!this.data?.pages) return null;
|
|
2786
|
+
const page = this.data.pages.find((p) => p.slug === slug);
|
|
2787
|
+
if (!page) {
|
|
2788
|
+
console.warn(`\u26A0\uFE0F NexusHub: Page '${slug}' not found in local cache`);
|
|
2789
|
+
return null;
|
|
2790
|
+
}
|
|
2791
|
+
return page.data;
|
|
2792
|
+
}
|
|
2793
|
+
getCollection(collectionId) {
|
|
2794
|
+
this.load();
|
|
2795
|
+
if (!this.data?.collections) return null;
|
|
2796
|
+
const collection = this.data.collections[collectionId];
|
|
2797
|
+
if (!collection) {
|
|
2798
|
+
console.warn(`\u26A0\uFE0F NexusHub: Collection '${collectionId}' not found in local cache`);
|
|
2799
|
+
return null;
|
|
2800
|
+
}
|
|
2801
|
+
return collection;
|
|
2802
|
+
}
|
|
2803
|
+
getGlobals() {
|
|
2804
|
+
this.load();
|
|
2805
|
+
return this.data?.globals || null;
|
|
2806
|
+
}
|
|
2807
|
+
getAllData() {
|
|
2808
|
+
this.load();
|
|
2809
|
+
return this.data;
|
|
2810
|
+
}
|
|
2811
|
+
shouldWarnAboutMissingCache(error) {
|
|
2812
|
+
return error.code === "ENOENT" || error.message && error.message.includes("ENOENT");
|
|
2813
|
+
}
|
|
2814
|
+
};
|
|
2815
|
+
var BrowserCache = class {
|
|
2816
|
+
constructor(projectId) {
|
|
2817
|
+
this.projectId = projectId;
|
|
2818
|
+
this.prefix = "nexushub_";
|
|
2819
|
+
this.maxSize = 5 * 1024 * 1024;
|
|
2820
|
+
// 5MB
|
|
2821
|
+
this.currentSize = 0;
|
|
2822
|
+
this.calculateCurrentSize();
|
|
2823
|
+
}
|
|
2824
|
+
set(key, data, ttl = 5 * 60 * 1e3) {
|
|
2825
|
+
const storageKey = this.getStorageKey(key);
|
|
2826
|
+
const entry = {
|
|
2827
|
+
data,
|
|
2828
|
+
metadata: {
|
|
2829
|
+
timestamp: Date.now(),
|
|
2830
|
+
expiresAt: Date.now() + ttl,
|
|
2831
|
+
size: this.calculateStorageSize(data)
|
|
2832
|
+
}
|
|
2833
|
+
};
|
|
2834
|
+
const serialized = JSON.stringify(entry);
|
|
2835
|
+
const newSize = new Blob([serialized]).size;
|
|
2836
|
+
if (this.currentSize + newSize > this.maxSize) {
|
|
2837
|
+
this.evictOldest();
|
|
2838
|
+
}
|
|
2839
|
+
try {
|
|
2840
|
+
localStorage.setItem(storageKey, serialized);
|
|
2841
|
+
this.currentSize += newSize;
|
|
2842
|
+
} catch (error) {
|
|
2843
|
+
console.warn("[BrowserCache] Failed to save to localStorage:", error);
|
|
2844
|
+
this.evictOldest();
|
|
2845
|
+
this.set(key, data, ttl);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
get(key) {
|
|
2849
|
+
const storageKey = this.getStorageKey(key);
|
|
2850
|
+
const item = localStorage.getItem(storageKey);
|
|
2851
|
+
if (!item) return null;
|
|
2852
|
+
try {
|
|
2853
|
+
const entry = JSON.parse(item);
|
|
2854
|
+
if (Date.now() > entry.metadata.expiresAt) {
|
|
2855
|
+
this.delete(key);
|
|
2856
|
+
return null;
|
|
2857
|
+
}
|
|
2858
|
+
return entry.data;
|
|
2859
|
+
} catch {
|
|
2860
|
+
this.delete(key);
|
|
2861
|
+
return null;
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
delete(key) {
|
|
2865
|
+
const storageKey = this.getStorageKey(key);
|
|
2866
|
+
const item = localStorage.getItem(storageKey);
|
|
2867
|
+
if (item) {
|
|
2868
|
+
this.currentSize -= new Blob([item]).size;
|
|
2869
|
+
}
|
|
2870
|
+
localStorage.removeItem(storageKey);
|
|
2871
|
+
}
|
|
2872
|
+
clear() {
|
|
2873
|
+
const keysToRemove = [];
|
|
2874
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
2875
|
+
const key = localStorage.key(i);
|
|
2876
|
+
if (key?.startsWith(this.prefix)) {
|
|
2877
|
+
keysToRemove.push(key);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
keysToRemove.forEach((key) => localStorage.removeItem(key));
|
|
2881
|
+
this.currentSize = 0;
|
|
2882
|
+
}
|
|
2883
|
+
getStorageKey(key) {
|
|
2884
|
+
return `${this.prefix}${this.projectId}_${key}`;
|
|
2885
|
+
}
|
|
2886
|
+
calculateCurrentSize() {
|
|
2887
|
+
this.currentSize = 0;
|
|
2888
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
2889
|
+
const key = localStorage.key(i);
|
|
2890
|
+
if (key?.startsWith(this.prefix)) {
|
|
2891
|
+
const item = localStorage.getItem(key);
|
|
2892
|
+
if (item) {
|
|
2893
|
+
this.currentSize += new Blob([item]).size;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
calculateStorageSize(data) {
|
|
2899
|
+
return new Blob([JSON.stringify(data)]).size;
|
|
2900
|
+
}
|
|
2901
|
+
evictOldest() {
|
|
2902
|
+
let oldestKey = null;
|
|
2903
|
+
let oldestTime = Infinity;
|
|
2904
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
2905
|
+
const key = localStorage.key(i);
|
|
2906
|
+
if (key?.startsWith(this.prefix)) {
|
|
2907
|
+
const item = localStorage.getItem(key);
|
|
2908
|
+
if (item) {
|
|
2909
|
+
try {
|
|
2910
|
+
const entry = JSON.parse(item);
|
|
2911
|
+
if (entry.metadata.timestamp < oldestTime) {
|
|
2912
|
+
oldestTime = entry.metadata.timestamp;
|
|
2913
|
+
oldestKey = key;
|
|
2914
|
+
}
|
|
2915
|
+
} catch {
|
|
2916
|
+
localStorage.removeItem(key);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
if (oldestKey) {
|
|
2922
|
+
const item = localStorage.getItem(oldestKey);
|
|
2923
|
+
if (item) {
|
|
2924
|
+
this.currentSize -= new Blob([item]).size;
|
|
2925
|
+
}
|
|
2926
|
+
localStorage.removeItem(oldestKey);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
};
|
|
2930
|
+
|
|
2931
|
+
// src/content/strategies.ts
|
|
2932
|
+
var RateLimiter = class {
|
|
2933
|
+
constructor(config) {
|
|
2934
|
+
this.requests = [];
|
|
2935
|
+
this.config = config;
|
|
2936
|
+
}
|
|
2937
|
+
async checkLimit() {
|
|
2938
|
+
const now = Date.now();
|
|
2939
|
+
const windowStart = now - this.config.timeWindow;
|
|
2940
|
+
this.requests = this.requests.filter((time) => time > windowStart);
|
|
2941
|
+
if (this.requests.length >= this.config.maxRequests) {
|
|
2942
|
+
const oldestRequest = this.requests[0];
|
|
2943
|
+
const waitTime = windowStart + this.config.timeWindow - now;
|
|
2944
|
+
if (waitTime > 0) {
|
|
2945
|
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
2946
|
+
return this.checkLimit();
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
this.requests.push(now);
|
|
2950
|
+
}
|
|
2951
|
+
getStats() {
|
|
2952
|
+
const now = Date.now();
|
|
2953
|
+
const windowStart = now - this.config.timeWindow;
|
|
2954
|
+
const currentRequests = this.requests.filter((time) => time > windowStart).length;
|
|
2955
|
+
return {
|
|
2956
|
+
currentRequests,
|
|
2957
|
+
limit: this.config.maxRequests
|
|
2958
|
+
};
|
|
2959
|
+
}
|
|
2960
|
+
};
|
|
2961
|
+
var ExponentialBackoff = class {
|
|
2962
|
+
constructor(config) {
|
|
2963
|
+
this.config = {
|
|
2964
|
+
jitter: true,
|
|
2965
|
+
...config
|
|
2966
|
+
};
|
|
2967
|
+
}
|
|
2968
|
+
async execute(fn, onRetry) {
|
|
2969
|
+
let lastError;
|
|
2970
|
+
for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
|
|
2971
|
+
try {
|
|
2972
|
+
return await fn();
|
|
2973
|
+
} catch (error) {
|
|
2974
|
+
lastError = error;
|
|
2975
|
+
if (this.isClientError(error) && !this.isRateLimitError(error)) {
|
|
2976
|
+
throw error;
|
|
2977
|
+
}
|
|
2978
|
+
if (attempt === this.config.maxRetries) {
|
|
2979
|
+
break;
|
|
2980
|
+
}
|
|
2981
|
+
const delay = this.calculateDelay(attempt);
|
|
2982
|
+
if (onRetry) {
|
|
2983
|
+
onRetry(attempt + 1, delay, error);
|
|
2984
|
+
}
|
|
2985
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
throw lastError;
|
|
2989
|
+
}
|
|
2990
|
+
calculateDelay(attempt) {
|
|
2991
|
+
let delay = this.config.baseDelay * Math.pow(2, attempt);
|
|
2992
|
+
delay = Math.min(delay, this.config.maxDelay);
|
|
2993
|
+
if (this.config.jitter) {
|
|
2994
|
+
delay = delay * (0.5 + Math.random());
|
|
2995
|
+
}
|
|
2996
|
+
return delay;
|
|
2997
|
+
}
|
|
2998
|
+
isClientError(error) {
|
|
2999
|
+
return error?.status >= 400 && error?.status < 500;
|
|
3000
|
+
}
|
|
3001
|
+
isRateLimitError(error) {
|
|
3002
|
+
return error?.status === 429;
|
|
3003
|
+
}
|
|
3004
|
+
};
|
|
3005
|
+
var RequestBatcher = class {
|
|
3006
|
+
constructor(batchWindow = 10, maxBatchSize = 20) {
|
|
3007
|
+
this.batchWindow = batchWindow;
|
|
3008
|
+
this.maxBatchSize = maxBatchSize;
|
|
3009
|
+
this.batch = [];
|
|
3010
|
+
this.processing = false;
|
|
3011
|
+
}
|
|
3012
|
+
async schedule(key, request) {
|
|
3013
|
+
return new Promise((resolve, reject) => {
|
|
3014
|
+
this.batch.push({ key, resolve, reject });
|
|
3015
|
+
if (this.batch.length >= this.maxBatchSize) {
|
|
3016
|
+
this.processBatch(request);
|
|
3017
|
+
} else if (!this.batchTimeout) {
|
|
3018
|
+
this.batchTimeout = setTimeout(
|
|
3019
|
+
() => this.processBatch(request),
|
|
3020
|
+
this.batchWindow
|
|
3021
|
+
);
|
|
3022
|
+
}
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
async processBatch(request) {
|
|
3026
|
+
if (this.processing || this.batch.length === 0) return;
|
|
3027
|
+
this.processing = true;
|
|
3028
|
+
if (this.batchTimeout) {
|
|
3029
|
+
clearTimeout(this.batchTimeout);
|
|
3030
|
+
this.batchTimeout = void 0;
|
|
3031
|
+
}
|
|
3032
|
+
const currentBatch = [...this.batch];
|
|
3033
|
+
this.batch = [];
|
|
3034
|
+
try {
|
|
3035
|
+
const result = await request();
|
|
3036
|
+
currentBatch.forEach((item) => {
|
|
3037
|
+
item.resolve(result);
|
|
3038
|
+
});
|
|
3039
|
+
} catch (error) {
|
|
3040
|
+
currentBatch.forEach((item) => {
|
|
3041
|
+
item.reject(error);
|
|
3042
|
+
});
|
|
3043
|
+
} finally {
|
|
3044
|
+
this.processing = false;
|
|
3045
|
+
if (this.batch.length > 0) {
|
|
3046
|
+
setTimeout(() => this.processBatch(request), 0);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
};
|
|
3051
|
+
|
|
3052
|
+
// src/content/utils.ts
|
|
3053
|
+
function validateSlug(slug) {
|
|
3054
|
+
if (!slug || typeof slug !== "string") {
|
|
3055
|
+
throw new Error("Slug must be a non-empty string");
|
|
3056
|
+
}
|
|
3057
|
+
if (!/^[a-z0-9-_]+$/.test(slug)) {
|
|
3058
|
+
throw new Error("Slug can only contain lowercase letters, numbers, hyphens, and underscores");
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
function normalizeQuery(query) {
|
|
3062
|
+
const normalized = { ...query };
|
|
3063
|
+
normalized.page = Math.max(1, normalized.page || 1);
|
|
3064
|
+
normalized.limit = Math.min(100, Math.max(1, normalized.limit || 10));
|
|
3065
|
+
normalized.order = normalized.order || "desc";
|
|
3066
|
+
if (normalized.page < 1) {
|
|
3067
|
+
throw new Error("Page must be greater than 0");
|
|
3068
|
+
}
|
|
3069
|
+
if (normalized.limit < 1 || normalized.limit > 100) {
|
|
3070
|
+
throw new Error("Limit must be between 1 and 100");
|
|
3071
|
+
}
|
|
3072
|
+
return normalized;
|
|
3073
|
+
}
|
|
3074
|
+
function buildQueryString(query) {
|
|
3075
|
+
const params = new URLSearchParams();
|
|
3076
|
+
if (query.page) params.append("page", query.page.toString());
|
|
3077
|
+
if (query.limit) params.append("limit", query.limit.toString());
|
|
3078
|
+
if (query.sort) params.append("sort", query.sort);
|
|
3079
|
+
if (query.order) params.append("order", query.order);
|
|
3080
|
+
if (query.search) params.append("search", query.search);
|
|
3081
|
+
if (query.include?.length) {
|
|
3082
|
+
params.append("include", query.include.join(","));
|
|
3083
|
+
}
|
|
3084
|
+
if (query.fields?.length) {
|
|
3085
|
+
params.append("fields", query.fields.join(","));
|
|
3086
|
+
}
|
|
3087
|
+
if (query.filter) {
|
|
3088
|
+
params.append("filter", JSON.stringify(query.filter));
|
|
3089
|
+
}
|
|
3090
|
+
return params.toString();
|
|
3091
|
+
}
|
|
3092
|
+
function measurePerformance(name, fn) {
|
|
3093
|
+
const start = performance.now();
|
|
3094
|
+
const result = fn();
|
|
3095
|
+
const end = performance.now();
|
|
3096
|
+
if (process.env.NODE_ENV === "development") {
|
|
3097
|
+
console.log(`\u23F1\uFE0F ${name}: ${(end - start).toFixed(2)}ms`);
|
|
3098
|
+
}
|
|
3099
|
+
return { result, duration: end - start };
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
// src/content/index.ts
|
|
3103
|
+
var ContentEngine = class {
|
|
3104
|
+
constructor(config) {
|
|
3105
|
+
this.config = config;
|
|
3106
|
+
this.localCache = new LocalCache();
|
|
3107
|
+
this.memoryCache = new MemoryCache({
|
|
3108
|
+
maxSize: 500,
|
|
3109
|
+
ttl: 5 * 60 * 1e3
|
|
3110
|
+
// 5 minutes
|
|
3111
|
+
});
|
|
3112
|
+
if (typeof window !== "undefined") {
|
|
3113
|
+
this.browserCache = new BrowserCache(config.projectId);
|
|
3114
|
+
}
|
|
3115
|
+
this.rateLimiter = new RateLimiter({
|
|
3116
|
+
maxRequests: config.debug ? 100 : 30,
|
|
3117
|
+
timeWindow: 6e4
|
|
3118
|
+
// 1 minute
|
|
3119
|
+
});
|
|
3120
|
+
this.backoff = new ExponentialBackoff({
|
|
3121
|
+
maxRetries: config.retries || 3,
|
|
3122
|
+
baseDelay: 100,
|
|
3123
|
+
maxDelay: 5e3,
|
|
3124
|
+
jitter: true
|
|
3125
|
+
});
|
|
3126
|
+
this.requestBatcher = new RequestBatcher(10, 20);
|
|
3127
|
+
this.defaultRevalidate = config.revalidateTime || 60;
|
|
3128
|
+
this.cacheStrategy = config.cacheStrategy || "memory";
|
|
3129
|
+
this.isServer = typeof window === "undefined";
|
|
3130
|
+
if (typeof window !== "undefined") {
|
|
3131
|
+
window.addEventListener("beforeunload", this.cleanup.bind(this));
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
/**
|
|
3135
|
+
* Fetch a Singleton Page with enhanced caching
|
|
3136
|
+
*/
|
|
3137
|
+
async getPage(slug, options = {}) {
|
|
3138
|
+
const { result, duration } = measurePerformance(
|
|
3139
|
+
`getPage("${slug}")`,
|
|
3140
|
+
() => this._getPage(slug, options)
|
|
3141
|
+
);
|
|
3142
|
+
if (this.config.debug && duration > 100) {
|
|
3143
|
+
console.warn(`[NexusHub] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`);
|
|
3144
|
+
}
|
|
3145
|
+
return result;
|
|
3146
|
+
}
|
|
3147
|
+
async _getPage(slug, options = {}) {
|
|
3148
|
+
validateSlug(slug);
|
|
3149
|
+
const {
|
|
3150
|
+
revalidate = this.defaultRevalidate,
|
|
3151
|
+
tags = [],
|
|
3152
|
+
forceRefresh = false,
|
|
3153
|
+
includeMetadata = false
|
|
3154
|
+
} = options;
|
|
3155
|
+
const cacheKey = `page:${slug}`;
|
|
3156
|
+
if (!forceRefresh && this.cacheStrategy === "memory") {
|
|
3157
|
+
const cached = this.memoryCache.get(cacheKey);
|
|
3158
|
+
if (cached && this.isCacheValid(cached.metadata)) {
|
|
3159
|
+
if (this.config.debug) {
|
|
3160
|
+
console.log(`[NexusHub] \u26A1 Served '${slug}' from memory cache.`);
|
|
3161
|
+
}
|
|
3162
|
+
return includeMetadata ? cached : cached.data;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
if (!forceRefresh && !this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
|
|
3166
|
+
const cached = this.browserCache.get(cacheKey);
|
|
3167
|
+
if (cached) {
|
|
3168
|
+
if (this.config.debug) {
|
|
3169
|
+
console.log(`[NexusHub] \u{1FAA3} Served '${slug}' from browser cache.`);
|
|
3170
|
+
}
|
|
3171
|
+
return cached;
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
if (!forceRefresh && process.env.NODE_ENV === "development") {
|
|
3175
|
+
const localData = this.localCache.getPage(slug);
|
|
3176
|
+
if (localData) {
|
|
3177
|
+
if (this.config.debug) {
|
|
3178
|
+
console.log(`[NexusHub] \u{1F4C1} Served '${slug}' from local cache.`);
|
|
3179
|
+
}
|
|
3180
|
+
this.memoryCache.set(cacheKey, localData, {
|
|
3181
|
+
tags: [...tags, CacheTags.content(slug)],
|
|
3182
|
+
revalidate
|
|
3183
|
+
});
|
|
3184
|
+
return localData;
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
try {
|
|
3188
|
+
await this.rateLimiter.checkLimit();
|
|
3189
|
+
const data = await this.backoff.execute(
|
|
3190
|
+
async () => {
|
|
3191
|
+
return this.fetchPage(slug, cacheKey, tags, revalidate, forceRefresh);
|
|
3192
|
+
},
|
|
3193
|
+
(attempt, delay, error) => {
|
|
3194
|
+
if (this.config.debug) {
|
|
3195
|
+
console.log(`[NexusHub] \u{1F504} Retry ${attempt} for '${slug}' after ${delay}ms: ${error.message}`);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
);
|
|
3199
|
+
return includeMetadata ? data : data.data;
|
|
3200
|
+
} catch (error) {
|
|
3201
|
+
const staleCache = this.memoryCache.get(cacheKey);
|
|
3202
|
+
if (staleCache && !forceRefresh) {
|
|
3203
|
+
console.warn(`[NexusHub] \u26A0\uFE0F Using stale cache for '${slug}' due to fetch error:`, error);
|
|
3204
|
+
return includeMetadata ? staleCache : staleCache.data;
|
|
3205
|
+
}
|
|
3206
|
+
throw this.normalizeError(error, `Failed to fetch page '${slug}'`);
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* Fetch a Collection with advanced query capabilities
|
|
3211
|
+
*/
|
|
3212
|
+
async getCollection(collectionId, query = {}, options = {}) {
|
|
3213
|
+
const { result, duration } = measurePerformance(
|
|
3214
|
+
`getCollection("${collectionId}")`,
|
|
3215
|
+
() => this._getCollection(collectionId, query, options)
|
|
3216
|
+
);
|
|
3217
|
+
if (this.config.debug && duration > 100) {
|
|
3218
|
+
console.warn(`[NexusHub] \u26A0\uFE0F getCollection("${collectionId}") took ${duration.toFixed(2)}ms`);
|
|
3219
|
+
}
|
|
3220
|
+
return result;
|
|
3221
|
+
}
|
|
3222
|
+
async _getCollection(collectionId, query = {}, options = {}) {
|
|
3223
|
+
const normalizedQuery = normalizeQuery(query);
|
|
3224
|
+
const {
|
|
3225
|
+
revalidate = this.defaultRevalidate,
|
|
3226
|
+
tags = [],
|
|
3227
|
+
forceRefresh = false,
|
|
3228
|
+
includeMetadata = false
|
|
3229
|
+
} = options;
|
|
3230
|
+
const queryString = buildQueryString(normalizedQuery);
|
|
3231
|
+
const cacheKey = `collection:${collectionId}:${queryString}`;
|
|
3232
|
+
if (!forceRefresh && this.cacheStrategy === "memory") {
|
|
3233
|
+
const cached = this.memoryCache.get(cacheKey);
|
|
3234
|
+
if (cached && this.isCacheValid(cached.metadata)) {
|
|
3235
|
+
if (this.config.debug) {
|
|
3236
|
+
console.log(`[NexusHub] \u26A1 Served collection '${collectionId}' from memory cache.`);
|
|
3237
|
+
}
|
|
3238
|
+
return includeMetadata ? cached : cached.data;
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
if (!forceRefresh && !this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
|
|
3242
|
+
const cached = this.browserCache.get(cacheKey);
|
|
3243
|
+
if (cached) {
|
|
3244
|
+
return cached;
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
if (!forceRefresh && process.env.NODE_ENV === "development") {
|
|
3248
|
+
const localCollection = this.localCache.getCollection(collectionId);
|
|
3249
|
+
if (localCollection) {
|
|
3250
|
+
const result = this.applyLocalQuery(localCollection, normalizedQuery);
|
|
3251
|
+
if (this.config.debug) {
|
|
3252
|
+
console.log(`[NexusHub] \u{1F4C1} Served collection '${collectionId}' from local cache.`);
|
|
3253
|
+
}
|
|
3254
|
+
this.memoryCache.set(cacheKey, result, {
|
|
3255
|
+
tags: [...tags, CacheTags.collection(collectionId)],
|
|
3256
|
+
revalidate
|
|
3257
|
+
});
|
|
3258
|
+
return result;
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
try {
|
|
3262
|
+
await this.rateLimiter.checkLimit();
|
|
3263
|
+
const result = await this.backoff.execute(async () => {
|
|
3264
|
+
return this.fetchCollection(collectionId, normalizedQuery, cacheKey, tags, revalidate);
|
|
3265
|
+
});
|
|
3266
|
+
return includeMetadata ? result : result.data;
|
|
3267
|
+
} catch (error) {
|
|
3268
|
+
const staleCache = this.memoryCache.get(cacheKey);
|
|
3269
|
+
if (staleCache && !forceRefresh) {
|
|
3270
|
+
console.warn(`[NexusHub] \u26A0\uFE0F Using stale cache for collection '${collectionId}'`);
|
|
3271
|
+
return includeMetadata ? staleCache : staleCache.data;
|
|
3272
|
+
}
|
|
3273
|
+
throw this.normalizeError(error, `Failed to fetch collection '${collectionId}'`);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
/**
|
|
3277
|
+
* Fetch Global Settings with nested includes support
|
|
3278
|
+
*/
|
|
3279
|
+
async getGlobals(options = {}) {
|
|
3280
|
+
const {
|
|
3281
|
+
include = [],
|
|
3282
|
+
revalidate = this.defaultRevalidate,
|
|
3283
|
+
forceRefresh = false
|
|
3284
|
+
} = options;
|
|
3285
|
+
const cacheKey = `globals:${include.join(",")}`;
|
|
3286
|
+
if (!forceRefresh && this.cacheStrategy === "memory") {
|
|
3287
|
+
const cached = this.memoryCache.get(cacheKey);
|
|
3288
|
+
if (cached && this.isCacheValid(cached.metadata)) {
|
|
3289
|
+
if (this.config.debug) console.log("[NexusHub] \u26A1 Served globals from memory cache.");
|
|
3290
|
+
return cached.data;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
if (!forceRefresh && !this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
|
|
3294
|
+
const cached = this.browserCache.get(cacheKey);
|
|
3295
|
+
if (cached) {
|
|
3296
|
+
return cached;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
if (!forceRefresh && process.env.NODE_ENV === "development") {
|
|
3300
|
+
const localGlobals = this.localCache.getGlobals();
|
|
3301
|
+
if (localGlobals) {
|
|
3302
|
+
this.memoryCache.set(cacheKey, localGlobals, {
|
|
3303
|
+
tags: [CacheTags.global],
|
|
3304
|
+
revalidate
|
|
3305
|
+
});
|
|
3306
|
+
return localGlobals;
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3309
|
+
try {
|
|
3310
|
+
await this.rateLimiter.checkLimit();
|
|
3311
|
+
const url = `${this.config.apiUrl}/content/${this.config.projectId}/globals`;
|
|
3312
|
+
const params = include.length > 0 ? `?include=${include.join(",")}` : "";
|
|
3313
|
+
const res = await this.fetchWithTimeout(
|
|
3314
|
+
`${url}${params}`,
|
|
3315
|
+
{
|
|
3316
|
+
method: "GET",
|
|
3317
|
+
headers: this.getHeaders(),
|
|
3318
|
+
next: {
|
|
3319
|
+
tags: [CacheTags.project(this.config.projectId), CacheTags.global],
|
|
3320
|
+
revalidate
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
);
|
|
3324
|
+
if (!res.ok) {
|
|
3325
|
+
throw new Error(`API Error ${res.status}: ${res.statusText}`);
|
|
3326
|
+
}
|
|
3327
|
+
const json = await res.json();
|
|
3328
|
+
const data = json.data || json;
|
|
3329
|
+
this.memoryCache.set(cacheKey, data, {
|
|
3330
|
+
tags: [CacheTags.project(this.config.projectId), CacheTags.global],
|
|
3331
|
+
revalidate
|
|
3332
|
+
});
|
|
3333
|
+
if (!this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
|
|
3334
|
+
this.browserCache.set(cacheKey, data, revalidate * 1e3);
|
|
3335
|
+
}
|
|
3336
|
+
return data;
|
|
3337
|
+
} catch (error) {
|
|
3338
|
+
const staleCache = this.memoryCache.get(cacheKey);
|
|
3339
|
+
if (staleCache && !forceRefresh) {
|
|
3340
|
+
console.warn("[NexusHub] \u26A0\uFE0F Using stale cache for globals");
|
|
3341
|
+
return staleCache.data;
|
|
3342
|
+
}
|
|
3343
|
+
throw this.normalizeError(error, "Failed to fetch globals");
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* Fetch a single item from a collection
|
|
3348
|
+
*/
|
|
3349
|
+
async getItem(collectionId, itemId, options = {}) {
|
|
3350
|
+
const cacheKey = `item:${collectionId}:${itemId}`;
|
|
3351
|
+
if (this.cacheStrategy === "memory") {
|
|
3352
|
+
const cached = this.memoryCache.get(cacheKey);
|
|
3353
|
+
if (cached && this.isCacheValid(cached.metadata)) {
|
|
3354
|
+
if (this.config.debug) {
|
|
3355
|
+
console.log(`[NexusHub] \u26A1 Served item '${itemId}' from cache.`);
|
|
3356
|
+
}
|
|
3357
|
+
return cached.data;
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
const params = new URLSearchParams();
|
|
3361
|
+
if (options.include?.length) {
|
|
3362
|
+
params.append("include", options.include.join(","));
|
|
3363
|
+
}
|
|
3364
|
+
const url = `${this.config.apiUrl}/content/${this.config.projectId}/collection/${collectionId}/${itemId}?${params}`;
|
|
3365
|
+
const res = await this.fetchWithTimeout(url, {
|
|
3366
|
+
method: "GET",
|
|
3367
|
+
headers: this.getHeaders(),
|
|
3368
|
+
next: {
|
|
3369
|
+
tags: [
|
|
3370
|
+
CacheTags.project(this.config.projectId),
|
|
3371
|
+
CacheTags.collection(collectionId),
|
|
3372
|
+
`item_${itemId}`,
|
|
3373
|
+
...options.tags || []
|
|
3374
|
+
],
|
|
3375
|
+
revalidate: options.revalidate || this.defaultRevalidate
|
|
3376
|
+
}
|
|
3377
|
+
});
|
|
3378
|
+
if (!res.ok) {
|
|
3379
|
+
throw new Error(`API Error ${res.status}: ${res.statusText}`);
|
|
3380
|
+
}
|
|
3381
|
+
const json = await res.json();
|
|
3382
|
+
const data = json.data || json;
|
|
3383
|
+
if (this.cacheStrategy === "memory") {
|
|
3384
|
+
this.memoryCache.set(cacheKey, data, {
|
|
3385
|
+
tags: [
|
|
3386
|
+
CacheTags.project(this.config.projectId),
|
|
3387
|
+
CacheTags.collection(collectionId),
|
|
3388
|
+
`item_${itemId}`
|
|
3389
|
+
],
|
|
3390
|
+
revalidate: options.revalidate || this.defaultRevalidate
|
|
3391
|
+
});
|
|
3392
|
+
}
|
|
3393
|
+
return data;
|
|
3394
|
+
}
|
|
3395
|
+
/**
|
|
3396
|
+
* Search across collections
|
|
3397
|
+
*/
|
|
3398
|
+
async search(query, options = {}) {
|
|
3399
|
+
const params = new URLSearchParams({
|
|
3400
|
+
q: query,
|
|
3401
|
+
limit: (options.limit || 20).toString()
|
|
3402
|
+
});
|
|
3403
|
+
if (options.collections?.length) {
|
|
3404
|
+
params.append("collections", options.collections.join(","));
|
|
3405
|
+
}
|
|
3406
|
+
if (options.fields?.length) {
|
|
3407
|
+
params.append("fields", options.fields.join(","));
|
|
3408
|
+
}
|
|
3409
|
+
const url = `${this.config.apiUrl}/content/${this.config.projectId}/search?${params}`;
|
|
3410
|
+
const res = await this.fetchWithTimeout(url, {
|
|
3411
|
+
method: "GET",
|
|
3412
|
+
headers: this.getHeaders(),
|
|
3413
|
+
next: {
|
|
3414
|
+
tags: [CacheTags.project(this.config.projectId), "search"],
|
|
3415
|
+
revalidate: options.revalidate || 60
|
|
3416
|
+
}
|
|
3417
|
+
});
|
|
3418
|
+
if (!res.ok) {
|
|
3419
|
+
throw new Error(`API Error ${res.status}: ${res.statusText}`);
|
|
3420
|
+
}
|
|
3421
|
+
return await res.json();
|
|
3422
|
+
}
|
|
3423
|
+
/**
|
|
3424
|
+
* Prefetch content for better performance
|
|
3425
|
+
*/
|
|
3426
|
+
async prefetch(urls) {
|
|
3427
|
+
if (typeof window !== "undefined" && "requestIdleCallback" in window) {
|
|
3428
|
+
requestIdleCallback(async () => {
|
|
3429
|
+
await Promise.allSettled(
|
|
3430
|
+
urls.map((url) => fetch(url, { priority: "low" }))
|
|
3431
|
+
);
|
|
3432
|
+
});
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
/**
|
|
3436
|
+
* Invalidate cache by tags
|
|
3437
|
+
*/
|
|
3438
|
+
invalidateCache(tags) {
|
|
3439
|
+
this.memoryCache.invalidateByTags(tags);
|
|
3440
|
+
if (this.config.debug) {
|
|
3441
|
+
console.log(`[NexusHub] \u267B\uFE0F Invalidated cache for tags: ${tags.join(", ")}`);
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
/**
|
|
3445
|
+
* Clear all caches
|
|
3446
|
+
*/
|
|
3447
|
+
clearCache() {
|
|
3448
|
+
this.memoryCache.clear();
|
|
3449
|
+
if (this.browserCache) {
|
|
3450
|
+
this.browserCache.clear();
|
|
3451
|
+
}
|
|
3452
|
+
if (this.config.debug) {
|
|
3453
|
+
console.log("[NexusHub] \u{1F9F9} Cleared all caches");
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
/**
|
|
3457
|
+
* Get cache statistics
|
|
3458
|
+
*/
|
|
3459
|
+
getCacheStats() {
|
|
3460
|
+
const stats = {
|
|
3461
|
+
memory: this.memoryCache.getStats(),
|
|
3462
|
+
local: { loaded: this.localCache.isLoaded() }
|
|
3463
|
+
};
|
|
3464
|
+
if (this.browserCache) {
|
|
3465
|
+
stats.browser = { size: 0 };
|
|
3466
|
+
}
|
|
3467
|
+
return stats;
|
|
3468
|
+
}
|
|
3469
|
+
/**
|
|
3470
|
+
* Cancel ongoing requests
|
|
3471
|
+
*/
|
|
3472
|
+
cancelRequests() {
|
|
3473
|
+
if (this.abortController) {
|
|
3474
|
+
this.abortController.abort();
|
|
3475
|
+
this.abortController = new AbortController();
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
/**
|
|
3479
|
+
* Subscribe to content updates (SSE)
|
|
3480
|
+
*/
|
|
3481
|
+
subscribeToUpdates(callback) {
|
|
3482
|
+
if (typeof EventSource === "undefined") {
|
|
3483
|
+
console.warn("[NexusHub] EventSource not supported in this environment");
|
|
3484
|
+
return () => {
|
|
3485
|
+
};
|
|
3486
|
+
}
|
|
3487
|
+
const eventSource = new EventSource(
|
|
3488
|
+
`${this.config.apiUrl}/content/${this.config.projectId}/updates`
|
|
3489
|
+
);
|
|
3490
|
+
eventSource.onmessage = (event) => {
|
|
3491
|
+
try {
|
|
3492
|
+
const data = JSON.parse(event.data);
|
|
3493
|
+
callback(data);
|
|
3494
|
+
if (data.type === "content.updated" && data.slug) {
|
|
3495
|
+
this.invalidateCache([CacheTags.content(data.slug)]);
|
|
3496
|
+
}
|
|
3497
|
+
} catch (error) {
|
|
3498
|
+
console.error("[NexusHub] Failed to parse update event:", error);
|
|
3499
|
+
}
|
|
3500
|
+
};
|
|
3501
|
+
eventSource.onerror = (error) => {
|
|
3502
|
+
console.error("[NexusHub] EventSource error:", error);
|
|
3503
|
+
eventSource.close();
|
|
3504
|
+
};
|
|
3505
|
+
return () => {
|
|
3506
|
+
eventSource.close();
|
|
3507
|
+
};
|
|
3508
|
+
}
|
|
3509
|
+
// Private helper methods
|
|
3510
|
+
async fetchPage(slug, cacheKey, tags, revalidate, forceRefresh) {
|
|
3511
|
+
const url = `${this.config.apiUrl}/content/${this.config.projectId}/page/${slug}`;
|
|
3512
|
+
if (this.config.debug) {
|
|
3513
|
+
console.log(`[NexusHub] \u{1F310} Fetching: ${url}`);
|
|
3514
|
+
}
|
|
3515
|
+
const res = await this.fetchWithTimeout(url, {
|
|
3516
|
+
method: "GET",
|
|
3517
|
+
headers: this.getHeaders(),
|
|
3518
|
+
next: {
|
|
3519
|
+
tags: [
|
|
3520
|
+
CacheTags.project(this.config.projectId),
|
|
3521
|
+
CacheTags.content(slug),
|
|
3522
|
+
...tags
|
|
3523
|
+
],
|
|
3524
|
+
revalidate
|
|
3525
|
+
}
|
|
3526
|
+
});
|
|
3527
|
+
if (!res.ok) {
|
|
3528
|
+
if (res.status === 404) {
|
|
3529
|
+
throw new Error(`Page '${slug}' not found. Check your Dashboard or Seed data.`);
|
|
3530
|
+
}
|
|
3531
|
+
throw new Error(`API Error ${res.status}: ${res.statusText}`);
|
|
3532
|
+
}
|
|
3533
|
+
const json = await res.json();
|
|
3534
|
+
const etag = res.headers.get("etag");
|
|
3535
|
+
const cacheEntry = {
|
|
3536
|
+
data: json.data,
|
|
3537
|
+
metadata: {
|
|
3538
|
+
timestamp: Date.now(),
|
|
3539
|
+
etag: etag || void 0,
|
|
3540
|
+
expiresAt: Date.now() + revalidate * 1e3,
|
|
3541
|
+
tags: [...tags, CacheTags.content(slug)]
|
|
3542
|
+
}
|
|
3543
|
+
};
|
|
3544
|
+
if (this.cacheStrategy === "memory") {
|
|
3545
|
+
this.memoryCache.set(cacheKey, cacheEntry.data, {
|
|
3546
|
+
tags: cacheEntry.metadata.tags,
|
|
3547
|
+
revalidate
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
if (!this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
|
|
3551
|
+
this.browserCache.set(cacheKey, cacheEntry.data, revalidate * 1e3);
|
|
3552
|
+
}
|
|
3553
|
+
return cacheEntry;
|
|
3554
|
+
}
|
|
3555
|
+
async fetchCollection(collectionId, query, cacheKey, tags, revalidate) {
|
|
3556
|
+
const params = buildQueryString(query);
|
|
3557
|
+
const url = `${this.config.apiUrl}/content/${this.config.projectId}/collection/${collectionId}?${params}`;
|
|
3558
|
+
if (this.config.debug) {
|
|
3559
|
+
console.log(`[NexusHub] \u{1F310} Fetching Collection: ${url}`);
|
|
3560
|
+
}
|
|
3561
|
+
const res = await this.fetchWithTimeout(url, {
|
|
3562
|
+
method: "GET",
|
|
3563
|
+
headers: this.getHeaders(),
|
|
3564
|
+
next: {
|
|
3565
|
+
tags: [
|
|
3566
|
+
CacheTags.project(this.config.projectId),
|
|
3567
|
+
CacheTags.collection(collectionId),
|
|
3568
|
+
...tags
|
|
3569
|
+
],
|
|
3570
|
+
revalidate
|
|
3571
|
+
}
|
|
3572
|
+
});
|
|
3573
|
+
if (!res.ok) {
|
|
3574
|
+
throw new Error(`API Error ${res.status}: ${res.statusText}`);
|
|
3575
|
+
}
|
|
3576
|
+
const json = await res.json();
|
|
3577
|
+
const etag = res.headers.get("etag");
|
|
3578
|
+
const cacheEntry = {
|
|
3579
|
+
data: json,
|
|
3580
|
+
metadata: {
|
|
3581
|
+
timestamp: Date.now(),
|
|
3582
|
+
etag: etag || void 0,
|
|
3583
|
+
expiresAt: Date.now() + revalidate * 1e3,
|
|
3584
|
+
tags: [...tags, CacheTags.collection(collectionId)]
|
|
3585
|
+
}
|
|
3586
|
+
};
|
|
3587
|
+
if (this.cacheStrategy === "memory") {
|
|
3588
|
+
this.memoryCache.set(cacheKey, cacheEntry.data, {
|
|
3589
|
+
tags: cacheEntry.metadata.tags,
|
|
3590
|
+
revalidate
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
if (!this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
|
|
3594
|
+
this.browserCache.set(cacheKey, cacheEntry.data, revalidate * 1e3);
|
|
3595
|
+
}
|
|
3596
|
+
return cacheEntry;
|
|
3597
|
+
}
|
|
3598
|
+
async fetchWithTimeout(url, options = {}) {
|
|
3599
|
+
const { timeout = this.config.timeout || 1e4, next, ...fetchOptions } = options;
|
|
3600
|
+
this.abortController = new AbortController();
|
|
3601
|
+
const timeoutId = setTimeout(() => {
|
|
3602
|
+
this.abortController.abort();
|
|
3603
|
+
}, timeout);
|
|
3604
|
+
try {
|
|
3605
|
+
const response = await fetch(url, {
|
|
3606
|
+
...fetchOptions,
|
|
3607
|
+
signal: this.abortController.signal
|
|
3608
|
+
});
|
|
3609
|
+
clearTimeout(timeoutId);
|
|
3610
|
+
return response;
|
|
3611
|
+
} catch (error) {
|
|
3612
|
+
clearTimeout(timeoutId);
|
|
3613
|
+
throw error;
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
applyLocalQuery(items, query) {
|
|
3617
|
+
let filtered = [...items];
|
|
3618
|
+
if (query.search) {
|
|
3619
|
+
const searchLower = query.search.toLowerCase();
|
|
3620
|
+
filtered = filtered.filter(
|
|
3621
|
+
(item) => JSON.stringify(item).toLowerCase().includes(searchLower)
|
|
3622
|
+
);
|
|
3623
|
+
}
|
|
3624
|
+
if (query.filter) {
|
|
3625
|
+
filtered = filtered.filter((item) => {
|
|
3626
|
+
return Object.entries(query.filter).every(([key, value]) => {
|
|
3627
|
+
const itemValue = item[key];
|
|
3628
|
+
if (itemValue === void 0) return false;
|
|
3629
|
+
if (Array.isArray(value)) {
|
|
3630
|
+
return value.includes(itemValue);
|
|
3631
|
+
}
|
|
3632
|
+
return itemValue === value;
|
|
3633
|
+
});
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
if (query.sort) {
|
|
3637
|
+
filtered.sort((a, b) => {
|
|
3638
|
+
const aVal = a[query.sort];
|
|
3639
|
+
const bVal = b[query.sort];
|
|
3640
|
+
const order = query.order === "asc" ? 1 : -1;
|
|
3641
|
+
if (aVal < bVal) return -1 * order;
|
|
3642
|
+
if (aVal > bVal) return 1 * order;
|
|
3643
|
+
return 0;
|
|
3644
|
+
});
|
|
3645
|
+
}
|
|
3646
|
+
const page = query.page || 1;
|
|
3647
|
+
const limit = query.limit || 10;
|
|
3648
|
+
const start = (page - 1) * limit;
|
|
3649
|
+
const end = start + limit;
|
|
3650
|
+
const total = filtered.length;
|
|
3651
|
+
return {
|
|
3652
|
+
items: filtered.slice(start, end),
|
|
3653
|
+
total,
|
|
3654
|
+
page,
|
|
3655
|
+
limit,
|
|
3656
|
+
totalPages: Math.ceil(total / limit),
|
|
3657
|
+
hasNext: end < total,
|
|
3658
|
+
hasPrev: start > 0
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
isCacheValid(metadata) {
|
|
3662
|
+
return Date.now() < metadata.expiresAt;
|
|
3663
|
+
}
|
|
3664
|
+
getHeaders() {
|
|
3665
|
+
const headers = {
|
|
3666
|
+
"Content-Type": "application/json",
|
|
3667
|
+
"X-Nexus-Client": "client-sdk/1.0.0",
|
|
3668
|
+
"X-Nexus-Project": this.config.projectId
|
|
3669
|
+
};
|
|
3670
|
+
if (this.config.apiKey) {
|
|
3671
|
+
headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
3672
|
+
}
|
|
3673
|
+
return headers;
|
|
3674
|
+
}
|
|
3675
|
+
normalizeError(error, context) {
|
|
3676
|
+
if (error instanceof Error) {
|
|
3677
|
+
if (error.name === "AbortError") {
|
|
3678
|
+
return new Error(`${context}: Request timeout`);
|
|
3679
|
+
}
|
|
3680
|
+
return error;
|
|
3681
|
+
}
|
|
3682
|
+
return new Error(`${context}: ${String(error)}`);
|
|
3683
|
+
}
|
|
3684
|
+
/**
|
|
3685
|
+
* Cleanup resources
|
|
3686
|
+
*/
|
|
3687
|
+
cleanup() {
|
|
3688
|
+
this.cancelRequests();
|
|
3689
|
+
if (typeof window !== "undefined") {
|
|
3690
|
+
window.removeEventListener("beforeunload", this.cleanup.bind(this));
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
};
|
|
3694
|
+
|
|
3695
|
+
// src/client.ts
|
|
3696
|
+
var NexusClient = class {
|
|
3697
|
+
constructor(config) {
|
|
3698
|
+
const fullConfig = getFullConfig(config);
|
|
3699
|
+
this.config = {
|
|
3700
|
+
debug: config?.debug || false,
|
|
3701
|
+
cacheStrategy: config?.cacheStrategy || "memory",
|
|
3702
|
+
revalidateTime: config?.revalidateTime || 60,
|
|
3703
|
+
timeout: config?.timeout || 1e4,
|
|
3704
|
+
retries: config?.retries || 3,
|
|
3705
|
+
...fullConfig
|
|
3706
|
+
};
|
|
3707
|
+
const errors = validateConfig(this.config);
|
|
3708
|
+
if (errors.length > 0) {
|
|
3709
|
+
console.warn("\u26A0\uFE0F NexusHub: Configuration issues:", errors.join(", "));
|
|
3710
|
+
if (!this.config.projectId) {
|
|
3711
|
+
console.warn("\u26A0\uFE0F NexusHub: No Project ID found. Content fetching will fail.");
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
this.content = new ContentEngine(this.config);
|
|
3715
|
+
}
|
|
3716
|
+
// Helper alias for cleaner code
|
|
3717
|
+
getPage(slug, options) {
|
|
3718
|
+
return this.content.getPage(slug, options);
|
|
3719
|
+
}
|
|
3720
|
+
// Get current config (readonly)
|
|
3721
|
+
getConfig() {
|
|
3722
|
+
return { ...this.config };
|
|
3723
|
+
}
|
|
3724
|
+
};
|
|
3725
|
+
var nexus = new NexusClient();
|
|
3726
|
+
var createNexusClient = (config) => new NexusClient(config);
|
|
3727
|
+
|
|
3728
|
+
// src/components/NexusProvider.tsx
|
|
3729
|
+
var import_navigation = __toESM(require_navigation2());
|
|
3730
|
+
import { createContext as createContext2, useEffect as useEffect2, useRef } from "react";
|
|
3731
|
+
|
|
3732
|
+
// src/analytics/tracker.ts
|
|
3733
|
+
var Tracker = class {
|
|
3734
|
+
constructor(config) {
|
|
3735
|
+
this.queue = [];
|
|
3736
|
+
this.isFlushing = false;
|
|
3737
|
+
this.SDK_VERSION = "1.0.0";
|
|
3738
|
+
this.config = config;
|
|
3739
|
+
this.sessionId = this.getSessionId();
|
|
3740
|
+
this.sessionStart = Date.now();
|
|
3741
|
+
this.endpoint = `${this.config.apiUrl.replace("/v1", "")}:3002/collect`;
|
|
3742
|
+
if (typeof window !== "undefined") {
|
|
3743
|
+
this.startFlushing();
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
/**
|
|
3747
|
+
* Generates or retrieves a persistent Session ID
|
|
3748
|
+
*/
|
|
3749
|
+
getSessionId() {
|
|
3750
|
+
if (typeof window === "undefined") return "server-session";
|
|
3751
|
+
let sid = localStorage.getItem("nexus_sid");
|
|
3752
|
+
let sessionStart = localStorage.getItem("nexus_session_start");
|
|
3753
|
+
const now = Date.now();
|
|
3754
|
+
const THIRTY_MINUTES = 30 * 60 * 1e3;
|
|
3755
|
+
if (!sid || !sessionStart || now - parseInt(sessionStart) > THIRTY_MINUTES) {
|
|
3756
|
+
sid = `sess_${Math.random().toString(36).substring(2, 11)}_${now}`;
|
|
3757
|
+
localStorage.setItem("nexus_sid", sid);
|
|
3758
|
+
localStorage.setItem("nexus_session_start", now.toString());
|
|
3759
|
+
localStorage.removeItem("nexus_last_event");
|
|
3760
|
+
}
|
|
3761
|
+
return sid;
|
|
3762
|
+
}
|
|
3763
|
+
/**
|
|
3764
|
+
* Start periodic flushing of analytics queue
|
|
3765
|
+
*/
|
|
3766
|
+
startFlushing() {
|
|
3767
|
+
this.flushInterval = setInterval(() => {
|
|
3768
|
+
this.flushQueue();
|
|
3769
|
+
}, 1e4);
|
|
3770
|
+
window.addEventListener("beforeunload", () => {
|
|
3771
|
+
this.flushQueue(true);
|
|
3772
|
+
});
|
|
3773
|
+
}
|
|
3774
|
+
/**
|
|
3775
|
+
* Send data to Rust Engine via Beacon or Fetch
|
|
3776
|
+
*/
|
|
3777
|
+
send(eventType, payload = {}) {
|
|
3778
|
+
if (typeof window === "undefined") return;
|
|
3779
|
+
const eventData = {
|
|
3780
|
+
project_id: this.config.projectId,
|
|
3781
|
+
session_id: this.sessionId,
|
|
3782
|
+
url: window.location.href,
|
|
3783
|
+
referrer: document.referrer,
|
|
3784
|
+
user_agent: window.navigator.userAgent,
|
|
3785
|
+
screen_width: window.screen.width,
|
|
3786
|
+
screen_height: window.screen.height,
|
|
3787
|
+
language: window.navigator.language,
|
|
3788
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
3789
|
+
event_type: eventType,
|
|
3790
|
+
event_data: payload,
|
|
3791
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3792
|
+
version: this.SDK_VERSION
|
|
3793
|
+
};
|
|
3794
|
+
this.queue.push(eventData);
|
|
3795
|
+
localStorage.setItem("nexus_last_event", JSON.stringify({
|
|
3796
|
+
type: eventType,
|
|
3797
|
+
timestamp: eventData.timestamp
|
|
3798
|
+
}));
|
|
3799
|
+
if (this.queue.length >= 20) {
|
|
3800
|
+
this.flushQueue();
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
/**
|
|
3804
|
+
* Get session ID
|
|
3805
|
+
*/
|
|
3806
|
+
getSession() {
|
|
3807
|
+
return this.sessionId;
|
|
3808
|
+
}
|
|
3809
|
+
/**
|
|
3810
|
+
* Get session duration
|
|
3811
|
+
*/
|
|
3812
|
+
getSessionDuration() {
|
|
3813
|
+
return Date.now() - this.sessionStart;
|
|
3814
|
+
}
|
|
3815
|
+
/**
|
|
3816
|
+
* Get session information
|
|
3817
|
+
*/
|
|
3818
|
+
getSessionInfo() {
|
|
3819
|
+
return {
|
|
3820
|
+
id: this.sessionId,
|
|
3821
|
+
start: this.sessionStart,
|
|
3822
|
+
duration: this.getSessionDuration(),
|
|
3823
|
+
eventsCount: this.queue.length
|
|
3824
|
+
};
|
|
3825
|
+
}
|
|
3826
|
+
/**
|
|
3827
|
+
* Flush the queue to the analytics endpoint
|
|
3828
|
+
*/
|
|
3829
|
+
async flushQueue(forceSync = false) {
|
|
3830
|
+
if (this.isFlushing || this.queue.length === 0) return;
|
|
3831
|
+
this.isFlushing = true;
|
|
3832
|
+
const events = [...this.queue];
|
|
3833
|
+
this.queue = [];
|
|
3834
|
+
try {
|
|
3835
|
+
const payload = {
|
|
3836
|
+
project_id: this.config.projectId,
|
|
3837
|
+
events,
|
|
3838
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3839
|
+
};
|
|
3840
|
+
if (forceSync && "navigator" in window && navigator.sendBeacon) {
|
|
3841
|
+
const blob = new Blob([JSON.stringify(payload)], { type: "application/json" });
|
|
3842
|
+
const success = navigator.sendBeacon(this.endpoint, blob);
|
|
3843
|
+
if (!success) {
|
|
3844
|
+
await fetch(this.endpoint, {
|
|
3845
|
+
method: "POST",
|
|
3846
|
+
body: JSON.stringify(payload),
|
|
3847
|
+
headers: { "Content-Type": "application/json" },
|
|
3848
|
+
keepalive: true
|
|
3849
|
+
});
|
|
3850
|
+
}
|
|
3851
|
+
} else {
|
|
3852
|
+
await fetch(this.endpoint, {
|
|
3853
|
+
method: "POST",
|
|
3854
|
+
body: JSON.stringify(payload),
|
|
3855
|
+
headers: { "Content-Type": "application/json" }
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
} catch (error) {
|
|
3859
|
+
console.error("NexusHub Analytics Error:", error);
|
|
3860
|
+
const fiveMinutesAgo = Date.now() - 5 * 60 * 1e3;
|
|
3861
|
+
const recentEvents = events.filter(
|
|
3862
|
+
(event) => new Date(event.timestamp).getTime() > fiveMinutesAgo
|
|
3863
|
+
);
|
|
3864
|
+
this.queue.unshift(...recentEvents);
|
|
3865
|
+
} finally {
|
|
3866
|
+
this.isFlushing = false;
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
/**
|
|
3870
|
+
* Manually flush events
|
|
3871
|
+
*/
|
|
3872
|
+
async flush() {
|
|
3873
|
+
await this.flushQueue();
|
|
3874
|
+
}
|
|
3875
|
+
/**
|
|
3876
|
+
* Stop tracking and cleanup
|
|
3877
|
+
*/
|
|
3878
|
+
stop() {
|
|
3879
|
+
if (this.flushInterval) {
|
|
3880
|
+
clearInterval(this.flushInterval);
|
|
3881
|
+
}
|
|
3882
|
+
this.flushQueue(true);
|
|
3883
|
+
}
|
|
3884
|
+
};
|
|
3885
|
+
|
|
3886
|
+
// src/analytics/vitals.ts
|
|
3887
|
+
import { onCLS, onLCP, onTTFB, onINP } from "web-vitals";
|
|
3888
|
+
var initVitals = (tracker) => {
|
|
3889
|
+
if (typeof window === "undefined") return;
|
|
3890
|
+
const sendMetric = (metric) => {
|
|
3891
|
+
tracker.send("web_vital", {
|
|
3892
|
+
metric_name: metric.name,
|
|
3893
|
+
value: Math.round(metric.value * 100) / 100,
|
|
3894
|
+
// Round to 2 decimal places
|
|
3895
|
+
rating: metric.rating,
|
|
3896
|
+
// 'good', 'needs-improvement', 'poor'
|
|
3897
|
+
delta: Math.round(metric.delta * 100) / 100,
|
|
3898
|
+
id: metric.id,
|
|
3899
|
+
navigation_type: metric.navigationType
|
|
3900
|
+
});
|
|
3901
|
+
if (process.env.NODE_ENV === "development") {
|
|
3902
|
+
console.log(`\u{1F4CA} ${metric.name}: ${metric.value} (${metric.rating})`);
|
|
3903
|
+
}
|
|
3904
|
+
};
|
|
3905
|
+
onCLS(sendMetric);
|
|
3906
|
+
onLCP(sendMetric);
|
|
3907
|
+
onTTFB(sendMetric);
|
|
3908
|
+
onINP(sendMetric);
|
|
3909
|
+
if ("PerformanceObserver" in window) {
|
|
3910
|
+
const lcpObserver = new PerformanceObserver((entryList) => {
|
|
3911
|
+
for (const entry of entryList.getEntries()) {
|
|
3912
|
+
const lcpEntry = entry;
|
|
3913
|
+
tracker.send("performance_entry", {
|
|
3914
|
+
type: entry.entryType,
|
|
3915
|
+
name: entry.name,
|
|
3916
|
+
startTime: Math.round(entry.startTime),
|
|
3917
|
+
duration: Math.round(entry.duration),
|
|
3918
|
+
renderTime: Math.round(lcpEntry.renderTime || 0),
|
|
3919
|
+
loadTime: Math.round(lcpEntry.loadTime || 0),
|
|
3920
|
+
size: lcpEntry.size
|
|
3921
|
+
});
|
|
3922
|
+
}
|
|
3923
|
+
});
|
|
3924
|
+
lcpObserver.observe({ type: "largest-contentful-paint", buffered: true });
|
|
3925
|
+
const fcpObserver = new PerformanceObserver((entryList) => {
|
|
3926
|
+
for (const entry of entryList.getEntries()) {
|
|
3927
|
+
tracker.send("performance_entry", {
|
|
3928
|
+
type: entry.entryType,
|
|
3929
|
+
name: entry.name,
|
|
3930
|
+
startTime: Math.round(entry.startTime)
|
|
3931
|
+
});
|
|
3932
|
+
}
|
|
3933
|
+
});
|
|
3934
|
+
fcpObserver.observe({ type: "paint", buffered: true });
|
|
3935
|
+
const longTaskObserver = new PerformanceObserver((entryList) => {
|
|
3936
|
+
for (const entry of entryList.getEntries()) {
|
|
3937
|
+
if (entry.duration > 50) {
|
|
3938
|
+
const taskEntry = entry;
|
|
3939
|
+
tracker.send("long_task", {
|
|
3940
|
+
duration: Math.round(entry.duration),
|
|
3941
|
+
startTime: Math.round(entry.startTime),
|
|
3942
|
+
attribution: taskEntry.attribution
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
});
|
|
3947
|
+
longTaskObserver.observe({ type: "longtask", buffered: true });
|
|
3948
|
+
}
|
|
3949
|
+
if ("memory" in performance) {
|
|
3950
|
+
const memory = performance.memory;
|
|
3951
|
+
tracker.send("memory_usage", {
|
|
3952
|
+
usedJSHeapSize: memory.usedJSHeapSize,
|
|
3953
|
+
totalJSHeapSize: memory.totalJSHeapSize,
|
|
3954
|
+
jsHeapSizeLimit: memory.jsHeapSizeLimit
|
|
3955
|
+
});
|
|
3956
|
+
}
|
|
3957
|
+
if ("connection" in navigator && navigator.connection) {
|
|
3958
|
+
const connection = navigator.connection;
|
|
3959
|
+
tracker.send("network_info", {
|
|
3960
|
+
effectiveType: connection.effectiveType,
|
|
3961
|
+
downlink: connection.downlink,
|
|
3962
|
+
rtt: connection.rtt,
|
|
3963
|
+
saveData: connection.saveData
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3966
|
+
};
|
|
3967
|
+
|
|
3968
|
+
// src/analytics/index.ts
|
|
3969
|
+
var AnalyticsEngine = class {
|
|
3970
|
+
constructor(config) {
|
|
3971
|
+
this.tracker = new Tracker(config);
|
|
3972
|
+
}
|
|
3973
|
+
start() {
|
|
3974
|
+
this.pageView();
|
|
3975
|
+
initVitals(this.tracker);
|
|
3976
|
+
if (typeof window !== "undefined") {
|
|
3977
|
+
window.addEventListener("click", (e) => {
|
|
3978
|
+
const target = e.target;
|
|
3979
|
+
const link = target.closest("a");
|
|
3980
|
+
if (link) {
|
|
3981
|
+
this.tracker.send("click", {
|
|
3982
|
+
href: link.href,
|
|
3983
|
+
text: link.innerText.substring(0, 100),
|
|
3984
|
+
// Limit text length
|
|
3985
|
+
id: link.id,
|
|
3986
|
+
className: link.className,
|
|
3987
|
+
dataset: link.dataset
|
|
3988
|
+
});
|
|
3989
|
+
}
|
|
3990
|
+
const button = target.closest("button");
|
|
3991
|
+
if (button) {
|
|
3992
|
+
this.tracker.send("button_click", {
|
|
3993
|
+
text: button.innerText.substring(0, 100),
|
|
3994
|
+
id: button.id,
|
|
3995
|
+
className: button.className,
|
|
3996
|
+
type: button.type
|
|
3997
|
+
});
|
|
3998
|
+
}
|
|
3999
|
+
});
|
|
4000
|
+
document.addEventListener("submit", (e) => {
|
|
4001
|
+
const form = e.target;
|
|
4002
|
+
if (form) {
|
|
4003
|
+
this.tracker.send("form_submit", {
|
|
4004
|
+
formId: form.id,
|
|
4005
|
+
action: form.action,
|
|
4006
|
+
method: form.method,
|
|
4007
|
+
fieldsCount: form.elements.length
|
|
4008
|
+
});
|
|
4009
|
+
}
|
|
4010
|
+
});
|
|
4011
|
+
if (typeof window.history !== "undefined") {
|
|
4012
|
+
const originalPushState = history.pushState;
|
|
4013
|
+
const originalReplaceState = history.replaceState;
|
|
4014
|
+
history.pushState = function(...args) {
|
|
4015
|
+
originalPushState.apply(this, args);
|
|
4016
|
+
window.dispatchEvent(new Event("pushstate"));
|
|
4017
|
+
window.dispatchEvent(new Event("locationchange"));
|
|
4018
|
+
};
|
|
4019
|
+
history.replaceState = function(...args) {
|
|
4020
|
+
originalReplaceState.apply(this, args);
|
|
4021
|
+
window.dispatchEvent(new Event("replacestate"));
|
|
4022
|
+
window.dispatchEvent(new Event("locationchange"));
|
|
4023
|
+
};
|
|
4024
|
+
window.addEventListener("popstate", () => {
|
|
4025
|
+
window.dispatchEvent(new Event("locationchange"));
|
|
4026
|
+
});
|
|
4027
|
+
window.addEventListener("locationchange", () => {
|
|
4028
|
+
this.pageView();
|
|
4029
|
+
});
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
pageView() {
|
|
4034
|
+
if (typeof window !== "undefined") {
|
|
4035
|
+
const pageData = {
|
|
4036
|
+
path: window.location.pathname,
|
|
4037
|
+
search: window.location.search,
|
|
4038
|
+
hash: window.location.hash,
|
|
4039
|
+
referrer: document.referrer,
|
|
4040
|
+
title: document.title
|
|
4041
|
+
};
|
|
4042
|
+
this.tracker.send("page_view", pageData);
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
/**
|
|
4046
|
+
* The "Handshake" - Linking Anonymous to Known User
|
|
4047
|
+
*/
|
|
4048
|
+
async identify(userId, traits = {}) {
|
|
4049
|
+
try {
|
|
4050
|
+
const endpoint = `${this.tracker["config"].apiUrl.replace("/v1", "")}:3002/identify`;
|
|
4051
|
+
const response = await fetch(endpoint, {
|
|
4052
|
+
method: "POST",
|
|
4053
|
+
headers: { "Content-Type": "application/json" },
|
|
4054
|
+
body: JSON.stringify({
|
|
4055
|
+
project_id: this.tracker["config"].projectId,
|
|
4056
|
+
session_id: this.tracker.getSession(),
|
|
4057
|
+
user_id: userId,
|
|
4058
|
+
traits,
|
|
4059
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
4060
|
+
})
|
|
4061
|
+
});
|
|
4062
|
+
return response.ok;
|
|
4063
|
+
} catch (error) {
|
|
4064
|
+
console.error("NexusHub Analytics Identify Error:", error);
|
|
4065
|
+
return false;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
/**
|
|
4069
|
+
* Track custom events
|
|
4070
|
+
*/
|
|
4071
|
+
track(eventName, properties = {}) {
|
|
4072
|
+
this.tracker.send("custom_event", {
|
|
4073
|
+
event_name: eventName,
|
|
4074
|
+
...properties
|
|
4075
|
+
});
|
|
4076
|
+
}
|
|
4077
|
+
/**
|
|
4078
|
+
* Set user properties
|
|
4079
|
+
*/
|
|
4080
|
+
setUserProperties(properties) {
|
|
4081
|
+
this.tracker.send("user_properties", properties);
|
|
4082
|
+
}
|
|
4083
|
+
/**
|
|
4084
|
+
* Track e-commerce events
|
|
4085
|
+
*/
|
|
4086
|
+
trackPurchase(orderData) {
|
|
4087
|
+
this.tracker.send("purchase", {
|
|
4088
|
+
...orderData,
|
|
4089
|
+
currency: orderData.currency || "USD",
|
|
4090
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
4091
|
+
});
|
|
4092
|
+
}
|
|
4093
|
+
/**
|
|
4094
|
+
* Track errors
|
|
4095
|
+
*/
|
|
4096
|
+
trackError(error, context) {
|
|
4097
|
+
this.tracker.send("error", {
|
|
4098
|
+
message: error.message,
|
|
4099
|
+
stack: error.stack,
|
|
4100
|
+
context,
|
|
4101
|
+
url: typeof window !== "undefined" ? window.location.href : "",
|
|
4102
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
4105
|
+
/**
|
|
4106
|
+
* Get session ID
|
|
4107
|
+
*/
|
|
4108
|
+
getSessionId() {
|
|
4109
|
+
return this.tracker.getSession();
|
|
4110
|
+
}
|
|
4111
|
+
/**
|
|
4112
|
+
* Stop analytics tracking
|
|
4113
|
+
*/
|
|
4114
|
+
stop() {
|
|
4115
|
+
this.tracker.send("session_end", {
|
|
4116
|
+
session_id: this.tracker.getSession(),
|
|
4117
|
+
duration: this.tracker.getSessionDuration()
|
|
4118
|
+
});
|
|
4119
|
+
}
|
|
4120
|
+
};
|
|
4121
|
+
|
|
4122
|
+
// src/auth/context.tsx
|
|
4123
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
4124
|
+
import { jsx } from "react/jsx-runtime";
|
|
4125
|
+
var AuthContext = createContext(null);
|
|
4126
|
+
var AuthProvider = ({
|
|
4127
|
+
children,
|
|
4128
|
+
config
|
|
4129
|
+
}) => {
|
|
4130
|
+
const [user, setUser] = useState(null);
|
|
4131
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
4132
|
+
const [error, setError] = useState(null);
|
|
4133
|
+
const API_URL = `${config.apiUrl}/project-auth`;
|
|
4134
|
+
useEffect(() => {
|
|
4135
|
+
checkSession();
|
|
4136
|
+
}, []);
|
|
4137
|
+
const checkSession = async () => {
|
|
4138
|
+
try {
|
|
4139
|
+
const res = await fetch(`${API_URL}/me`, {
|
|
4140
|
+
headers: { "x-project-id": config.projectId }
|
|
4141
|
+
});
|
|
4142
|
+
if (res.ok) {
|
|
4143
|
+
const data = await res.json();
|
|
4144
|
+
setUser(data);
|
|
4145
|
+
}
|
|
4146
|
+
} catch (err) {
|
|
4147
|
+
setUser(null);
|
|
4148
|
+
} finally {
|
|
4149
|
+
setIsLoading(false);
|
|
4150
|
+
}
|
|
4151
|
+
};
|
|
4152
|
+
const login = async (creds) => {
|
|
4153
|
+
setIsLoading(true);
|
|
4154
|
+
setError(null);
|
|
4155
|
+
try {
|
|
4156
|
+
const res = await fetch(`${API_URL}/login`, {
|
|
4157
|
+
method: "POST",
|
|
4158
|
+
headers: {
|
|
4159
|
+
"Content-Type": "application/json",
|
|
4160
|
+
"x-project-id": config.projectId
|
|
4161
|
+
},
|
|
4162
|
+
body: JSON.stringify(creds)
|
|
4163
|
+
});
|
|
4164
|
+
if (!res.ok) throw new Error(await res.text());
|
|
4165
|
+
const data = await res.json();
|
|
4166
|
+
setUser(data.user);
|
|
4167
|
+
} catch (err) {
|
|
4168
|
+
setError(err);
|
|
4169
|
+
throw err;
|
|
4170
|
+
} finally {
|
|
4171
|
+
setIsLoading(false);
|
|
4172
|
+
}
|
|
4173
|
+
};
|
|
4174
|
+
const register = async (creds) => {
|
|
4175
|
+
setIsLoading(true);
|
|
4176
|
+
setError(null);
|
|
4177
|
+
try {
|
|
4178
|
+
const res = await fetch(`${API_URL}/register`, {
|
|
4179
|
+
method: "POST",
|
|
4180
|
+
headers: {
|
|
4181
|
+
"Content-Type": "application/json",
|
|
4182
|
+
"x-project-id": config.projectId
|
|
4183
|
+
},
|
|
4184
|
+
body: JSON.stringify(creds)
|
|
4185
|
+
});
|
|
4186
|
+
if (!res.ok) throw new Error(await res.text());
|
|
4187
|
+
const data = await res.json();
|
|
4188
|
+
setUser(data.user);
|
|
4189
|
+
} catch (err) {
|
|
4190
|
+
setError(err);
|
|
4191
|
+
throw err;
|
|
4192
|
+
} finally {
|
|
4193
|
+
setIsLoading(false);
|
|
4194
|
+
}
|
|
4195
|
+
};
|
|
4196
|
+
const logout = async () => {
|
|
4197
|
+
try {
|
|
4198
|
+
await fetch(`${API_URL}/logout`, { method: "POST" });
|
|
4199
|
+
setUser(null);
|
|
4200
|
+
} catch (err) {
|
|
4201
|
+
console.error("Logout failed", err);
|
|
4202
|
+
}
|
|
4203
|
+
};
|
|
4204
|
+
const loginWithGoogle = () => {
|
|
4205
|
+
window.location.href = `${API_URL}/google?projectId=${config.projectId}`;
|
|
4206
|
+
};
|
|
4207
|
+
const updateProfile = async (data) => {
|
|
4208
|
+
const res = await fetch(`${API_URL}/me`, {
|
|
4209
|
+
method: "PATCH",
|
|
4210
|
+
headers: {
|
|
4211
|
+
"Content-Type": "application/json",
|
|
4212
|
+
"x-project-id": config.projectId
|
|
4213
|
+
},
|
|
4214
|
+
body: JSON.stringify(data)
|
|
4215
|
+
});
|
|
4216
|
+
if (res.ok) {
|
|
4217
|
+
const updated = await res.json();
|
|
4218
|
+
setUser(updated);
|
|
4219
|
+
}
|
|
4220
|
+
};
|
|
4221
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, { value: {
|
|
4222
|
+
user,
|
|
4223
|
+
isLoading,
|
|
4224
|
+
error,
|
|
4225
|
+
isAuthenticated: !!user,
|
|
4226
|
+
login,
|
|
4227
|
+
register,
|
|
4228
|
+
logout,
|
|
4229
|
+
loginWithGoogle,
|
|
4230
|
+
updateProfile
|
|
4231
|
+
}, children });
|
|
4232
|
+
};
|
|
4233
|
+
var useNexusAuth = () => {
|
|
4234
|
+
const context = useContext(AuthContext);
|
|
4235
|
+
if (!context) {
|
|
4236
|
+
throw new Error("useNexusAuth must be used within a NexusProvider");
|
|
4237
|
+
}
|
|
4238
|
+
return context;
|
|
4239
|
+
};
|
|
4240
|
+
|
|
4241
|
+
// src/components/NexusProvider.tsx
|
|
4242
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
4243
|
+
var NexusContext = createContext2(null);
|
|
4244
|
+
var NexusProvider = ({
|
|
4245
|
+
children,
|
|
4246
|
+
projectId
|
|
4247
|
+
}) => {
|
|
4248
|
+
const pathname = (0, import_navigation.usePathname)();
|
|
4249
|
+
const searchParams = (0, import_navigation.useSearchParams)();
|
|
4250
|
+
const analyticsRef = useRef(null);
|
|
4251
|
+
useEffect2(() => {
|
|
4252
|
+
if (!analyticsRef.current) {
|
|
4253
|
+
if (projectId) {
|
|
4254
|
+
nexus["config"].projectId = projectId;
|
|
4255
|
+
}
|
|
4256
|
+
analyticsRef.current = new AnalyticsEngine(nexus["config"]);
|
|
4257
|
+
analyticsRef.current.start();
|
|
4258
|
+
}
|
|
4259
|
+
}, [projectId]);
|
|
4260
|
+
useEffect2(() => {
|
|
4261
|
+
if (analyticsRef.current) {
|
|
4262
|
+
analyticsRef.current.pageView();
|
|
4263
|
+
}
|
|
4264
|
+
}, [pathname, searchParams]);
|
|
4265
|
+
return /* @__PURE__ */ jsx2(NexusContext.Provider, { value: nexus, children: /* @__PURE__ */ jsx2(AuthProvider, { config: nexus["config"], children }) });
|
|
4266
|
+
};
|
|
4267
|
+
export {
|
|
4268
|
+
BrowserCache,
|
|
4269
|
+
CacheTags,
|
|
4270
|
+
ContentEngine,
|
|
4271
|
+
ExponentialBackoff,
|
|
4272
|
+
LocalCache,
|
|
4273
|
+
MemoryCache,
|
|
4274
|
+
NexusClient,
|
|
4275
|
+
NexusProvider,
|
|
4276
|
+
RateLimiter,
|
|
4277
|
+
RequestBatcher,
|
|
4278
|
+
createNexusClient,
|
|
4279
|
+
nexus,
|
|
4280
|
+
useNexusAuth
|
|
4281
|
+
};
|