import{aX as _e,aY as mt,d as A,g as U,s as T,aV as ne,aZ as wt}from"./DP2RCIpD.js";import{o as Ve}from"./0o9CXqwM.js";const D=[];function xe(e,t=_e){let n=null;const r=new Set;function a(o){if(mt(e,o)&&(e=o,n)){const l=!D.length;for(const c of r)c[1](),D.push(c,e);if(l){for(let c=0;c{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:i,subscribe:s}}class Re{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Le{constructor(t,n){this.status=t,this.location=n}}class Ae extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function vt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function yt(e){return e.split("%25").map(decodeURI).join("%25")}function bt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function kt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function Et(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&W.delete(Ue(e)),St(e,t));const W=new Map;function xt(e,t){const n=Ue(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&W.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=Et(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Rt(e,t,n){if(W.size>0){const r=Ue(e,n),a=W.get(r);if(a){if(performance.now(){const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return we(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return we(String.fromCharCode(...l.slice(2).split("-").map(_=>parseInt(_,16))));const f=Lt.exec(l),[,p,w,h,u]=f;return t.push({name:h,matcher:u,optional:!!p,rest:!!w,chained:w?c===1&&s[0]==="":!1}),w?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return we(l)}).join("")}).join("")}/?$`),params:t}}function Ut(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Tt(e){return e.slice(1).split("/").filter(Ut)}function It(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;of).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const f=t[o+1],p=a[o+1];f&&!f.rest&&f.optional&&p&&l.chained&&(s=0),!f&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function we(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Ot({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,f]])=>{const{pattern:p,params:w}=At(o),h={id:o,exec:u=>{const _=p.exec(u);if(_)return It(_,w,r)},errors:[1,...f||[]].map(u=>e[u]),layouts:[0,...c||[]].map(s),leaf:i(l)};return h.errors.length=h.layouts.length=Math.max(h.errors.length,h.layouts.length),h});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function He(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Be(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const L=globalThis.__sveltekit_tdx9xw?.base??"",Pt=globalThis.__sveltekit_tdx9xw?.assets??L??"",$t="1775852332484",Je="sveltekit:snapshot",Xe="sveltekit:scroll",Ze="sveltekit:states",Ct="sveltekit:pageurl",B="sveltekit:history",H="sveltekit:navigation",j={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Te=location.origin;function Qe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function V(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ke={...j,"":j.hover};function et(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function tt(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=et(e)}}function be(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||de(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===Te&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function re(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=V(o,"preload-code")),a===null&&(a=V(o,"preload-data")),t===null&&(t=V(o,"keepfocus")),n===null&&(n=V(o,"noscroll")),i===null&&(i=V(o,"reload")),s===null&&(s=V(o,"replacestate")),o=et(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ke[r??"off"],preload_data:Ke[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function Me(e){const t=xe(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const nt={v:()=>{}};function jt(){const{set:e,subscribe:t}=xe(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Pt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==$t;return s&&(e(!0),nt.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function de(e,t,n){return e.origin!==Te||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function fn(e){}const rt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...rt];const Nt=new Set([...rt]);[...Nt];function qt(e){return e.filter(t=>t!=null)}function Ie(e){return e instanceof Re||e instanceof Ae?e.status:500}function Dt(e){return e instanceof Ae?e.text:"Internal Error"}let E,J,ve;const Vt=Ve.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ve.toString()),ze="a:";Vt?(E={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(ze)},J={current:null},ve={current:!1}):(E=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL(ze));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},J=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},ve=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},nt.v=()=>ve.current=!0);function Bt(e){Object.assign(E,e)}const Kt=new Set(["icon","shortcut icon","apple-touch-icon"]);let F=null;const C=He(Xe)??{},X=He(Je)??{},$={url:Me({}),page:Me({}),navigating:xe(null),updated:jt()};function Oe(e){C[e]=q()}function Mt(e,t){let n=e+1;for(;C[n];)delete C[n],n+=1;for(n=t+1;X[n];)delete X[n],n+=1}function Z(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function at(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(L||"/");e&&await e.update()}}function Fe(){}let Pe,ke,ae,I,Ee,y;const oe=[],se=[];let x=null;function ie(){x?.fork?.then(e=>e?.discard()),x=null}const te=new Map,ot=new Set,zt=new Set,Y=new Set;let m={branch:[],error:null,url:null},st=!1,le=!1,Ge=!0,Q=!1,G=!1,it=!1,$e=!1,lt,v,R,N;const ce=new Set,We=new Map;async function gn(e,t,n){globalThis.__sveltekit_tdx9xw&&(globalThis.__sveltekit_tdx9xw.query,globalThis.__sveltekit_tdx9xw.prerender),document.URL!==location.href&&(location.href=location.href),y=e,await e.hooks.init?.(),Pe=Ot(e),I=document.documentElement,Ee=t,ke=e.nodes[0],ae=e.nodes[1],ke(),ae(),v=history.state?.[B],R=history.state?.[H],v||(v=R=Date.now(),history.replaceState({...history.state,[B]:v,[H]:R},""));const r=C[v];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await an(Ee,n)):(await K({type:"enter",url:Qe(y.hash?ln(new URL(location.href)):location.href),replace_state:!0}),a()),rn()}function Ft(){oe.length=0,$e=!1}function ct(e){se.some(t=>t?.snapshot)&&(X[e]=se.map(t=>t?.snapshot?.capture()))}function ut(e){X[e]?.forEach((t,n)=>{se[n]?.snapshot?.restore(t)})}function Ye(){Oe(v),Be(Xe,C),ct(R),Be(Je,X)}async function Gt(e,t,n,r){let a;t.invalidateAll&&ie(),await K({type:"goto",url:Qe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&($e=!0,a=[],We.forEach((i,s)=>{for(const o of i.keys())a.push(s+"/"+o)})),t.invalidate&&t.invalidate.forEach(nn)}}),t.invalidateAll&&ne().then(ne).then(()=>{We.forEach((i,s)=>{i.forEach(({resource:o},l)=>{a?.includes(s+"/"+l)&&o.refresh?.()})})})}async function Wt(e){if(e.id!==x?.id){ie();const t={};ce.add(t),x={id:e.id,token:t,promise:dt({...e,preload:t}).then(n=>(ce.delete(t),n.type==="loaded"&&n.state.error&&ie(),n)),fork:null}}return x.promise}async function ye(e){const t=(await he(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function ft(e,t,n){const r={params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)};m={...e.state,nav:r};const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(E,e.props.page),lt=new y.root({target:t,props:{...e.props,stores:$,components:se},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),ut(R),n){const i={from:null,to:{...r,scroll:C[v]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};Y.forEach(s=>s(i))}le=!0}async function ue({url:e,params:t,branch:n,errors:r,status:a,error:i,route:s,form:o}){let l="never";if(L&&(e.pathname===L||e.pathname===L+"/"))l="always";else for(const u of n)u?.slash!==void 0&&(l=u.slash);e.pathname=vt(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:i,route:s},props:{constructors:qt(n).map(u=>u.node.component),page:De(E)}};o!==void 0&&(c.props.form=o);let f={},p=!E,w=0;for(let u=0;uo(new URL(s))))return!0;return!1}function je(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Jt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Xt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:De(E),constructors:[]}}}async function dt({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(x?.id===e)return ce.delete(x.token),x.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(g=>g?.().catch(()=>{})),c.forEach(g=>g?.[1]().catch(()=>{}));const f=m.url?e!==fe(m.url):!1,p=m.route?a.id!==m.route.id:!1,w=Jt(m.url,n);let h=!1;const u=c.map(async(g,d)=>{if(!g)return;const b=m.branch[d];return g[1]===b?.loader&&!Ht(h,p,f,w,b.universal?.uses,r)?b:(h=!0,Ce({loader:g[1],url:n,params:r,route:a,parent:async()=>{const O={};for(let P=0;P{});const _=[];for(let g=0;gPromise.resolve({}),server_data_node:je(i)}),o={node:await ae(),loader:ae,universal:null,server:null,data:null};return ue({url:n,params:a,branch:[s,o],status:e,error:t,errors:[],route:null})}catch(s){if(s instanceof Le)return Gt(new URL(s.location,location.href),{},0);throw s}}async function Qt(e){const t=e.href;if(te.has(t))return te.get(t);let n;try{const r=(async()=>{let a=await y.hooks.reroute({url:new URL(e),fetch:async(i,s)=>Yt(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);y.hash?i.hash=a:i.pathname=a,a=i}return a})();te.set(t,r),n=await r}catch{te.delete(t);return}return n}async function he(e,t){if(e&&!de(e,L,y.hash)){const n=await Qt(e);if(!n)return;const r=en(n);for(const a of Pe){const i=a.exec(r);if(i)return{id:fe(e),invalidating:t,route:a,params:bt(i),url:e}}}}function en(e){return yt(y.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(L.length))||"/"}function fe(e){return(y.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function ht({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=qe(m,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return Q||ot.forEach(c=>c(l)),s?null:o}async function K({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Fe,block:f=Fe,event:p}){const w=N;N=l;const h=await he(t,!1),u=e==="enter"?qe(m,h,t,e):ht({url:t,type:e,delta:n?.delta,intent:h,scroll:n?.scroll,event:p});if(!u){f(),N===l&&(N=w);return}const _=v,g=R;c(),Q=!0,le&&u.navigation.type!=="enter"&&$.navigating.set(J.current=u.navigation);let d=h&&await dt(h);if(!d){if(de(t,L,y.hash))return await Z(t,i);d=await pt(t,{id:null},await ee(new Ae(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=h?.url||t,N!==l)return u.reject(new Error("navigation aborted")),!1;if(d.type==="redirect"){if(o<20){await K({type:e,url:new URL(d.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),u.fulfil(void 0);return}d=await Ne({status:500,error:await ee(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else d.props.page.status>=400&&await $.updated.check()&&(await at(),await Z(t,i));if(Ft(),Oe(_),ct(g),d.props.page.url.pathname!==t.pathname&&(t.pathname=d.props.page.url.pathname),s=n?n.state:s,!n){const k=i?0:1,M={[B]:v+=k,[H]:R+=k,[Ze]:s};(i?history.replaceState:history.pushState).call(history,M,"",t),i||Mt(v,R)}const b=h&&x?.id===h.id?x.fork:null;x?.fork&&!b&&ie(),x=null,d.props.page.state=s;let S;if(le){const k=(await Promise.all(Array.from(zt,z=>z(u.navigation)))).filter(z=>typeof z=="function");if(k.length>0){let z=function(){k.forEach(ge=>{Y.delete(ge)})};k.push(z),k.forEach(ge=>{Y.add(ge)})}const M=u.navigation.to;m={...d.state,nav:{params:M.params,route:M.route,url:M.url}},d.props.page&&(d.props.page.url=t);const pe=b&&await b;pe?S=pe.commit():(F=null,lt.$set(d.props),F&&Object.assign(d.props.page,F),Bt(d.props.page),S=wt?.()),it=!0}else await ft(d,Ee,!1);const{activeElement:O}=document;await S,await ne(),await ne();let P=null;if(Ge){const k=n?n.scroll:a?q():null;k?scrollTo(k.x,k.y):(P=t.hash&&document.getElementById(gt(t)))?P.scrollIntoView():scrollTo(0,0)}const _t=document.activeElement!==O&&document.activeElement!==document.body;!r&&!_t&&sn(t,!P),Ge=!0,d.props.page&&(F&&Object.assign(d.props.page,F),Object.assign(E,d.props.page)),Q=!1,e==="popstate"&&ut(R),u.fulfil(void 0),u.navigation.to&&(u.navigation.to.scroll=q()),Y.forEach(k=>k(u.navigation)),$.navigating.set(J.current=null)}async function pt(e,t,n,r,a){return e.origin===Te&&e.pathname===location.pathname&&!st?await Ne({status:r,error:n,url:e,route:t}):await Z(e,a)}function tn(){let e,t={element:void 0,href:void 0},n;I.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,j.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],j.tap)}I.addEventListener("mousedown",r),I.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(ye(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=tt(o,I),f=c===t.element&&c?.href===t.href&&l>=n;if(!c||f)return;const{url:p,external:w,download:h}=be(c,L,y.hash);if(w||h)return;const u=re(c),_=p&&fe(m.url)===fe(p);if(!(u.reload||_))if(l<=u.preload_data){t={element:c,href:c.href},n=j.tap;const g=await he(p,!1);if(!g)return;Wt(g)}else l<=u.preload_code&&(t={element:c,href:c.href},n=l,ye(p))}function s(){a.disconnect();for(const o of I.querySelectorAll("a")){const{url:l,external:c,download:f}=be(o,L,y.hash);if(c||f)continue;const p=re(o);p.reload||(p.preload_code===j.viewport&&a.observe(o),p.preload_code===j.eager&&ye(l))}}Y.add(s),s()}function ee(e,t){if(e instanceof Re)return e.body;const n=Ie(e),r=Dt(e);return y.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function nn(e){if(typeof e=="function")oe.push(e);else{const{href:t}=new URL(e,location.href);oe.push(n=>n.href===t)}}function rn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Ye(),!Q){const r=qe(m,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ot.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ye()}),navigator.connection?.saveData||tn(),I.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=tt(t.composedPath()[0],I);if(!n)return;const{url:r,external:a,target:i,download:s}=be(n,L,y.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=re(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,f]=(y.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===me(location);if(a||o.reload&&(!p||!f)){ht({url:r,type:"link",event:t})?Q=!0:t.preventDefault();return}if(f!==void 0&&p){const[,w]=m.url.href.split("#");if(w===f){if(t.preventDefault(),f===""||f==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const h=n.ownerDocument.getElementById(decodeURIComponent(f));h&&(h.scrollIntoView(),h.focus())}return}if(G=!0,Oe(v),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(w=>{requestAnimationFrame(()=>{setTimeout(w,0)}),setTimeout(w,100)}),await K({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),I.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(de(s,L,!1))return;const o=t.target,l=re(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),K({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Se){if(t.state?.[B]){const n=t.state[B];if(N={},n===v)return;const r=C[n],a=t.state[Ze]??{},i=new URL(t.state[Ct]??location.href),s=t.state[H],o=m.url?me(location)===me(m.url):!1;if(s===R&&(it||o)){a!==E.state&&(E.state=a),e(i),C[v]=q(),r&&scrollTo(r.x,r.y),v=n;return}const c=n-v;await K({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{v=n,R=s},block:()=>{history.go(-c)},nav_token:N,event:t})}else if(!G){const n=new URL(location.href);e(n),y.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[B]:++v,[H]:R},"",location.href))});for(const t of document.querySelectorAll("link"))Kt.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&$.navigating.set(J.current=null)});function e(t){m.url=E.url=t,$.page.set(De(E)),$.page.notify()}}async function an(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){st=!0;const c=new URL(location.href);let f;({params:a={},route:i={id:null}}=await he(c,!1)||{}),f=Pe.find(({id:h})=>h===i.id);let p,w=!0;try{const h=r.map(async(_,g)=>{const d=o[g];return d?.uses&&(d.uses=on(d.uses)),Ce({loader:y.nodes[_],url:c,params:a,route:i,parent:async()=>{const b={};for(let S=0;S{const o=history.state;Se=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),Se=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s{if(a.rangeCount===i.length){for(let s=0;s{i=c,s=f});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function De(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function ln(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function gt(e){let t;if(y.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{gn as a,fn as l,E as p,$ as s};