server.mjs 47 KB

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