error-404-Dj6KT2oP.js 15 KB

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