{"version":3,"file":"nuxt-link.95622040.js","sources":["../../../../node_modules/nuxt/dist/app/compat/idle-callback.mjs","../../../../node_modules/nuxt/dist/app/composables/ready.mjs","../../../../node_modules/nuxt/dist/app/composables/preload.mjs","../../../../node_modules/nuxt/dist/app/components/nuxt-link.mjs"],"sourcesContent":["export const requestIdleCallback = process.server ? () => {\n} : globalThis.requestIdleCallback || ((cb) => {\n const start = Date.now();\n const idleDeadline = {\n didTimeout: false,\n timeRemaining: () => Math.max(0, 50 - (Date.now() - start))\n };\n return setTimeout(() => {\n cb(idleDeadline);\n }, 1);\n});\nexport const cancelIdleCallback = process.server ? () => {\n} : globalThis.cancelIdleCallback || ((id) => {\n clearTimeout(id);\n});\n","import { useNuxtApp } from \"../nuxt.mjs\";\nimport { requestIdleCallback } from \"../compat/idle-callback.mjs\";\nexport const onNuxtReady = (callback) => {\n if (process.server) {\n return;\n }\n const nuxtApp = useNuxtApp();\n if (nuxtApp.isHydrating) {\n nuxtApp.hooks.hookOnce(\"app:suspense:resolve\", () => {\n requestIdleCallback(callback);\n });\n } else {\n requestIdleCallback(callback);\n }\n};\n","import { useNuxtApp } from \"../nuxt.mjs\";\nimport { useRouter } from \"./router.mjs\";\nexport const preloadComponents = async (components) => {\n if (process.server) {\n return;\n }\n const nuxtApp = useNuxtApp();\n components = Array.isArray(components) ? components : [components];\n await Promise.all(components.map((name) => _loadAsyncComponent(nuxtApp.vueApp._context.components[name])));\n};\nexport const prefetchComponents = (components) => {\n return preloadComponents(components);\n};\nfunction _loadAsyncComponent(component) {\n if (component?.__asyncLoader && !component.__asyncResolved) {\n return component.__asyncLoader();\n }\n}\nexport async function preloadRouteComponents(to, router = useRouter()) {\n if (process.server) {\n return;\n }\n if (!router._routePreloaded) {\n router._routePreloaded = /* @__PURE__ */ new Set();\n }\n if (router._routePreloaded.has(to)) {\n return;\n }\n const promises = router._preloadPromises = router._preloadPromises || [];\n if (promises.length > 4) {\n return Promise.all(promises).then(() => preloadRouteComponents(to, router));\n }\n router._routePreloaded.add(to);\n const components = router.resolve(to).matched.map((component) => component.components?.default).filter((component) => typeof component === \"function\");\n for (const component of components) {\n const promise = Promise.resolve(component()).catch(() => {\n }).finally(() => promises.splice(promises.indexOf(promise)));\n promises.push(promise);\n }\n await Promise.all(promises);\n}\n","import { defineComponent, h, ref, resolveComponent, computed, onMounted, onBeforeUnmount } from \"vue\";\nimport { hasProtocol, parseQuery, parseURL } from \"ufo\";\nimport { preloadRouteComponents } from \"../composables/preload.mjs\";\nimport { onNuxtReady } from \"../composables/ready.mjs\";\nimport { navigateTo, useRouter } from \"../composables/router.mjs\";\nimport { useNuxtApp } from \"../nuxt.mjs\";\nimport { cancelIdleCallback, requestIdleCallback } from \"../compat/idle-callback.mjs\";\nconst firstNonUndefined = (...args) => args.find((arg) => arg !== void 0);\nconst DEFAULT_EXTERNAL_REL_ATTRIBUTE = \"noopener noreferrer\";\nexport function defineNuxtLink(options) {\n const componentName = options.componentName || \"NuxtLink\";\n const checkPropConflicts = (props, main, sub) => {\n if (process.dev && props[main] !== void 0 && props[sub] !== void 0) {\n console.warn(`[${componentName}] \\`${main}\\` and \\`${sub}\\` cannot be used together. \\`${sub}\\` will be ignored.`);\n }\n };\n return defineComponent({\n name: componentName,\n props: {\n // Routing\n to: {\n type: [String, Object],\n default: void 0,\n required: false\n },\n href: {\n type: [String, Object],\n default: void 0,\n required: false\n },\n // Attributes\n target: {\n type: String,\n default: void 0,\n required: false\n },\n rel: {\n type: String,\n default: void 0,\n required: false\n },\n noRel: {\n type: Boolean,\n default: void 0,\n required: false\n },\n // Prefetching\n prefetch: {\n type: Boolean,\n default: void 0,\n required: false\n },\n noPrefetch: {\n type: Boolean,\n default: void 0,\n required: false\n },\n // Styling\n activeClass: {\n type: String,\n default: void 0,\n required: false\n },\n exactActiveClass: {\n type: String,\n default: void 0,\n required: false\n },\n prefetchedClass: {\n type: String,\n default: void 0,\n required: false\n },\n // Vue Router's `` additional props\n replace: {\n type: Boolean,\n default: void 0,\n required: false\n },\n ariaCurrentValue: {\n type: String,\n default: void 0,\n required: false\n },\n // Edge cases handling\n external: {\n type: Boolean,\n default: void 0,\n required: false\n },\n // Slot API\n custom: {\n type: Boolean,\n default: void 0,\n required: false\n }\n },\n setup(props, { slots }) {\n const router = useRouter();\n const to = computed(() => {\n checkPropConflicts(props, \"to\", \"href\");\n return props.to || props.href || \"\";\n });\n const isExternal = computed(() => {\n if (props.external) {\n return true;\n }\n if (props.target && props.target !== \"_self\") {\n return true;\n }\n if (typeof to.value === \"object\") {\n return false;\n }\n return to.value === \"\" || hasProtocol(to.value, true);\n });\n const prefetched = ref(false);\n const el = process.server ? void 0 : ref(null);\n if (process.client) {\n checkPropConflicts(props, \"prefetch\", \"noPrefetch\");\n const shouldPrefetch = props.prefetch !== false && props.noPrefetch !== true && props.target !== \"_blank\" && !isSlowConnection();\n if (shouldPrefetch) {\n const nuxtApp = useNuxtApp();\n let idleId;\n let unobserve = null;\n onMounted(() => {\n const observer = useObserver();\n onNuxtReady(() => {\n idleId = requestIdleCallback(() => {\n if (el?.value?.tagName) {\n unobserve = observer.observe(el.value, async () => {\n unobserve?.();\n unobserve = null;\n const path = typeof to.value === \"string\" ? to.value : router.resolve(to.value).fullPath;\n await Promise.all([\n nuxtApp.hooks.callHook(\"link:prefetch\", path).catch(() => {\n }),\n !isExternal.value && preloadRouteComponents(to.value, router).catch(() => {\n })\n ]);\n prefetched.value = true;\n });\n }\n });\n });\n });\n onBeforeUnmount(() => {\n if (idleId) {\n cancelIdleCallback(idleId);\n }\n unobserve?.();\n unobserve = null;\n });\n }\n }\n return () => {\n if (!isExternal.value) {\n return h(\n resolveComponent(\"RouterLink\"),\n {\n ref: process.server ? void 0 : (ref2) => {\n el.value = ref2?.$el;\n },\n to: to.value,\n ...prefetched.value && !props.custom ? { class: props.prefetchedClass || options.prefetchedClass } : {},\n activeClass: props.activeClass || options.activeClass,\n exactActiveClass: props.exactActiveClass || options.exactActiveClass,\n replace: props.replace,\n ariaCurrentValue: props.ariaCurrentValue,\n custom: props.custom,\n rel: props.rel\n },\n slots.default\n );\n }\n const href = typeof to.value === \"object\" ? router.resolve(to.value)?.href ?? null : to.value || null;\n const target = props.target || null;\n checkPropConflicts(props, \"noRel\", \"rel\");\n const rel = props.noRel ? null : firstNonUndefined(props.rel, options.externalRelAttribute, href ? DEFAULT_EXTERNAL_REL_ATTRIBUTE : \"\") || null;\n const navigate = () => navigateTo(href, { replace: props.replace });\n if (props.custom) {\n if (!slots.default) {\n return null;\n }\n return slots.default({\n href,\n navigate,\n get route() {\n if (!href) {\n return void 0;\n }\n const url = parseURL(href);\n return {\n path: url.pathname,\n fullPath: url.pathname,\n get query() {\n return parseQuery(url.search);\n },\n hash: url.hash,\n // stub properties for compat with vue-router\n params: {},\n name: void 0,\n matched: [],\n redirectedFrom: void 0,\n meta: {},\n href\n };\n },\n rel,\n target,\n isExternal: isExternal.value,\n isActive: false,\n isExactActive: false\n });\n }\n return h(\"a\", { ref: el, href, rel, target }, slots.default?.());\n };\n }\n });\n}\nexport default defineNuxtLink({ componentName: \"NuxtLink\" });\nfunction useObserver() {\n if (process.server) {\n return;\n }\n const nuxtApp = useNuxtApp();\n if (nuxtApp._observer) {\n return nuxtApp._observer;\n }\n let observer = null;\n const callbacks = /* @__PURE__ */ new Map();\n const observe = (element, callback) => {\n if (!observer) {\n observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n const callback2 = callbacks.get(entry.target);\n const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;\n if (isVisible && callback2) {\n callback2();\n }\n }\n });\n }\n callbacks.set(element, callback);\n observer.observe(element);\n return () => {\n callbacks.delete(element);\n observer.unobserve(element);\n if (callbacks.size === 0) {\n observer.disconnect();\n observer = null;\n }\n };\n };\n const _observer = nuxtApp._observer = {\n observe\n };\n return _observer;\n}\nfunction isSlowConnection() {\n if (process.server) {\n return;\n }\n const cn = navigator.connection;\n if (cn && (cn.saveData || /2g/.test(cn.effectiveType))) {\n return true;\n }\n return false;\n}\n"],"names":["requestIdleCallback","cb","start","idleDeadline","cancelIdleCallback","id","onNuxtReady","callback","nuxtApp","useNuxtApp","preloadRouteComponents","to","router","useRouter","promises","components","component","_a","promise","firstNonUndefined","args","arg","DEFAULT_EXTERNAL_REL_ATTRIBUTE","defineNuxtLink","options","componentName","defineComponent","props","slots","computed","isExternal","hasProtocol","prefetched","ref","el","isSlowConnection","idleId","unobserve","onMounted","observer","useObserver","path","onBeforeUnmount","h","resolveComponent","ref2","href","target","rel","navigate","navigateTo","url","parseURL","parseQuery","_b","__nuxt_component_0","callbacks","observe","element","entries","entry","callback2","cn"],"mappings":"kIAAO,MAAMA,EACT,WAAW,sBAAyBC,GAAO,CAC7C,MAAMC,EAAQ,KAAK,MACbC,EAAe,CACnB,WAAY,GACZ,cAAe,IAAM,KAAK,IAAI,EAAG,IAAM,KAAK,MAAQD,EAAM,CAC9D,EACE,OAAO,WAAW,IAAM,CACtBD,EAAGE,CAAY,CAChB,EAAE,CAAC,CACN,GACaC,EACT,WAAW,qBAAwBC,GAAO,CAC5C,aAAaA,CAAE,CACjB,GCZaC,EAAeC,GAAa,CAIvC,MAAMC,EAAUC,IACZD,EAAQ,YACVA,EAAQ,MAAM,SAAS,uBAAwB,IAAM,CACnDR,EAAoBO,CAAQ,CAClC,CAAK,EAEDP,EAAoBO,CAAQ,CAEhC,ECIO,eAAeG,EAAuBC,EAAIC,EAASC,IAAa,CAOrE,GAHKD,EAAO,kBACVA,EAAO,gBAAkC,IAAI,KAE3CA,EAAO,gBAAgB,IAAID,CAAE,EAC/B,OAEF,MAAMG,EAAWF,EAAO,iBAAmBA,EAAO,kBAAoB,CAAA,EACtE,GAAIE,EAAS,OAAS,EACpB,OAAO,QAAQ,IAAIA,CAAQ,EAAE,KAAK,IAAMJ,EAAuBC,EAAIC,CAAM,CAAC,EAE5EA,EAAO,gBAAgB,IAAID,CAAE,EAC7B,MAAMI,EAAaH,EAAO,QAAQD,CAAE,EAAE,QAAQ,IAAKK,GAAS,OAAK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