nuxt-graphql-middleware 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/client/200.html +8 -8
  2. package/dist/client/404.html +8 -8
  3. package/dist/client/_nuxt/{lIgCBhS_.js → CPiV13Ng.js} +1 -1
  4. package/dist/client/_nuxt/CQCiRbEL.js +1 -0
  5. package/dist/client/_nuxt/{CROlboVl.js → CYI2eNUl.js} +1 -1
  6. package/dist/client/_nuxt/UAIVpYSK.js +25 -0
  7. package/dist/client/_nuxt/builds/latest.json +1 -1
  8. package/dist/client/_nuxt/builds/meta/48332277-c4ad-4d6a-8f09-7a58a109c32d.json +1 -0
  9. package/dist/client/_nuxt/error-404.Bbd2eCoc.css +1 -0
  10. package/dist/client/_nuxt/error-500.Cd2cwFc3.css +1 -0
  11. package/dist/client/_nuxt/{FTbv7CO6.js → u1b7LyOw.js} +1 -1
  12. package/dist/client/index.html +8 -8
  13. package/dist/module.d.mts +1 -1
  14. package/dist/module.json +2 -2
  15. package/dist/module.mjs +141 -46
  16. package/dist/runtime/composables/nuxtApp.d.ts +30 -2
  17. package/dist/runtime/composables/nuxtApp.js +66 -24
  18. package/dist/runtime/composables/useAsyncGraphqlQuery.js +28 -25
  19. package/dist/runtime/composables/useGraphqlMutation.d.ts +1 -1
  20. package/dist/runtime/composables/useGraphqlMutation.js +11 -16
  21. package/dist/runtime/composables/useGraphqlQuery.d.ts +1 -1
  22. package/dist/runtime/composables/useGraphqlQuery.js +7 -25
  23. package/dist/runtime/composables/useGraphqlUploadMutation.js +1 -1
  24. package/dist/runtime/helpers/ClientCache.d.ts +1 -0
  25. package/dist/runtime/helpers/ClientCache.js +12 -0
  26. package/dist/runtime/helpers/composables.d.ts +8 -0
  27. package/dist/runtime/helpers/composables.js +27 -0
  28. package/dist/runtime/helpers/index.d.ts +0 -4
  29. package/dist/runtime/helpers/index.js +0 -13
  30. package/dist/runtime/helpers/queryEncoding.d.ts +11 -0
  31. package/dist/runtime/helpers/queryEncoding.js +89 -0
  32. package/dist/runtime/plugins/devMode.js +2 -1
  33. package/dist/runtime/server/api/query.js +5 -7
  34. package/dist/runtime/server/utils/useGraphqlQuery.js +2 -2
  35. package/dist/runtime/settings/index.d.ts +1 -0
  36. package/dist/runtime/settings/index.js +1 -0
  37. package/dist/shared/{nuxt-graphql-middleware.cXfDI4U3.d.mts → nuxt-graphql-middleware.-BeiPV4H.d.mts} +49 -0
  38. package/dist/utils.d.mts +1 -1
  39. package/package.json +7 -7
  40. package/dist/client/_nuxt/BM34SYth.js +0 -1
  41. package/dist/client/_nuxt/D5hBL5aZ.js +0 -25
  42. package/dist/client/_nuxt/builds/meta/83f9fcd5-bd28-4608-b499-05e08fe0f7d0.json +0 -1
  43. package/dist/client/_nuxt/error-404.ehK72JOs.css +0 -1
  44. package/dist/client/_nuxt/error-500._g0akJim.css +0 -1
@@ -1,4 +1,9 @@
1
1
  import { CLIENT_CONTEXT_PREFIX } from "../settings/index.js";
2
+ import { GraphqlMiddlewareCache } from "./ClientCache.js";
3
+ import {
4
+ clientCacheEnabledAtBuild,
5
+ importMetaServer
6
+ } from "#nuxt-graphql-middleware/config";
2
7
  export function encodeContext(context) {
3
8
  return Object.entries(context).reduce(
4
9
  (acc, [key, value]) => {
@@ -10,3 +15,25 @@ export function encodeContext(context) {
10
15
  {}
11
16
  );
12
17
  }
18
+ export function sortQueryParams(obj) {
19
+ const sortedKeys = Object.keys(obj).sort();
20
+ const sortedObj = {};
21
+ for (const key of sortedKeys) {
22
+ sortedObj[key] = obj[key];
23
+ }
24
+ return sortedObj;
25
+ }
26
+ export function getOrCreateClientCache(app, config) {
27
+ if (importMetaServer || !clientCacheEnabledAtBuild) {
28
+ return;
29
+ }
30
+ if (!config.graphqlMiddleware.clientCacheEnabled) {
31
+ return;
32
+ }
33
+ if (!app.$graphqlCache) {
34
+ app.$graphqlCache = new GraphqlMiddlewareCache(
35
+ config.graphqlMiddleware.clientCacheMaxSize
36
+ );
37
+ }
38
+ return app.$graphqlCache;
39
+ }
@@ -5,7 +5,3 @@
5
5
  * items.filter(falsy)
6
6
  */
7
7
  export declare function falsy<T>(value: T): value is NonNullable<T>;
8
- /**
9
- * Get the parameters for the GraphQL middleware query.
10
- */
11
- export declare function buildRequestParams(variables?: Record<string, any> | undefined | null): Record<string, any>;
@@ -1,16 +1,3 @@
1
1
  export function falsy(value) {
2
2
  return value !== null && value !== void 0;
3
3
  }
4
- export function buildRequestParams(variables) {
5
- if (typeof variables !== "object" || !variables) {
6
- return {};
7
- }
8
- for (const key in variables) {
9
- if (typeof variables[key] !== "string") {
10
- return {
11
- __variables: JSON.stringify(variables)
12
- };
13
- }
14
- }
15
- return variables;
16
- }
@@ -0,0 +1,11 @@
1
+ export declare function encodeVariables(variables?: Record<string, any> | null): Record<string, any>;
2
+ /**
3
+ * Get the variables from query parameters.
4
+ *
5
+ * For simple cases with type prefixes:
6
+ * ?name=Jon&n:age=20&b:isUser=false
7
+ *
8
+ * In complex cases, the entire variables are sent as a JSON encoded string:
9
+ * ?__variables=%7B%22foobar%22:%7B%22path%22:%22%22%7D%7D
10
+ */
11
+ export declare function decodeVariables(query: Record<string, any>, validKeys?: string[]): any;
@@ -0,0 +1,89 @@
1
+ import { experimentalQueryParamEncoding } from "#nuxt-graphql-middleware/config";
2
+ import { CLIENT_CONTEXT_PREFIX, OPERATION_HASH_PREFIX } from "../settings/index.js";
3
+ export function encodeVariables(variables) {
4
+ if (typeof variables !== "object" || !variables) {
5
+ return {};
6
+ }
7
+ if (!experimentalQueryParamEncoding) {
8
+ for (const key in variables) {
9
+ if (typeof variables[key] !== "string") {
10
+ return {
11
+ __variables: JSON.stringify(variables)
12
+ };
13
+ }
14
+ }
15
+ return variables;
16
+ }
17
+ const result = {};
18
+ let needsFallback = false;
19
+ for (const key in variables) {
20
+ const value = variables[key];
21
+ const type = typeof value;
22
+ if (type === "string") {
23
+ result[key] = value;
24
+ } else if (type === "number") {
25
+ result[`n:${key}`] = String(value);
26
+ } else if (type === "boolean") {
27
+ result[`b:${key}`] = String(value);
28
+ } else {
29
+ needsFallback = true;
30
+ break;
31
+ }
32
+ }
33
+ if (needsFallback) {
34
+ return {
35
+ __variables: JSON.stringify(variables)
36
+ };
37
+ }
38
+ return result;
39
+ }
40
+ function filterValidKeys(validKeys, obj) {
41
+ return validKeys.reduce((acc, key) => {
42
+ const value = obj[key];
43
+ if (value !== void 0 && value !== null) {
44
+ acc[key] = value;
45
+ }
46
+ return acc;
47
+ }, {});
48
+ }
49
+ export function decodeVariables(query, validKeys) {
50
+ try {
51
+ if (query.__variables && typeof query.__variables === "string") {
52
+ return JSON.parse(query.__variables);
53
+ }
54
+ } catch {
55
+ }
56
+ if (!experimentalQueryParamEncoding) {
57
+ if (validKeys) {
58
+ return filterValidKeys(validKeys, query);
59
+ }
60
+ return query;
61
+ }
62
+ if (validKeys && validKeys.length === 0) {
63
+ return {};
64
+ }
65
+ const result = {};
66
+ for (const key in query) {
67
+ if (key.startsWith(CLIENT_CONTEXT_PREFIX) || key.startsWith(OPERATION_HASH_PREFIX)) {
68
+ continue;
69
+ } else if (key.startsWith("n:")) {
70
+ const actualKey = key.substring(2);
71
+ if (validKeys && !validKeys.includes(actualKey)) {
72
+ continue;
73
+ }
74
+ result[actualKey] = Number(query[key]);
75
+ } else if (key.startsWith("b:")) {
76
+ const actualKey = key.substring(2);
77
+ if (validKeys && !validKeys.includes(actualKey)) {
78
+ continue;
79
+ }
80
+ result[actualKey] = query[key] === "true";
81
+ } else if (key !== "__variables") {
82
+ if (validKeys && !validKeys.includes(key)) {
83
+ continue;
84
+ }
85
+ result[key] = query[key];
86
+ }
87
+ }
88
+ return result;
89
+ }
@@ -1,6 +1,7 @@
1
1
  import { defineNuxtPlugin, useState } from "#imports";
2
2
  import { createApp } from "vue";
3
3
  import DevModeOverlay from "../components/DevModeOverlay.vue";
4
+ import { importMetaClient } from "#nuxt-graphql-middleware/config";
4
5
  export default defineNuxtPlugin({
5
6
  name: "nuxt-graphql-middleware:dev-mode",
6
7
  setup(nuxtApp) {
@@ -11,7 +12,7 @@ export default defineNuxtPlugin({
11
12
  nuxtApp.hook("nuxt-graphql-middleware:errors", (value) => {
12
13
  errors.value.push(value);
13
14
  });
14
- if (import.meta.client) {
15
+ if (importMetaClient) {
15
16
  nuxtApp.hook("app:mounted", () => {
16
17
  const container = document.createElement("div");
17
18
  document.body.appendChild(container);
@@ -1,13 +1,10 @@
1
1
  import { defineEventHandler, getQuery, getRouterParam } from "h3";
2
- import {
3
- queryParamToVariables,
4
- extractRequestContext,
5
- isValidQuery,
6
- throwError
7
- } from "./../helpers/index.js";
2
+ import { extractRequestContext, isValidQuery, throwError } from "./../helpers/index.js";
8
3
  import { GraphqlMiddlewareOperation } from "./../../settings/index.js";
9
4
  import { documents } from "#nuxt-graphql-middleware/documents";
10
5
  import { doGraphqlRequest } from "../utils/doGraphqlRequest.js";
6
+ import { decodeVariables } from "../../helpers/queryEncoding.js";
7
+ import { operationVariables } from "#nuxt-graphql-middleware/operation-variables";
11
8
  export default defineEventHandler(async (event) => {
12
9
  const operationName = getRouterParam(event, "name");
13
10
  if (!isValidQuery(operationName)) {
@@ -16,7 +13,8 @@ export default defineEventHandler(async (event) => {
16
13
  const operationDocument = documents.query[operationName];
17
14
  const queryParams = getQuery(event);
18
15
  const context = extractRequestContext(queryParams);
19
- const variables = queryParamToVariables(queryParams);
16
+ const validVariableKeys = operationVariables[operationName];
17
+ const variables = decodeVariables(queryParams, validVariableKeys);
20
18
  return doGraphqlRequest(
21
19
  {
22
20
  query: operationDocument,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  encodeContext
3
3
  } from "./../../helpers/composables.js";
4
- import { buildRequestParams } from "./../../helpers/index.js";
4
+ import { encodeVariables } from "./../../helpers/queryEncoding.js";
5
5
  import { performRequest } from "./index.js";
6
6
  export function useGraphqlQuery(...args) {
7
7
  const [name, variables, fetchOptions = {}, clientContext = {}] = typeof args[0] === "string" ? [args[0], args[1], args[2]?.fetchOptions, args[2]?.clientContext] : [
@@ -14,7 +14,7 @@ export function useGraphqlQuery(...args) {
14
14
  ...fetchOptions,
15
15
  params: {
16
16
  ...fetchOptions.params || {},
17
- ...buildRequestParams(variables),
17
+ ...encodeVariables(variables),
18
18
  ...encodeContext(clientContext)
19
19
  }
20
20
  });
@@ -3,3 +3,4 @@ export declare enum GraphqlMiddlewareOperation {
3
3
  Mutation = "mutation"
4
4
  }
5
5
  export declare const CLIENT_CONTEXT_PREFIX = "__gqlc_";
6
+ export declare const OPERATION_HASH_PREFIX = "__gqlh";
@@ -4,3 +4,4 @@ export var GraphqlMiddlewareOperation = /* @__PURE__ */ ((GraphqlMiddlewareOpera
4
4
  return GraphqlMiddlewareOperation2;
5
5
  })(GraphqlMiddlewareOperation || {});
6
6
  export const CLIENT_CONTEXT_PREFIX = "__gqlc_";
7
+ export const OPERATION_HASH_PREFIX = "__gqlh";
@@ -169,15 +169,64 @@ interface ModuleOptions {
169
169
  };
170
170
  /**
171
171
  * Enable Nuxt DevTools integration.
172
+ *
173
+ * @default true
172
174
  */
173
175
  devtools?: boolean;
174
176
  /**
175
177
  * Client caching configuration.
176
178
  */
177
179
  clientCache?: {
180
+ /**
181
+ * Whether client caching should be enabled.
182
+ *
183
+ * Note that if you set this to false during build, the cache will not be
184
+ * available at all. If you intend to enable/disable it using app config at
185
+ * runtime, it *must* be enabled at build!
186
+ *
187
+ * @default false
188
+ */
178
189
  enabled?: boolean;
190
+ /**
191
+ * The maximum number of cache entries.
192
+ *
193
+ * @default 100
194
+ */
179
195
  maxSize?: number;
180
196
  };
197
+ /**
198
+ * Experimental features.
199
+ */
200
+ experimental?: {
201
+ /**
202
+ * Enables improved encoding for GraphQL query param encoding.
203
+ *
204
+ * If enabled, query variables that are non-strings such as numbers or
205
+ * booleans are encoded as strings, with a prefix in their name to indicate
206
+ * the type.
207
+ *
208
+ * For example, given this object definining query variables:
209
+ *
210
+ * ```
211
+ * {
212
+ * name: 'John',
213
+ * age: 35,
214
+ * isUser: false
215
+ * }
216
+ * ```
217
+ *
218
+ * This would be encoded as:
219
+ *
220
+ * ```
221
+ * name=John&n:age=35&b:isUser=false
222
+ * ```
223
+ *
224
+ * This only works for flat primitive values. Nested objects or arrays are
225
+ * still encoded using the __variables fallback where all variables are
226
+ * JSON encoded.
227
+ */
228
+ improvedQueryParamEncoding?: boolean;
229
+ };
181
230
  }
182
231
 
183
232
  declare const defaultOptions: ModuleOptions;
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { M as ModuleContext } from './shared/nuxt-graphql-middleware.cXfDI4U3.mjs';
1
+ import { M as ModuleContext } from './shared/nuxt-graphql-middleware.-BeiPV4H.mjs';
2
2
  import 'graphql';
3
3
  import 'nuxt/schema';
4
4
  import '@nuxt/kit';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Module to perform GraphQL requests as a server middleware.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -73,25 +73,25 @@
73
73
  "@graphql-codegen/schema-ast": "^4.1.0",
74
74
  "@graphql-tools/utils": "^10.8.6",
75
75
  "@nuxt/devtools-kit": "^2.3.1",
76
- "graphql-typescript-deluxe": "^0.0.13",
76
+ "graphql-typescript-deluxe": "^0.0.14",
77
77
  "minisearch": "^7.1.2",
78
78
  "picocolors": "^1.1.1"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@iconify-json/carbon": "^1.2.8",
82
- "@nuxt/devtools": "^2.3.1",
83
- "@nuxt/devtools-ui-kit": "^2.3.1",
82
+ "@nuxt/devtools": "^2.4.0",
83
+ "@nuxt/devtools-ui-kit": "^2.4.0",
84
84
  "@nuxt/eslint": "^1.2.0",
85
- "@nuxt/kit": "^3.16.2",
85
+ "@nuxt/kit": "^3.17.2",
86
86
  "@nuxt/module-builder": "^1.0.1",
87
- "@nuxt/schema": "^3.16.2",
87
+ "@nuxt/schema": "^3.17.2",
88
88
  "@types/micromatch": "^4.0.9",
89
89
  "cypress": "^13.12.0",
90
90
  "eslint": "^9.23.0",
91
91
  "eslint-config-prettier": "^10.1.1",
92
92
  "eslint-plugin-prettier": "^5.2.3",
93
93
  "mermaid": "^11.5.0",
94
- "nuxt": "^3.16.2",
94
+ "nuxt": "^3.17.2",
95
95
  "postcss": "^8.5.3",
96
96
  "postcss-cli": "^11.0.1",
97
97
  "postcss-import": "^16.1.0",
@@ -1 +0,0 @@
1
- import{u as P,d as B,r as R,a as N,o as T,b as H,c as I,e as U,f as M,h as q,g as A,p as V,i as z,j as x,k as O,l as F,m as D,n as $,w as W,q as G,s as K,_ as Q,t as J,v as X,x as S,y as C,z as Y,A as Z,B as ee}from"./D5hBL5aZ.js";import{u as te}from"./FTbv7CO6.js";async function E(t,n=P()){const{path:d,matched:h}=n.resolve(t);if(!h.length||(n._routePreloaded||(n._routePreloaded=new Set),n._routePreloaded.has(d)))return;const v=n._preloadPromises||(n._preloadPromises=[]);if(v.length>4)return Promise.all(v).then(()=>E(t,n));n._routePreloaded.add(d);const e=h.map(a=>{var u;return(u=a.components)==null?void 0:u.default}).filter(a=>typeof a=="function");for(const a of e){const u=Promise.resolve(a()).catch(()=>{}).finally(()=>v.splice(v.indexOf(u)));v.push(u)}await Promise.all(v)}const ne=(...t)=>t.find(n=>n!==void 0);function ae(t){const n=t.componentName||"NuxtLink";function d(e){return typeof e=="string"&&e.startsWith("#")}function h(e,a){if(!e||t.trailingSlash!=="append"&&t.trailingSlash!=="remove")return e;if(typeof e=="string")return j(e,t.trailingSlash);const u="path"in e&&e.path!==void 0?e.path:a(e).path;return{...e,name:void 0,path:j(u,t.trailingSlash)}}function v(e){const a=P(),u=D(),s=x(()=>!!e.target&&e.target!=="_self"),p=x(()=>{const f=e.to||e.href||"";return typeof f=="string"&&O(f,{acceptRelative:!0})}),_=A("RouterLink"),b=typeof _!="string"?_.useLink:void 0,m=x(()=>{if(e.external)return!0;const f=e.to||e.href||"";return typeof f=="object"?!1:f===""||p.value}),r=x(()=>{const f=e.to||e.href||"";return m.value?f:h(f,a.resolve)}),c=m.value||b==null?void 0:b({...e,to:r}),y=x(()=>{var f;if(!r.value||p.value||d(r.value))return r.value;if(m.value){const k=typeof r.value=="object"&&"path"in r.value?z(r.value):r.value,w=typeof k=="object"?a.resolve(k).href:k;return h(w,a.resolve)}return typeof r.value=="object"?((f=a.resolve(r.value))==null?void 0:f.href)??null:h(F(u.app.baseURL,r.value),a.resolve)});return{to:r,hasTarget:s,isAbsoluteUrl:p,isExternal:m,href:y,isActive:(c==null?void 0:c.isActive)??x(()=>r.value===a.currentRoute.value.path),isExactActive:(c==null?void 0:c.isExactActive)??x(()=>r.value===a.currentRoute.value.path),route:(c==null?void 0:c.route)??x(()=>a.resolve(r.value)),async navigate(f){await $(y.value,{replace:e.replace,external:m.value||s.value})}}}return B({name:n,props:{to:{type:[String,Object],default:void 0,required:!1},href:{type:[String,Object],default:void 0,required:!1},target:{type:String,default:void 0,required:!1},rel:{type:String,default:void 0,required:!1},noRel:{type:Boolean,default:void 0,required:!1},prefetch:{type:Boolean,default:void 0,required:!1},prefetchOn:{type:[String,Object],default:void 0,required:!1},noPrefetch:{type:Boolean,default:void 0,required:!1},activeClass:{type:String,default:void 0,required:!1},exactActiveClass:{type:String,default:void 0,required:!1},prefetchedClass:{type:String,default:void 0,required:!1},replace:{type:Boolean,default:void 0,required:!1},ariaCurrentValue:{type:String,default:void 0,required:!1},external:{type:Boolean,default:void 0,required:!1},custom:{type:Boolean,default:void 0,required:!1}},useLink:v,setup(e,{slots:a}){const u=P(),{to:s,href:p,navigate:_,isExternal:b,hasTarget:m,isAbsoluteUrl:r}=v(e),c=R(!1),y=R(null),f=o=>{var l;y.value=e.custom?(l=o==null?void 0:o.$el)==null?void 0:l.nextElementSibling:o==null?void 0:o.$el};function k(o){var l,i;return!c.value&&(typeof e.prefetchOn=="string"?e.prefetchOn===o:((l=e.prefetchOn)==null?void 0:l[o])??((i=t.prefetchOn)==null?void 0:i[o]))&&(e.prefetch??t.prefetch)!==!1&&e.noPrefetch!==!0&&e.target!=="_blank"&&!se()}async function w(o=N()){if(c.value)return;c.value=!0;const l=typeof s.value=="string"?s.value:b.value?z(s.value):u.resolve(s.value).fullPath,i=b.value?new URL(l,window.location.href).href:l;await Promise.all([o.hooks.callHook("link:prefetch",i).catch(()=>{}),!b.value&&!m.value&&E(s.value,u).catch(()=>{})])}if(k("visibility")){const o=N();let l,i=null;T(()=>{const g=oe();H(()=>{l=I(()=>{var L;(L=y==null?void 0:y.value)!=null&&L.tagName&&(i=g.observe(y.value,async()=>{i==null||i(),i=null,await w(o)}))})})}),U(()=>{l&&M(l),i==null||i(),i=null})}return()=>{var i;if(!b.value&&!m.value&&!d(s.value)){const g={ref:f,to:s.value,activeClass:e.activeClass||t.activeClass,exactActiveClass:e.exactActiveClass||t.exactActiveClass,replace:e.replace,ariaCurrentValue:e.ariaCurrentValue,custom:e.custom};return e.custom||(k("interaction")&&(g.onPointerenter=w.bind(null,void 0),g.onFocus=w.bind(null,void 0)),c.value&&(g.class=e.prefetchedClass||t.prefetchedClass),g.rel=e.rel||void 0),q(A("RouterLink"),g,a.default)}const o=e.target||null,l=ne(e.noRel?"":e.rel,t.externalRelAttribute,r.value||m.value?"noopener noreferrer":"")||null;return e.custom?a.default?a.default({href:p.value,navigate:_,prefetch:w,get route(){if(!p.value)return;const g=new URL(p.value,window.location.href);return{path:g.pathname,fullPath:g.pathname,get query(){return V(g.search)},hash:g.hash,params:{},name:void 0,matched:[],redirectedFrom:void 0,meta:{},href:p.value}},rel:l,target:o,isExternal:b.value||m.value,isActive:!1,isExactActive:!1}):null:q("a",{ref:y,href:p.value||null,rel:l,target:o},(i=a.default)==null?void 0:i.call(a))}}})}const re=ae(K);function j(t,n){const d=n==="append"?W:G;return O(t)&&!t.startsWith("http")?t:d(t,!0)}function oe(){const t=N();if(t._observer)return t._observer;let n=null;const d=new Map,h=(e,a)=>(n||(n=new IntersectionObserver(u=>{for(const s of u){const p=d.get(s.target);(s.isIntersecting||s.intersectionRatio>0)&&p&&p()}})),d.set(e,a),n.observe(e),()=>{d.delete(e),n==null||n.unobserve(e),d.size===0&&(n==null||n.disconnect(),n=null)});return t._observer={observe:h}}const ie=/2g/;function se(){const t=navigator.connection;return!!(t&&(t.saveData||ie.test(t.effectiveType)))}const le={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},ue={class:"max-w-520px text-center z-20"},ce=["textContent"],fe=["textContent"],de={class:"flex items-center justify-center w-full"},he={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const n=t;return te({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{innerHTML:`!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)}}();`}],style:[{innerHTML:'*,: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: }'}]}),(d,h)=>{const v=re;return X(),J("div",le,[h[0]||(h[0]=S("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),S("div",ue,[S("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:C(t.statusCode)},null,8,ce),S("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:C(t.description)},null,8,fe),S("div",de,[Y(v,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:Z(()=>[ee(C(t.backHome),1)]),_:1})])])])}}},ge=Q(he,[["__scopeId","data-v-1c9f6778"]]);export{ge as default};