1function W(){return typeof window<"u"&&typeof window.scrollY=="number"}function Yt(){return!(typeof process>"u"||!process.cwd||!process.versions||typeof process.versions.node>"u"||!process.release||process.release.name!=="node")}function ve(e,t){let n;{var r=Error.stackTraceLimit;Error.stackTraceLimit=1/0,n=new Error(e),Error.stackTraceLimit=r}return Yt()&&(n.stack=Kt(n.stack,t)),n}function Kt(e,t){if(!e)return e;const n=Xt(e);let r=0;return n.filter(o=>o.includes(" (internal/")||o.includes(" (node:internal")?!1:r<t&&qt(o)?(r++,!1):!0).join(` 2`)}function qt(e){return e.startsWith(" at ")}function Xt(e){return e.split(/\r?\n/)}function C(e,t){const n=globalThis.__vike=globalThis.__vike||{};return n[e]=n[e]||t}function E(e){return typeof e=="object"&&e!==null}function Ee(e){return Array.from(new Set(e))}const T=C("assertPackageInstances.ts",{instances:[],alreadyLogged:new Set}),Qt="The client runtime of Server Routing as well as the client runtime of Client Routing are both being loaded. Make sure they aren't loaded both at the same time for a given page. See https://vike.dev/client-runtimes-conflict",nt="Two vike client runtime instances are being loaded. Make sure your client-side bundles don't include vike twice. (In order to reduce the size of your client-side JavaScript bundles.)";function rt(){{const e=Ee(T.instances);en(e.length<=1,`Both vike@${e[0]} and vike@${e[1]} loaded. Only one version should be loaded.`)}T.checkSingleInstance&&T.instances.length>1&&pe(!1,nt,{onlyOnce:!0,showStackTrace:!0})}function Xi(e){pe(T.isClientRouting!==!1,Qt,{onlyOnce:!0,showStackTrace:!0}),pe(T.isClientRouting===void 0,nt,{onlyOnce:!0,showStackTrace:!0}),T.isClientRouting=!0,e&&(T.checkSingleInstance=!0),rt()}function Zt(e){T.instances.push(e),rt()}function en(e,t){if(e)return;const n=`[vike][Wrong Usage] ${t}`;throw new Error(n)}function pe(e,t,{onlyOnce:n,showStackTrace:r}){if(e)return;const i=`[vike][Warning] ${t}`;if(n){const{alreadyLogged:o}=T,l=n===!0?i:n;if(o.has(l))return;o.add(l)}console.warn(r?new Error(i):i)}const tn="0.4.145",H={projectName:"Vike",projectVersion:tn,npmPackageName:"vike",githubRepository:"https://github.com/vikejs/vike"};Zt(H.projectVersion);const it=new Proxy(e=>e,{get:()=>it}),y=it,v=C("utils/assert.ts",{alreadyLogged:new Set,logger(e,t){t==="info"?console.log(e):console.warn(e)},showStackTraceList:new WeakSet}),nn=`[${H.npmPackageName}]`,rn=`[${H.npmPackageName}@${H.projectVersion}]`,_e=2;function s(e,t){var l;if(e)return;const n=(()=>{if(!t)return null;const a=typeof t=="string"?t:JSON.stringify(t);return y.dim(`Debug info (for ${H.projectName} maintainers; you can ignore this): ${a}`)})(),r=`${H.githubRepository}/issues/new`;let i=[`You stumbled upon a bug in ${H.projectName}'s source code.`,`Go to ${y.blue(r)} and copy-paste this error; a maintainer will fix the bug (usually under 24 hours).`,n].filter(Boolean).join(" ");i=G(i),i=ie(i,"Bug"),i=M(i,!0);const o=ve(i,_e);throw(l=v.onBeforeLog)==null||l.call(v),o}function h(e,t,{showStackTrace:n}={}){var i;if(e)return;t=G(t),t=ie(t,"Wrong Usage"),t=M(t);const r=ve(t,_e);throw n&&v.showStackTraceList.add(r),(i=v.onBeforeLog)==null||i.call(v),r}function ot(e){return e=G(e),e=ie(e,"Error"),e=M(e),ve(e,_e)}function S(e,t,{onlyOnce:n,showStackTrace:r}){var i;if(!e){if(t=G(t),t=ie(t,"Warning"),t=M(t),n){const{alreadyLogged:o}=v,l=n===!0?t:n;if(o.has(l))return;o.add(l)}if((i=v.onBeforeLog)==null||i.call(v),r){const o=new Error(t);v.showStackTraceList.add(o),v.logger(o,"warn")}else v.logger(t,"warn")}}function $e(e,t,{onlyOnce:n}){var r;if(!e){if(t=G(t),t=M(t),n){const{alreadyLogged:i}=v,o=t;if(i.has(o))return;i.add(o)}(r=v.onBeforeLog)==null||r.call(v),v.logger(t,"info")}}function ie(e,t){let n=`[${t}]`;const r=t==="Warning"?"yellow":"red";return n=y.bold(y[r](n)),`${n}${e}`}function G(e){return e.startsWith("[")?e:` ${e}`}function M(e,t=!1){return`${t?rn:nn}${e}`}function st(){s(W())}const at=C("utils/assertRouterType.ts",{});function oe(){sn(on()),at.isClientRouting=!0}function on(){return at.isClientRouting!==!1}function sn(e){h(W(),`${y.cyan("import { something } from 'vike/client/router'")} is forbidden on the server-side`,{showStackTrace:!0}),S(e,"You shouldn't `import { something } from 'vike/client/router'` when using Server Routing. The 'vike/client/router' utilities work only with Client Routing. In particular, don't `import { navigate }` nor `import { prefetch }` as they unnecessarily bloat your client-side bundle sizes.",{showStackTrace:!0,onlyOnce:!0})}function an(){st(),oe()}function ln(){st()}function Ne(e){const t=e/1e3;if(t<120){const n=Be(t);return`${n} second${De(n)}`}{const n=t/60,r=Be(n);return`${r} minute${De(r)}`}}function Be(e){let t=e.toFixed(1);
2return t.endsWith(".0")&&(t=t.slice(0,-2)),t}function De(e){return e==="1"?"":"s"}const un=C("utils/executeHook.ts",{userHookErrors:new Map});function se(e,t,n){const{timeoutErr:r,timeoutWarn:i}=cn(t);let o,l;const a=new Promise((f,g)=>{o=p=>{u(),f(p)},l=p=>{u(),g(p)}}),u=()=>{clearTimeout(c),clearTimeout(d)},c=setTimeout(()=>{S(!1,`The ${t}() hook defined by ${n} is taking more than ${Ne(i)}`,{onlyOnce:!1})},i),d=setTimeout(()=>{const f=ot(`Hook timeout: the ${t}() hook defined by ${n} didn't finish after ${Ne(r)}`);l(f)},r);return(async()=>{try{const f=await e();o(f)}catch(f){E(f)&&un.userHookErrors.set(f,{hookName:t,hookFilePath:n}),l(f)}})(),a}function cn(e){return e==="onBeforeRoute"?{timeoutErr:5*1e3,timeoutWarn:1*1e3}:e==="onBeforePrerender"?{timeoutErr:10*60*1e3,timeoutWarn:30*1e3}:{timeoutErr:40*1e3,timeoutWarn:4*1e3}}function x(e,t,n){return typeof e=="string"?Ve(e.split(""),t,n).join(""):Ve(e,t,n)}function Ve(e,t,n){const r=[];let i=t>=0?t:e.length+t;s(i>=0&&i<=e.length);let o=n>=0?n:e.length+n;for(s(o>=0&&o<=e.length);!(i===o||(i===e.length&&(i=0),i===o));){const l=e[i];s(l!==void 0),r.push(l),i++}return r}const lt=["http://","https://","tauri://"];function Ce(e){return lt.some(t=>e.startsWith(t))||e.startsWith("/")||e.startsWith(".")||e.startsWith("?")||e.startsWith("#")||e===""}function fn(e,t){s(t.includes(" but ")),h(typeof e=="string",`${t} should be a string`),!Ce(e)&&(!e.startsWith("/")&&!e.includes(":")?h(!1,`${t} is ${y.cyan(e)} and it should be /${y.cyan(e)} instead (URL pathnames should start with a leading slash)`):h(!1,`${t} isn't a valid URL`))}function J(e,t){s(Ce(e)),s(t.startsWith("/"));const[n,...r]=e.split("#");s(n!==void 0);const i=["",...r].join("#")||null;s(i===null||i.startsWith("#"));const o=i===null?"":ye(i.slice(1)),[l,...a]=n.split("?");s(l!==void 0);const u=["",...a].join("?")||null;s(u===null||u.startsWith("?"));const c={},d={};Array.from(new URLSearchParams(u||"")).forEach(([$,V])=>{c[$]=V,d[$]=[...d.hasOwnProperty($)?d[$]:[],V]});const{origin:f,pathname:g}=gn(l,t);s(f===null||f===ye(f)),s(g.startsWith("/")),s(f===null||e.startsWith(f));const p=l.slice((f||"").length);mn(e,f,p,u,i);let{pathname:P,hasBaseServer:O}=yn(g,t);return P=dn(P),s(P.startsWith("/")),{origin:f,pathname:P,pathnameOriginal:p,hasBaseServer:O,search:c,searchAll:d,searchOriginal:u,hash:o,hashOriginal:i}}function ye(e){try{return decodeURIComponent(e)}catch{}try{return decodeURI(e)}catch{}return e}function dn(e){return e=e.split("/").map(t=>ye(t).split("/").join("%2F")).join("/"),e=e.replace(/\s/g,""),e}function gn(e,t){var n;{const{origin:r,pathname:i}=ce(e);if(r)return{origin:r,pathname:i};s(i===e)}if(e.startsWith("/"))return{origin:null,pathname:e};{let r=typeof window<"u"&&((n=window==null?void 0:window.document)==null?void 0:n.baseURI);r&&(r=ce(r).pathname);const o=hn(e,r||t);return ce(o)}}function ce(e){if(lt.some(t=>e.startsWith(t))){const[t,n,r,...i]=e.split("/"),o=[t,n,r].join("/"),l=["",...i].join("/")||"/";return{origin:o,pathname:l}}else return{pathname:e,origin:null}}function hn(e,t){const n=t.split("/"),r=e.split("/");let i=t.endsWith("/");e.startsWith(".")&&n.pop();for(const l in r){const a=r[l];a==""&&l==="0"||a!="."&&(a==".."?n.pop():(i=!1,n.push(a)))}let o=n.join("/");return i&&!o.endsWith("/")&&(o+="/"),o.startsWith("/")||(o="/"+o),o}function pn(e){s(e.startsWith("/")),s(!e.includes("?")),s(!e.includes("#"))}function yn(e,t){pn(e),s(Oe(t));let n=e;if(s(n.startsWith("/")),s(t.startsWith("/")),t==="/")return{pathname:e,hasBaseServer:!0};let r=t;return t.endsWith("/")&&n===x(t,0,-1)&&(r=x(t,0,-1),s(n===r)),n.startsWith(r)?(s(n.startsWith("/")||n.startsWith("http")),s(n.startsWith(r)),n=n.slice(r.length),n.startsWith("/")||(n="/"+n),s(n.startsWith("/")),{pathname:n,hasBaseServer:!0}):{pathname:e,hasBaseServer:!1}}function Oe(e){return e.startsWith("/")}function mn(e,t,n,r,i){const o=bn(t,n,r,i);s(e===o)}function bn(e,t,n,r){return`${e||""}${t}${n||""}${r||""}`}function ke(e){const t=window.location.href,{searchOriginal:n,hashOriginal:r,pathname:i}=J(t,"/");let o;return e!=null&&e.withoutHash?o=`${i}${n||""}`:o=`${i}${n||""}${r||""}`,s(o.startsWith("/")),o}function A(e){return e instanceof Function||typeof e=="function"}function m(e,t,n="unknown"){if(!E(e))return!1;if(!(t in e))return n==="undefined";if(n==="unknown")return!0;const r=e[t];return n==="array"?Array.isArray(r):n==="object"?E(r):n==="string[]"?Array.isArray(r)&&r.every(i=>typeof i=="string"):n==="function"?A(r):Array.isArray(n)?typeof r=="string"&&n.includes(r):n==="null"?r===null:n==="undefined"?r===void 0:n==="true"?r===!0:n==="false"?r===!1:typeof r===n}function b(e,t){t&&Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}ln();function I(e){return typeof e!="object"||e===null?!1:Object.getPrototypeOf(e)===null?!0:e.constructor.name==="Object"}function wn(){var r,i,o,l;const e=!!((i=(r=window.__REACT_DEVTOOLS_GLOBAL_HOOK__)==null?void 0:r.renderers)!=null&&i.size),t=!!((l=(o=window.__REACT_DEVTOOLS_GLOBAL_HOOK__)==null?void 0:o.rendererInterfaces)!=null&&l.size),n=!!window.__vite_plugin_react_preamble_installed__;return e||t||n}function ut(e,t){const n=Object.keys,r=typeof e;return e&&t&&r==="object"&&r===typeof t?n(e).length===n(t).length&&n(e).every(o=>ut(e[o],t[o])):e===t}function Pn(e,t){return E(e)&&E(t)&&e.constructor===t.constructor&&ut({...e,stack:null},{...t,stack:null})&&t.message===t.message}function ee(e){window.location.href=e}function Rn(e){return new Promise(t=>setTimeout(t,e))}function Sn(e,t){let n=!1;return()=>{n||(n=!0,setTimeout(()=>{n=!1,e()},t))}}function ct(e){window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()})}function vn(e){window.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&e()})}function En(e){return!e.startsWith("/")&&!e.startsWith(".")&&!e.startsWith("?")&&e!==""}an();const _n=[{is:e=>e===void 0,match:e=>e==="!undefined",serialize:()=>"!undefined",deserialize:()=>{}},{is:e=>e===1/0,match:e=>e==="!Infinity",serialize:()=>"!Infinity",deserialize:()=>1/0},{is:e=>e===-1/0,match:e=>e==="!-Infinity",serialize:()=>"!-Infinity",deserialize:()=>-1/0},{is:e=>typeof e=="number"&&isNaN(e),match:e=>e==="!NaN",serialize:()=>"!NaN",deserialize:()=>NaN},{is:e=>e instanceof Date,match:e=>e.startsWith("!Date:"),serialize:e=>"!Date:"+e.toISOString(),deserialize:e=>new Date(e.slice(6))},{is:e=>typeof e=="bigint",match:e=>e.startsWith("!BigInt:"),serialize:e=>"!BigInt:"+e.toString(),deserialize:e=>{if(typeof BigInt>"u")throw new Error("Your JavaScript environement does not support BigInt. C
2onsider adding a polyfill.");return BigInt(e.slice(8))}},{is:e=>e instanceof RegExp,match:e=>e.startsWith("!RegExp:"),serialize:e=>"!RegExp:"+e.toString(),deserialize:e=>{e=e.slice(8);const t=e.match(/\/(.*)\/(.*)?/),n=t[1],r=t[2];return new RegExp(n,r)}},{is:e=>e instanceof Map,match:e=>e.startsWith("!Map:"),serialize:(e,t)=>"!Map:"+t(Array.from(e.entries())),deserialize:(e,t)=>new Map(t(e.slice(5)))},{is:e=>e instanceof Set,match:e=>e.startsWith("!Set:"),serialize:(e,t)=>"!Set:"+t(Array.from(e.values())),deserialize:(e,t)=>new Set(t(e.slice(5)))},{is:e=>typeof e=="string"&&e.startsWith("!"),match:e=>e.startsWith("!"),serialize:e=>"!"+e,deserialize:e=>e.slice(1)}];function ae(e){const t=JSON.parse(e);return ft(t)}function ft(e){return typeof e=="string"?$n(e):(typeof e=="object"&&e!==null&&Object.entries(e).forEach(([t,n])=>{e[t]=ft(n)}),e)}function $n(e){for(const{match:t,deserialize:n}of _n)if(t(e))return n(e,ae);return e}function Cn(){const e="vike_pageContext",t=document.getElementById(e);h(t,`The element #${e} (which vike automatically injects into the HTML) is missing from the DOM. This may happen if your HTML is malformed. Make sure your HTML isn't malformed, and make sure you don't remove #${e} from the HTML nor from the DOM.`);const n=t.textContent;s(n);const r=ae(n);return s(m(r,"_pageId","string")),b(r,{_hasPageContextFromServer:!0}),r}function Z(e){return(t,n)=>{const r=e(t),i=e(n);return r===i?0:r>i?-1:1}}function On(e){return(t,n)=>{const r=e(t),i=e(n);return r===i?0:r<i?-1:1}}function j(e){return(t,n)=>{const r=e(t),i=e(n);if(s([!0,!1,null].includes(r)),s([!0,!1,null].includes(i)),r===i)return 0;if(r===!0||i===!1)return-1;if(i===!0||r===!1)return 1;s(!1)}}function kn(e){return j(t=>{const n=e(t);return n===null?null:!n})}function Tn(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0}const xn=e=>e!=null;function Ue(e){return"["+e.map(t=>"'"+t+"'").join(", ")+"]"}function dt(e){const t=n=>`Not a posix path: ${n}`;s(e!==null,t("null")),s(typeof e=="string",t(`typeof path === ${JSON.stringify(typeof e)}`)),s(e!=="",t("(empty string)")),s(e),s(!e.includes("\\"),t(e))}function fe(e,t){const n=Object.getOwnPropertyDescriptor(e,t);return!!n&&!("value"in n)&&!!n.get}function Fn(e){return typeof e=="object"&&e!==null&&"then"in e&&A(e.then)}function In(e){return[null,void 0].includes(e)?String(e):["boolean","number","string"].includes(typeof e)?JSON.stringify(e):null}function An(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}function B(e){dt(e)}function Te(e,t){return ht(e,t,!0)}function gt(e,t){return ht(e,t,!1)}function ht(e,t,n){const r=n?"CLIENT_ONLY":"SERVER_ONLY",i=e.filter(p=>p.isRelevant(t)&&p.fileType!==".page.route").sort(jn(n,t)),o=p=>{const P=i.filter($=>$.pageId===t&&$.isEnv(p?"CLIENT_AND_SERVER":r));h(P.length<=1,`Merge the following files into a single file: ${P.map($=>$.filePath).join(" ")}`);const O=P[0];return s(O===void 0||!O.isDefaultPageFile),O},l=o(!1),a=o(!0),u=p=>i.filter(P=>P.isRendererPageFile&&P.isEnv(p?"CLIENT_AND_SERVER":r))[0],c=u(!1),d=u(!0),f=i.filter(p=>p.isDefaultPageFile&&!p.isRendererPageFile&&(p.isEnv(r)||p.isEnv("CLIENT_AND_SERVER")));return[l,a,...f,c,d].filter(xn)}function jn(e,t){const n=e?"CLIENT_ONLY":"SERVER_ONLY",r=-1,i=1,o=0;return(l,a)=>{if(!l.isDefaultPageFile&&a.isDefaultPageFile)return r;if(!a.isDefaultPageFile&&l.isDefaultPageFile)return i;{const u=l.isRendererPageFile,c=a.isRendererPageFile;if(!u&&c)return r;if(!c&&u)return i;s(u===c)}{const u=ze(t,l.filePath),c=ze(t,a.filePath);if(u<c)return r;if(c<u)return i;s(u===c)}{if(l.isEnv(n)&&a.isEnv("CLIENT_AND_SERVER"))return r;if(a.isEnv(n)&&l.isEnv("CLIENT_AND_SERVER"))return i}return o}}function ze(e,t){B(e),B(t);let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);const r=e.slice(n),i=t.slice(n),o=r.split("/").length,l=i.split("/").length;return o+l}async function Ln(e,t){const r=gt(e,t).filter(o=>o.fileType===".page.server");return await Promise.all(r.map(async o=>{o.exportNames||(s(o.loadExportNames,t),await o.loadExportNames())})),{hasOnBeforeRenderServerSideOnlyHook:r.some(({exportNames:o})=>(s(o),o.includes("onBeforeRender")))}}function pt(e,t){if(t.length>0){const r=t.filter(i=>i.isErrorPage);return r.length===0?null:(h(r.length===1,"Only one error page can be defined"),r[0].pageId)}const n=Ee(e.map(({pageId:r})=>r).filter(r=>Y(r)));if(h(n.length<=1,`Only one _error.page.js is allowed, but found several: ${n.join(" ")}`),n.length>0){const r=n[0];return s(r),r}return null}function Y(e,t){return s(!e.includes("\\")),e.includes("/_error")}function Hn(e,t){if(t.length>0){const n=t.find(r=>r.pageId===e);return s(n),!!n.isErrorPage}else return Y(e)}function z(e,t){if(!(t in e.exports))return null;const n=e.exports[t],r=e.exportsAll[t][0];if(s(r.exportValue===n),n===null)return null;const i=r.filePath;return s(i),s(!i.endsWith(" ")),Wn(n,{hookName:t,hookFilePath:i}),{hookFn:n,hookName:t,hookFilePath:i}}function de(e,t){z(e,t)}function Wn(e,{hookName:t,hookFilePath:n}){s(t&&n),s(!t.endsWith(")")),h(A(e),`Hook ${t}() defined by ${n} should be a function`)}function Nn(e){const t=Object.entries(e);for(const n in e)delete e[n];t.sort(([n],[r])=>
2Tn(n,r)).forEach(([n,r])=>{e[n]=r})}function Bn(e){Dn(e),Vn(e)}function Dn(e){Hn(e._pageId,e._pageConfigs)&&s(m(e,"is404","boolean"))}function Vn(e){if(e.is404===void 0||e.is404===null)return;const t=e.pageProps||{};if(!E(t)){S(!1,"pageContext.pageProps should be an object",{showStackTrace:!0,onlyOnce:!0});return}t.is404=t.is404||e.is404,e.pageProps=t}const Un="not-serializable",te=C("getPageContextProxyForUser.ts",{});function zn(e){return s([!0,!1].includes(e._hasPageContextFromServer)),s([!0,!1].includes(e._hasPageContextFromClient)),new Proxy(e,{get(t,n){const r=e[n],i=JSON.stringify(n);return h(r!==Un,`pageContext[${i}] couldn't be serialized and, therefore, is missing on the client-side. Check the server logs for more information.`),Gn(e,n),r}})}function Gn(e,t){if(te.prev===t||te.prev==="__v_raw"||(Yn(t),t in e)||Jn(t))return;const n=JSON.stringify(t);e._hasPageContextFromServer&&!e._hasPageContextFromClient&&h(!1,`pageContext[${n}] isn't available on the client-side because ${n} is missing in passToClient, see https://vike.dev/passToClient`)}const Mn=["then","toJSON"];function Jn(e){return!!(Mn.includes(e)||typeof e=="symbol"||typeof e!="string"||e.startsWith("__v_"))}function Yn(e){te.prev=e,window.setTimeout(()=>{te.prev=void 0},0)}function xe(e,t){if(t){const i=e;s([!0,!1].includes(i.isHydration)),s([!0,!1,null].includes(i.isBackwardNavigation))}else{const i=e;s(i.isHydration===!0),s(i.isBackwardNavigation===null)}s("config"in e),s("configEntries"in e),s("exports"in e),s("exportsAll"in e),s("pageExports"in e),s(E(e.pageExports));const n=e.exports.Page;b(e,{Page:n}),Kn(e),Nn(e);const r=zn(e);return Bn(e),r}function Kn(e){Object.entries(e).forEach(([t,n])=>{delete e[t],e[t]=n})}const qn=["js","ts","cjs","cts","mjs","mts","jsx","tsx","cjsx","ctsx","mjsx","mtsx"],yt=["vue","svelte","marko","md","mdx"],Xn=[...qn,...yt];function mt(e){const t=Xn.some(n=>e.endsWith("."+n));return s(!Qn(e)||t),t}function Qn(e){return/\.(c|m)?(j|t)sx?$/.test(e)}function Zn(e){return yt.some(t=>e.endsWith("."+t))}const er=["clientRouting"];function tr(e){er.forEach(t=>{if(s(e.fileExports),!(t in e.fileExports))return;const n=`The value of \`${t}\` is only allowed to be \`true\`.`;h(e.fileExports[t]!==!1,`${e.filePath} has \`export { ${t} }\` with the value \`false\` which is prohibited: remove \`export { ${t} }\` instead. (${n})`),h(e.fileExports[t]===!0,`${e.filePath} has \`export { ${t} }\` with a forbidden value. ${n}`)})}const bt=["render","clientRouting","prerender","doNotPrerender"];function nr(e,t){h(!bt.includes(e),`${t} has \`export default { ${e} }\` which is prohibited, use \`export { ${e} }\` instead.`)}function rr(e,t){if(!e)return null;let[n,...r]=e;if(!n||r.length===0&&["*","default",t].includes(n))return null;s(n!=="*");let i="",o="";return n==="default"?i="export default":(i="export",r=[n,...r]),r.forEach(a=>{i=`${i} { ${a}`,o=` }${o}`}),i+o}function le(e,t,{definedAt:n}){const r=wt(n,t),i=r==="internally"?r:`at ${r}`;let o=`${t}${e==="Hook"?"()":""}`;return`${e} ${y.cyan(o)} defined ${i}`}function wt(e,t){if("isComputed"in e)return"internally";let n;return"files"in e?n=e.files:n=[e],s(n.length>=1),n.map(i=>{const{filePathToShowToUser:o,fileExportPathToShowToUser:l}=i;let a=o;const u=rr(l,t);return u&&(a=`${a} > ${y.cyan(u)}`),a}).join(" / ")}function D(e,t,n){const r=or(e,t);if(r===null)return null;const{value:i,definedAt:o}=r;return n&&ir(i,n,t,o),r}function ir(e,t,n,r){s(e!==null);const i=typeof e;if(i===t)return;const o=In(e),l=o!==null?`value ${y.cyan(o)}`:`type ${y.cyan(i)}`,u=`${le("Config",n,{definedAt:r})} has an invalid ${l}: it should be a ${y.cyan(t)} instead`;h(!1,u)}function or(e,t){const n=e.configValues[t];return!n||n.value===null?null:n}function Pt(e,t){const n=t.find(r=>r.pageId===e);return s(t.length>0),s(n),n}function Rt({definedAt:e}){if("isComputed"in e||"files"in e)return null;const{filePathToShowToUser:t}=e;return s(t),t}function sr({definedAt:e}){const t=Rt({definedAt:e});return s(t),t}function ar(e,t){const n={},r={},i={};e.forEach(a=>{lr(a).forEach(({exportName:c,exportValue:d,isFromDefaultExport:f})=>{s(c!=="default"),i[c]=i[c]??[],i[c].push({exportValue:d,exportSource:`${a.filePath} > ${f?`\`export default { ${c} }\``:`\`export { ${c} }\``}`,filePath:a.filePath,_filePath:a.filePath,_fileType:a.fileType,_isFromDefaultExport:f})})}
2),t&&Object.entries(t.configValues).forEach(([a,u])=>{const{value:c}=u,d=Rt(u),f=le("Config",a,u);r[a]=r[a]??c,n[a]=n[a]??[],s(n[a].length===0),n[a].push({configValue:c,configDefinedAt:f,configDefinedByFile:d});const g=a;i[g]=i[g]??[],i[g].push({exportValue:c,exportSource:f,filePath:d,_filePath:d,_fileType:null,_isFromDefaultExport:null})});const o=ur(),l={};return Object.entries(i).forEach(([a,u])=>{u.forEach(({exportValue:c,_fileType:d,_isFromDefaultExport:f})=>{l[a]=l[a]??c,d===".page"&&!f&&(a in o||(o[a]=c))})}),s(!("default"in l)),s(!("default"in i)),{config:r,configEntries:n,exports:l,exportsAll:i,pageExports:o}}function lr(e){const{filePath:t,fileExports:n}=e;s(n),s(mt(t));const r=[];return Object.entries(n).sort(kn(([i])=>i==="default")).forEach(([i,o])=>{let l=i==="default";if(l)if(Zn(t))i="Page";else{h(E(o),`The ${y.cyan("export default")} of ${t} should be an object.`),Object.entries(o).forEach(([a,u])=>{nr(a,t),r.push({exportName:a,exportValue:u,isFromDefaultExport:l})});return}r.push({exportName:i,exportValue:o,isFromDefaultExport:l})}),r.forEach(({exportName:i,isFromDefaultExport:o})=>{s(!(o&&bt.includes(i)))}),r}function ur(){return new Proxy({},{get(...e){return W()||S(!1,"`pageContext.pageExports` is outdated. Use `pageContext.exports` instead, see https://vike.dev/exports",{onlyOnce:!0,showStackTrace:!0}),Reflect.get(...e)}})}function cr(e){const t=".page.",n=x(e.split(t),0,-1).join(t);return s(!n.includes("\\")),n}const fr=[".page",".page.server",".page.route",".page.client",".css"];function dr(e){if(dt(e),e.endsWith(".css"))return".css";s(mt(e),e);const n=e.split("/").slice(-1)[0].split("."),r=n.slice(-3)[0],i=n.slice(-2)[0];if(i==="page")return".page";if(s(r==="page",e),i==="server")return".page.server";if(i==="client")return".page.client";if(i==="route")return".page.route";s(!1,e)}function St(e){const t=o=>i.pageId===o||i.isDefaultPageFile&&(Ge(i.filePath)||gr(o,i.filePath)),n=dr(e),i={filePath:e,fileType:n,isEnv:o=>{if(s(n!==".page.route"),o==="CLIENT_ONLY")return n===".page.client"||n===".css";if(o==="SERVER_ONLY")return n===".page.server";if(o==="CLIENT_AND_SERVER")return n===".page";s(!1)},isRelevant:t,isDefaultPageFile:me(e),isRendererPageFile:n!==".css"&&me(e)&&Ge(e),isErrorPageFile:Y(e),pageId:cr(e)};return i}function me(e){return B(e),Y(e)?!1:e.includes("/_default")}function Ge(e){return B(e),e.includes("/renderer/")}function gr(e,t){B(e),B(t),s(!e.endsWith("/")),s(!t.endsWith("/")),s(me(t));const n=x(t.split("/"),0,-1).filter(r=>r!=="_default").join("/");return e.startsWith(n)}function hr(e){s(Array.isArray(e)),e.forEach(t=>{s(E(t)),s(m(t,"pageId","string")),s(m(t,"routeFilesystem")),s(m(t,"configValuesSerialized")),s(m(t,"configValuesImported"))})}function pr(e){s(m(e,"configValuesImported"))}const yr=["$$registrations","_rerender_only"],mr=[".md",".mdx"];function br(e,t,n){wr(e,t,n)}function wr(e,t,n){const i=Object.keys(e).filter(l=>!yr.includes(l)),o=i.filter(l=>l!=="default"&&l!==n);if(o.length===0){if(i.length===1)return;{s(i.length===0);let l=`${t} doesn't export any value, but it should have a ${y.cyan("export default")}`;n&&(l+=` or ${y.cyan(`export { ${n} }`)}`),h(!1,l)}}else if(n){if(mr.some(l=>t.endsWith(l)))return;o.forEach(l=>{S(!1,`${t} should have only a single export: move ${y.cyan(`export { ${l} }`)} to +config.h.js or its own +${o}.js`,{onlyOnce:!0})})}else{const l=o.join(", ");h(!1,`${t} replace ${y.cyan(`export { ${l} }`)} with ${y.cyan(`export default { ${l} }`)}`)}}function be(e){const t={},n=(r,i,o,l)=>{t[r]={value:i,definedAt:{filePathToShowToUser:o,fileExportPathToShowToUser:[r,"default"].includes(l)?[]:[l]}},Pr(i,r,o)};return e.forEach(r=>{if(r.isValueFile){const{exportValues:i,importPath:o,configName:l}=r;l!=="client"&&br(i,o,l),Object.entries(i).forEach(([a,u])=>{const c=a!=="default",d=c?a:r.configName;c&&d in t||n(d,u,o,a)})}else{const{configName:i,importPath:o,exportValue:l,exportName:a}=r;n(i,l,o,a)}}),t}function Pr(e,t,n){s(!n.includes("+config.")),h(e!==null,`Set ${y.cyan(t)} to ${y.cyan("null")} in a +config.h.js file instead of ${n}`)}function Rr(e,t){const n=e.map(i=>{const o={};{const{configValuesSerialized:d}=i;
2Object.entries(d).forEach(([f,g])=>{{const{valueSerialized:p,definedAt:P}=g;s(p),s(!o[f]),o[f]={value:ae(p),definedAt:P}}})}{const{configValuesImported:d}=i,f=be(d);Object.assign(o,f)}const{pageId:l,isErrorPage:a,routeFilesystem:u,loadConfigValuesAll:c}=i;return Sr(o),{pageId:l,isErrorPage:a,routeFilesystem:u,configValues:o,loadConfigValuesAll:c}}),r={configValues:{}};{const i=be(t.configValuesImported);Object.assign(r.configValues,i)}return{pageConfigs:n,pageConfigGlobal:r}}function Sr(e){const t="route",n=e[t];if(!n)return;const{value:r}=n,i=typeof r,o=le("Config",t,n);h(i==="string"||A(r),`${o} has an invalid type '${i}': it should be a string or a function instead, see https://vike.dev/route`)}function vr(e){s(m(e,"isGeneratedFile")),s(e.isGeneratedFile!==!1,"vike was re-installed(/re-built). Restart your app."),s(e.isGeneratedFile===!0,`\`isGeneratedFile === ${e.isGeneratedFile}\``),s(m(e,"pageFilesLazy","object")),s(m(e,"pageFilesEager","object")),s(m(e,"pageFilesExportNamesLazy","object")),s(m(e,"pageFilesExportNamesEager","object")),s(m(e.pageFilesLazy,".page")),s(m(e.pageFilesLazy,".page.client")||m(e.pageFilesLazy,".page.server")),s(m(e,"pageFilesList","string[]")),s(m(e,"pageConfigsSerialized")),s(m(e,"pageConfigGlobalSerialized"));const{pageConfigsSerialized:t,pageConfigGlobalSerialized:n}=e;hr(t),pr(n);const{pageConfigs:r,pageConfigGlobal:i}=Rr(t,n),o={};K(e.pageFilesLazy).forEach(({filePath:a,pageFile:u,globValue:c})=>{u=o[a]=o[a]??u;const d=c;Me(d),u.loadFile=async()=>{"fileExports"in u||(u.fileExports=await d(),tr(u))}}),K(e.pageFilesExportNamesLazy).forEach(({filePath:a,pageFile:u,globValue:c})=>{u=o[a]=o[a]??u;const d=c;Me(d),u.loadExportNames=async()=>{if(!("exportNames"in u)){const f=await d();h("exportNames"in f,"You seem to be using Vite 2 but the latest vike versions only work with Vite 3"),s(m(f,"exportNames","string[]"),u.filePath),u.exportNames=f.exportNames}}}),K(e.pageFilesEager).forEach(({filePath:a,pageFile:u,globValue:c})=>{u=o[a]=o[a]??u;const d=c;s(E(d)),u.fileExports=d}),K(e.pageFilesExportNamesEager).forEach(({filePath:a,pageFile:u,globValue:c})=>{u=o[a]=o[a]??u;const d=c;s(E(d)),s(m(d,"exportNames","string[]"),u.filePath),u.exportNames=d.exportNames}),e.pageFilesList.forEach(a=>{o[a]=o[a]??St(a)});const l=Object.values(o);return l.forEach(({filePath:a})=>{s(!a.includes("\\"))}),{pageFiles:l,pageConfigs:r,pageConfigGlobal:i}}function K(e){const t=[];return Object.entries(e).forEach(([n,r])=>{s(fr.includes(n)),s(E(r)),Object.entries(r).forEach(([i,o])=>{const l=St(i);s(l.fileType===n),t.push({filePath:i,pageFile:l,globValue:o})})}),t}function Me(e){s(A(e))}const F=C("setPageFiles.ts",{});function Qi(e){const{pageFiles:t,pageConfigs:n,pageConfigGlobal:r}=vr(e);F.pageFilesAll=t,F.pageConfigs=n,F.pageConfigGlobal=r}async function Er(e,t){e?(s(!F.pageFilesGetter),s(t===void 0)):(s(F.pageFilesGetter),s(typeof t=="boolean"),(!F.pageFilesAll||!t)&&await F.pageFilesGetter());const{pageFilesAll:n,pageConfigs:r,pageConfigGlobal:i}=F;s(n&&r&&i);const o=_r(n,r);return{pageFilesAll:n,allPageIds:o,pageConfigs:r,pageConfigGlobal:i}}function _r(e,t){const n=e.filter(({isDefaultPageFile:o})=>!o).map(({pageId:o})=>o),r=Ee(n),i=t.map(o=>o.pageId);return[...r,...i]}function vt(e,t){const n=e.filter(i=>i.pageId===t);return s(n.length<=1),n[0]??null}async function $r(e,t){if("isAllLoaded"in e&&!t)return e;const n=await e.loadConfigValuesAll(),r=be(n);return Object.assign(e.configValues,r),b(e,{isAllLoaded:!0}),e}const Et="__whileFetchingAssets";async function ne(e,t){const n=Te(t._pageFilesAll,e),r=vt(t._pageConfigs,e);let i;const o=!1;try{i=(await Promise.all([r&&$r(r,o),...n.map(p=>{var P;return(P=p.loadFile)==null?void 0:P.call(p)})]))[0]}catch(g){throw Cr(g)&&Object.assign(g,{[Et]:!0}),g}const{config:l,configEntries:a,exports:u,exportsAll:c,pageExports:d}=ar(n,i);return{config:l,configEntries:a,exports:u,exportsAll:c,pageExports:d,_pageFilesLoaded:n}}function Fe(e){return e?e[Et]===!0:!1}function Cr(e){return e instanceof Error?["Failed to fetch dynamically imported module","error loading dynamically imported module","Importing a module script failed","error resolving module specifier","failed to resolve module"].some(n=>e.message.toLowerCase().includes(n.toLowerCase())):!1}const Je=["urlPathname","urlParsed"],Or=["Page","pageExports","exports"];function _t(e){[...Or,...Je].forEach(n=>
2{n in e&&(Je.includes(n)?(s(n.startsWith("url")),S(!1,`pageContext.${n} is already available in the browser when using Client Routing; adding '${n}' to passToClient has no effect`,{onlyOnce:!0})):S(!1,`pageContext.${n} is a built-in that cannot be overriden; adding '${n}' to passToClient has no effect`,{onlyOnce:!0}),delete e[n])})}const kr="/";function Tr(e,t,n){const{pathnameOriginal:r,searchOriginal:i,hashOriginal:o}=J(e,kr);e.startsWith("/")&&s(e===`${r}${i||""}${o||""}`,{url:e});const l=r.endsWith("/");let a;return n&&r!=="/"?(l?a=x(r,0,-1):a=r,s(!a.endsWith("/"),{url:e}),s(a!=="")):a=r+(l?"":"/")+"index",s(a),a=a+t,`${a}${i||""}${o||""}`}const xr=".pageContext.json",Fr=!1;function Ir(e){return Tr(e,xr,Fr)}function $t(e,{hookName:t,hookFilePath:n}){if(e==null)return;s(!t.endsWith(")"));const r=`The ${y.cyan("pageContext")} object provided by the ${t}() hook defined by ${n}`;h(E(e),`${r} should be an object (but it's ${y.cyan(`typeof pageContext === ${JSON.stringify(typeof e)}`)} instead)`),h(!("_objectCreatedByVike"in e),`${r} shouldn't be the whole ${y.cyan("pageContext")} object, see https://vike.dev/pageContext-manipulation#do-not-return-entire-pagecontext`),S(!("_pageId"in e),`${r} sets ${y.cyan("pageContext._pageId")} which means that Vike's routing is overriden. This is an experimental feature: make sure to contact a vike maintainer before using this.`,{onlyOnce:!0}),h(!("is404"in e),`${r} sets ${y.cyan("pageContext.is404")} which is forbidden, use ${y.cyan("throw render()")} instead, see https://vike.dev/render`)}function Ar(e,t,n){s(!n.endsWith(" "));const r=[],i=Object.keys(e);for(const o of i)t.includes(o)||r.push(o);h(r.length===0,[n,"returned an object with following unknown keys:",Ue(r)+".","Only following keys are allowed:",Ue(t)+"."].join(" "))}function jr(e,t){if(e==null)return;const n=`The onBeforeRender() hook defined by ${t}`;h(I(e),`${n} should return a plain JavaScript object, ${y.cyan("undefined")}, or ${y.cyan("null")}`),Ar(e,["pageContext"],n),e.pageContext&&$t(e.pageContext,{hookName:"onBeforeRender",hookFilePath:t})}function Lr(e,t){if(!I(e))return!1;for(const n of Object.keys(e))if(!t.includes(n))return!1;return!0}function Hr(e){return typeof e=="object"&&e!==null&&Object.values(e).every(t=>typeof t=="string")}function Wr(e,t){if(s(e.length>0),e.length===1)return e[0];const n=e.slice(0,e.length-1),r=e[e.length-1];return n.join(", ")+` ${t} `+r}W()&&oe();async function Nr(e,t){let n;if(e._pageFilesAll.length>0?(s(e._pageConfigs.length===0),n=Br(e._pageId,e._pageFilesAll)):n=z(e,"guard"),!n)return;const r=n.hookFn;let i=e;const o=t(e);o&&(i=o);const l=await se(()=>r(i),"guard",n.hookFilePath);h(l===void 0,`The guard() hook of ${n.hookFilePath} returns a value, but guard() doesn't accept any return value`)}function Br(e,t){const n=t.find(a=>a.pageId===e&&a.fileType===".page.route");if(!n)return null;const{filePath:r,fileExports:i}=n;s(i);const o=i.guard;if(!o)return null;const l=r;return h(A(o),`guard() defined by ${l} should be a function`),{hookFn:o,hookName:"guard",hookFilePath:l}}function Dr(e){const t=new Error("AbortRender");return b(t,{_pageContextAbort:e,[Ct]:!0}),t}const Ct="_isAbortError";function Ye(e){return typeof e=="object"&&e!==null&&Ct in e}function Vr(e){return e._urlRewrite||e._urlRedirect||e.abortStatusCode?(s(m(e,"_abortCall","string")),!0):!1}function Ur(e,t,n){if(t)return;const r=n._urlRewrite??n.urlOriginal;s(r);const i=e._pageContextAbort._abortCall;$e(!1,`${y.cyan(i)} intercepted while rendering ${y.cyan(r)}`,{onlyOnce:!1})}function zr(e){Gr(e);const t={_urlRewrite:null};return e.forEach(n=>{Object.assign(t,n)}),t}function Gr(e){const t=[];e.forEach(n=>{const r=n._urlRewrite;{const i=t.indexOf(r);if(i!==-1){const o=[...t.slice(i),r].map(l=>`render('${l}')`).join(" => ");h(!1,`Infinite loop of render() calls: ${o}`)}}t.push(r)})}function Mr(e,t){const n=[e>0&&y.cyan("throw render('/some-url')"),t>0&&y.cyan("throw redirect('/some-url')")].filter(Boolean).join(" and ");h(e+t<=7,`Maximum chain length of 7 ${n} exceeded. Did you define an infinite loop of ${n}?`)}const Ot=C("router/getPageContext.ts",{});async function Jr(e){const t=Cn();_t(t),b(t,{isHydration:!0,_hasPageContextFromClient:!1}),b(t,await ne(t._pageId,e));{const n={...e,...t};if(await Qr(n)){const r=await Tt(n);b(t,r)}}return xt(t),t}async function Yr(e){const t=pt(e._pageFilesAll,e._pageConfigs);if(!t)throw new Error("No error page defined.");const n={isHydration:!1,_pageId:t};return b(n,await kt({...e,...n},!0)),n}async function Kr(e){const t={isHydration:!1,_pageId:e._pageId};return b(t,await kt({...e,...t},!1)),xt(t),t}async function kt(e,t){let n={};if(b(n,await ne(e._pageId,e)),!t&&await qr({...e,...n})){const r=await Zr(e);
2if(!r._isError)b(n,r);else{const i=pt(e._pageFilesAll,e._pageConfigs);s(i),n={},b(n,{isHydration:!1,_pageId:i}),b(n,await ne(n._pageId,e)),s(m(r,"is404","boolean")),s(m(r,"pageProps","object")),s(m(r.pageProps,"is404","boolean")),s(!("serverSideError"in r)),b(n,r)}}else b(n,{_hasPageContextFromServer:!1}),t||await Nr({_hasPageContextFromClient:!1,...e,...n},r=>xe(r,!0));{const r=await Tt({...e,...n});b(n,r)}return n}async function Tt(e){const t=z(e,"onBeforeRender");if(!t)return{_hasPageContextFromClient:!1};const n=t.hookFn,r={_hasPageContextFromClient:!0},i=xe({...e,...r},!0),o=await se(()=>n(i),"onBeforeRender",t.hookFilePath);jr(o,t.hookFilePath);const l=o==null?void 0:o.pageContext;return b(r,l),r}function xt(e){e._pageContextInitHasClientData&&(Ot.pageContextInitHasClientData=!0)}async function qr(e){return!!Ot.pageContextInitHasClientData||await Xr(e)}async function Xr(e){var t;if(e._pageConfigs.length>0){const n=Pt(e._pageId,e._pageConfigs);return((t=D(n,"onBeforeRenderEnv"))==null?void 0:t.value)==="server-only"}else{const{hasOnBeforeRenderServerSideOnlyHook:n}=await Ln(e._pageFilesAll,e._pageId);return n}}async function Qr(e){var t;if(e._pageConfigs.length>0){const n=Pt(e._pageId,e._pageConfigs);return((t=D(n,"onBeforeRenderEnv"))==null?void 0:t.value)==="client-only"}else return!1}async function Zr(e){const t=Ir(e._urlRewrite??e.urlOriginal),n=await fetch(t);{const o=n.headers.get("content-type"),l="application/json",a=o&&o.includes(l);if(!a&&n.status===404)throw ee(e.urlOriginal),ti();h(a,`Wrong Content-Type for ${t}: it should be ${l} but it's ${o} instead. Make sure to properly use pageContext.httpResponse.headers, see https://vike.dev/renderPage`)}const r=await n.text(),i=ae(r);if(s(E(i)),"serverSideError"in i)throw ot("The pageContext object couldn't be fetched from the server as an error occurred on the server-side. Check your server logs.");if(Vr(i))throw Dr(i);return s(m(i,"_pageId","string")),_t(i),b(i,{_hasPageContextFromServer:!0}),i}function ei(e){return E(e)&&!!e._alreadyServerSideRouted}function ti(){const e=new Error("Page doesn't exist");return Object.assign(e,{_alreadyServerSideRouted:!0}),e}function Ft(e,t=!0){s(e.urlOriginal),"urlPathname"in e&&(s(typeof e.urlPathname=="string"),s(fe(e,"urlPathname"))),"urlParsed"in e&&s(fe(e,"urlParsed")),"url"in e&&s(fe(e,"url")),Object.defineProperty(e,"urlPathname",{get:At,enumerable:t,configurable:!0}),Object.defineProperty(e,"url",{get:ni,enumerable:!1,configurable:!0}),Object.defineProperty(e,"urlParsed",{get:ri,enumerable:t,configurable:!0})}function It(e){let t=e._urlHandler;t||(t=i=>i);let n=e._urlRewrite??e.urlLogical??e.urlOriginal;n=t(n);const r=e._baseServer;return s(n&&typeof n=="string"),s(r.startsWith("/")),J(n,r)}function At(){const{pathname:e}=It(this),t=e;return s(t.startsWith("/")),t}function ni(){return S(!1,"`pageContext.url` is outdated. Use `pageContext.urlPathname`, `pageContext.urlParsed`, or `pageContext.urlOriginal` instead. (See https://vike.dev/migration/0.4.23 for more information.)",{onlyOnce:!0,showStackTrace:!0}),At.call(this)}function ri(){const e=It(this),{origin:t,pathname:n,pathnameOriginal:r,search:i,searchAll:o,searchOriginal:l,hash:a,hashOriginal:u}=e,c=W(),d=g=>{S(c,`pageContext.urlParsed.${g} isn't available on the server-side (HTTP requests don't include the URL hash by design)`,{onlyOnce:!0,showStackTrace:!0})},f={origin:t,pathname:n,pathnameOriginal:r,search:i,searchAll:o,searchOriginal:l,get hash(){return d("hash"),a},get hashOriginal(){return d("hashOriginal"),u},get hashString(){return S(!1,"pageContext.urlParsed.hashString has been renamed to pageContext.urlParsed.hashOriginal",{onlyOnce:!0,showStackTrace:!0}),d("hashString"),u},get searchString(){return S(!1,"pageContext.urlParsed.searchString has been renamed to pageContext.urlParsed.searchOriginal",{onlyOnce:!0,showStackTrace:!0}),l}};return q(f,"hashString"),q(f,"searchString"),c||(q(f,"hash"),q(f,"hashOriginal")),f}function q(e,t){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(e,t,{...n,enumerable:!1})}function ii(e){s(typeof e.urlOriginal=="string"),s(typeof e.urlPathname=="string"),s(I(e.urlParsed)),s(e.urlPathname===e.urlParsed.pathname)}function oi(e,t){const r=t.filter(({filesystemRoot:o})=>e.startsWith(o)).sort(Z(({filesystemRoot:o})=>o.length))[0];let i;if(r){const{filesystemRoot:o,urlRoot:l}=r,a={pageId:e,filesystemRoot:o,urlRoot:l};s(l.startsWith("/")&&e.startsWith("/")&&o.startsWith("/"),a),s(e.startsWith(o),a),o!=="/"?(s(!o.endsWith("/"),a),i=x(e,o.length,0)):i=e,s(i.startsWith("/"),a),i=l+(l.endsWith("/")?"":"/")+x(i,1,0)}else i=e;return s(i.startsWith("/")),i=i.split("/").filter(o=>o!=="pages"&&o!=="src"&&o!=="index").join("/"),s(!i.includes(".page.")),s(!i.endsWith(".")),i.endsWith("/index")&&(i=x(i,0,-6)),i===""&&(i="/"),s(i.startsWith("/")),s(!i.endsWith("/")||i==="/"),i}async function si(e,t,n){ii(t);let r=e(t);if(jt(r,`The Route Function ${n}`),r=await r,r===!1)return null;if(r===!0&&(r={}),h(I(r),`The Route Function ${n} should return a boolean or a plain JavaScript object (but it's ${y.cyan(`typeof result === ${JSON.stringify(typeof r)}`)} instead)`),"match"in r){const{match:l}=r;if(h(typeof l=="boolean",`The ${y.cyan("match")} value returned by the Route Function ${n} should be a boolean.`),!l)return null}let i=null;"precedence"in r&&(i=r.precedence,h(typeof i=="number",`The ${y.cyan("precedence")} value returned by the Route Function ${n}
2 should be a number.`)),Lt(r,`The ${y.cyan("routeParams")} object returned by the Route Function ${n} should`);const o=r.routeParams||{};return h(!("pageContext"in r),`Providing ${y.cyan("pageContext")} in Route Functions is prohibited, see https://vike.dev/route-function#cannot-provide-pagecontext`),s(I(o)),Object.keys(r).forEach(l=>{h(l==="match"||l==="routeParams"||l==="precedence",`The Route Function ${n} returned an object with an unknown property ${y.cyan(l)} (the known properties are ${y.cyan("match")}, ${y.cyan("routeParams")}, and ${y.cyan("precedence")})`)}),{precedence:i,routeParams:o}}function jt(e,t){S(!Fn(e),`${t} returned a promise, but asynchronous routing is deprecated and will be removed in the next major release, see https://vike.dev/route-function#async`,{onlyOnce:!0})}function Ke(){const e=y.cyan("iKnowThePerformanceRisksOfAsyncRouteFunctions");S(!1,`${e} is deprecated and will be removed in the next major release`,{onlyOnce:!0})}function Lt(e,t){s(t.endsWith(" should")),m(e,"routeParams")&&(s(t.endsWith(" should")),h(I(e.routeParams),`${t} be a plain JavaScript object.`),h(Hr(e.routeParams),`${t} only hold string values.`))}async function ai(e,t,n,r){await Promise.all(e.filter(a=>a.fileType===".page.route").map(a=>{var u;return(u=a.loadFile)==null?void 0:u.call(a)}));const{onBeforeRouteHook:i,filesystemRoots:o}=ui(e,t,n);return{pageRoutes:li(o,e,t,r),onBeforeRouteHook:i}}function li(e,t,n,r){const i=[];let o=[...r];if(n.length>0){s(e===null);const l=!0;n.filter(a=>!a.isErrorPage).forEach(a=>{const u=a.pageId;o=fi(o,u);let c=null;{const d="route",f=D(a,d);if(f){const g=f.value,p=wt(f.definedAt,d);typeof g=="string"?c={pageId:u,comesFromV1PageConfig:l,routeString:g,routeDefinedAt:p,routeType:"STRING"}:(s(A(g)),D(a,"iKnowThePerformanceRisksOfAsyncRouteFunctions","boolean")&&Ke(),c={pageId:u,comesFromV1PageConfig:l,routeFunction:g,routeDefinedAt:p,routeType:"FUNCTION"})}}if(!c){const{routeFilesystem:d}=a;s(d);const{routeString:f,definedBy:g}=d;s(d.routeString.startsWith("/")),c={pageId:u,routeFilesystemDefinedBy:g,comesFromV1PageConfig:l,routeString:f,routeDefinedAt:null,routeType:"FILESYSTEM"}}s(c),i.push(c)})}if(n.length===0){s(e);const l=!1;o.filter(a=>!Y(a)).forEach(a=>{const u=t.find(c=>c.pageId===a&&c.fileType===".page.route");if(!u||!("default"in u.fileExports)){const c=oi(a,e);s(c.startsWith("/")),s(!c.endsWith("/")||c==="/"),i.push({pageId:a,comesFromV1PageConfig:l,routeString:c,routeDefinedAt:null,routeFilesystemDefinedBy:`${a}.page.*`,routeType:"FILESYSTEM"})}else{const{filePath:c,fileExports:d}=u;if(s(d.default),m(d,"default","string")){const f=d.default;h(f.startsWith("/"),`A Route String should start with a leading slash '/' but ${c} has \`export default '${f}'\`. Make sure to \`export default '/${f}'\` instead.`),i.push({pageId:a,comesFromV1PageConfig:l,routeString:f,routeDefinedAt:c,routeType:"STRING"});return}if(m(d,"default","function")){const f=d.default;"iKnowThePerformanceRisksOfAsyncRouteFunctions"in d&&Ke(),i.push({pageId:a,comesFromV1PageConfig:l,routeFunction:f,routeDefinedAt:c,routeType:"FUNCTION"});return}h(!1,`The default export of ${c} should be a string or a function.`)}})}return i}function ui(e,t,n){var o;if(t.length>0){const l="onBeforeRoute";if((o=n.configValues[l])!=null&&o.value){const a=n.configValues[l],{value:u}=a,c=sr(a),d=le("Hook",l,a);return h(A(u),`${d} should be a function.`),{onBeforeRouteHook:{hookFilePath:c,onBeforeRoute:u},filesystemRoots:null}}return{onBeforeRouteHook:null,filesystemRoots:null}}let r=null;const i=[];return e.filter(l=>l.fileType===".page.route"&&l.isDefaultPageFile).forEach(({filePath:l,fileExports:a})=>{if(s(a),"onBeforeRoute"in a){h(m(a,"onBeforeRoute","function"),`\`export { onBeforeRoute }\` of ${l} should be a function.`);const{onBeforeRoute:u}=a;r={hookFilePath:`${l} > \`export { onBeforeRoute }\``,onBeforeRoute:u}}"filesystemRoutingRoot"in a&&(h(m(a,"filesystemRoutingRoot","string"),`\`export { filesystemRoutingRoot }\` of ${l} should be a string.`),h(m(a,"filesystemRoutingRoot","string"),`\`export { filesystemRoutingRoot }\` of ${l} is \`'${a.filesystemRoutingRoot}
2'\` but it should start with a leading slash \`/\`.`),i.push({filesystemRoot:ci(l),urlRoot:a.filesystemRoutingRoot}))}),{onBeforeRouteHook:r,filesystemRoots:i}}function ci(e){s(e.startsWith("/")),s(!e.endsWith("/"));const t=e.split("/"),n=x(t,0,-1).join("/")||"/";return s(n.startsWith("/")),s(!n.endsWith("/")||n==="/"),n}function fi(e,t){const{length:n}=e;return e=e.filter(r=>r!==t),s(e.length===n-1),e}function Ht(){const e="/";return s(di(e)),e}function di(e){return e.startsWith("/")}const ge=C("createPageContext.ts",{});async function Wt(e){ge.pageFilesData||(ge.pageFilesData=await Er(!0));const{pageFilesAll:t,allPageIds:n,pageConfigs:r,pageConfigGlobal:i}=ge.pageFilesData,{pageRoutes:o,onBeforeRouteHook:l}=await ai(t,r,i,n),a=Ht();s(Oe(a));const c={urlOriginal:e,_objectCreatedByVike:!0,_urlHandler:null,_urlRewrite:null,_baseServer:a,_isProduction:!0,_pageFilesAll:t,_pageConfigs:r,_pageConfigGlobal:i,_allPageIds:n,_pageRoutes:o,_onBeforeRouteHook:l};return Ft(c),c}function gi(e){const t=e.getAttribute("href");return!!(t===null||t===""||En(t)||pi(e)||yi(t)||!mi(t)||!Ce(t)||!hi(e))}function hi(e){if(bi()){const n=e.getAttribute("data-vike-link");return n!==null&&n!=="false"}else return!0}function pi(e){const t=e.getAttribute("target"),n=e.getAttribute("rel");return t==="_blank"||t==="_external"||n==="external"||e.hasAttribute("download")}function yi(e){if(e.startsWith("#"))return!0;const t=n=>n.split("#")[0];return!!(e.includes("#")&&t(e)===t(window.location.href))}function mi(e){const t=Ht();s(Oe(t));const{hasBaseServer:n}=J(e,t);return n}function bi(){return!!window._disableAutomaticLinkInterception}function wi(e,t){let n=Pi(e,t);return n==="viewport"&&!e._isProduction&&($e(!1,"Viewport prefetching is disabled in development",{onlyOnce:!0}),n="hover"),{prefetchStaticAssets:n}}function Pi(e,t){{const n=Ri(t);if(n!==null)return n}if("prefetchLinks"in e.exports&&h(!1,"`export { prefetchLinks }` is deprecated, use `export { prefetchStaticAssets }` instead."),"prefetchStaticAssets"in e.exports){const{prefetchStaticAssets:n}=e.exports;if(n===!1)return!1;if(n==="hover")return"hover";if(n==="viewport")return"viewport";const r="prefetchStaticAssets value should be false, 'hover', or 'viewport'";h(I(n),r);const i=Object.keys(n);h(i.length===1&&i[0]==="when",r);const{when:o}=n;if(o==="HOVER"||o==="VIEWPORT"){const l=o.toLowerCase();return S(!1,`prefetchStaticAssets value \`{ when: '${o}' }\` is outdated: set prefetchStaticAssets to '${l}' instead`,{onlyOnce:!0}),l}h(!1,r)}return"hover"}function Ri(e){const t=e.getAttribute("data-prefetch-static-assets"),n=e.getAttribute("data-prefetch");if(t===null&&n===null)return null;const r="The attribute data-prefetch is outdated, use data-prefetch-static-assets instead.";if(t){if(h(n===null,r),t==="hover"||t==="viewport")return t;if(t==="false")return!1;h(!1,`data-prefetch-static-assets has value "${t}" but it should instead be "false", "hover", or "viewport"`)}if(n){if(s(!t),S(!1,r,{onlyOnce:!0}),n==="true")return"viewport";if(n==="false")return"hover";h(!1,`data-prefetch has value "${n}" but it should instead be "true" or "false"`)}s(!1)}const Nt=new Map;function Si(e){const t=Bt(e);return Nt.has(t)}function vi(e){const t=Bt(e);Nt.set(t,!0)}function Bt(e){return J(e,"/").pathname}function U(e){return e.fileType===".css"?[]:e.exportNames?e.exportNames:(s(e.fileExports,e.filePath),Object.keys(e.fileExports))}function Ei({pageFilesClientSide:e,pageFilesServerSide:t,pageId:n}){return{isHtmlOnly:r(),isClientRouting:o()};function r(){return t.some(a=>a.pageId===n&&a.fileType===".page")?(i(),!1):!(!t.some(a=>a.pageId===n&&a.fileType===".page.server")||e.some(a=>a.pageId===n&&a.fileType===".page.client"&&U(a).includes("render")))}function i(){const l=e.some(a=>U(a).includes("render"));h(l,["No client-side `render()` hook found.","See https://vike.dev/render-modes for more information.",["Loaded client-side page files (none of them `export { render }`):",...e.map((a,u)=>` (${u+1}): ${a.filePath}`)].join(` 3`)].join(" "))}function o(){return e.some(a=>U(a).includes("clientRouting"))}}function _i({pageFilesClientSide:e,pageFilesServerSide:t,isHtmlOnly:n,isClientRouting:r}){let i=[];const o=t.filter(a=>!e.includes(a)),l=[];
3if(l.push(...e.map(a=>({id:a.filePath,onlyAssets:!1,eagerlyImported:!1}))),l.push(...o.map(a=>({id:a.filePath,onlyAssets:!0,eagerlyImported:!1}))),n)i=e.map(a=>a.filePath);else{const a=$i(r);l.push({id:a,onlyAssets:!1,eagerlyImported:!1}),i=[a]}return{clientEntries:i,clientDependencies:l}}function $i(e){return e?"@@vike/dist/esm/client/client-routing-runtime/entry.js":"@@vike/dist/esm/client/server-routing-runtime/entry.js"}function Ci(e,t){let n=Te(e,t);const r=gt(e,t),{isHtmlOnly:i,isClientRouting:o}=Ei({pageFilesClientSide:n,pageFilesServerSide:r,pageId:t});i&&(n=n.filter(u=>u.isEnv("CLIENT_ONLY")&&!U(u).includes("render")),n=ki(n));const{clientEntries:l,clientDependencies:a}=_i({pageFilesClientSide:n,pageFilesServerSide:r,isHtmlOnly:i,isClientRouting:o});return{isHtmlOnly:i,isClientRouting:o,clientEntries:l,clientDependencies:a,pageFilesClientSide:n,pageFilesServerSide:r}}async function Oi(e,t,{sharedPageFilesAlreadyLoaded:n}){const r=Te(e,t);await Promise.all(r.map(async i=>{var o;s(i.isEnv("CLIENT_ONLY")||i.isEnv("CLIENT_AND_SERVER")),!(n&&i.isEnv("CLIENT_AND_SERVER"))&&await((o=i.loadExportNames)==null?void 0:o.call(i))}))}function ki(e){const t=[];for(const n of e)if(t.push(n),U(n).includes("overrideDefaultPages"))break;return t}function Ti(e,t,n){var r,i;if(e){const o=((r=D(e,"clientRouting","boolean"))==null?void 0:r.value)??!1;return{isClientSideRenderable:((i=D(e,"isClientSideRenderable","boolean"))==null?void 0:i.value)??!1,isClientRouting:o}}else{const{isHtmlOnly:o,isClientRouting:l}=Ci(t,n);return{isClientSideRenderable:!o,isClientRouting:l}}}async function Dt(e,t){await Oi(t._pageFilesAll,e,{sharedPageFilesAlreadyLoaded:!1});const n=vt(t._pageConfigs,e),{isClientSideRenderable:r,isClientRouting:i}=Ti(n,t._pageFilesAll,e);return r&&i}const Vt="@",we=":";function xi(e,t="Invalid"){let n=`${t} Route String ${L(e)}`;h(e!=="",`${n} (empty string): set it to ${L("/")} instead`),h(["/","*"].includes(e[0]),`${n}: it should start with ${L("/")} or ${L("*")}`),h(!e.includes("**"),`${n}: set it to ${L(e.split("**").join("*"))} instead`)}function Pe(e,t){xi(e);const n=Ut(e),r=n.map(f=>f.param?"[^/]+":f.glob?f.isLastDir?"|/.*":".*":An(f.static)).map(f=>`(${f})`).join(""),i=new RegExp(`^${r}/?$`),o=t.match(i);if(!o)return null;const l={},[a,...u]=o;let c=0;const d=n.filter(f=>f.glob).length>1;return n.forEach((f,g)=>{let p=u[g];if(f.param&&(l[f.param]=p),f.glob){const P=`*${d?++c:""}`;f.isLastDir&&(p=p.slice(1)),l[P]=p}}),{routeParams:l}}function Ut(e){const t=[],n=i=>{const o=t[t.length-1];o!=null&&o.static?o.static+=i:t.push({static:i})},r=e.split("/");return r.forEach((i,o)=>{const l=o===0,a=o===r.length-1;Fi(i)?(S(!i.startsWith(we),`Outdated Route String ${L(e)}, use ${L(e.split(we).join(Vt))} instead`,{onlyOnce:!0}),l||n("/"),t.push({param:i.slice(1)})):i==="*"&&a&&e!=="*"&&e!=="/*"?t.push({glob:!0,isLastDir:!0}):(l||n("/"),i.split("*").forEach((u,c)=>{c!==0&&t.push({glob:!0}),u!==""&&n(u)}))}),t}function X(e){const t=Ut(e),n=a=>(a==null?void 0:a.split("/").filter(Boolean).length)||0;let r=0;for(const a of t){if(!a.static)break;r+=n(a.static)}const i=t.map(a=>n(a.static)).reduce((a,u)=>a+u,0),o=t.filter(a=>a.param).length,l=t.filter(a=>a.glob).length;return{numberOfStaticPartsBeginning:r,numberOfStaticParts:i,numberOfParams:o,numberOfGlobs:l}}function Fi(e){return e.startsWith(Vt)||e.startsWith(we)}function qe(e){const n=Pe(e,e);return s(n),Object.keys(n.routeParams).length===0}function L(e){return W()?`'${e}'`:(e===""&&(e="''"),y.cyan(e))}function Ii(e){e.sort(Ai).sort(j(t=>t.routeType==="FUNCTION"&&!!t.precedence&&t.precedence<0)).sort(j(t=>t.routeType==="STRING"&&qe(t.routeString)===!1)).sort(j(t=>t.routeType==="FUNCTION"&&!t.precedence)).sort(j(t=>t.routeType==="STRING"&&qe(t.routeString)===!0)).sort(j(t=>t.routeType==="FILESYSTEM")).sort(j(t=>t.routeType==="FUNCTION"&&!!t.precedence&&t.precedence>0))}function Ai(e,t){{const n=e.precedence??0,r=t.precedence??0;if(n!==r)return n>r?-1:1}if(!t.routeString||!e.routeString)return 0;{const r=Z(i=>X(i).numberOfStaticPartsBeginning)(e.routeString,t.routeString);if(r!==0)return r}{const r=Z(i=>X(i).numberOfStaticParts)(e.routeString,t.routeString);if(r!==0)return r}{const r=On(i=>X(i).numberOfGlobs)(e.routeString,t.routeString);if(r!==0)return r}{const r=Z(i=>X(i).numberOfParams)(e.routeString,t.routeString);if(r!==0)return r}return 0}async function ji(e){const t={};if(!e._onBeforeRouteHook)return null;const n=await Li(e._onBeforeRouteHook,e);return n&&(b(t,n),m(t,"_pageId","string")||m(t,"_pageId","null"))?(m(t,"routeParam
3s")?s(m(t,"routeParams","object")):b(t,{routeParams:{}}),b(t,{_routingProvidedByOnBeforeRouteHook:!0,_debugRouteMatches:"CUSTOM_ROUTING"}),t):(b(t,{_routingProvidedByOnBeforeRouteHook:!1}),t)}async function Li(e,t){let n=e.onBeforeRoute(t);jt(n,`The onBeforeRoute() hook ${e.hookFilePath}`),n=await n;const r=`The onBeforeRoute() hook defined by ${e.hookFilePath}`;if(h(n==null||Lr(n,["pageContext"])&&m(n,"pageContext"),`${r} should return ${y.cyan("null")}, ${y.cyan("undefined")}, or a plain JavaScript object ${y.cyan("{ pageContext: { /* ... */ } }")}`),n==null)return null;if(h(m(n,"pageContext","object"),`${r} returned ${y.cyan("{ pageContext }")} but pageContext should be a plain JavaScript object.`),m(n.pageContext,"_pageId")&&!m(n.pageContext,"_pageId","null")){const l=`${r} returned ${y.cyan("{ pageContext: { _pageId } }")} but ${y.cyan("_pageId")} should be`;h(m(n.pageContext,"_pageId","string"),`${l} a string or null`),h(t._allPageIds.includes(n.pageContext._pageId),`${l} ${Wr(t._allPageIds.map(a=>y.cyan(a)),"or")}`)}m(n.pageContext,"routeParams")&&Lt(n.pageContext,`${r} returned ${y.cyan("{ pageContext: { routeParams } }")} but routeParams should`);const i=l=>`${r} returned ${y.cyan(`{ pageContext: { ${l} } }`)} which is deprecated. Return ${y.cyan("{ pageContext: { urlLogical } }")} instead.`;m(n.pageContext,"url")&&(S(!1,i("url"),{onlyOnce:!0}),n.pageContext.urlLogical=n.pageContext.url,delete n.pageContext.url),m(n.pageContext,"urlOriginal")&&(S(!1,i("urlOriginal"),{onlyOnce:!0}),n.pageContext.urlLogical=n.pageContext.urlOriginal,delete n.pageContext.urlOriginal),m(n.pageContext,"urlLogical")&&fn(n.pageContext.urlLogical,`${r} returned ${y.cyan("{ pageContext: { urlLogical } }")} but ${y.cyan("urlLogical")}`),$t(n.pageContext,{hookFilePath:e.hookFilePath,hookName:"onBeforeRoute"});const o={};return b(o,n.pageContext),o}var Q;function Xe(...e){var t;Q||(Q=(t=globalThis.__brillout_debug_createDebugger)==null?void 0:t.call(globalThis,"vike:routing")),Q&&Q(...e)}W()&&oe();async function zt(e){Xe("Pages routes:",e._pageRoutes),Ft(e);const t={},n=await ji(e);if(n){if(n._routingProvidedByOnBeforeRouteHook)return s(n._pageId),n;b(t,n)}const r={};b(r,e),b(r,n);const i=r._allPageIds;s(i.length>=0),h(r._pageFilesAll.length>0||r._pageConfigs.length>0,"No *.page.js file found. You must create at least one *.page.js file."),h(i.length>0,"You must create at least one *.page.js file that isn't _default.page.*");const{urlPathname:o}=r;s(o.startsWith("/"));const l=[];await Promise.all(r._pageRoutes.map(async u=>{const{pageId:c,routeType:d}=u;if(u.routeType==="FILESYSTEM"){const{routeString:f}=u,g=Pe(f,o);if(g){const{routeParams:p}=g;l.push({pageId:c,routeParams:p,routeString:f,routeType:d})}return}if(u.routeType==="STRING"){const{routeString:f}=u,g=Pe(f,o);if(g){const{routeParams:p}=g;s(d==="STRING"),l.push({pageId:c,routeString:f,routeParams:p,routeType:d})}return}if(u.routeType==="FUNCTION"){const{routeFunction:f,routeDefinedAt:g}=u,p=await si(f,r,g);if(p){const{routeParams:P,precedence:O}=p;l.push({pageId:c,precedence:O,routeParams:P,routeType:d})}return}s(!1)})),Ii(l);const a=l[0];if(Xe(`Route matches for URL ${y.cyan(o)} (in precedence order):`,l),b(t,{_debugRouteMatches:l}),!a)return b(t,{_pageId:null,routeParams:{}}),t;{const{routeParams:u}=a;s(I(u)),b(t,{_pageId:a.pageId,routeParams:a.routeParams})}return t}oe();const Qe=C("prefetch.ts",{linkPrefetchHandlerAdded:new Map});async function Hi(e,t){try{await ne(e,t)}catch(n){if(Fe(n))Se(n,!0);else throw n}}function Wi(e){vi(e.urlPathname),[...document.getElementsByTagName("A")].forEach(n=>{if(Qe.linkPrefetchHandlerAdded.has(n))return;Qe.linkPrefetchHandlerAdded.set(n,!0);const r=n.getAttribute("href");if(gi(n)||(s(r),Si(r)))return;const{prefetchStaticAssets:i}=wi(e,n);if(i&&(i==="hover"&&(n.addEventListener("mouseover",()=>{he(r)}),n.addEventListener("touchstart",()=>{he(r)},{passive:!0})),i==="viewport")){const o=new IntersectionObserver(l=>{l.forEach(a=>{a.isIntersecting&&(he(r),o.disconnect())})});o.observe(n)}})}async function he(e){const t=await Wt(e);let n;try{n=await zt(t)}catch{return}n!=null&&n._pageId&&await Dt(n._pageId,t)&&await Hi(n._pageId,t)}async function Ni(e,t){const n=xe(e,t);let r=null,i;r=z(e,"render"),i="render";{const a=z(e,"onRenderClient");a&&(r=a,i="onRenderClient")}if(!r){const a=Bi(e);if(s(a),e._pageConfigs.length>0)h(!1,`No onRenderClient() hook defined for URL '${a}', but it's needed, see https://vike.dev/onRenderClient`);else{const u=e._pageFilesLoaded.filter(d=>d.fileType===".page.client");let c;u.length===0?c="No file `*.page.client.*` found for URL "+a:c="One of the following files should export a render() hook: "+u.map(d=>d.filePath).join(" "),h(!1,c)}}s(r);const o=r.hookFn;s(i);const l=await se(()=>o(n),i,r.hookFilePath);h(l===void 0,`The ${i}() hook defined by ${r.hookFilePath} isn't allowed to return a value`)}function Bi(e){let t;try{t=e.urlPathname??e.urlOriginal}catch{}return t=t??window.location.href,t}function Di(){let e=window.history.state;e||(e={});let t=!1;"timestamp"in e||(t=!0,e.timestamp=je()),"scrollPosition"in e||(t=!0,e.scrollPosition=Ae()),"triggedBy"in e||(e.triggedBy="browser"),Gt(e),t&&Le(e)}function Ie(){const e=window.history.state||{};return Gt(e),e}function Ae(){return{x:window.scrollX,y:window.scrollY}}function je(){return new Date().getTime()}function Ze(){const e=Ae(),t=Ie();Le({...t,scrollPosition:e})}function Vi(e,t){if(t)Le(Ie(),e);else{const n=je();Ui({timestamp:n,scrollPosition:null,triggedBy:"vike"},e)}}function Gt(e){if(s(E(e)),"timestamp"in e){const{timestamp:t}=e;s(typeof t=="number")}if("scrollPosition"in e){const{scrollPosition:t}=e;t!==null&&s(m(t,"x","number")&&m(t,"y","number"))}}function Le(e,t){window.history.replaceState(e,"",t??null)}function Ui(e,t){window.history.pushState(e,"",t)}function Zi(){const e=history.pushState;history.pushState=(t={},...n)=>{h(t==null||E(t),"history.pushState(state) argument state must be an object");const r={scrollPosition:Ae(),timestamp:je(),...t,triggedBy:"user"};return e.apply(history,[r,...n])}}function Mt(e){if(e==="preserve-scroll")return;let t;if(e==="scroll-to-top-or-hash"){const n=Gi();if(n&&n!=="top"){const r=document.getElementById(n)||document.getElementsByName(n)[0];if(r){r.scrollIntoView();return}}t={x:0,y:0}}else s("x"in e&&"y"in e),t=e;zi(t)}function zi(e){const t=()=>window.scrollTo(e.x,e.y),n=()=>window.scrollX===e.x&&window.scrollY===e.y;n()||(t(),!n()&&requestAnimationFrame(()=>{t(),!n()&&setTimeout(async()=>
3{if(t(),n())return;const r=new Date().getTime();for(;;)if(await Rn(10),t(),n()||new Date().getTime()-r>100)return},0)}))}function Gi(){let{hash:e}=window.location;return e===""?null:(s(e.startsWith("#")),e=e.slice(1),e)}function eo(){window.addEventListener("scroll",Sn(Ze,Math.ceil(1e3/3)),{passive:!0}),ct(Ze)}const N=C("onBrowserHistoryNavigation.ts",{previousState:re()});function to(){window.addEventListener("popstate",()=>{const e=re(),t=e.historyState.scrollPosition||"scroll-to-top-or-hash",n=e.historyState.triggedBy==="user",r=e.urlWithoutHash===N.previousState.urlWithoutHash,i=!e.historyState.timestamp||!N.previousState.historyState.timestamp?null:e.historyState.timestamp<N.previousState.historyState.timestamp;N.previousState=e,r&&!n?window.history.state===null?(Di(),N.previousState=re()):Mt(t):Re({scrollTarget:t,isBackwardNavigation:i,isUserLandPushStateNavigation:n})})}function re(){return{urlWithoutHash:ke({withoutHash:!0}),historyState:Ie()}}function Mi(){N.previousState=re()}const Jt=C("scrollRestoration.ts",{});function no(){et(),ct(et),vn(()=>Jt.initialRenderIsDone&&He())}function Ji(){Jt.initialRenderIsDone=!0}function He(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual")}function et(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="auto")}const R=C("renderPageClientSide.ts",{renderCounter:0});async function Re(e){var V,We;const{scrollTarget:t,urlOriginal:n=ke(),overwriteLastHistoryEntry:r=!1,isBackwardNavigation:i,pageContextsFromRewrite:o=[],redirectCount:l=0,isUserLandPushStateNavigation:a,isClientSideNavigation:u=!0}=e,{abortRender:c,setHydrationCanBeAborted:d,isFirstRender:f}=qi();if(s(u===!f),Mr(o.length,l),R.clientRoutingIsDisabled){ee(n);return}const g=await Wt(n);if(c())return;b(g,{isBackwardNavigation:i,isClientSideNavigation:u});{const w=zr(o);b(g,w)}let p={};const P=w=>{s(w),s(!("err"in p)),s(!("errorWhileRendering"in g)),p.err=w,g.errorWhileRendering=w};if(!f){try{p={pageContextFromRoute:await zt(g)}}catch(w){P(w)}if(c())return;if(p.pageContextFromRoute){const{pageContextFromRoute:w}=p;b(g,w);let _;if(!w._pageId)_=!1;else if(_=await Dt(w._pageId,g),c())return;if(!_){ee(n);return}const k=w._pageId&&((V=R.previousPageContext)==null?void 0:V._pageId)&&w._pageId===R.previousPageContext._pageId;if(a&&k)return}}const O=!f;if(O&&!R.isTransitioning&&(await((We=R.onPageTransitionStart)==null?void 0:We.call(R,g)),R.isTransitioning=!0,c()))return;if(f){s(!p.pageContextFromRoute),s(!p.err);try{p.pageContextFromHooks=await Jr(g)}catch(w){P(w)}if(c())return}else if(!p.err){const{pageContextFromRoute:w}=p;s(w),s(w._pageId),s(m(w,"_pageId","string")),b(g,w);try{p.pageContextFromHooks=await Kr(g)}catch(_){P(_)}if(c())return}if("err"in p){const{err:w}=p;if(Ye(w)||console.error(w),tt(w,g,f))return;if(Ye(w)){const _=w;Ur(w,g._isProduction,g);const k=_._pageContextAbort;if(k._urlRewrite){await Re({...e,scrollTarget:"scroll-to-top-or-hash",pageContextsFromRewrite:[...o,k]});return}if(k._urlRedirect){const ue=k._urlRedirect.url;if(ue.startsWith("http")){window.location.href=ue;return}else await Re({...e,scrollTarget:"scroll-to-top-or-hash",urlOriginal:ue,overwriteLastHistoryEntry:!1,isBackwardNavigation:!1,redirectCount:l+1});return}s(k.abortStatusCode),b(g,k),k.abortStatusCode===404&&b(g,{is404:!0})}else b(g,{is404:!1});try{p.pageContextFromHooks=await Yr(g)}catch(_){if(tt(_,g,f)||(f||setTimeout(()=>{window.location.pathname=n},0),Pn(w,_)))return;throw _}if(c())return}const{pageContextFromHooks:$}=p;if(s($),b(g,$),de(g,"onPageTransitionStart"),R.onPageTransitionStart=g.exports.onPageTransitionStart,g.exports.hydrationCanBeAborted?d():S(!wn(),"You seem to be using React; we recommend setting hydrationCanBeAborted to true, see https://vike.dev/clientRouting",{onlyOnce:!0}),!c()&&!(R.renderPromise&&(await R.renderPromise,s(R.renderPromise===void 0),c()))){if(Yi(n,r),R.previousPageContext=g,s(R.renderPromise===void 0),R.renderPromise=(async()=>{await Ni(g,!0),Wi(g),R.renderPromise=void 0})(),await R.renderPromise,s(R.renderPromise===void 0),f){de(g,"onHydrationEnd");const{onHydrationEnd:w}=g.exports;if(w){const _=g.exportsAll.onHydrationEnd[0].exportSource;if(s(_),await se(()=>w(g),"onHydrationEnd",_),c(!0))return}}
3if(!c(!0)){if(O){if(g.exports.onPageTransitionEnd&&(de(g,"onPageTransitionEnd"),await g.exports.onPageTransitionEnd(g),c(!0)))return;R.isTransitioning=void 0}Mt(t),He(),Ji()}}}function Yi(e,t){ke()!==e&&(He(),Vi(e,t),Mi())}function tt(e,t,n){return!!(ei(e)||Ki(e,t,n))}function Ki(e,t,n){if(!Fe(e))return!1;if(n)throw Se(e,!1),e;return Se(e,!0),ee(t.urlOriginal),!0}function Se(e,t){s(Fe(e)),R.clientRoutingIsDisabled=!0,t&&console.log(e),$e(!1,["Failed to fetch static asset.","This usually happens when a new frontend is deployed.","Falling back to Server Routing.","(The next page navigation will use Server Routing instead of Client Routing.)"].filter(Boolean).join(" "),{onlyOnce:!0})}function qi(){const e=++R.renderCounter;s(e>=1);let t=!1;return{abortRender:i=>!i&&e===1&&!t?!1:e!==R.renderCounter,setHydrationCanBeAborted:()=>{t=!0},isFirstRender:e===1}}function ro(){return R.renderCounter}export{oe as a,h as b,on as c,gi as d,s as e,no as f,Di as g,eo as h,W as i,ro as j,Xi as k,Zi as m,to as o,ae as p,Re as r,Qi as s,_n as t};
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.