error-404-Dj6KT2oP.mjs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. import { mergeProps, withCtx, createTextVNode, toDisplayString, useSSRContext, defineComponent, ref, h, resolveComponent, computed } from 'vue';
  2. import { p as parseQuery, h as hasProtocol, j as joinURL, w as withTrailingSlash, a as withoutTrailingSlash } from '../routes/index.mjs';
  3. import { _ as _export_sfc, u as useRouter, n as nuxtLinkDefaults, r as resolveRouteObject, a as navigateTo, b as useNuxtApp, c as useRuntimeConfig } from './server.mjs';
  4. import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent } from 'vue/server-renderer';
  5. import { u as useHead } from './index-C2merokO.mjs';
  6. import 'node:http';
  7. import 'node:https';
  8. import 'node:fs';
  9. import 'node:path';
  10. import 'node:url';
  11. import '../routes/renderer.mjs';
  12. import 'vue-bundle-renderer/runtime';
  13. import 'devalue';
  14. import '@unhead/ssr';
  15. import 'unhead';
  16. import '@unhead/shared';
  17. import 'vue-router';
  18. async function preloadRouteComponents(to, router = useRouter()) {
  19. {
  20. return;
  21. }
  22. }
  23. const firstNonUndefined = (...args) => args.find((arg) => arg !== void 0);
  24. // @__NO_SIDE_EFFECTS__
  25. function defineNuxtLink(options) {
  26. const componentName = options.componentName || "NuxtLink";
  27. function resolveTrailingSlashBehavior(to, resolve) {
  28. if (!to || options.trailingSlash !== "append" && options.trailingSlash !== "remove") {
  29. return to;
  30. }
  31. if (typeof to === "string") {
  32. return applyTrailingSlashBehavior(to, options.trailingSlash);
  33. }
  34. const path = "path" in to && to.path !== void 0 ? to.path : resolve(to).path;
  35. const resolvedPath = {
  36. ...to,
  37. name: void 0,
  38. // named routes would otherwise always override trailing slash behavior
  39. path: applyTrailingSlashBehavior(path, options.trailingSlash)
  40. };
  41. return resolvedPath;
  42. }
  43. function useNuxtLink(props) {
  44. var _a, _b, _c;
  45. const router = useRouter();
  46. const config = useRuntimeConfig();
  47. const hasTarget = computed(() => !!props.target && props.target !== "_self");
  48. const isAbsoluteUrl = computed(() => {
  49. const path = props.to || props.href || "";
  50. return typeof path === "string" && hasProtocol(path, { acceptRelative: true });
  51. });
  52. const builtinRouterLink = resolveComponent("RouterLink");
  53. const useBuiltinLink = builtinRouterLink && typeof builtinRouterLink !== "string" ? builtinRouterLink.useLink : void 0;
  54. const isExternal = computed(() => {
  55. if (props.external) {
  56. return true;
  57. }
  58. const path = props.to || props.href || "";
  59. if (typeof path === "object") {
  60. return false;
  61. }
  62. return path === "" || isAbsoluteUrl.value;
  63. });
  64. const to = computed(() => {
  65. const path = props.to || props.href || "";
  66. if (isExternal.value) {
  67. return path;
  68. }
  69. return resolveTrailingSlashBehavior(path, router.resolve);
  70. });
  71. const link = isExternal.value ? void 0 : useBuiltinLink == null ? void 0 : useBuiltinLink({ ...props, to });
  72. const href = computed(() => {
  73. var _a3;
  74. var _a2;
  75. if (!to.value || isAbsoluteUrl.value) {
  76. return to.value;
  77. }
  78. if (isExternal.value) {
  79. const path = typeof to.value === "object" && "path" in to.value ? resolveRouteObject(to.value) : to.value;
  80. const href2 = typeof path === "object" ? router.resolve(path).href : path;
  81. return resolveTrailingSlashBehavior(
  82. href2,
  83. router.resolve
  84. /* will not be called */
  85. );
  86. }
  87. if (typeof to.value === "object") {
  88. return (_a3 = (_a2 = router.resolve(to.value)) == null ? void 0 : _a2.href) != null ? _a3 : null;
  89. }
  90. return resolveTrailingSlashBehavior(
  91. joinURL(config.app.baseURL, to.value),
  92. router.resolve
  93. /* will not be called */
  94. );
  95. });
  96. return {
  97. to,
  98. hasTarget,
  99. isAbsoluteUrl,
  100. isExternal,
  101. //
  102. href,
  103. isActive: (_a = link == null ? void 0 : link.isActive) != null ? _a : computed(() => to.value === router.currentRoute.value.path),
  104. isExactActive: (_b = link == null ? void 0 : link.isExactActive) != null ? _b : computed(() => to.value === router.currentRoute.value.path),
  105. route: (_c = link == null ? void 0 : link.route) != null ? _c : computed(() => router.resolve(to.value)),
  106. async navigate() {
  107. await navigateTo(href.value, { replace: props.replace, external: isExternal.value || hasTarget.value });
  108. }
  109. };
  110. }
  111. return defineComponent({
  112. name: componentName,
  113. props: {
  114. // Routing
  115. to: {
  116. type: [String, Object],
  117. default: void 0,
  118. required: false
  119. },
  120. href: {
  121. type: [String, Object],
  122. default: void 0,
  123. required: false
  124. },
  125. // Attributes
  126. target: {
  127. type: String,
  128. default: void 0,
  129. required: false
  130. },
  131. rel: {
  132. type: String,
  133. default: void 0,
  134. required: false
  135. },
  136. noRel: {
  137. type: Boolean,
  138. default: void 0,
  139. required: false
  140. },
  141. // Prefetching
  142. prefetch: {
  143. type: Boolean,
  144. default: void 0,
  145. required: false
  146. },
  147. prefetchOn: {
  148. type: [String, Object],
  149. default: void 0,
  150. required: false
  151. },
  152. noPrefetch: {
  153. type: Boolean,
  154. default: void 0,
  155. required: false
  156. },
  157. // Styling
  158. activeClass: {
  159. type: String,
  160. default: void 0,
  161. required: false
  162. },
  163. exactActiveClass: {
  164. type: String,
  165. default: void 0,
  166. required: false
  167. },
  168. prefetchedClass: {
  169. type: String,
  170. default: void 0,
  171. required: false
  172. },
  173. // Vue Router's `<RouterLink>` additional props
  174. replace: {
  175. type: Boolean,
  176. default: void 0,
  177. required: false
  178. },
  179. ariaCurrentValue: {
  180. type: String,
  181. default: void 0,
  182. required: false
  183. },
  184. // Edge cases handling
  185. external: {
  186. type: Boolean,
  187. default: void 0,
  188. required: false
  189. },
  190. // Slot API
  191. custom: {
  192. type: Boolean,
  193. default: void 0,
  194. required: false
  195. }
  196. },
  197. useLink: useNuxtLink,
  198. setup(props, { slots }) {
  199. const router = useRouter();
  200. const { to, href, navigate, isExternal, hasTarget, isAbsoluteUrl } = useNuxtLink(props);
  201. const prefetched = ref(false);
  202. const el = void 0;
  203. const elRef = void 0;
  204. function shouldPrefetch(mode) {
  205. var _a2, _b2;
  206. var _a, _b;
  207. return !prefetched.value && (typeof props.prefetchOn === "string" ? props.prefetchOn === mode : (_a2 = (_a = props.prefetchOn) == null ? void 0 : _a[mode]) != null ? _a2 : (_b = options.prefetchOn) == null ? void 0 : _b[mode]) && ((_b2 = props.prefetch) != null ? _b2 : options.prefetch) !== false && props.noPrefetch !== true && props.target !== "_blank" && !isSlowConnection();
  208. }
  209. async function prefetch(nuxtApp = useNuxtApp()) {
  210. if (prefetched.value) {
  211. return;
  212. }
  213. prefetched.value = true;
  214. const path = typeof to.value === "string" ? to.value : isExternal.value ? resolveRouteObject(to.value) : router.resolve(to.value).fullPath;
  215. await Promise.all([
  216. nuxtApp.hooks.callHook("link:prefetch", path).catch(() => {
  217. }),
  218. !isExternal.value && !hasTarget.value && preloadRouteComponents(to.value, router).catch(() => {
  219. })
  220. ]);
  221. }
  222. return () => {
  223. var _a;
  224. if (!isExternal.value && !hasTarget.value) {
  225. const routerLinkProps = {
  226. ref: elRef,
  227. to: to.value,
  228. activeClass: props.activeClass || options.activeClass,
  229. exactActiveClass: props.exactActiveClass || options.exactActiveClass,
  230. replace: props.replace,
  231. ariaCurrentValue: props.ariaCurrentValue,
  232. custom: props.custom
  233. };
  234. if (!props.custom) {
  235. if (shouldPrefetch("interaction")) {
  236. routerLinkProps.onPointerenter = prefetch.bind(null, void 0);
  237. routerLinkProps.onFocus = prefetch.bind(null, void 0);
  238. }
  239. if (prefetched.value) {
  240. routerLinkProps.class = props.prefetchedClass || options.prefetchedClass;
  241. }
  242. routerLinkProps.rel = props.rel || void 0;
  243. }
  244. return h(
  245. resolveComponent("RouterLink"),
  246. routerLinkProps,
  247. slots.default
  248. );
  249. }
  250. const target = props.target || null;
  251. const rel = firstNonUndefined(
  252. // converts `""` to `null` to prevent the attribute from being added as empty (`rel=""`)
  253. props.noRel ? "" : props.rel,
  254. options.externalRelAttribute,
  255. /*
  256. * A fallback rel of `noopener noreferrer` is applied for external links or links that open in a new tab.
  257. * This solves a reverse tabnapping security flaw in browsers pre-2021 as well as improving privacy.
  258. */
  259. isAbsoluteUrl.value || hasTarget.value ? "noopener noreferrer" : ""
  260. ) || null;
  261. if (props.custom) {
  262. if (!slots.default) {
  263. return null;
  264. }
  265. return slots.default({
  266. href: href.value,
  267. navigate,
  268. prefetch,
  269. get route() {
  270. if (!href.value) {
  271. return void 0;
  272. }
  273. const url = new URL(href.value, "http://localhost");
  274. return {
  275. path: url.pathname,
  276. fullPath: url.pathname,
  277. get query() {
  278. return parseQuery(url.search);
  279. },
  280. hash: url.hash,
  281. params: {},
  282. name: void 0,
  283. matched: [],
  284. redirectedFrom: void 0,
  285. meta: {},
  286. href: href.value
  287. };
  288. },
  289. rel,
  290. target,
  291. isExternal: isExternal.value || hasTarget.value,
  292. isActive: false,
  293. isExactActive: false
  294. });
  295. }
  296. return h("a", { ref: el, href: href.value || null, rel, target }, (_a = slots.default) == null ? void 0 : _a.call(slots));
  297. };
  298. }
  299. });
  300. }
  301. const __nuxt_component_0 = /* @__PURE__ */ defineNuxtLink(nuxtLinkDefaults);
  302. function applyTrailingSlashBehavior(to, trailingSlash) {
  303. const normalizeFn = trailingSlash === "append" ? withTrailingSlash : withoutTrailingSlash;
  304. const hasProtocolDifferentFromHttp = hasProtocol(to) && !to.startsWith("http");
  305. if (hasProtocolDifferentFromHttp) {
  306. return to;
  307. }
  308. return normalizeFn(to, true);
  309. }
  310. function isSlowConnection() {
  311. {
  312. return;
  313. }
  314. }
  315. const _sfc_main = {
  316. __name: "error-404",
  317. __ssrInlineRender: true,
  318. props: {
  319. appName: {
  320. type: String,
  321. default: "Nuxt"
  322. },
  323. version: {
  324. type: String,
  325. default: ""
  326. },
  327. statusCode: {
  328. type: Number,
  329. default: 404
  330. },
  331. statusMessage: {
  332. type: String,
  333. default: "Not Found"
  334. },
  335. description: {
  336. type: String,
  337. default: "Sorry, the page you are looking for could not be found."
  338. },
  339. backHome: {
  340. type: String,
  341. default: "Go back home"
  342. }
  343. },
  344. setup(__props) {
  345. const props = __props;
  346. useHead({
  347. title: `${props.statusCode} - ${props.statusMessage} | ${props.appName}`,
  348. script: [
  349. {
  350. children: `!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`
  351. }
  352. ],
  353. style: [
  354. {
  355. children: `*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }`
  356. }
  357. ]
  358. });
  359. return (_ctx, _push, _parent, _attrs) => {
  360. const _component_NuxtLink = __nuxt_component_0;
  361. _push(`<div${ssrRenderAttrs(mergeProps({ class: "antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black" }, _attrs))} data-v-00b6b518><div class="fixed left-0 right-0 spotlight z-10" data-v-00b6b518></div><div class="max-w-520px text-center z-20" data-v-00b6b518><h1 class="font-medium mb-8 sm:text-10xl text-8xl" data-v-00b6b518>${ssrInterpolate(__props.statusCode)}</h1><p class="font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl" data-v-00b6b518>${ssrInterpolate(__props.description)}</p><div class="flex items-center justify-center w-full" data-v-00b6b518>`);
  362. _push(ssrRenderComponent(_component_NuxtLink, {
  363. to: "/",
  364. class: "cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"
  365. }, {
  366. default: withCtx((_, _push2, _parent2, _scopeId) => {
  367. if (_push2) {
  368. _push2(`${ssrInterpolate(__props.backHome)}`);
  369. } else {
  370. return [
  371. createTextVNode(toDisplayString(__props.backHome), 1)
  372. ];
  373. }
  374. }),
  375. _: 1
  376. }, _parent));
  377. _push(`</div></div></div>`);
  378. };
  379. }
  380. };
  381. const _sfc_setup = _sfc_main.setup;
  382. _sfc_main.setup = (props, ctx) => {
  383. const ssrContext = useSSRContext();
  384. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/error-404.vue");
  385. return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
  386. };
  387. const error404 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-00b6b518"]]);
  388. export { error404 as default };
  389. //# sourceMappingURL=error-404-Dj6KT2oP.mjs.map