PageSourceSearch

https://www.hamburg-tourism.de/_nuxt/nuxt-link.CszWSFUC.js

js hamburg-tourism.de collected 2026-09-24 09:42:01 UTC 10,802 bytes, 325 lines download raw bytes

1import { d as defineComponent, c as computed, f as ref, B as onMounted, al as onBeforeUnmount, b as h, ae as resolveComponent } from "./swiper-vue.DTY2ZdM9.js";
2import { g as useRouter, k as hasProtocol, o as onNuxtReady, r as requestIdleCallback, l as cancelIdleCallback, m as joinURL, p as parseURL, q as parseQuery, t as nuxtLinkDefaults, v as useRuntimeConfig, w as useNuxtApp, n as navigateTo, x as withTrailingSlash, y as withoutTrailingSlash } from "./entry.VtQUS9N7.js";
3async function preloadRouteComponents(to, router = useRouter()) {
4  const { path, matched } = router.resolve(to);
5  if (!matched.length) {
6    return;
7  }
8  if (!router._routePreloaded) {
9    router._routePreloaded = /* @__PURE__ */ new Set();
10  }
11  if (router._routePreloaded.has(path)) {
12    return;
13  }
14  const promises = router._preloadPromises = router._preloadPromises || [];
15  if (promises.length > 4) {
16    return Promise.all(promises).then(() => preloadRouteComponents(to, router));
17  }
18  router._routePreloaded.add(path);
19  const components = matched.map((component) => {
20    var _a;
21    return (_a = component.components) == null ? void 0 : _a.default;
22  }).filter((component) => typeof component === "function");
23  for (const component of components) {
24    const promise = Promise.resolve(component()).catch(() => {
25    }).finally(() => promises.splice(promises.indexOf(promise)));
26    promises.push(promise);
27  }
28  await Promise.all(promises);
29}
30const firstNonUndefined = (...args) => args.find((arg) => arg !== void 0);
31// @__NO_SIDE_EFFECTS__
32function defineNuxtLink(options) {
33  const componentName = options.componentName || "NuxtLink";
34  function resolveTrailingSlashBehavior(to, resolve) {
35    if (!to || options.trailingSlash !== "append" && options.trailingSlash !== "remove") {
36      return to;
37    }
38    if (typeof to === "string") {
39      return applyTrailingSlashBehavior(to, options.trailingSlash);
40    }
41    const path = "path" in to && to.path !== void 0 ? to.path : resolve(to).path;
42    const resolvedPath = {
43      ...to,
44      path: applyTrailingSlashBehavior(path, options.trailingSlash)
45    };
46    if ("name" in resolvedPath) {
47      delete resolvedPath.name;
48    }
49    return resolvedPath;
50  }
51  return defineComponent({
52    name: componentName,
53    props: {
54      // Routing
55      to: {
56        type: [String, Object],
57        default: void 0,
58        required: false
59      },
60      href: {
61        type: [String, Object],
62        default: void 0,
63        required: false
64      },
65      // Attributes
66      target: {
67        type: String,
68        default: void 0,
69        required: false
70      },
71      rel: {
72        type: String,
73        default: void 0,
74        required: false
75      },
76      noRel: {
77        type: Boolean,
78        default: void 0,
79        required: false
80      },
81      // Prefetching
82      prefetch: {
83        type: Boolean,
84        default: void 0,
85        required: false
86      },
87      noPrefetch: {
88        type: Boolean,
89        default: void 0,
90        required: false
91      },
92      // Styling
93      activeClass: {
94        type: String,
95        default: void 0,
96        required: false
97      },
98      exactActiveClass: {
99        type: String,
100        default: void 0,
101        required: false
102      },
103      prefetchedClass: {
104        type: String,
105        default: void 0,
106        required: false
107      },
108      // Vue Router's `<RouterLink>` additional props
109      replace: {
110        type: Boolean,
111        default: void 0,
112        required: false
113      },
114      ariaCurrentValue: {
115        type: String,
116        default: void 0,
117        required: false
118      },
119      // Edge cases handling
120      external: {
121        type: Boolean,
122        default: void 0,
123        required: false
124      },
125      // Slot API
126      custom: {
127        type: Boolean,
128        default: void 0,
129        required: false
130      }
131    },
132    setup(props, { slots }) {
133      const router = useRouter();
134      const config = useRuntimeConfig();
135      const to = computed(() => {
136        const path = props.to || props.href || "";
137        return resolveTrailingSlashBehavior(path, router.resolve);
138      });
139      const isAbsoluteUrl = computed(() => typeof to.value === "string" && hasProtocol(to.value, { acceptRelative: true }));
140      const hasTarget = computed(() => props.target && props.target !== "_self");
141      const isExternal = computed(() => {
142        if (props.external) {
143          return true;
144        }
145        if (hasTarget.value) {
146          return true;
147        }
148        if (typeof to.value === "object") {
149          return false;
150        }
151        return to.value === "" || isAbsoluteUrl.value;
152      });
153      const prefetched = ref(false);
154      const el = ref(null);
155      const elRef = (ref2) => {
156        var _a;
157        el.value = props.custom ? (_a = ref2 == null ? void 0 : ref2.$el) == null ? void 0 : _a.nextElementSibling : ref2 == null ? void 0 : ref2.$el;
158      };
159      {
160        const shouldPrefetch = props.prefetch !== false && props.noPrefetch !== true && props.target !== "_blank" && !isSlowConnection();
161        if (shouldPrefetch) {
162          const nuxtApp = useNuxtApp();
163          let idleId;
164          let unobserve = null;
165          onMounted(() => {
166            const observer = useObserver();
167            onNuxtReady(() => {
168              idleId = requestIdleCallback(() => {
169                var _a;
170                if ((_a = el == null ? void 0 : el.value) == null ? void 0 : _a.tagName) {
171                  unobserve = observer.observe(el.value, async () => {
172                    unobserve == null ? void 0 : unobserve();
173                    unobserve = null;
174                    const path = typeof to.value === "string" ? to.value : router.resolve(to.value).fullPath;
175                    await Promise.all([
176                      nuxtApp.hooks.callHook("link:prefetch", path).catch(() => {
177                      }),
178                      !isExternal.value && preloadRouteComponents(to.value, router).catch(() => {
179                      })
180                    ]);
181                    prefetched.value = true;
182                  });
183                }
184              });
185            });
186          });
187          onBeforeUnmount(() => {
188            if (idleId) {
189              cancelIdleCallback(idleId);
190            }
191            unobserve == null ? void 0 : unobserve();
192            unobserve = null;
193          });
194        }
195      }
196      return () => {
197        var _a, _b;
198        if (!isExternal.value) {
199          const routerLinkProps = {
200            ref: elRef,
201            to: to.value,
202            activeClass: props.activeClass || options.activeClass,
203            exactActiveClass: props.exactActiveClass || options.exactActiveClass,
204            replace: props.replace,
205            ariaCurrentValue: props.ariaCurrentValue,
206            custom: props.custom
207          };
208          if (!props.custom) {
209            if (prefetched.value) {
210              routerLinkProps.class = props.prefetchedClass || options.prefetchedClass;
211            }
212            routerLinkProps.rel = props.rel || void 0;
213          }
214          return h(
215            resolveComponent("RouterLink"),
216            routerLinkProps,
217            slots.default
218          );
219        }
220        const href = typeof to.value === "object" ? ((_a = router.resolve(to.value)) == null ? void 0 : _a.href) ?? null : to.value && !props.external && !isAbsoluteUrl.value ? resolveTrailingSlashBehavior(joinURL(config.app.baseURL, to.value), router.resolve) : to.value || null;
221        const target = props.target || null;
222        const rel = firstNonUndefined(
223          // converts `""` to `null` to prevent the attribute from being added as empty (`rel=""`)
224          props.noRel ? "" : props.rel,
225          options.externalRelAttribute,
226          /*
227          * A fallback rel of `noopener noreferrer` is applied for external links or links that open in a new tab.
228          * This solves a reverse tabnapping security flaw in browsers pre-2021 as well as improving privacy.
229          */
230          isAbsoluteUrl.value || hasTarget.value ? "noopener noreferrer" : ""
231        ) || null;
232        if (props.custom) {
233          if (!slots.default) {
234            return null;
235          }
236          const navigate = () => navigateTo(href, { replace: props.replace, external: props.external });
237          return slots.default({
238            href,
239            navigate,
240            get route() {
241              if (!href) {
242                return void 0;
243              }
244              const url = parseURL(href);
245              return {
246                path: url.pathname,
247                fullPath: url.pathname,
248                get query() {
249                  return parseQuery(url.search);
250                },
251                hash: url.hash,
252                params: {},
253                name: void 0,
254                matched: [],
255                redirectedFrom: void 0,
256                meta: {},
257                href
258              };
259            },
260            rel,
261            target,
262            isExternal: isExternal.value,
263            isActive: false,
264            isExactActive: false
265          });
266        }
267        return h("a", { ref: el, href, rel, target }, (_b = slots.default) == null ? void 0 : _b.call(slots));
268      };
269    }
270  });
271}
272const __nuxt_component_0 = /* @__PURE__ */ defineNuxtLink(nuxtLinkDefaults);
273function applyTrailingSlashBehavior(to, trailingSlash) {
274  const normalizeFn = trailingSlash === "append" ? withTrailingSlash : withoutTrailingSlash;
275  const hasProtocolDifferentFromHttp = hasProtocol(to) && !to.startsWith("http");
276  if (hasProtocolDifferentFromHttp) {
277    return to;
278  }
279  return normalizeFn(to, true);
280}
281function useObserver() {
282  const nuxtApp = useNuxtApp();
283  if (nuxtApp._observer) {
284    return nuxtApp._observer;
285  }
286  let observer = null;
287  const callbacks = /* @__PURE__ */ new Map();
288  const observe = (element, callback) => {
289    if (!observer) {
290      observer = new IntersectionObserver((entries) => {
291        for (const entry of entries) {
292          const callback2 = callbacks.get(entry.target);
293          const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
294          if (isVisible && callback2) {
295            callback2();
296          }
297        }
298      });
299    }
300    callbacks.set(element, callback);
301    observer.observe(element);
302    return () => {
303      callbacks.delete(element);
304      observer.unobserve(element);
305      if (callbacks.size === 0) {
306        observer.disconnect();
307        observer = null;
308      }
309    };
310  };
311  const _observer = nuxtApp._observer = {
312    observe
313  };
314  return _observer;
315}
316function isSlowConnection() {
317  const cn = navigator.connection;
318  if (cn && (cn.saveData || /2g/.test(cn.effectiveType))) {
319    return true;
320  }
321  return false;
322}
323export {
324  __nuxt_component_0 as _
325};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.