const v={},d=new Set,s=new WeakSet;let f=!0,h,l=!1;function g(e){l||(l=!0,f??=!1,h??="hover",p(),w(),y(),S())}function p(){for(const e of["touchstart","mousedown"])document.addEventListener(e,t=>{a(t.target,"tap")&&c(t.target.href,{ignoreSlowConnection:!0})},{passive:!0})}function w(){let e;document.body.addEventListener("focusin",n=>{a(n.target,"hover")&&t(n)},{passive:!0}),document.body.addEventListener("focusout",o,{passive:!0}),u(()=>{for(const n of document.getElementsByTagName("a"))s.has(n)||a(n,"hover")&&(s.add(n),n.addEventListener("mouseenter",t,{passive:!0}),n.addEventListener("mouseleave",o,{passive:!0}))});function t(n){const r=n.target.href;e&&clearTimeout(e),e=setTimeout(()=>{c(r)},80)}function o(){e&&(clearTimeout(e),e=0)}}function y(){let e;u(()=>{for(const t of document.getElementsByTagName("a"))s.has(t)||a(t,"viewport")&&(s.add(t),e??=L(),e.observe(t))})}function L(){const e=new WeakMap;return new IntersectionObserver((t,o)=>{for(const n of t){const r=n.target,i=e.get(r);n.isIntersecting?(i&&clearTimeout(i),e.set(r,setTimeout(()=>{o.unobserve(r),e.delete(r),c(r.href)},300))):i&&(clearTimeout(i),e.delete(r))}})}function S(){u(()=>{for(const e of document.getElementsByTagName("a"))a(e,"load")&&c(e.href)})}function c(e,t){e=e.replace(/#.*/,"");const o=t?.ignoreSlowConnection??!1;if(E(e,o))if(d.add(e),document.createElement("link").relList?.supports?.("prefetch")&&t?.with!=="fetch"){const n=document.createElement("link");n.rel="prefetch",n.setAttribute("href",e),document.head.append(n)}else{const n=new Headers;for(const[r,i]of Object.entries(v))n.set(r,i);fetch(e,{priority:"low",headers:n})}}function E(e,t){if(!navigator.onLine||!t&&m())return!1;try{const o=new URL(e,location.href);return location.origin===o.origin&&(location.pathname!==o.pathname||location.search!==o.search)&&!d.has(e)}catch{}return!1}function a(e,t){if(e?.tagName!=="A")return!1;const o=e.dataset.astroPrefetch;return o==="false"?!1:t==="tap"&&(o!=null||f)&&m()?!0:o==null&&f||o===""?t===h:o===t}function m(){if("connection"in navigator){const e=navigator.connection;return e.saveData||/2g/.test(e.effectiveType)}return!1}function u(e){e();let t=!1;document.addEventListener("astro:page-load",()=>{if(!t){t=!0;return}e()})}g();
