import{S as v,e as I}from"./effect.qYiVeV-Q.js";function M(t,e=()=>{throw new Error("Unable to call `effect()`. To use this function, install the `signal-polyfill` package.")}){return{ready(n){window.customElements.define(`simple-query-root-${t()}`,it(t,e,n))}}}function it(t,e,n){return class extends HTMLElement{constructor(){super(...arguments),this.#t=new AbortController,this.abortSignal=this.#t.signal}#e;#t;async connectedCallback(){const o=this.getAttribute("data-stringified"),r=st(this,t),i=JSON.parse(o);this.#e=await n(r,{effect:e.bind({signal:this.abortSignal}),data:i,abortSignal:this.abortSignal})}disconnectedCallback(){this.#e?.(),this.#t.abort()}}}function st(t,e){function n(r){return`[data-target=${JSON.stringify(e(r))}]`}function o(r){const i=n(r),c=t.querySelector(i);if(!c)throw new Error(`Element not found: ${i}`);return c}return Object.assign(o,{self:t,optional(r){const i=n(r);return t.querySelector(i)??void 0},all(r){const i=n(r);return[...t.querySelectorAll(i)]}}),o}const at=new v.State(!1),$=new v.State(0),ct=new v.State(0),F="1781dd9e";function lt(t){return t?t+"-"+F:F}const ut=M(lt,I);ut.ready((t,e)=>{const n=new v.State(window.matchMedia("(min-width: 640px)").matches);window.matchMedia("(min-width: 640px)").onchange=({matches:o})=>{n.set(o)},e.effect(()=>{t.self.toggleAttribute("data-visible",at.get()&&!n.get())})});const q="6ddbc803";function ft(t){return t?t+"-"+q:q}const dt=M(ft,I),p=new v.State(!1);dt.ready((t,e)=>{let n=0,o=!1;t("btn").addEventListener("click",()=>{p.set(!p.get())}),e.effect(()=>{t.self.toggleAttribute("data-open",p.get()),t("btn").toggleAttribute("aria-expanded",p.get())});const r=()=>{n=window.scrollY,o||(window.requestAnimationFrame(()=>{p.set(n<20),o=!1}),o=!0)},i=window.matchMedia("(min-width: 640px)");p.set(i.matches),i.matches&&document.addEventListener("scroll",r,{signal:e.abortSignal}),i.addEventListener("change",c=>{p.set(c.matches),c.matches?document.addEventListener("scroll",r,{signal:e.abortSignal}):document.removeEventListener("scroll",r)},{signal:e.abortSignal})});const y="data-astro-transition-persist";function mt(t){for(const e of document.scripts)for(const n of t.scripts)if(!n.hasAttribute("data-astro-rerun")&&(!e.src&&e.textContent===n.textContent||e.src&&e.type===n.type&&e.src===n.src)){n.dataset.astroExec="";break}}function ht(t){const e=document.documentElement,n=[...e.attributes].filter(({name:o})=>(e.removeAttribute(o),o.startsWith("data-astro-")));[...t.documentElement.attributes,...n].forEach(({name:o,value:r})=>e.setAttribute(o,r))}function gt(t){for(const e of Array.from(document.head.children)){const n=bt(e,t);n?n.remove():e.remove()}document.head.append(...t.head.children)}function pt(t,e){e.replaceWith(t);for(const n of e.querySelectorAll(`[${y}]`)){const o=n.getAttribute(y),r=t.querySelector(`[${y}="${o}"]`);r&&(r.replaceWith(n),r.localName==="astro-island"&&yt(n)&&(n.setAttribute("ssr",""),n.setAttribute("props",r.getAttribute("props"))))}}const wt=()=>{const t=document.activeElement;if(t?.closest(`[${y}]`)){if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){const e=t.selectionStart,n=t.selectionEnd;return()=>x({activeElement:t,start:e,end:n})}return()=>x({activeElement:t})}else return()=>x({activeElement:null})},x=({activeElement:t,start:e,end:n})=>{t&&(t.focus(),(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(typeof e=="number"&&(t.selectionStart=e),typeof n=="number"&&(t.selectionEnd=n)))},bt=(t,e)=>{const n=t.getAttribute(y),o=n&&e.head.querySelector(`[${y}="${n}"]`);if(o)return o;if(t.matches("link[rel=stylesheet]")){const r=t.getAttribute("href");return e.head.querySelector(`link[rel=stylesheet][href="${r}"]`)}return null},yt=t=>{const e=t.dataset.astroTransitionPersistProps;return e==null||e==="false"},vt=t=>{mt(t),ht(t),gt(t);const e=wt();pt(t.body,document.body),e()},Tt="astro:before-preparation",Et="astro:after-preparation",At="astro:before-swap",St="astro:after-swap",Lt=t=>document.dispatchEvent(new Event(t));class J extends Event{from;to;direction;navigationType;sourceElement;info;newDocument;signal;constructor(e,n,o,r,i,c,a,u,f,l){super(e,n),this.from=o,this.to=r,this.direction=i,this.navigationType=c,this.sourceElement=a,this.info=u,this.newDocument=f,this.signal=l,Object.defineProperties(this,{from:{enumerable:!0},to:{enumerable:!0,writable:!0},direction:{enumerable:!0,writable:!0},navigationType:{enumerable:!0},sourceElement:{enumerable:!0},info:{enumerable:!0},newDocument:{enumerable:!0,writable:!0},signal:{enumerable:!0}})}}class Rt extends J{formData;loader;constructor(e,n,o,r,i,c,a,u,f,l){super(Tt,{cancelable:!0},e,n,o,r,i,c,a,u),this.formData=f,this.loader=l.bind(this,this),Object.defineProperties(this,{formData:{enumerable:!0},loader:{enumerable:!0,writable:!0}})}}class kt extends J{direction;viewTransition;swap;constructor(e,n){super(At,void 0,e.from,e.to,e.direction,e.navigationType,e.sourceElement,e.info,e.newDocument,e.signal),this.direction=e.direction,this.viewTransition=n,this.swap=()=>vt(this.newDocument),Object.defineProperties(this,{direction:{enumerable:!0},viewTransition:{enumerable:!0},swap:{enumerable:!0,writable:!0}})}}async function xt(t,e,n,o,r,i,c,a,u){const f=new Rt(t,e,n,o,r,i,window.document,c,a,u);return document.dispatchEvent(f)&&(await f.loader(),f.defaultPrevented||(Lt(Et),f.navigationType!=="traverse"&&N({scrollX,scrollY}))),f}function Pt(t,e){const n=new kt(t,e);return document.dispatchEvent(n),n.swap(),n}const Dt=history.pushState.bind(history),A=history.replaceState.bind(history),N=t=>{history.state&&(history.scrollRestoration="manual",A({...history.state,...t},""))},O=!!document.startViewTransition,C=()=>!!document.querySelector('[name="astro-view-transitions-enabled"]'),G=(t,e)=>t.pathname===e.pathname&&t.search===e.search;let d,w,L;const z=t=>document.dispatchEvent(new Event(t)),Q=()=>z("astro:page-load"),It=()=>{let t=document.createElement("div");t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),t.className="astro-route-announcer",document.body.append(t),setTimeout(()=>{let e=document.title||document.querySelector("h1")?.textContent||location.pathname;t.textContent=e},60)},Y="data-astro-transition-persist",X="data-astro-transition",P="data-astro-transition-fallback";let _,T=0;history.state?(T=history.state.index,scrollTo({left:history.state.scrollX,top:history.state.scrollY})):C()&&(A({index:T,scrollX,scrollY},""),history.scrollRestoration="manual");async function Mt(t,e){try{const n=await fetch(t,e),r=(n.headers.get("content-type")??"").split(";",1)[0].trim();return r!=="text/html"&&r!=="application/xhtml+xml"?null:{html:await n.text(),redirected:n.redirected?n.url:void 0,mediaType:r}}catch{return null}}function Z(){const t=document.querySelector('[name="astro-view-transitions-fallback"]');return t?t.getAttribute("content"):"animate"}function Nt(){let t=Promise.resolve();for(const e of Array.from(document.scripts)){if(e.dataset.astroExec==="")continue;const n=e.getAttribute("type");if(n&&n!=="module"&&n!=="text/javascript")continue;const o=document.createElement("script");o.innerHTML=e.innerHTML;for(const r of e.attributes){if(r.name==="src"){const i=new Promise(c=>{o.onload=o.onerror=c});t=t.then(()=>i)}o.setAttribute(r.name,r.value)}o.dataset.astroExec="",e.replaceWith(o)}return t}const tt=(t,e,n,o,r)=>{const i=G(e,t),c=document.title;document.title=o;let a=!1;if(t.href!==location.href&&!r)if(n.history==="replace"){const u=history.state;A({...n.state,index:u.index,scrollX:u.scrollX,scrollY:u.scrollY},"",t.href)}else Dt({...n.state,index:++T,scrollX:0,scrollY:0},"",t.href);if(document.title=c,L=t,i||(scrollTo({left:0,top:0,behavior:"instant"}),a=!0),r)scrollTo(r.scrollX,r.scrollY);else{if(t.hash){history.scrollRestoration="auto";const u=history.state;location.href=t.href,history.state||(A(u,""),i&&window.dispatchEvent(new PopStateEvent("popstate")))}else a||scrollTo({left:0,top:0,behavior:"instant"});history.scrollRestoration="manual"}};function Ot(t){const e=[];for(const n of t.querySelectorAll("head link[rel=stylesheet]"))if(!document.querySelector(`[${Y}="${n.getAttribute(Y)}"], link[rel=stylesheet][href="${n.getAttribute("href")}"]`)){const o=document.createElement("link");o.setAttribute("rel","preload"),o.setAttribute("as","style"),o.setAttribute("href",n.getAttribute("href")),e.push(new Promise(r=>{["load","error"].forEach(i=>o.addEventListener(i,r)),document.head.append(o)}))}return e}async function U(t,e,n,o,r){async function i(u){function f(h){const m=h.effect;return!m||!(m instanceof KeyframeEffect)||!m.target?!1:window.getComputedStyle(m.target,m.pseudoElement).animationIterationCount==="infinite"}const l=document.getAnimations();document.documentElement.setAttribute(P,u);const g=document.getAnimations().filter(h=>!l.includes(h)&&!f(h));return Promise.allSettled(g.map(h=>h.finished))}if(r==="animate"&&!n.transitionSkipped&&!t.signal.aborted)try{await i("old")}catch{}const c=document.title,a=Pt(t,n.viewTransition);tt(a.to,a.from,e,c,o),z(St),r==="animate"&&(!n.transitionSkipped&&!a.signal.aborted?i("new").finally(()=>n.viewTransitionFinished()):n.viewTransitionFinished())}function Ct(){return d?.controller.abort(),d={controller:new AbortController}}async function et(t,e,n,o,r){const i=Ct();if(!C()||location.origin!==n.origin){i===d&&(d=void 0),location.href=n.href;return}const c=r?"traverse":o.history==="replace"?"replace":"push";if(c!=="traverse"&&N({scrollX,scrollY}),G(e,n)&&(t!=="back"&&n.hash||t==="back"&&e.hash)){tt(n,e,o,document.title,r),i===d&&(d=void 0);return}const a=await xt(e,n,t,c,o.sourceElement,o.info,i.controller.signal,o.formData,u);if(a.defaultPrevented||a.signal.aborted){i===d&&(d=void 0),a.signal.aborted||(location.href=n.href);return}async function u(s){const g=s.to.href,h={signal:s.signal};if(s.formData){h.method="POST";const b=s.sourceElement instanceof HTMLFormElement?s.sourceElement:s.sourceElement instanceof HTMLElement&&"form"in s.sourceElement?s.sourceElement.form:s.sourceElement?.closest("form");h.body=b?.attributes.getNamedItem("enctype")?.value==="application/x-www-form-urlencoded"?new URLSearchParams(s.formData):s.formData}const m=await Mt(g,h);if(m===null){s.preventDefault();return}if(m.redirected){const b=new URL(m.redirected);if(b.origin!==s.to.origin){s.preventDefault();return}s.to=b}if(_??=new DOMParser,s.newDocument=_.parseFromString(m.html,m.mediaType),s.newDocument.querySelectorAll("noscript").forEach(b=>b.remove()),!s.newDocument.querySelector('[name="astro-view-transitions-enabled"]')&&!s.formData){s.preventDefault();return}const k=Ot(s.newDocument);k.length&&!s.signal.aborted&&await Promise.all(k)}async function f(){if(w&&w.viewTransition){try{w.viewTransition.skipTransition()}catch{}try{await w.viewTransition.updateCallbackDone}catch{}}return w={transitionSkipped:!1}}const l=await f();if(a.signal.aborted){i===d&&(d=void 0);return}if(document.documentElement.setAttribute(X,a.direction),O)l.viewTransition=document.startViewTransition(async()=>await U(a,o,l,r));else{const s=(async()=>{await Promise.resolve(),await U(a,o,l,r,Z())})();l.viewTransition={updateCallbackDone:s,ready:s,finished:new Promise(g=>l.viewTransitionFinished=g),skipTransition:()=>{l.transitionSkipped=!0,document.documentElement.removeAttribute(P)}}}l.viewTransition.updateCallbackDone.finally(async()=>{await Nt(),Q(),It()}),l.viewTransition.finished.finally(()=>{l.viewTransition=void 0,l===w&&(w=void 0),i===d&&(d=void 0),document.documentElement.removeAttribute(X),document.documentElement.removeAttribute(P)});try{await l.viewTransition.updateCallbackDone}catch(s){const g=s;console.log("[astro]",g.name,g.message,g.stack)}}async function B(t,e){await et("forward",L,new URL(t,location.href),e??{})}function Ht(t){if(!C()&&t.state){location.reload();return}if(t.state===null)return;const e=history.state,n=e.index,o=n>T?"forward":"back";T=n,et(o,L,new URL(location.href),{},e)}const V=()=>{history.state&&(scrollX!==history.state.scrollX||scrollY!==history.state.scrollY)&&N({scrollX,scrollY})};{if(O||Z()!=="none")if(L=new URL(location.href),addEventListener("popstate",Ht),addEventListener("load",Q),"onscrollend"in window)addEventListener("scrollend",V);else{let t,e,n,o;const r=()=>{if(o!==history.state?.index){clearInterval(t),t=void 0;return}if(e===scrollY&&n===scrollX){clearInterval(t),t=void 0,V();return}else e=scrollY,n=scrollX};addEventListener("scroll",()=>{t===void 0&&(o=history.state.index,e=scrollY,n=scrollX,t=window.setInterval(r,50))},{passive:!0})}for(const t of document.scripts)t.dataset.astroExec=""}const nt=new Set,S=new WeakSet;let D,ot,W=!1;function $t(t){W||(W=!0,D??=t?.prefetchAll,ot??=t?.defaultStrategy??"hover",Ft(),qt(),Yt(),_t())}function Ft(){for(const t of["touchstart","mousedown"])document.body.addEventListener(t,e=>{E(e.target,"tap")&&R(e.target.href,{ignoreSlowConnection:!0})},{passive:!0})}function qt(){let t;document.body.addEventListener("focusin",o=>{E(o.target,"hover")&&e(o)},{passive:!0}),document.body.addEventListener("focusout",n,{passive:!0}),H(()=>{for(const o of document.getElementsByTagName("a"))S.has(o)||E(o,"hover")&&(S.add(o),o.addEventListener("mouseenter",e,{passive:!0}),o.addEventListener("mouseleave",n,{passive:!0}))});function e(o){const r=o.target.href;t&&clearTimeout(t),t=setTimeout(()=>{R(r)},80)}function n(){t&&(clearTimeout(t),t=0)}}function Yt(){let t;H(()=>{for(const e of document.getElementsByTagName("a"))S.has(e)||E(e,"viewport")&&(S.add(e),t??=Xt(),t.observe(e))})}function Xt(){const t=new WeakMap;return new IntersectionObserver((e,n)=>{for(const o of e){const r=o.target,i=t.get(r);o.isIntersecting?(i&&clearTimeout(i),t.set(r,setTimeout(()=>{n.unobserve(r),t.delete(r),R(r.href)},300))):i&&(clearTimeout(i),t.delete(r))}})}function _t(){H(()=>{for(const t of document.getElementsByTagName("a"))E(t,"load")&&R(t.href)})}function R(t,e){t=t.replace(/#.*/,"");const n=e?.ignoreSlowConnection??!1;if(Ut(t,n))if(nt.add(t),document.createElement("link").relList?.supports?.("prefetch")&&e?.with!=="fetch"){const o=document.createElement("link");o.rel="prefetch",o.setAttribute("href",t),document.head.append(o)}else fetch(t,{priority:"low"})}function Ut(t,e){if(!navigator.onLine||!e&&rt())return!1;try{const n=new URL(t,location.href);return location.origin===n.origin&&(location.pathname!==n.pathname||location.search!==n.search)&&!nt.has(t)}catch{}return!1}function E(t,e){if(t?.tagName!=="A")return!1;const n=t.dataset.astroPrefetch;return n==="false"?!1:e==="tap"&&(n!=null||D)&&rt()?!0:n==null&&D||n===""?e===ot:n===e}function rt(){if("connection"in navigator){const t=navigator.connection;return t.saveData||/2g/.test(t.effectiveType)}return!1}function H(t){t();let e=!1;document.addEventListener("astro:page-load",()=>{if(!e){e=!0;return}t()})}function Bt(){const t=document.querySelector('[name="astro-view-transitions-fallback"]');return t?t.getAttribute("content"):"animate"}function j(t){return t.dataset.astroReload!==void 0}(O||Bt()!=="none")&&(document.addEventListener("click",t=>{let e=t.target;if(t.composed&&(e=t.composedPath()[0]),e instanceof Element&&(e=e.closest("a, area")),!(e instanceof HTMLAnchorElement)&&!(e instanceof SVGAElement)&&!(e instanceof HTMLAreaElement))return;const n=e instanceof HTMLElement?e.target:e.target.baseVal,o=e instanceof HTMLElement?e.href:e.href.baseVal,r=new URL(o,location.href).origin;j(e)||e.hasAttribute("download")||!e.href||n&&n!=="_self"||r!==location.origin||t.button!==0||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey||t.defaultPrevented||(t.preventDefault(),B(o,{history:e.dataset.astroHistory==="replace"?"replace":"auto",sourceElement:e}))}),document.addEventListener("submit",t=>{let e=t.target;if(e.tagName!=="FORM"||t.defaultPrevented||j(e))return;const n=e,o=t.submitter,r=new FormData(n,o),i=typeof n.action=="string"?n.action:n.getAttribute("action"),c=typeof n.method=="string"?n.method:n.getAttribute("method");let a=o?.getAttribute("formaction")??i??location.pathname;const u=o?.getAttribute("formmethod")??c??"get";if(u==="dialog"||location.origin!==new URL(a,location.href).origin)return;const f={sourceElement:o??n};if(u==="get"){const l=new URLSearchParams(r),s=new URL(a);s.search=l.toString(),a=s.toString()}else f.formData=r;t.preventDefault(),B(a,f)}),$t({prefetchAll:!0}));const K="bd31ac44";function Vt(t){return t?t+"-"+K:K}const Wt=M(Vt,I);Wt.ready((t,e)=>{const n=new v.State(!1);e.effect(()=>{t.self.toggleAttribute("data-open",n.get()),t("progress").value=$.get(),t.self.toggleAttribute("data-done-reading",Math.round($.get()*10)/10>=1);const o=ct.get();t("btn").style.setProperty("--section-offset",`calc(-${o} * (var(--spacing-3) + 1em))`);for(const[r,i]of t.all("links").entries())i.toggleAttribute("data-active",r===o)}),t("btn").addEventListener("click",()=>{n.set(!n.get())})});export{M as a,ct as c,at as i,$ as p};
