Files
minstrel/internal/web/build/_app/immutable/chunks/Dg9CzvF0.js
T
2026-04-22 10:26:36 -04:00

2 lines
28 KiB
JavaScript

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