server.mjs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287
  1. import { version, unref, inject, defineComponent, provide, shallowReactive, h, ref, watch, Suspense, nextTick, Fragment, Transition, hasInjectionContext, getCurrentInstance, useSSRContext, createApp, effectScope, reactive, getCurrentScope, onErrorCaptured, onServerPrefetch, createVNode, resolveDynamicComponent, toRef, defineAsyncComponent, mergeProps, shallowRef, isReadonly, isRef, isShallow, isReactive, toRaw } from 'vue';
  2. import { $ as $fetch, h as hasProtocol, i as isScriptProtocol, j as joinURL, b as withQuery, d as defu, s as sanitizeStatusCode, c as createHooks, e as createError$1, t as toRouteMatcher, f as createRouter$1 } from '../routes/index.mjs';
  3. import { a as baseURL } from '../routes/renderer.mjs';
  4. import { getActiveHead, CapoPlugin } from 'unhead';
  5. import { defineHeadPlugin } from '@unhead/shared';
  6. import { RouterView, createMemoryHistory, createRouter, START_LOCATION } from 'vue-router';
  7. import { ssrRenderSuspense, ssrRenderComponent, ssrRenderVNode, ssrRenderAttrs } from 'vue/server-renderer';
  8. import 'node:http';
  9. import 'node:https';
  10. import 'node:fs';
  11. import 'node:path';
  12. import 'node:url';
  13. import 'vue-bundle-renderer/runtime';
  14. import 'devalue';
  15. import '@unhead/ssr';
  16. function createContext$1(opts = {}) {
  17. let currentInstance;
  18. let isSingleton = false;
  19. const checkConflict = (instance) => {
  20. if (currentInstance && currentInstance !== instance) {
  21. throw new Error("Context conflict");
  22. }
  23. };
  24. let als;
  25. if (opts.asyncContext) {
  26. const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage;
  27. if (_AsyncLocalStorage) {
  28. als = new _AsyncLocalStorage();
  29. } else {
  30. console.warn("[unctx] `AsyncLocalStorage` is not provided.");
  31. }
  32. }
  33. const _getCurrentInstance = () => {
  34. if (als && currentInstance === void 0) {
  35. const instance = als.getStore();
  36. if (instance !== void 0) {
  37. return instance;
  38. }
  39. }
  40. return currentInstance;
  41. };
  42. return {
  43. use: () => {
  44. const _instance = _getCurrentInstance();
  45. if (_instance === void 0) {
  46. throw new Error("Context is not available");
  47. }
  48. return _instance;
  49. },
  50. tryUse: () => {
  51. return _getCurrentInstance();
  52. },
  53. set: (instance, replace) => {
  54. if (!replace) {
  55. checkConflict(instance);
  56. }
  57. currentInstance = instance;
  58. isSingleton = true;
  59. },
  60. unset: () => {
  61. currentInstance = void 0;
  62. isSingleton = false;
  63. },
  64. call: (instance, callback) => {
  65. checkConflict(instance);
  66. currentInstance = instance;
  67. try {
  68. return als ? als.run(instance, callback) : callback();
  69. } finally {
  70. if (!isSingleton) {
  71. currentInstance = void 0;
  72. }
  73. }
  74. },
  75. async callAsync(instance, callback) {
  76. currentInstance = instance;
  77. const onRestore = () => {
  78. currentInstance = instance;
  79. };
  80. const onLeave = () => currentInstance === instance ? onRestore : void 0;
  81. asyncHandlers$1.add(onLeave);
  82. try {
  83. const r = als ? als.run(instance, callback) : callback();
  84. if (!isSingleton) {
  85. currentInstance = void 0;
  86. }
  87. return await r;
  88. } finally {
  89. asyncHandlers$1.delete(onLeave);
  90. }
  91. }
  92. };
  93. }
  94. function createNamespace$1(defaultOpts = {}) {
  95. const contexts = {};
  96. return {
  97. get(key, opts = {}) {
  98. if (!contexts[key]) {
  99. contexts[key] = createContext$1({ ...defaultOpts, ...opts });
  100. }
  101. contexts[key];
  102. return contexts[key];
  103. }
  104. };
  105. }
  106. const _globalThis$1 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : {};
  107. const globalKey$2 = "__unctx__";
  108. const defaultNamespace = _globalThis$1[globalKey$2] || (_globalThis$1[globalKey$2] = createNamespace$1());
  109. const getContext = (key, opts = {}) => defaultNamespace.get(key, opts);
  110. const asyncHandlersKey$1 = "__unctx_async_handlers__";
  111. const asyncHandlers$1 = _globalThis$1[asyncHandlersKey$1] || (_globalThis$1[asyncHandlersKey$1] = /* @__PURE__ */ new Set());
  112. if (!globalThis.$fetch) {
  113. globalThis.$fetch = $fetch.create({
  114. baseURL: baseURL()
  115. });
  116. }
  117. const appPageTransition = false;
  118. const appKeepalive = false;
  119. const nuxtLinkDefaults = { "componentName": "NuxtLink", "prefetch": true, "prefetchOn": { "visibility": true } };
  120. const appId = "nuxt-app";
  121. function getNuxtAppCtx(id = appId) {
  122. return getContext(id, {
  123. asyncContext: false
  124. });
  125. }
  126. const NuxtPluginIndicator = "__nuxt_plugin";
  127. function createNuxtApp(options) {
  128. var _a;
  129. let hydratingCount = 0;
  130. const nuxtApp = {
  131. _id: options.id || appId || "nuxt-app",
  132. _scope: effectScope(),
  133. provide: void 0,
  134. globalName: "nuxt",
  135. versions: {
  136. get nuxt() {
  137. return "3.13.2";
  138. },
  139. get vue() {
  140. return nuxtApp.vueApp.version;
  141. }
  142. },
  143. payload: shallowReactive({
  144. ...((_a = options.ssrContext) == null ? void 0 : _a.payload) || {},
  145. data: shallowReactive({}),
  146. state: reactive({}),
  147. once: /* @__PURE__ */ new Set(),
  148. _errors: shallowReactive({})
  149. }),
  150. static: {
  151. data: {}
  152. },
  153. runWithContext(fn) {
  154. if (nuxtApp._scope.active && !getCurrentScope()) {
  155. return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn));
  156. }
  157. return callWithNuxt(nuxtApp, fn);
  158. },
  159. isHydrating: false,
  160. deferHydration() {
  161. if (!nuxtApp.isHydrating) {
  162. return () => {
  163. };
  164. }
  165. hydratingCount++;
  166. let called = false;
  167. return () => {
  168. if (called) {
  169. return;
  170. }
  171. called = true;
  172. hydratingCount--;
  173. if (hydratingCount === 0) {
  174. nuxtApp.isHydrating = false;
  175. return nuxtApp.callHook("app:suspense:resolve");
  176. }
  177. };
  178. },
  179. _asyncDataPromises: {},
  180. _asyncData: shallowReactive({}),
  181. _payloadRevivers: {},
  182. ...options
  183. };
  184. {
  185. nuxtApp.payload.serverRendered = true;
  186. }
  187. if (nuxtApp.ssrContext) {
  188. nuxtApp.payload.path = nuxtApp.ssrContext.url;
  189. nuxtApp.ssrContext.nuxt = nuxtApp;
  190. nuxtApp.ssrContext.payload = nuxtApp.payload;
  191. nuxtApp.ssrContext.config = {
  192. public: nuxtApp.ssrContext.runtimeConfig.public,
  193. app: nuxtApp.ssrContext.runtimeConfig.app
  194. };
  195. }
  196. nuxtApp.hooks = createHooks();
  197. nuxtApp.hook = nuxtApp.hooks.hook;
  198. {
  199. const contextCaller = async function(hooks, args) {
  200. for (const hook of hooks) {
  201. await nuxtApp.runWithContext(() => hook(...args));
  202. }
  203. };
  204. nuxtApp.hooks.callHook = (name, ...args) => nuxtApp.hooks.callHookWith(contextCaller, name, ...args);
  205. }
  206. nuxtApp.callHook = nuxtApp.hooks.callHook;
  207. nuxtApp.provide = (name, value) => {
  208. const $name = "$" + name;
  209. defineGetter(nuxtApp, $name, value);
  210. defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value);
  211. };
  212. defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp);
  213. defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp);
  214. const runtimeConfig = options.ssrContext.runtimeConfig;
  215. nuxtApp.provide("config", runtimeConfig);
  216. return nuxtApp;
  217. }
  218. function registerPluginHooks(nuxtApp, plugin2) {
  219. if (plugin2.hooks) {
  220. nuxtApp.hooks.addHooks(plugin2.hooks);
  221. }
  222. }
  223. async function applyPlugin(nuxtApp, plugin2) {
  224. if (typeof plugin2 === "function") {
  225. const { provide: provide2 } = await nuxtApp.runWithContext(() => plugin2(nuxtApp)) || {};
  226. if (provide2 && typeof provide2 === "object") {
  227. for (const key in provide2) {
  228. nuxtApp.provide(key, provide2[key]);
  229. }
  230. }
  231. }
  232. }
  233. async function applyPlugins(nuxtApp, plugins2) {
  234. var _a, _b, _c, _d;
  235. const resolvedPlugins = [];
  236. const unresolvedPlugins = [];
  237. const parallels = [];
  238. const errors = [];
  239. let promiseDepth = 0;
  240. async function executePlugin(plugin2) {
  241. var _a2;
  242. const unresolvedPluginsForThisPlugin = ((_a2 = plugin2.dependsOn) == null ? void 0 : _a2.filter((name) => plugins2.some((p) => p._name === name) && !resolvedPlugins.includes(name))) ?? [];
  243. if (unresolvedPluginsForThisPlugin.length > 0) {
  244. unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin2]);
  245. } else {
  246. const promise = applyPlugin(nuxtApp, plugin2).then(async () => {
  247. if (plugin2._name) {
  248. resolvedPlugins.push(plugin2._name);
  249. await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => {
  250. if (dependsOn.has(plugin2._name)) {
  251. dependsOn.delete(plugin2._name);
  252. if (dependsOn.size === 0) {
  253. promiseDepth++;
  254. await executePlugin(unexecutedPlugin);
  255. }
  256. }
  257. }));
  258. }
  259. });
  260. if (plugin2.parallel) {
  261. parallels.push(promise.catch((e) => errors.push(e)));
  262. } else {
  263. await promise;
  264. }
  265. }
  266. }
  267. for (const plugin2 of plugins2) {
  268. if (((_a = nuxtApp.ssrContext) == null ? void 0 : _a.islandContext) && ((_b = plugin2.env) == null ? void 0 : _b.islands) === false) {
  269. continue;
  270. }
  271. registerPluginHooks(nuxtApp, plugin2);
  272. }
  273. for (const plugin2 of plugins2) {
  274. if (((_c = nuxtApp.ssrContext) == null ? void 0 : _c.islandContext) && ((_d = plugin2.env) == null ? void 0 : _d.islands) === false) {
  275. continue;
  276. }
  277. await executePlugin(plugin2);
  278. }
  279. await Promise.all(parallels);
  280. if (promiseDepth) {
  281. for (let i = 0; i < promiseDepth; i++) {
  282. await Promise.all(parallels);
  283. }
  284. }
  285. if (errors.length) {
  286. throw errors[0];
  287. }
  288. }
  289. // @__NO_SIDE_EFFECTS__
  290. function defineNuxtPlugin(plugin2) {
  291. if (typeof plugin2 === "function") {
  292. return plugin2;
  293. }
  294. const _name = plugin2._name || plugin2.name;
  295. delete plugin2.name;
  296. return Object.assign(plugin2.setup || (() => {
  297. }), plugin2, { [NuxtPluginIndicator]: true, _name });
  298. }
  299. function callWithNuxt(nuxt, setup, args) {
  300. const fn = () => setup();
  301. const nuxtAppCtx = getNuxtAppCtx(nuxt._id);
  302. {
  303. return nuxt.vueApp.runWithContext(() => nuxtAppCtx.callAsync(nuxt, fn));
  304. }
  305. }
  306. function tryUseNuxtApp(id) {
  307. var _a;
  308. let nuxtAppInstance;
  309. if (hasInjectionContext()) {
  310. nuxtAppInstance = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app.$nuxt;
  311. }
  312. nuxtAppInstance = nuxtAppInstance || getNuxtAppCtx(id).tryUse();
  313. return nuxtAppInstance || null;
  314. }
  315. function useNuxtApp(id) {
  316. const nuxtAppInstance = tryUseNuxtApp(id);
  317. if (!nuxtAppInstance) {
  318. {
  319. throw new Error("[nuxt] instance unavailable");
  320. }
  321. }
  322. return nuxtAppInstance;
  323. }
  324. // @__NO_SIDE_EFFECTS__
  325. function useRuntimeConfig(_event) {
  326. return useNuxtApp().$config;
  327. }
  328. function defineGetter(obj, key, val) {
  329. Object.defineProperty(obj, key, { get: () => val });
  330. }
  331. const LayoutMetaSymbol = Symbol("layout-meta");
  332. const PageRouteSymbol = Symbol("route");
  333. const useRouter = () => {
  334. var _a;
  335. return (_a = useNuxtApp()) == null ? void 0 : _a.$router;
  336. };
  337. const useRoute = () => {
  338. if (hasInjectionContext()) {
  339. return inject(PageRouteSymbol, useNuxtApp()._route);
  340. }
  341. return useNuxtApp()._route;
  342. };
  343. // @__NO_SIDE_EFFECTS__
  344. function defineNuxtRouteMiddleware(middleware) {
  345. return middleware;
  346. }
  347. const isProcessingMiddleware = () => {
  348. try {
  349. if (useNuxtApp()._processingMiddleware) {
  350. return true;
  351. }
  352. } catch {
  353. return false;
  354. }
  355. return false;
  356. };
  357. const navigateTo = (to, options) => {
  358. if (!to) {
  359. to = "/";
  360. }
  361. const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
  362. const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
  363. const isExternal = (options == null ? void 0 : options.external) || isExternalHost;
  364. if (isExternal) {
  365. if (!(options == null ? void 0 : options.external)) {
  366. throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.");
  367. }
  368. const { protocol } = new URL(toPath, "http://localhost");
  369. if (protocol && isScriptProtocol(protocol)) {
  370. throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`);
  371. }
  372. }
  373. const inMiddleware = isProcessingMiddleware();
  374. const router = useRouter();
  375. const nuxtApp = useNuxtApp();
  376. {
  377. if (nuxtApp.ssrContext) {
  378. const fullPath = typeof to === "string" || isExternal ? toPath : router.resolve(to).fullPath || "/";
  379. const location2 = isExternal ? toPath : joinURL((/* @__PURE__ */ useRuntimeConfig()).app.baseURL, fullPath);
  380. const redirect = async function(response) {
  381. await nuxtApp.callHook("app:redirected");
  382. const encodedLoc = location2.replace(/"/g, "%22");
  383. const encodedHeader = encodeURL(location2, isExternalHost);
  384. nuxtApp.ssrContext._renderResponse = {
  385. statusCode: sanitizeStatusCode((options == null ? void 0 : options.redirectCode) || 302, 302),
  386. body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
  387. headers: { location: encodedHeader }
  388. };
  389. return response;
  390. };
  391. if (!isExternal && inMiddleware) {
  392. router.afterEach((final) => final.fullPath === fullPath ? redirect(false) : void 0);
  393. return to;
  394. }
  395. return redirect(!inMiddleware ? void 0 : (
  396. /* abort route navigation */
  397. false
  398. ));
  399. }
  400. }
  401. if (isExternal) {
  402. nuxtApp._scope.stop();
  403. if (options == null ? void 0 : options.replace) {
  404. (void 0).replace(toPath);
  405. } else {
  406. (void 0).href = toPath;
  407. }
  408. if (inMiddleware) {
  409. if (!nuxtApp.isHydrating) {
  410. return false;
  411. }
  412. return new Promise(() => {
  413. });
  414. }
  415. return Promise.resolve();
  416. }
  417. return (options == null ? void 0 : options.replace) ? router.replace(to) : router.push(to);
  418. };
  419. function resolveRouteObject(to) {
  420. return withQuery(to.path || "", to.query || {}) + (to.hash || "");
  421. }
  422. function encodeURL(location2, isExternalHost = false) {
  423. const url = new URL(location2, "http://localhost");
  424. if (!isExternalHost) {
  425. return url.pathname + url.search + url.hash;
  426. }
  427. if (location2.startsWith("//")) {
  428. return url.toString().replace(url.protocol, "");
  429. }
  430. return url.toString();
  431. }
  432. const NUXT_ERROR_SIGNATURE = "__nuxt_error";
  433. const useError = () => toRef(useNuxtApp().payload, "error");
  434. const showError = (error) => {
  435. const nuxtError = createError(error);
  436. try {
  437. const nuxtApp = useNuxtApp();
  438. const error2 = useError();
  439. if (false) ;
  440. error2.value = error2.value || nuxtError;
  441. } catch {
  442. throw nuxtError;
  443. }
  444. return nuxtError;
  445. };
  446. const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error;
  447. const createError = (error) => {
  448. const nuxtError = createError$1(error);
  449. Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, {
  450. value: true,
  451. configurable: false,
  452. writable: false
  453. });
  454. return nuxtError;
  455. };
  456. version[0] === "3";
  457. function resolveUnref(r) {
  458. return typeof r === "function" ? r() : unref(r);
  459. }
  460. function resolveUnrefHeadInput(ref2) {
  461. if (ref2 instanceof Promise || ref2 instanceof Date || ref2 instanceof RegExp)
  462. return ref2;
  463. const root = resolveUnref(ref2);
  464. if (!ref2 || !root)
  465. return root;
  466. if (Array.isArray(root))
  467. return root.map((r) => resolveUnrefHeadInput(r));
  468. if (typeof root === "object") {
  469. const resolved = {};
  470. for (const k in root) {
  471. if (!Object.prototype.hasOwnProperty.call(root, k)) {
  472. continue;
  473. }
  474. if (k === "titleTemplate" || k[0] === "o" && k[1] === "n") {
  475. resolved[k] = unref(root[k]);
  476. continue;
  477. }
  478. resolved[k] = resolveUnrefHeadInput(root[k]);
  479. }
  480. return resolved;
  481. }
  482. return root;
  483. }
  484. defineHeadPlugin({
  485. hooks: {
  486. "entries:resolve": (ctx) => {
  487. for (const entry2 of ctx.entries)
  488. entry2.resolvedInput = resolveUnrefHeadInput(entry2.input);
  489. }
  490. }
  491. });
  492. const headSymbol = "usehead";
  493. const _global = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  494. const globalKey$1 = "__unhead_injection_handler__";
  495. function setHeadInjectionHandler(handler) {
  496. _global[globalKey$1] = handler;
  497. }
  498. function injectHead() {
  499. if (globalKey$1 in _global) {
  500. return _global[globalKey$1]();
  501. }
  502. const head = inject(headSymbol);
  503. if (!head && "production" !== "production")
  504. console.warn("Unhead is missing Vue context, falling back to shared context. This may have unexpected results.");
  505. return head || getActiveHead();
  506. }
  507. [CapoPlugin({ track: true })];
  508. const unhead_KgADcZ0jPj = /* @__PURE__ */ defineNuxtPlugin({
  509. name: "nuxt:head",
  510. enforce: "pre",
  511. setup(nuxtApp) {
  512. const head = nuxtApp.ssrContext.head;
  513. setHeadInjectionHandler(
  514. // need a fresh instance of the nuxt app to avoid parallel requests interfering with each other
  515. () => useNuxtApp().vueApp._context.provides.usehead
  516. );
  517. nuxtApp.vueApp.use(head);
  518. }
  519. });
  520. function createContext(opts = {}) {
  521. let currentInstance;
  522. let isSingleton = false;
  523. const checkConflict = (instance) => {
  524. if (currentInstance && currentInstance !== instance) {
  525. throw new Error("Context conflict");
  526. }
  527. };
  528. let als;
  529. if (opts.asyncContext) {
  530. const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage;
  531. if (_AsyncLocalStorage) {
  532. als = new _AsyncLocalStorage();
  533. } else {
  534. console.warn("[unctx] `AsyncLocalStorage` is not provided.");
  535. }
  536. }
  537. const _getCurrentInstance = () => {
  538. if (als && currentInstance === void 0) {
  539. const instance = als.getStore();
  540. if (instance !== void 0) {
  541. return instance;
  542. }
  543. }
  544. return currentInstance;
  545. };
  546. return {
  547. use: () => {
  548. const _instance = _getCurrentInstance();
  549. if (_instance === void 0) {
  550. throw new Error("Context is not available");
  551. }
  552. return _instance;
  553. },
  554. tryUse: () => {
  555. return _getCurrentInstance();
  556. },
  557. set: (instance, replace) => {
  558. if (!replace) {
  559. checkConflict(instance);
  560. }
  561. currentInstance = instance;
  562. isSingleton = true;
  563. },
  564. unset: () => {
  565. currentInstance = void 0;
  566. isSingleton = false;
  567. },
  568. call: (instance, callback) => {
  569. checkConflict(instance);
  570. currentInstance = instance;
  571. try {
  572. return als ? als.run(instance, callback) : callback();
  573. } finally {
  574. if (!isSingleton) {
  575. currentInstance = void 0;
  576. }
  577. }
  578. },
  579. async callAsync(instance, callback) {
  580. currentInstance = instance;
  581. const onRestore = () => {
  582. currentInstance = instance;
  583. };
  584. const onLeave = () => currentInstance === instance ? onRestore : void 0;
  585. asyncHandlers.add(onLeave);
  586. try {
  587. const r = als ? als.run(instance, callback) : callback();
  588. if (!isSingleton) {
  589. currentInstance = void 0;
  590. }
  591. return await r;
  592. } finally {
  593. asyncHandlers.delete(onLeave);
  594. }
  595. }
  596. };
  597. }
  598. function createNamespace(defaultOpts = {}) {
  599. const contexts = {};
  600. return {
  601. get(key, opts = {}) {
  602. if (!contexts[key]) {
  603. contexts[key] = createContext({ ...defaultOpts, ...opts });
  604. }
  605. contexts[key];
  606. return contexts[key];
  607. }
  608. };
  609. }
  610. const _globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : {};
  611. const globalKey = "__unctx__";
  612. _globalThis[globalKey] || (_globalThis[globalKey] = createNamespace());
  613. const asyncHandlersKey = "__unctx_async_handlers__";
  614. const asyncHandlers = _globalThis[asyncHandlersKey] || (_globalThis[asyncHandlersKey] = /* @__PURE__ */ new Set());
  615. function executeAsync(function_) {
  616. const restores = [];
  617. for (const leaveHandler of asyncHandlers) {
  618. const restore2 = leaveHandler();
  619. if (restore2) {
  620. restores.push(restore2);
  621. }
  622. }
  623. const restore = () => {
  624. for (const restore2 of restores) {
  625. restore2();
  626. }
  627. };
  628. let awaitable = function_();
  629. if (awaitable && typeof awaitable === "object" && "catch" in awaitable) {
  630. awaitable = awaitable.catch((error) => {
  631. restore();
  632. throw error;
  633. });
  634. }
  635. return [awaitable, restore];
  636. }
  637. const interpolatePath = (route, match) => {
  638. return match.path.replace(/(:\w+)\([^)]+\)/g, "$1").replace(/(:\w+)[?+*]/g, "$1").replace(/:\w+/g, (r) => {
  639. var _a;
  640. return ((_a = route.params[r.slice(1)]) == null ? void 0 : _a.toString()) || "";
  641. });
  642. };
  643. const generateRouteKey$1 = (routeProps, override) => {
  644. const matchedRoute = routeProps.route.matched.find((m) => {
  645. var _a;
  646. return ((_a = m.components) == null ? void 0 : _a.default) === routeProps.Component.type;
  647. });
  648. const source = override ?? (matchedRoute == null ? void 0 : matchedRoute.meta.key) ?? (matchedRoute && interpolatePath(routeProps.route, matchedRoute));
  649. return typeof source === "function" ? source(routeProps.route) : source;
  650. };
  651. const wrapInKeepAlive = (props, children) => {
  652. return { default: () => children };
  653. };
  654. function toArray(value) {
  655. return Array.isArray(value) ? value : [value];
  656. }
  657. async function getRouteRules(url) {
  658. {
  659. const _routeRulesMatcher = toRouteMatcher(
  660. createRouter$1({ routes: (/* @__PURE__ */ useRuntimeConfig()).nitro.routeRules })
  661. );
  662. return defu({}, ..._routeRulesMatcher.matchAll(url).reverse());
  663. }
  664. }
  665. const _routes = [
  666. {
  667. name: "index",
  668. path: "/",
  669. component: () => import('./index-CPaUT6RS.mjs')
  670. },
  671. {
  672. name: "login",
  673. path: "/login",
  674. component: () => import('./login-C0jWU6fx.mjs')
  675. },
  676. {
  677. name: "register",
  678. path: "/register",
  679. component: () => import('./register-hicBJgDn.mjs')
  680. }
  681. ];
  682. const _wrapIf = (component, props, slots) => {
  683. props = props === true ? {} : props;
  684. return { default: () => {
  685. var _a;
  686. return props ? h(component, props, slots) : (_a = slots.default) == null ? void 0 : _a.call(slots);
  687. } };
  688. };
  689. function generateRouteKey(route) {
  690. const source = (route == null ? void 0 : route.meta.key) ?? route.path.replace(/(:\w+)\([^)]+\)/g, "$1").replace(/(:\w+)[?+*]/g, "$1").replace(/:\w+/g, (r) => {
  691. var _a;
  692. return ((_a = route.params[r.slice(1)]) == null ? void 0 : _a.toString()) || "";
  693. });
  694. return typeof source === "function" ? source(route) : source;
  695. }
  696. function isChangingPage(to, from) {
  697. if (to === from || from === START_LOCATION) {
  698. return false;
  699. }
  700. if (generateRouteKey(to) !== generateRouteKey(from)) {
  701. return true;
  702. }
  703. const areComponentsSame = to.matched.every(
  704. (comp, index) => {
  705. var _a, _b;
  706. return comp.components && comp.components.default === ((_b = (_a = from.matched[index]) == null ? void 0 : _a.components) == null ? void 0 : _b.default);
  707. }
  708. );
  709. if (areComponentsSame) {
  710. return false;
  711. }
  712. return true;
  713. }
  714. const routerOptions0 = {
  715. scrollBehavior(to, from, savedPosition) {
  716. var _a;
  717. const nuxtApp = useNuxtApp();
  718. const behavior = ((_a = useRouter().options) == null ? void 0 : _a.scrollBehaviorType) ?? "auto";
  719. let position = savedPosition || void 0;
  720. const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
  721. if (!position && from && to && routeAllowsScrollToTop !== false && isChangingPage(to, from)) {
  722. position = { left: 0, top: 0 };
  723. }
  724. if (to.path === from.path) {
  725. if (from.hash && !to.hash) {
  726. return { left: 0, top: 0 };
  727. }
  728. if (to.hash) {
  729. return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
  730. }
  731. return false;
  732. }
  733. const hasTransition = (route) => !!(route.meta.pageTransition ?? appPageTransition);
  734. const hookToWait = hasTransition(from) && hasTransition(to) ? "page:transition:finish" : "page:finish";
  735. return new Promise((resolve) => {
  736. nuxtApp.hooks.hookOnce(hookToWait, async () => {
  737. await new Promise((resolve2) => setTimeout(resolve2, 0));
  738. if (to.hash) {
  739. position = { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
  740. }
  741. resolve(position);
  742. });
  743. });
  744. }
  745. };
  746. function _getHashElementScrollMarginTop(selector) {
  747. try {
  748. const elem = (void 0).querySelector(selector);
  749. if (elem) {
  750. return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle((void 0).documentElement).scrollPaddingTop) || 0);
  751. }
  752. } catch {
  753. }
  754. return 0;
  755. }
  756. const configRouterOptions = {
  757. hashMode: false,
  758. scrollBehaviorType: "auto"
  759. };
  760. const routerOptions = {
  761. ...configRouterOptions,
  762. ...routerOptions0
  763. };
  764. const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
  765. var _a;
  766. let __temp, __restore;
  767. if (!((_a = to.meta) == null ? void 0 : _a.validate)) {
  768. return;
  769. }
  770. const nuxtApp = useNuxtApp();
  771. const router = useRouter();
  772. const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp);
  773. if (result === true) {
  774. return;
  775. }
  776. const error = createError({
  777. statusCode: result && result.statusCode || 404,
  778. statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`,
  779. data: {
  780. path: to.fullPath
  781. }
  782. });
  783. const unsub = router.beforeResolve((final) => {
  784. unsub();
  785. if (final === to) {
  786. const unsub2 = router.afterEach(async () => {
  787. unsub2();
  788. await nuxtApp.runWithContext(() => showError(error));
  789. });
  790. return false;
  791. }
  792. });
  793. });
  794. const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
  795. {
  796. return;
  797. }
  798. });
  799. const globalMiddleware = [
  800. validate,
  801. manifest_45route_45rule
  802. ];
  803. const namedMiddleware = {};
  804. const plugin = /* @__PURE__ */ defineNuxtPlugin({
  805. name: "nuxt:router",
  806. enforce: "pre",
  807. async setup(nuxtApp) {
  808. var _a, _b, _c;
  809. let __temp, __restore;
  810. let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
  811. if (routerOptions.hashMode && !routerBase.includes("#")) {
  812. routerBase += "#";
  813. }
  814. const history = ((_a = routerOptions.history) == null ? void 0 : _a.call(routerOptions, routerBase)) ?? createMemoryHistory(routerBase);
  815. const routes = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes;
  816. let startPosition;
  817. const router = createRouter({
  818. ...routerOptions,
  819. scrollBehavior: (to, from, savedPosition) => {
  820. if (from === START_LOCATION) {
  821. startPosition = savedPosition;
  822. return;
  823. }
  824. if (routerOptions.scrollBehavior) {
  825. router.options.scrollBehavior = routerOptions.scrollBehavior;
  826. if ("scrollRestoration" in (void 0).history) {
  827. const unsub = router.beforeEach(() => {
  828. unsub();
  829. (void 0).history.scrollRestoration = "manual";
  830. });
  831. }
  832. return routerOptions.scrollBehavior(to, START_LOCATION, startPosition || savedPosition);
  833. }
  834. },
  835. history,
  836. routes
  837. });
  838. nuxtApp.vueApp.use(router);
  839. const previousRoute = shallowRef(router.currentRoute.value);
  840. router.afterEach((_to, from) => {
  841. previousRoute.value = from;
  842. });
  843. Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", {
  844. get: () => previousRoute.value
  845. });
  846. const initialURL = nuxtApp.ssrContext.url;
  847. const _route = shallowRef(router.currentRoute.value);
  848. const syncCurrentRoute = () => {
  849. _route.value = router.currentRoute.value;
  850. };
  851. nuxtApp.hook("page:finish", syncCurrentRoute);
  852. router.afterEach((to, from) => {
  853. var _a2, _b2, _c2, _d;
  854. if (((_b2 = (_a2 = to.matched[0]) == null ? void 0 : _a2.components) == null ? void 0 : _b2.default) === ((_d = (_c2 = from.matched[0]) == null ? void 0 : _c2.components) == null ? void 0 : _d.default)) {
  855. syncCurrentRoute();
  856. }
  857. });
  858. const route = {};
  859. for (const key in _route.value) {
  860. Object.defineProperty(route, key, {
  861. get: () => _route.value[key],
  862. enumerable: true
  863. });
  864. }
  865. nuxtApp._route = shallowReactive(route);
  866. nuxtApp._middleware = nuxtApp._middleware || {
  867. global: [],
  868. named: {}
  869. };
  870. useError();
  871. if (!((_b = nuxtApp.ssrContext) == null ? void 0 : _b.islandContext)) {
  872. router.afterEach(async (to, _from, failure) => {
  873. delete nuxtApp._processingMiddleware;
  874. if (failure) {
  875. await nuxtApp.callHook("page:loading:end");
  876. }
  877. if ((failure == null ? void 0 : failure.type) === 4) {
  878. return;
  879. }
  880. if (to.matched.length === 0) {
  881. await nuxtApp.runWithContext(() => showError(createError$1({
  882. statusCode: 404,
  883. fatal: false,
  884. statusMessage: `Page not found: ${to.fullPath}`,
  885. data: {
  886. path: to.fullPath
  887. }
  888. })));
  889. } else if (to.redirectedFrom && to.fullPath !== initialURL) {
  890. await nuxtApp.runWithContext(() => navigateTo(to.fullPath || "/"));
  891. }
  892. });
  893. }
  894. try {
  895. if (true) {
  896. ;
  897. [__temp, __restore] = executeAsync(() => router.push(initialURL)), await __temp, __restore();
  898. ;
  899. }
  900. ;
  901. [__temp, __restore] = executeAsync(() => router.isReady()), await __temp, __restore();
  902. ;
  903. } catch (error2) {
  904. [__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore();
  905. }
  906. const resolvedInitialRoute = router.currentRoute.value;
  907. syncCurrentRoute();
  908. if ((_c = nuxtApp.ssrContext) == null ? void 0 : _c.islandContext) {
  909. return { provide: { router } };
  910. }
  911. const initialLayout = nuxtApp.payload.state._layout;
  912. router.beforeEach(async (to, from) => {
  913. var _a2, _b2;
  914. await nuxtApp.callHook("page:loading:start");
  915. to.meta = reactive(to.meta);
  916. if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) {
  917. to.meta.layout = initialLayout;
  918. }
  919. nuxtApp._processingMiddleware = true;
  920. if (!((_a2 = nuxtApp.ssrContext) == null ? void 0 : _a2.islandContext)) {
  921. const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
  922. for (const component of to.matched) {
  923. const componentMiddleware = component.meta.middleware;
  924. if (!componentMiddleware) {
  925. continue;
  926. }
  927. for (const entry2 of toArray(componentMiddleware)) {
  928. middlewareEntries.add(entry2);
  929. }
  930. }
  931. {
  932. const routeRules = await nuxtApp.runWithContext(() => getRouteRules(to.path));
  933. if (routeRules.appMiddleware) {
  934. for (const key in routeRules.appMiddleware) {
  935. if (routeRules.appMiddleware[key]) {
  936. middlewareEntries.add(key);
  937. } else {
  938. middlewareEntries.delete(key);
  939. }
  940. }
  941. }
  942. }
  943. for (const entry2 of middlewareEntries) {
  944. const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await ((_b2 = namedMiddleware[entry2]) == null ? void 0 : _b2.call(namedMiddleware).then((r) => r.default || r)) : entry2;
  945. if (!middleware) {
  946. throw new Error(`Unknown route middleware: '${entry2}'.`);
  947. }
  948. const result = await nuxtApp.runWithContext(() => middleware(to, from));
  949. {
  950. if (result === false || result instanceof Error) {
  951. const error2 = result || createError$1({
  952. statusCode: 404,
  953. statusMessage: `Page Not Found: ${initialURL}`
  954. });
  955. await nuxtApp.runWithContext(() => showError(error2));
  956. return false;
  957. }
  958. }
  959. if (result === true) {
  960. continue;
  961. }
  962. if (result || result === false) {
  963. return result;
  964. }
  965. }
  966. }
  967. });
  968. router.onError(async () => {
  969. delete nuxtApp._processingMiddleware;
  970. await nuxtApp.callHook("page:loading:end");
  971. });
  972. nuxtApp.hooks.hookOnce("app:created", async () => {
  973. try {
  974. if ("name" in resolvedInitialRoute) {
  975. resolvedInitialRoute.name = void 0;
  976. }
  977. await router.replace({
  978. ...resolvedInitialRoute,
  979. force: true
  980. });
  981. router.options.scrollBehavior = routerOptions.scrollBehavior;
  982. } catch (error2) {
  983. await nuxtApp.runWithContext(() => showError(error2));
  984. }
  985. });
  986. return { provide: { router } };
  987. }
  988. });
  989. function definePayloadReducer(name, reduce) {
  990. {
  991. useNuxtApp().ssrContext._payloadReducers[name] = reduce;
  992. }
  993. }
  994. const reducers = [
  995. ["NuxtError", (data) => isNuxtError(data) && data.toJSON()],
  996. ["EmptyShallowRef", (data) => isRef(data) && isShallow(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
  997. ["EmptyRef", (data) => isRef(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
  998. ["ShallowRef", (data) => isRef(data) && isShallow(data) && data.value],
  999. ["ShallowReactive", (data) => isReactive(data) && isShallow(data) && toRaw(data)],
  1000. ["Ref", (data) => isRef(data) && data.value],
  1001. ["Reactive", (data) => isReactive(data) && toRaw(data)]
  1002. ];
  1003. const revive_payload_server_eJ33V7gbc6 = /* @__PURE__ */ defineNuxtPlugin({
  1004. name: "nuxt:revive-payload:server",
  1005. setup() {
  1006. for (const [reducer, fn] of reducers) {
  1007. definePayloadReducer(reducer, fn);
  1008. }
  1009. }
  1010. });
  1011. const components_plugin_KR1HBZs4kY = /* @__PURE__ */ defineNuxtPlugin({
  1012. name: "nuxt:global-components"
  1013. });
  1014. const plugins = [
  1015. unhead_KgADcZ0jPj,
  1016. plugin,
  1017. revive_payload_server_eJ33V7gbc6,
  1018. components_plugin_KR1HBZs4kY
  1019. ];
  1020. const RouteProvider = defineComponent({
  1021. props: {
  1022. vnode: {
  1023. type: Object,
  1024. required: true
  1025. },
  1026. route: {
  1027. type: Object,
  1028. required: true
  1029. },
  1030. vnodeRef: Object,
  1031. renderKey: String,
  1032. trackRootNodes: Boolean
  1033. },
  1034. setup(props) {
  1035. const previousKey = props.renderKey;
  1036. const previousRoute = props.route;
  1037. const route = {};
  1038. for (const key in props.route) {
  1039. Object.defineProperty(route, key, {
  1040. get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key],
  1041. enumerable: true
  1042. });
  1043. }
  1044. provide(PageRouteSymbol, shallowReactive(route));
  1045. return () => {
  1046. return h(props.vnode, { ref: props.vnodeRef });
  1047. };
  1048. }
  1049. });
  1050. const __nuxt_component_0 = defineComponent({
  1051. name: "NuxtPage",
  1052. inheritAttrs: false,
  1053. props: {
  1054. name: {
  1055. type: String
  1056. },
  1057. transition: {
  1058. type: [Boolean, Object],
  1059. default: void 0
  1060. },
  1061. keepalive: {
  1062. type: [Boolean, Object],
  1063. default: void 0
  1064. },
  1065. route: {
  1066. type: Object
  1067. },
  1068. pageKey: {
  1069. type: [Function, String],
  1070. default: null
  1071. }
  1072. },
  1073. setup(props, { attrs, slots, expose }) {
  1074. const nuxtApp = useNuxtApp();
  1075. const pageRef = ref();
  1076. const forkRoute = inject(PageRouteSymbol, null);
  1077. let previousPageKey;
  1078. expose({ pageRef });
  1079. inject(LayoutMetaSymbol, null);
  1080. let vnode;
  1081. const done = nuxtApp.deferHydration();
  1082. if (props.pageKey) {
  1083. watch(() => props.pageKey, (next, prev) => {
  1084. if (next !== prev) {
  1085. nuxtApp.callHook("page:loading:start");
  1086. }
  1087. });
  1088. }
  1089. return () => {
  1090. return h(RouterView, { name: props.name, route: props.route, ...attrs }, {
  1091. default: (routeProps) => {
  1092. if (!routeProps.Component) {
  1093. done();
  1094. return;
  1095. }
  1096. const key = generateRouteKey$1(routeProps, props.pageKey);
  1097. if (!nuxtApp.isHydrating && !hasChildrenRoutes(forkRoute, routeProps.route, routeProps.Component) && previousPageKey === key) {
  1098. nuxtApp.callHook("page:loading:end");
  1099. }
  1100. previousPageKey = key;
  1101. const hasTransition = !!(props.transition ?? routeProps.route.meta.pageTransition ?? appPageTransition);
  1102. const transitionProps = hasTransition && _mergeTransitionProps([
  1103. props.transition,
  1104. routeProps.route.meta.pageTransition,
  1105. appPageTransition,
  1106. { onAfterLeave: () => {
  1107. nuxtApp.callHook("page:transition:finish", routeProps.Component);
  1108. } }
  1109. ].filter(Boolean));
  1110. const keepaliveConfig = props.keepalive ?? routeProps.route.meta.keepalive ?? appKeepalive;
  1111. vnode = _wrapIf(
  1112. Transition,
  1113. hasTransition && transitionProps,
  1114. wrapInKeepAlive(
  1115. keepaliveConfig,
  1116. h(Suspense, {
  1117. suspensible: true,
  1118. onPending: () => nuxtApp.callHook("page:start", routeProps.Component),
  1119. onResolve: () => {
  1120. nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).then(() => nuxtApp.callHook("page:loading:end")).finally(done));
  1121. }
  1122. }, {
  1123. default: () => {
  1124. const providerVNode = h(RouteProvider, {
  1125. key: key || void 0,
  1126. vnode: slots.default ? h(Fragment, void 0, slots.default(routeProps)) : routeProps.Component,
  1127. route: routeProps.route,
  1128. renderKey: key || void 0,
  1129. trackRootNodes: hasTransition,
  1130. vnodeRef: pageRef
  1131. });
  1132. return providerVNode;
  1133. }
  1134. })
  1135. )
  1136. ).default();
  1137. return vnode;
  1138. }
  1139. });
  1140. };
  1141. }
  1142. });
  1143. function _mergeTransitionProps(routeProps) {
  1144. const _props = routeProps.map((prop) => ({
  1145. ...prop,
  1146. onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0
  1147. }));
  1148. return defu(..._props);
  1149. }
  1150. function hasChildrenRoutes(fork, newRoute, Component) {
  1151. if (!fork) {
  1152. return false;
  1153. }
  1154. const index = newRoute.matched.findIndex((m) => {
  1155. var _a;
  1156. return ((_a = m.components) == null ? void 0 : _a.default) === (Component == null ? void 0 : Component.type);
  1157. });
  1158. return index < newRoute.matched.length - 1;
  1159. }
  1160. const _export_sfc = (sfc, props) => {
  1161. const target = sfc.__vccOpts || sfc;
  1162. for (const [key, val] of props) {
  1163. target[key] = val;
  1164. }
  1165. return target;
  1166. };
  1167. const _sfc_main$2 = {};
  1168. function _sfc_ssrRender(_ctx, _push, _parent, _attrs) {
  1169. const _component_NuxtPage = __nuxt_component_0;
  1170. _push(`<div${ssrRenderAttrs(_attrs)}>`);
  1171. _push(ssrRenderComponent(_component_NuxtPage, null, null, _parent));
  1172. _push(`</div>`);
  1173. }
  1174. const _sfc_setup$2 = _sfc_main$2.setup;
  1175. _sfc_main$2.setup = (props, ctx) => {
  1176. const ssrContext = useSSRContext();
  1177. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("app.vue");
  1178. return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
  1179. };
  1180. const AppComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender]]);
  1181. const _sfc_main$1 = {
  1182. __name: "nuxt-error-page",
  1183. __ssrInlineRender: true,
  1184. props: {
  1185. error: Object
  1186. },
  1187. setup(__props) {
  1188. const props = __props;
  1189. const _error = props.error;
  1190. _error.stack ? _error.stack.split("\n").splice(1).map((line) => {
  1191. const text = line.replace("webpack:/", "").replace(".vue", ".js").trim();
  1192. return {
  1193. text,
  1194. internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise")
  1195. };
  1196. }).map((i) => `<span class="stack${i.internal ? " internal" : ""}">${i.text}</span>`).join("\n") : "";
  1197. const statusCode = Number(_error.statusCode || 500);
  1198. const is404 = statusCode === 404;
  1199. const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
  1200. const description = _error.message || _error.toString();
  1201. const stack = void 0;
  1202. const _Error404 = defineAsyncComponent(() => import('./error-404-Dj6KT2oP.mjs'));
  1203. const _Error = defineAsyncComponent(() => import('./error-500-B0Hn6rMk.mjs'));
  1204. const ErrorTemplate = is404 ? _Error404 : _Error;
  1205. return (_ctx, _push, _parent, _attrs) => {
  1206. _push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
  1207. };
  1208. }
  1209. };
  1210. const _sfc_setup$1 = _sfc_main$1.setup;
  1211. _sfc_main$1.setup = (props, ctx) => {
  1212. const ssrContext = useSSRContext();
  1213. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
  1214. return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
  1215. };
  1216. const _sfc_main = {
  1217. __name: "nuxt-root",
  1218. __ssrInlineRender: true,
  1219. setup(__props) {
  1220. const IslandRenderer = () => null;
  1221. const nuxtApp = useNuxtApp();
  1222. nuxtApp.deferHydration();
  1223. nuxtApp.ssrContext.url;
  1224. const SingleRenderer = false;
  1225. provide(PageRouteSymbol, useRoute());
  1226. nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
  1227. const error = useError();
  1228. const abortRender = error.value && !nuxtApp.ssrContext.error;
  1229. onErrorCaptured((err, target, info) => {
  1230. nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
  1231. {
  1232. const p = nuxtApp.runWithContext(() => showError(err));
  1233. onServerPrefetch(() => p);
  1234. return false;
  1235. }
  1236. });
  1237. const islandContext = nuxtApp.ssrContext.islandContext;
  1238. return (_ctx, _push, _parent, _attrs) => {
  1239. ssrRenderSuspense(_push, {
  1240. default: () => {
  1241. if (unref(abortRender)) {
  1242. _push(`<div></div>`);
  1243. } else if (unref(error)) {
  1244. _push(ssrRenderComponent(unref(_sfc_main$1), { error: unref(error) }, null, _parent));
  1245. } else if (unref(islandContext)) {
  1246. _push(ssrRenderComponent(unref(IslandRenderer), { context: unref(islandContext) }, null, _parent));
  1247. } else if (unref(SingleRenderer)) {
  1248. ssrRenderVNode(_push, createVNode(resolveDynamicComponent(unref(SingleRenderer)), null, null), _parent);
  1249. } else {
  1250. _push(ssrRenderComponent(unref(AppComponent), null, null, _parent));
  1251. }
  1252. },
  1253. _: 1
  1254. });
  1255. };
  1256. }
  1257. };
  1258. const _sfc_setup = _sfc_main.setup;
  1259. _sfc_main.setup = (props, ctx) => {
  1260. const ssrContext = useSSRContext();
  1261. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-root.vue");
  1262. return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
  1263. };
  1264. let entry;
  1265. {
  1266. entry = async function createNuxtAppServer(ssrContext) {
  1267. const vueApp = createApp(_sfc_main);
  1268. const nuxt = createNuxtApp({ vueApp, ssrContext });
  1269. try {
  1270. await applyPlugins(nuxt, plugins);
  1271. await nuxt.hooks.callHook("app:created", vueApp);
  1272. } catch (error) {
  1273. await nuxt.hooks.callHook("app:error", error);
  1274. nuxt.payload.error = nuxt.payload.error || createError(error);
  1275. }
  1276. if (ssrContext == null ? void 0 : ssrContext._renderResponse) {
  1277. throw new Error("skipping render");
  1278. }
  1279. return vueApp;
  1280. };
  1281. }
  1282. const entry$1 = (ssrContext) => entry(ssrContext);
  1283. export { _export_sfc as _, navigateTo as a, useNuxtApp as b, useRuntimeConfig as c, resolveUnrefHeadInput as d, entry$1 as default, injectHead as i, nuxtLinkDefaults as n, resolveRouteObject as r, useRouter as u };
  1284. //# sourceMappingURL=server.mjs.map