@kitbag/router 0.20.2 → 0.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +26 -28
- package/dist/kitbag-router.js +251 -243
- package/dist/kitbag-router.umd.cjs +2 -2
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(A,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(A=typeof globalThis<"u"?globalThis:A||self,i(A["@kitbag/router"]={},A.Vue))})(this,function(A,i){"use strict";var Ao=Object.defineProperty;var vo=(A,i,Z)=>i in A?Ao(A,i,{enumerable:!0,configurable:!0,writable:!0,value:Z}):A[i]=Z;var G=(A,i,Z)=>vo(A,typeof i!="symbol"?i+"":i,Z);function Z(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function $t(t){return Z(t)?t:`/${t}`}class de extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}class pe extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}class X extends Error{constructor(){super("Router not installed")}}class he extends Error{constructor(e,r){super(`useRoute called with incorrect route. Given ${e}, expected ${r}`)}}const me=Symbol();function Rt(){const t=i.inject(me);if(!t)throw new X;return t}function it(t){return Array.isArray(t)?t:[t]}function ye(t,e){return t.filter(r=>e===r).length}function ct(...t){const e=t.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of e)if(ye(e,r)>1)throw new de(r)}class z extends Error{}const wt="[",At="]";function vr(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function kr(t){return typeof t=="function"&&vr(t)}function vt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function ge(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function Re(t,e){return vt(t)?{...t,defaultValue:e??t.defaultValue}:{get:r=>tt(r,t),set:r=>et(r,t),defaultValue:e}}function Ur(t){return vt(t)&&t.defaultValue!==void 0}function Lr(t,e){return Re(t,e)}function Nr(t){return t!==void 0}function ut(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F(t){return typeof t=="string"&&t.length>0}let E=null;async function Vr(){const{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:m,ZodArray:f,ZodTuple:g,ZodUnion:w,ZodDiscriminatedUnion:B,ZodRecord:v,ZodMap:C,ZodSet:b,ZodIntersection:c,ZodPromise:l,ZodFunction:u}=await import("zod");return{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:m,ZodArray:f,ZodTuple:g,ZodUnion:w,ZodDiscriminatedUnion:B,ZodRecord:v,ZodMap:C,ZodSet:b,ZodIntersection:c,ZodPromise:l,ZodFunction:u}}function Br(t){return Object.values(t).some(e=>Object.values(e.host.params).some(r=>Ht(r))||Object.values(e.path.params).some(r=>Ht(r))||Object.values(e.query.params).some(r=>Ht(r)))}function Ht(t){return ut(t)&&"parse"in t&&typeof t.parse=="function"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="zod"}async function Cr(){try{E=await Vr()}catch{throw new Error("Failed to initialize Zod")}}function we(t){return E?t instanceof E.ZodSchema:!1}function Ee(t){return{get:(e,{invalid:r})=>{try{return _t(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return qt(e,t)}catch{throw r()}}}}const xr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ft(t,e){if(typeof e=="string"&&xr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function lt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function kt(t,e){return E!=null&&E.ZodString&&t instanceof E.ZodString?1:E!=null&&E.ZodString&&e instanceof E.ZodString?-1:0}function _t(t,e){if(!E)throw new Error("Zod is not initialized");if(e instanceof E.ZodString)return e.parse(t);if(e instanceof E.ZodBoolean)return e.parse(!!t);if(e instanceof E.ZodDate)return e.parse(new Date(t));if(e instanceof E.ZodNumber)return e.parse(Number(t));if(e instanceof E.ZodLiteral)return lt([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof E.ZodObject)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodEnum)return e.parse(t);if(e instanceof E.ZodNativeEnum)return lt([()=>e.parse(Number(t)),()=>e.parse(t)]);if(e instanceof E.ZodArray||e instanceof E.ZodTuple)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>_t(t,n));return lt(r)}if(e instanceof E.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>_t(t,n));return lt(r)}if(e instanceof E.ZodRecord)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodMap)return e.parse(new Map(JSON.parse(t,ft)));if(e instanceof E.ZodSet)return e.parse(new Set(JSON.parse(t,ft)));if(e instanceof E.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof E.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof E.ZodFunction)throw new Error("Function schemas are not supported");return e.parse(t)}function qt(t,e){if(!E)throw new Error("Zod is not initialized");if(e instanceof E.ZodString)return e.parse(t);if(e instanceof E.ZodBoolean)return e.parse(t).toString();if(e instanceof E.ZodDate)return e.parse(t).toISOString();if(e instanceof E.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof E.ZodLiteral)return e.parse(t).toString();if(e instanceof E.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof E.ZodEnum)return e.parse(t);if(e instanceof E.ZodNativeEnum)return e.parse(t).toString();if(e instanceof E.ZodArray||e instanceof E.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof E.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>qt(t,n));return lt(r)}if(e instanceof E.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>qt(t,n));return lt(r)}if(e instanceof E.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof E.ZodMap){const r=e.parse(t);return JSON.stringify(Array.from(r.entries()))}if(e instanceof E.ZodSet){const r=e.parse(t);return JSON.stringify(Array.from(r.values()))}if(e instanceof E.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof E.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof E.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(e.parse(t))}function It(t){return typeof t=="object"&&t!==null&&"then"in t}function N(t,e){const r=t["~standard"].validate(e);if(It(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function jr(t){return ut(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function be(t){return jr(t)}function Se(t){return{get:(e,{invalid:r})=>{try{return Dt(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Jt(e,t)}catch{throw r()}}}}const Or=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function dt(t,e){if(typeof e=="string"&&Or.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function pt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Ut(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function Dt(t,e){if(e.type==="boolean")return N(e,!!t);if(e.type==="date")return N(e,new Date(t));if(e.type==="number")return N(e,Number(t));if(e.type==="literal")return pt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="object")return N(e,JSON.parse(t,dt));if(e.type==="enum")return pt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="array"||e.type==="tuple")return N(e,JSON.parse(t,dt));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return pt(r)}if(e.type==="record")return N(e,JSON.parse(t,dt));if(e.type==="map")return N(e,new Map(JSON.parse(t,dt)));if(e.type==="set")return N(e,new Set(JSON.parse(t,dt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return N(e,t)}function Jt(t,e){if(e.type==="string"||e.type==="boolean")return N(e,t).toString();if(e.type==="date")return N(e,t).toISOString();if(e.type==="number")return N(e,Number(t)).toString();if(e.type==="literal")return N(e,t).toString();if(e.type==="object")return JSON.stringify(N(e,t));if(e.type==="enum"||e.type==="nativeEnum")return N(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(N(e,t));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Jt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Jt(t,n));return pt(r)}if(e.type==="record")return JSON.stringify(N(e,t));if(e.type==="map"){const r=N(e,t);return JSON.stringify(Array.from(r.entries()))}if(e.type==="set"){const r=N(e,t);return JSON.stringify(Array.from(r.values()))}if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(N(e,t))}function Zr(t,e){return t[e]??String}const j={invalid:t=>{throw new z(t)}},Pe={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Tt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},Ft={get:(t,{invalid:e})=>{const r=Number(t);if(isNaN(r))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},Ae={get:(t,{invalid:e})=>{const r=new Date(t);if(isNaN(r.getTime()))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ve={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function $r(t,e){switch(typeof e){case"string":return Pe.get(t,j)===e;case"number":return Ft.get(t,j)===e;case"boolean":return Tt.get(t,j)===e;default:return!1}}function tt(t,e,r=!1){if(t===void 0||!F(t)){if(Ur(e))return e.defaultValue;if(r)return;throw new z}if(e===String)return Pe.get(t,j);if(e===Boolean)return Tt.get(t,j);if(e===Number)return Ft.get(t,j);if(e===Date)return Ae.get(t,j);if(e===JSON)return ve.get(t,j);if(kr(e))return e(t,j);if(vt(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new z}if(ge(e)){if($r(t,e))return e;throw new z}return we(e)?Ee(e).get(t,j):be(e)?Se(e).get(t,j):t}function Hr(t,e,r=!1){try{return tt(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function _r(t,e,r=!1){try{return et(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function et(t,e,r=!1){if(t===void 0){if(r)return"";throw new z}if(e===Boolean)return Tt.set(t,j);if(e===Number)return Ft.set(t,j);if(e===Date)return Ae.set(t,j);if(e===JSON)return ve.set(t,j);if(vt(e))return e.set(t,j);if(ge(e)){if(e!==t)throw new z;return t.toString()}if(we(e))return Ee(e).set(t,j);if(be(e))return Se(e).set(t,j);try{return t.toString()}catch{throw new z}}function Mt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qr(t,e){const r=Array.from(t.matchAll(e));if(r.length===0)return[t];let n=0;const o=r.reduce((s,p)=>{const m=Mt(t.slice(n,p.index));m.length&&s.push(m);const[f]=p;return s.push(f),n=p.index+f.length,s},[]),a=t.slice(n);return a&&o.push(a),o}function Ir(t){const e=ke(t.path.value);return new RegExp(`^${e}$`,"i")}function Dr(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,r])=>!Gt(r)).map(([r,n])=>{const o=ke(n);return new RegExp(`${Mt(r)}=${o}(&|$)`,"i")})}function ke(t){return qr(t,new RegExp(Lt,"g")).map(e=>e.startsWith(wt)?Ue(e):Mt(e)).join("")}function Ue(t){return t.replace(new RegExp(Lt,"g"),".+")}function Jr(t,e){const r=Le(e);return t.replace(r,"(.*)")}function Wt(t,e){return Fr(e).test(t.value)}function Gt(t){return new RegExp(Tr,"g").test(t)}const Lt=`\\${wt}\\??([\\w-_]+)\\${At}`,Tr=`\\${wt}\\?([\\w-_]+)\\${At}`;function zt(t){const[e]=Ne(t,new RegExp(Lt,"g"));return e}function Le(t){return new RegExp(`\\${wt}\\??${t}\\${At}`,"g")}function Fr(t){return new RegExp(`\\${wt}\\?${t}\\${At}`,"g")}function Ne(t,e){return Array.from(t.matchAll(e)).flatMap(([,...n])=>n.map(o=>F(o)?o:""))}function Mr(t="",e={}){return F(t)?Array.from(t.matchAll(new RegExp(Lt,"g"))).reduce((n,[o,a])=>{const s=zt(o);if(!s)return n;const p=Zr(e,s);return ct([s],n),n[a]=p,n},{}):{}}function Wr(t){return ut(t)&&typeof t.value=="string"}function rt(t){return t===void 0?M():Wr(t)?t:M(t,{})}function M(t,e){return{value:t??"",params:Mr(t,e)}}function Ve(t,e){ct(t.params,e.params);const r=`${t.value}${e.value}`;return M(r,{...t.params,...e.params})}function Gr(t,e){return Ve(t,e)}function zr(t,e){return Qr(t,e),{...t,...e}}function Qr(t,e){const r=Object.keys(t).find(n=>n in e&&typeof e[n]!=typeof t[n]);if(r)throw new pe(r)}function Kr(t,e){ct(t.params,e.params);const r=[t.value,e.value].filter(F).join("&");return M(r,{...t.params,...e.params})}function Yr(t,e){return ct(t,e),{...t,...e}}function Be(t){return"parent"in t&&!!t.parent}function Ce(t){return"component"in t&&!!t.component}function xe(t){return"props"in t&&typeof t.props=="function"}function je(t){return"components"in t&&!!t.components}function Oe(t){return"props"in t&&typeof t.props=="object"}function Ze(t,e){return{...e,path:Ve(t.path,e.path),query:Kr(t.query,e.query),meta:zr(t.meta,e.meta),state:Yr(t.state,e.state),hash:Gr(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function Qt(){return typeof window<"u"&&typeof window.document<"u"}function Kt(t){const e=new URLSearchParams(t);return{get:(...r)=>e.get(...r),getAll:(...r)=>e.getAll(...r),set:(...r)=>{e.set(...r)},append:(...r)=>{e.append(...r)},delete:(...r)=>{e.delete(...r)},toString:(...r)=>e.toString(...r),forEach:(...r)=>{e.forEach(...r)},entries:(...r)=>e.entries(...r),keys:(...r)=>e.keys(...r),values:(...r)=>e.values(...r),has:(...r)=>e.has(...r),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function Yt(){let t=0;return()=>(++t).toString()}const Xr=Yt()();function tn(t){return t===Xr}const Xt=Yt();function $e(t){return t===void 0?"":t}function nt(t,e){const r=Xt(),n=$e(t.name),o=rt(t.path),a=rt(t.query),s=rt(t.hash),p=t.meta??{},m=t.state??{},f=i.markRaw({id:r,meta:p,state:m,...t,props:e}),g={id:r,matched:f,matches:[f],name:n,path:o,query:a,hash:s,meta:p,state:m,depth:1,host:M(),prefetch:t.prefetch},w=Be(t)?Ze(t.parent,g):g;return ct(w.path.params,w.query.params,w.hash.params),w}const Nt={template:"<div>This is component</div>"},te=nt({name:"parentA",path:"/parentA/[paramA]"}),He=nt({parent:te,name:"parentA.childA",path:"/childA/[?paramB]"}),en=nt({parent:te,name:"parentA.childB",path:"/childB/[paramD]",component:Nt}),rn=nt({parent:He,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Nt});nt({name:"parentB",path:"/parentB",component:Nt}),nt({name:"parentC",path:"/",component:Nt});const nn="lazy",on={components:!0,props:!1};function Vt(t){return["eager","lazy","intent"].includes(t)}function _e({routerPrefetch:t,routePrefetch:e,linkPrefetch:r},n){const o=ee(r,n),a=ee(e,n),s=ee(t,n),p=[o,a,s,on[n],nn].reduce((m,f)=>Vt(m)?m:m===!0&&Vt(f)?f:m===!0&&!Vt(f)?m:m===void 0?f:m,void 0);return Vt(p)?p:!1}function ee(t,e){return ut(t)?t[e]:t}class qe extends Error{constructor(){super("Uncaught CallbackContextAbortError");G(this,"response");this.response={status:"ABORT"}}}class ht extends Error{constructor(r){super("Uncaught CallbackContextPushError");G(this,"response");this.response={status:"PUSH",to:r}}}class Bt extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");G(this,"response");this.response={status:"REJECT",type:r}}}function Ie(){return{reject:o=>{throw new Bt(o)},push:(...o)=>{throw new ht(o)},replace:(o,a,s)=>{if(Z(o)){const f=a??{};throw new ht([o,{...f,replace:!0}])}const p=a,m=s??{};throw new ht([o,p,{...m,replace:!0}])},abort:()=>{throw new qe}}}function De(t){try{const e=t();return It(e)?e.catch(r=>r):e}catch(e){return e}}function Je(){let t=null;function e(n){t=n}function r(n){return t?t.runWithContext(n):n()}return{setVueApp:e,runWithContext:r}}const Te=Symbol();function an(){const{setVueApp:t,runWithContext:e}=Je(),r=i.reactive(new Map),{push:n,replace:o,reject:a}=Ie(),s=(b,c,l)=>c.matches.filter(u=>_e({...l,routePrefetch:u.prefetch},"props")===b).flatMap(u=>v(u)).reduce((u,{id:d,name:S,props:U})=>{if(!U)return u;const k=B(d,S,c),R=e(()=>De(()=>U(c,{push:n,replace:o,reject:a,parent:g(c,!0)})));return u[k]=R,u},{}),p=b=>{Object.entries(b).forEach(([c,l])=>{r.set(c,l)})},m=async b=>{const c=b.matches.flatMap(v),l=[],u=[];for(const{id:d,name:S,props:U}of c){if(!U)continue;const k=B(d,S,b);if(l.push(k),!r.has(k)){const R=e(()=>De(()=>U(b,{push:n,replace:o,reject:a,parent:g(b)})));r.set(k,R)}u.push((async()=>{const R=await r.get(k);if(R instanceof Error)throw R})())}C(l);try{return await Promise.all(u),{status:"SUCCESS"}}catch(d){if(d instanceof ht||d instanceof Bt)return d.response;throw d}},f=(b,c,l)=>{const u=B(b,c,l);return r.get(u)};function g(b,c=!1){const l=b.matches.at(-2);if(l)return xe(l)?{name:l.name??"",get props(){return w(l,"default",b,c)}}:Oe(l)?{name:l.name??"",props:new Proxy({},{get(u,d){return typeof d!="string"?Reflect.get(u,d):w(l,d,b,c)}})}:{name:l.name??"",props:void 0}}function w(b,c,l,u=!1){const d=f(b.id,c,l);if(u&&!d){const S=b.name??"unknown",U=l.name||"unknown";console.warn(`
|
|
1
|
+
(function(A,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(A=typeof globalThis<"u"?globalThis:A||self,i(A["@kitbag/router"]={},A.Vue))})(this,function(A,i){"use strict";var ko=Object.defineProperty;var Uo=(A,i,Z)=>i in A?ko(A,i,{enumerable:!0,configurable:!0,writable:!0,value:Z}):A[i]=Z;var G=(A,i,Z)=>Uo(A,typeof i!="symbol"?i+"":i,Z);function Z(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function $t(t){return Z(t)?t:`/${t}`}class de extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}class pe extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}class X extends Error{constructor(){super("Router not installed")}}class he extends Error{constructor(e,r){super(`useRoute called with incorrect route. Given ${e}, expected ${r}`)}}const ye=Symbol();function Rt(){const t=i.inject(ye);if(!t)throw new X;return t}function it(t){return Array.isArray(t)?t:[t]}function me(t,e){return t.filter(r=>e===r).length}function ct(...t){const e=t.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of e)if(me(e,r)>1)throw new de(r)}class z extends Error{}const wt="[",At="]";function vr(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function kr(t){return typeof t=="function"&&vr(t)}function vt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function ge(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function Re(t,e){return vt(t)?{...t,defaultValue:e??t.defaultValue}:{get:r=>tt(r,t),set:r=>et(r,t),defaultValue:e}}function Ur(t){return vt(t)&&t.defaultValue!==void 0}function Lr(t,e){return Re(t,e)}function Nr(t){return t!==void 0}function ut(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F(t){return typeof t=="string"&&t.length>0}let E=null;async function Vr(){const{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:y,ZodArray:f,ZodTuple:g,ZodUnion:w,ZodDiscriminatedUnion:B,ZodRecord:v,ZodMap:C,ZodSet:b,ZodIntersection:c,ZodPromise:l,ZodFunction:u}=await import("zod");return{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:y,ZodArray:f,ZodTuple:g,ZodUnion:w,ZodDiscriminatedUnion:B,ZodRecord:v,ZodMap:C,ZodSet:b,ZodIntersection:c,ZodPromise:l,ZodFunction:u}}function Br(t){return Object.values(t).some(e=>Object.values(e.host.params).some(r=>_t(r))||Object.values(e.path.params).some(r=>_t(r))||Object.values(e.query.params).some(r=>_t(r)))}function _t(t){return ut(t)&&"parse"in t&&typeof t.parse=="function"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="zod"}async function Cr(){try{E=await Vr()}catch{throw new Error("Failed to initialize Zod")}}function we(t){return E?t instanceof E.ZodSchema:!1}function Ee(t){return{get:(e,{invalid:r})=>{try{return Ht(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return qt(e,t)}catch{throw r()}}}}const xr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ft(t,e){if(typeof e=="string"&&xr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function lt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function kt(t,e){return E!=null&&E.ZodString&&t instanceof E.ZodString?1:E!=null&&E.ZodString&&e instanceof E.ZodString?-1:0}function Ht(t,e){if(!E)throw new Error("Zod is not initialized");if(e instanceof E.ZodString)return e.parse(t);if(e instanceof E.ZodBoolean)return e.parse(!!t);if(e instanceof E.ZodDate)return e.parse(new Date(t));if(e instanceof E.ZodNumber)return e.parse(Number(t));if(e instanceof E.ZodLiteral)return lt([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof E.ZodObject)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodEnum)return e.parse(t);if(e instanceof E.ZodNativeEnum)return lt([()=>e.parse(Number(t)),()=>e.parse(t)]);if(e instanceof E.ZodArray||e instanceof E.ZodTuple)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>Ht(t,n));return lt(r)}if(e instanceof E.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>Ht(t,n));return lt(r)}if(e instanceof E.ZodRecord)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodMap)return e.parse(new Map(JSON.parse(t,ft)));if(e instanceof E.ZodSet)return e.parse(new Set(JSON.parse(t,ft)));if(e instanceof E.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof E.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof E.ZodFunction)throw new Error("Function schemas are not supported");return e.parse(t)}function qt(t,e){if(!E)throw new Error("Zod is not initialized");if(e instanceof E.ZodString)return e.parse(t);if(e instanceof E.ZodBoolean)return e.parse(t).toString();if(e instanceof E.ZodDate)return e.parse(t).toISOString();if(e instanceof E.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof E.ZodLiteral)return e.parse(t).toString();if(e instanceof E.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof E.ZodEnum)return e.parse(t);if(e instanceof E.ZodNativeEnum)return e.parse(t).toString();if(e instanceof E.ZodArray||e instanceof E.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof E.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>qt(t,n));return lt(r)}if(e instanceof E.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>qt(t,n));return lt(r)}if(e instanceof E.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof E.ZodMap){const r=e.parse(t);return JSON.stringify(Array.from(r.entries()))}if(e instanceof E.ZodSet){const r=e.parse(t);return JSON.stringify(Array.from(r.values()))}if(e instanceof E.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof E.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof E.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(e.parse(t))}function It(t){return typeof t=="object"&&t!==null&&"then"in t}function N(t,e){const r=t["~standard"].validate(e);if(It(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function jr(t){return ut(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function be(t){return jr(t)}function Se(t){return{get:(e,{invalid:r})=>{try{return Dt(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Jt(e,t)}catch{throw r()}}}}const Or=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function dt(t,e){if(typeof e=="string"&&Or.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function pt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Ut(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function Dt(t,e){if(e.type==="boolean")return N(e,!!t);if(e.type==="date")return N(e,new Date(t));if(e.type==="number")return N(e,Number(t));if(e.type==="literal")return pt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="object")return N(e,JSON.parse(t,dt));if(e.type==="enum")return pt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="array"||e.type==="tuple")return N(e,JSON.parse(t,dt));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return pt(r)}if(e.type==="record")return N(e,JSON.parse(t,dt));if(e.type==="map")return N(e,new Map(JSON.parse(t,dt)));if(e.type==="set")return N(e,new Set(JSON.parse(t,dt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return N(e,t)}function Jt(t,e){if(e.type==="string"||e.type==="boolean")return N(e,t).toString();if(e.type==="date")return N(e,t).toISOString();if(e.type==="number")return N(e,Number(t)).toString();if(e.type==="literal")return N(e,t).toString();if(e.type==="object")return JSON.stringify(N(e,t));if(e.type==="enum"||e.type==="nativeEnum")return N(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(N(e,t));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Jt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Jt(t,n));return pt(r)}if(e.type==="record")return JSON.stringify(N(e,t));if(e.type==="map"){const r=N(e,t);return JSON.stringify(Array.from(r.entries()))}if(e.type==="set"){const r=N(e,t);return JSON.stringify(Array.from(r.values()))}if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(N(e,t))}function Zr(t,e){return t[e]??String}const j={invalid:t=>{throw new z(t)}},Pe={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Tt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},Ft={get:(t,{invalid:e})=>{const r=Number(t);if(isNaN(r))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},Ae={get:(t,{invalid:e})=>{const r=new Date(t);if(isNaN(r.getTime()))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ve={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function $r(t,e){switch(typeof e){case"string":return Pe.get(t,j)===e;case"number":return Ft.get(t,j)===e;case"boolean":return Tt.get(t,j)===e;default:return!1}}function tt(t,e,r=!1){if(t===void 0||!F(t)){if(Ur(e))return e.defaultValue;if(r)return;throw new z}if(e===String)return Pe.get(t,j);if(e===Boolean)return Tt.get(t,j);if(e===Number)return Ft.get(t,j);if(e===Date)return Ae.get(t,j);if(e===JSON)return ve.get(t,j);if(kr(e))return e(t,j);if(vt(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new z}if(ge(e)){if($r(t,e))return e;throw new z}return we(e)?Ee(e).get(t,j):be(e)?Se(e).get(t,j):t}function _r(t,e,r=!1){try{return tt(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function Hr(t,e,r=!1){try{return et(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function et(t,e,r=!1){if(t===void 0){if(r)return"";throw new z}if(e===Boolean)return Tt.set(t,j);if(e===Number)return Ft.set(t,j);if(e===Date)return Ae.set(t,j);if(e===JSON)return ve.set(t,j);if(vt(e))return e.set(t,j);if(ge(e)){if(e!==t)throw new z;return t.toString()}if(we(e))return Ee(e).set(t,j);if(be(e))return Se(e).set(t,j);try{return t.toString()}catch{throw new z}}function Mt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qr(t,e){const r=Array.from(t.matchAll(e));if(r.length===0)return[t];let n=0;const o=r.reduce((s,p)=>{const y=Mt(t.slice(n,p.index));y.length&&s.push(y);const[f]=p;return s.push(f),n=p.index+f.length,s},[]),a=t.slice(n);return a&&o.push(a),o}function Ir(t){const e=ke(t.path.value);return new RegExp(`^${e}$`,"i")}function Dr(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,r])=>!Gt(r)).map(([r,n])=>{const o=ke(n);return new RegExp(`${Mt(r)}=${o}(&|$)`,"i")})}function ke(t){return qr(t,new RegExp(Lt,"g")).map(e=>e.startsWith(wt)?Ue(e):Mt(e)).join("")}function Ue(t){return t.replace(new RegExp(Lt,"g"),".+")}function Jr(t,e){const r=Le(e);return t.replace(r,"(.*)")}function Wt(t,e){return Fr(e).test(t.value)}function Gt(t){return new RegExp(Tr,"g").test(t)}const Lt=`\\${wt}\\??([\\w-_]+)\\${At}`,Tr=`\\${wt}\\?([\\w-_]+)\\${At}`;function zt(t){const[e]=Ne(t,new RegExp(Lt,"g"));return e}function Le(t){return new RegExp(`\\${wt}\\??${t}\\${At}`,"g")}function Fr(t){return new RegExp(`\\${wt}\\?${t}\\${At}`,"g")}function Ne(t,e){return Array.from(t.matchAll(e)).flatMap(([,...n])=>n.map(o=>F(o)?o:""))}function Mr(t="",e={}){return F(t)?Array.from(t.matchAll(new RegExp(Lt,"g"))).reduce((n,[o,a])=>{const s=zt(o);if(!s)return n;const p=Zr(e,s);return ct([s],n),n[a]=p,n},{}):{}}function Wr(t){return ut(t)&&typeof t.value=="string"}function rt(t){return t===void 0?M():Wr(t)?t:M(t,{})}function M(t,e){return{value:t??"",params:Mr(t,e)}}function Ve(t,e){ct(t.params,e.params);const r=`${t.value}${e.value}`;return M(r,{...t.params,...e.params})}function Gr(t,e){return Ve(t,e)}function zr(t,e){return Qr(t,e),{...t,...e}}function Qr(t,e){const r=Object.keys(t).find(n=>n in e&&typeof e[n]!=typeof t[n]);if(r)throw new pe(r)}function Kr(t,e){ct(t.params,e.params);const r=[t.value,e.value].filter(F).join("&");return M(r,{...t.params,...e.params})}function Yr(t,e){return ct(t,e),{...t,...e}}function Be(t){return"parent"in t&&!!t.parent}function Ce(t){return"component"in t&&!!t.component}function xe(t){return"props"in t&&typeof t.props=="function"}function je(t){return"components"in t&&!!t.components}function Oe(t){return"props"in t&&typeof t.props=="object"}function Ze(t,e){return{...e,path:Ve(t.path,e.path),query:Kr(t.query,e.query),meta:zr(t.meta,e.meta),state:Yr(t.state,e.state),hash:Gr(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function Qt(){return typeof window<"u"&&typeof window.document<"u"}function Kt(t){const e=new URLSearchParams(t);return{get:(...r)=>e.get(...r),getAll:(...r)=>e.getAll(...r),set:(...r)=>{e.set(...r)},append:(...r)=>{e.append(...r)},delete:(...r)=>{e.delete(...r)},toString:(...r)=>e.toString(...r),forEach:(...r)=>{e.forEach(...r)},entries:(...r)=>e.entries(...r),keys:(...r)=>e.keys(...r),values:(...r)=>e.values(...r),has:(...r)=>e.has(...r),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function Yt(){let t=0;return()=>(++t).toString()}const Xr=Yt()();function tn(t){return t===Xr}const Xt=Yt();function $e(t){return t===void 0?"":t}function nt(t,e){const r=Xt(),n=$e(t.name),o=rt(t.path),a=rt(t.query),s=rt(t.hash),p=t.meta??{},y=t.state??{},f=i.markRaw({id:r,meta:p,state:y,...t,props:e}),g={id:r,matched:f,matches:[f],name:n,path:o,query:a,hash:s,meta:p,state:y,depth:1,host:M(),prefetch:t.prefetch},w=Be(t)?Ze(t.parent,g):g;return ct(w.path.params,w.query.params,w.hash.params),w}const Nt={template:"<div>This is component</div>"},te=nt({name:"parentA",path:"/parentA/[paramA]"}),_e=nt({parent:te,name:"parentA.childA",path:"/childA/[?paramB]"}),en=nt({parent:te,name:"parentA.childB",path:"/childB/[paramD]",component:Nt}),rn=nt({parent:_e,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Nt});nt({name:"parentB",path:"/parentB",component:Nt}),nt({name:"parentC",path:"/",component:Nt});const nn="lazy",on={components:!0,props:!1};function Vt(t){return["eager","lazy","intent"].includes(t)}function He({routerPrefetch:t,routePrefetch:e,linkPrefetch:r},n){const o=ee(r,n),a=ee(e,n),s=ee(t,n),p=[o,a,s,on[n],nn].reduce((y,f)=>Vt(y)?y:y===!0&&Vt(f)?f:y===!0&&!Vt(f)?y:y===void 0?f:y,void 0);return Vt(p)?p:!1}function ee(t,e){return ut(t)?t[e]:t}class qe extends Error{constructor(){super("Uncaught CallbackContextAbortError");G(this,"response");this.response={status:"ABORT"}}}class ht extends Error{constructor(r){super("Uncaught CallbackContextPushError");G(this,"response");this.response={status:"PUSH",to:r}}}class Bt extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");G(this,"response");this.response={status:"REJECT",type:r}}}function Ie(){return{reject:o=>{throw new Bt(o)},push:(...o)=>{throw new ht(o)},replace:(o,a,s)=>{if(Z(o)){const f=a??{};throw new ht([o,{...f,replace:!0}])}const p=a,y=s??{};throw new ht([o,p,{...y,replace:!0}])},abort:()=>{throw new qe}}}function De(t){try{const e=t();return It(e)?e.catch(r=>r):e}catch(e){return e}}function Je(){let t=null;function e(n){t=n}function r(n){return t?t.runWithContext(n):n()}return{setVueApp:e,runWithContext:r}}const Te=Symbol();function an(){const{setVueApp:t,runWithContext:e}=Je(),r=i.reactive(new Map),{push:n,replace:o,reject:a}=Ie(),s=(b,c,l)=>c.matches.filter(u=>He({...l,routePrefetch:u.prefetch},"props")===b).flatMap(u=>v(u)).reduce((u,{id:d,name:S,props:U})=>{if(!U)return u;const k=B(d,S,c),R=e(()=>De(()=>U(c,{push:n,replace:o,reject:a,parent:g(c,!0)})));return u[k]=R,u},{}),p=b=>{Object.entries(b).forEach(([c,l])=>{r.set(c,l)})},y=async b=>{const c=b.matches.flatMap(v),l=[],u=[];for(const{id:d,name:S,props:U}of c){if(!U)continue;const k=B(d,S,b);if(l.push(k),!r.has(k)){const R=e(()=>De(()=>U(b,{push:n,replace:o,reject:a,parent:g(b)})));r.set(k,R)}u.push((async()=>{const R=await r.get(k);if(R instanceof Error)throw R})())}C(l);try{return await Promise.all(u),{status:"SUCCESS"}}catch(d){if(d instanceof ht||d instanceof Bt)return d.response;throw d}},f=(b,c,l)=>{const u=B(b,c,l);return r.get(u)};function g(b,c=!1){const l=b.matches.at(-2);if(l)return xe(l)?{name:l.name??"",get props(){return w(l,"default",b,c)}}:Oe(l)?{name:l.name??"",props:new Proxy({},{get(u,d){return typeof d!="string"?Reflect.get(u,d):w(l,d,b,c)}})}:{name:l.name??"",props:void 0}}function w(b,c,l,u=!1){const d=f(b.id,c,l);if(u&&!d){const S=b.name??"unknown",U=l.name||"unknown";console.warn(`
|
|
2
2
|
Unable to access parent props "${c}" from route "${S}" while prefetching props for route "${U}".
|
|
3
3
|
This may occur if the parent route's props were not also prefetched.
|
|
4
|
-
`)}return d}function B(b,c,l){return[b,c,l.id,JSON.stringify(l.params)].join("-")}function v(b){return xe(b)?[{id:b.id,name:"default",props:b.props}]:Oe(b)?Object.entries(b.props).map(([c,l])=>({id:b.id,name:c,props:l})):[]}function C(b){for(const c of r.keys())b.includes(c)||r.delete(c)}return{getPrefetchProps:s,setPrefetchProps:p,getProps:f,setProps:m,setVueApp:t}}function Fe(){const t=i.inject(Te);if(!t)throw new X;return t}const sn=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Me(t){return t.name===sn.name&&"__asyncLoader"in t}const We=Symbol("visibilityObserver");function cn(t){const e=i.inject(We);if(!e)throw new X;return i.watch(t,(n,o)=>{n&&e.observe(n),o&&e.unobserve(o)},{immediate:!0}),i.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:i.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function Ge(t,e,r){i.watch(t,(n,o)=>{n&&n.addEventListener(e,r),o&&o.removeEventListener(e,r)},{immediate:!0}),i.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,r)})}function un(t){const e=new Map,r=i.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Fe(),{isElementVisible:a}=cn(r),s=()=>{const f=Array.from(e.values()).reduce((g,w)=>(Object.assign(g,w),g),{});o(f)};i.watch(()=>i.toValue(t),({route:f,...g})=>{e.clear(),f&&m("eager",f,g)},{immediate:!0}),i.watch(a,f=>{const{route:g,...w}=i.toValue(t);!g||!f||m("lazy",g,w)},{immediate:!0}),Ge(r,"focusin",p),Ge(r,"mouseover",p);function p(){const{route:f,...g}=i.toValue(t);f&&m("intent",f,g)}function m(f,g,w){fn(f,g,w),e.has(f)||e.set(f,n(f,g,w))}return{element:r,commit:s}}function fn(t,e,r){e.matches.forEach(n=>{_e({...r,routePrefetch:n.prefetch},"components")===t&&(Ce(n)&&Me(n.component)&&n.component.__asyncLoader(),je(n)&&Object.values(n.components).forEach(a=>{Me(a)&&a.__asyncLoader()}))})}const ze=Symbol("isRouterRouteSymbol");function ln(t){return typeof t=="object"&&t!==null&&ze in t}function dn(t,e){function r(c,l,u){if(typeof c=="object"){const S={...t.params,...c};return e(t.name,S,l)}const d={...t.params,[c]:l};return e(t.name,d,u)}const n=(...c)=>{const l=new URLSearchParams(t.query);l.set(...c),r({},{query:l})},o=(...c)=>{const l=new URLSearchParams(t.query);l.append(...c),r({},{query:l})},a=(...c)=>{const l=new URLSearchParams(t.query);l.delete(...c),r({},{query:l})},{id:s,matched:p,matches:m,name:f,hash:g,href:w}=i.toRefs(t),B=i.computed({get(){return new Proxy(t.params,{set(c,l,u){return r(l,u),!0}})},set(c){r(c)}}),v=i.computed({get(){return new Proxy(t.query,{get(c,l,u){switch(l){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(c,l,u)}}})},set(c){r({},{query:c})}}),C=i.computed({get(){return new Proxy(t.state,{set(c,l,u){return r({},{state:{...t.state,[l]:u}}),!0}})},set(c){r({},{state:c})}});return i.reactive({id:s,matched:p,matches:m,state:C,query:v,hash:g,params:B,name:f,href:w,update:r,[ze]:!0})}function Ct(t,e,{exact:r}={}){return ln(t)?e===void 0?!0:r?t.matched.name===e:t.matches.map(n=>n.name).includes(e):!1}function re(...t){const e=new URLSearchParams;for(const r of t){const n=new URLSearchParams(r);for(const[o,a]of n.entries())e.append(o,a)}return e}function Qe(t,e={},r={}){const n=Rt(),o=i.computed(()=>{const c=i.toValue(t);return typeof c!="string"?c:Z(c)?n.find(c,i.toValue(r)):n.resolve(c,i.toValue(e),i.toValue(r))}),a=i.computed(()=>{if(o.value)return o.value.href;const c=i.toValue(t);if(Z(c))return c;console.error(new Error("Failed to resolve route in RouterLink."))}),s=i.computed(()=>Ct(n.route)&&n.route.matches.some(c=>{var l;return c.id===((l=o.value)==null?void 0:l.id)})),p=i.computed(()=>{var c;return n.route.id===((c=o.value)==null?void 0:c.id)}),m=i.computed(()=>Ct(n.route)&&Nr(o.value)&&n.route.href.startsWith(o.value.href)),f=i.computed(()=>{var c;return n.route.href===((c=o.value)==null?void 0:c.href)}),g=i.computed(()=>!!a.value&&n.isExternal(a.value)),w=i.computed(()=>{const c=i.toValue(t);return typeof c!="string"||Z(c)?i.toValue(e):i.toValue(r)}),{element:B,commit:v}=un(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:w.value.prefetch})),C=c=>{v();const l={replace:(c==null?void 0:c.replace)??w.value.replace,query:re(w.value.query,c==null?void 0:c.query),hash:(c==null?void 0:c.hash)??w.value.hash,state:{...w.value.state,...c==null?void 0:c.state}},u=i.toValue(t);return Z(u)||typeof u=="object"?n.push(u,l):n.push(u,i.toValue(e),l)};return{element:B,route:o,href:a,isMatch:s,isExactMatch:p,isActive:m,isExactActive:f,isExternal:g,push:C,replace:c=>C({...c,replace:!0})}}const pn=["href"],Ke=i.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,r=Rt(),n=i.computed(()=>C(e.to)),o=i.computed(()=>b(e.to)),a=i.computed(()=>{const{to:l,...u}=e;return u}),{element:s,isMatch:p,isExactMatch:m,isActive:f,isExactActive:g,isExternal:w,push:B}=Qe(()=>typeof e.to=="function"?e.to(r.resolve):e.to,a),v=i.computed(()=>({"router-link--match":p.value,"router-link--exact-match":m.value,"router-link--active":f.value,"router-link--exact-active":g.value}));function C(l){if(typeof l=="function"){const u=l(r.resolve);return C(u)}return Z(l)?r.find(l):l}function b(l){if(typeof l=="function"){const u=l(r.resolve);return b(u)}return Z(l)?l:l==null?void 0:l.href}function c(l){l.preventDefault(),B()}return(l,u)=>(i.openBlock(),i.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:i.normalizeClass(["router-link",v.value]),onClick:c},[i.renderSlot(l.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:n.value,isMatch:i.unref(p),isExactMatch:i.unref(m),isActive:i.unref(f),isExactActive:i.unref(g),isExternal:i.unref(w)})))],10,pn))}}),Ye=Symbol();function hn(){const t=i.inject(Ye);if(!t)throw new X;return t}function ne(t,e){const r=Rt();function n(){if(!t)return;if(!Ct(r.route,t,e))throw new he(t,r.route.name)}return i.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const Xe=Symbol();function oe(){return i.inject(Xe,0)}function mn(t,e,r){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=i.getCurrentInstance(),o=Fe(),a=ne();return()=>{const s=o.getProps(t.id,e,a);return s instanceof Error?"":It(s)?n!=null&&n.suspense?i.h(gn,{component:r,props:s}):i.h(yn,{component:r,props:s}):i.h(r,s)}}})}const yn=i.defineComponent(t=>{const e=i.ref();return i.watch(()=>t.props,async r=>{e.value=await r},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),gn=i.defineComponent(async t=>{const e=i.ref();return e.value=await t.props,i.watch(()=>e.value,async r=>{e.value=await r},{deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),tr=Symbol();function Rn(){const t=new Map;return{getRouteComponents:r=>{const n=t.get(r.id);if(n)return n;const o=wn(r);return t.set(r.id,o),o}}}function wn(t){return je(t)?er(t,t.components):Ce(t)?er(t,{default:t.component}):{default:ae}}function er(t,e){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,mn(t,r,n)]))}function En(){const t=i.inject(tr);if(!t)throw new X;return t}const ae=i.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(t){const e=ne(),{started:r}=Rt(),n=hn(),o=oe(),{getRouteComponents:a}=En();i.provide(Xe,o+1);const s=i.computed(()=>{if(!r.value)return null;if(n.value)return n.value.component;const p=e.matches.at(o);return p?a(p)[t.name]:null});return(p,m)=>s.value?i.renderSlot(p.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(e),component:s.value,rejection:i.unref(n)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value)))]):i.createCommentVNode("",!0)}});class ot{constructor(){G(this,"onBeforeRouteEnter",new Set);G(this,"onBeforeRouteUpdate",new Set);G(this,"onBeforeRouteLeave",new Set);G(this,"onAfterRouteEnter",new Set);G(this,"onAfterRouteUpdate",new Set);G(this,"onAfterRouteLeave",new Set)}}const Et=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},bt=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},St=(t,e,r)=>{var n,o;return((n=t.matches.at(r))==null?void 0:n.id)===((o=e==null?void 0:e.matches.at(r))==null?void 0:o.id)};function rr(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Et;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return St;case"onBeforeRouteLeave":case"onAfterRouteLeave":return bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function bn(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&Et(t,e,o)&&it(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&St(t,e,o)&&it(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&bt(t,e,o)&&it(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function Sn(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onAfterRouteEnter&&Et(t,e,o)&&it(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&St(t,e,o)&&it(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onAfterRouteLeave&&bt(t,e,o)&&it(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function Pn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Et(t,e,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),St(t,e,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{bt(t,e,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function An(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Et(t,e,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),St(t,e,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{bt(t,e,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}const nr=Symbol();function vn(){const{setVueApp:t,runWithContext:e}=Je(),r={global:new ot,component:new ot},{reject:n,push:o,replace:a,abort:s}=Ie(),p=u=>(r.global.onBeforeRouteEnter.add(u),()=>r.global.onBeforeRouteEnter.delete(u)),m=u=>(r.global.onBeforeRouteUpdate.add(u),()=>r.global.onBeforeRouteUpdate.delete(u)),f=u=>(r.global.onBeforeRouteLeave.add(u),()=>r.global.onBeforeRouteLeave.delete(u)),g=u=>(r.global.onAfterRouteEnter.add(u),()=>r.global.onAfterRouteEnter.delete(u)),w=u=>(r.global.onAfterRouteUpdate.add(u),()=>r.global.onAfterRouteUpdate.delete(u)),B=u=>(r.global.onAfterRouteLeave.add(u),()=>r.global.onAfterRouteLeave.delete(u));async function v({to:u,from:d}){const{global:S,component:U}=r,k=bn(u,d),R=Pn(u,d,S),h=[...R.onBeforeRouteEnter,...k.onBeforeRouteEnter,...R.onBeforeRouteUpdate,...k.onBeforeRouteUpdate,...U.onBeforeRouteUpdate,...R.onBeforeRouteLeave,...k.onBeforeRouteLeave,...U.onBeforeRouteLeave];try{const y=h.map(L=>e(()=>L(u,{from:d,reject:n,push:o,replace:a,abort:s})));await Promise.all(y)}catch(y){if(y instanceof ht||y instanceof Bt||y instanceof qe)return y.response;throw y}return{status:"SUCCESS"}}async function C({to:u,from:d}){const{global:S,component:U}=r,k=Sn(u,d),R=An(u,d,S),h=[...U.onAfterRouteLeave,...k.onAfterRouteLeave,...R.onAfterRouteLeave,...U.onAfterRouteUpdate,...k.onAfterRouteUpdate,...R.onAfterRouteUpdate,...U.onAfterRouteEnter,...k.onAfterRouteEnter,...R.onAfterRouteEnter];try{const y=h.map(L=>e(()=>L(u,{from:d,reject:n,push:o,replace:a})));await Promise.all(y)}catch(y){if(y instanceof ht||y instanceof Bt)return y.response;throw y}return{status:"SUCCESS"}}return{runBeforeRouteHooks:v,runAfterRouteHooks:C,addComponentBeforeRouteHook:({lifecycle:u,depth:d,hook:S})=>{const U=rr(u),k=r.component[u],R=(h,y)=>{if(U(h,y.from,d))return S(h,y)};return k.add(R),()=>k.delete(R)},addComponentAfterRouteHook:({lifecycle:u,depth:d,hook:S})=>{const U=rr(u),k=r.component[u],R=(h,y)=>{if(U(h,y.from,d))return S(h,y)};return k.add(R),()=>k.delete(R)},addGlobalRouteHooks:u=>{u.onBeforeRouteEnter.forEach(d=>p(d)),u.onBeforeRouteUpdate.forEach(d=>m(d)),u.onBeforeRouteLeave.forEach(d=>f(d)),u.onAfterRouteEnter.forEach(d=>g(d)),u.onAfterRouteUpdate.forEach(d=>w(d)),u.onAfterRouteLeave.forEach(d=>B(d))},onBeforeRouteEnter:p,onBeforeRouteUpdate:m,onBeforeRouteLeave:f,onAfterRouteEnter:g,onAfterRouteUpdate:w,onAfterRouteLeave:B,setVueApp:t}}function or(){const t=i.inject(nr);if(!t)throw new X;return t}function ar(t){return e=>{const r=oe(),o=or().addComponentBeforeRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}function sr(t){return e=>{const r=oe(),o=or().addComponentAfterRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}const kn=ar("onBeforeRouteLeave"),Un=ar("onBeforeRouteUpdate"),Ln=sr("onAfterRouteLeave"),Nn=sr("onAfterRouteUpdate");function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},K.apply(null,arguments)}var H;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(H||(H={}));var mt=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function at(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var xt="beforeunload",Vn="hashchange",ir="popstate";function cr(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var R=n.location,h=R.pathname,y=R.search,L=R.hash,V=o.state||{};return[V.idx,mt({pathname:h,search:y,hash:L,state:V.usr||null,key:V.key||"default"})]}var s=null;function p(){if(s)v.call(s),s=null;else{var R=H.Pop,h=a(),y=h[0],L=h[1];if(v.length)if(y!=null){var V=g-y;V&&(s={action:R,location:L,retry:function(){U(V*-1)}},U(V))}else process.env.NODE_ENV!=="production"&&at(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else u(R)}}n.addEventListener(ir,p);var m=H.Pop,f=a(),g=f[0],w=f[1],B=yt(),v=yt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function C(R){return typeof R=="string"?R:st(R)}function b(R,h){return h===void 0&&(h=null),mt(K({pathname:w.pathname,hash:"",search:""},typeof R=="string"?Pt(R):R,{state:h,key:Ot()}))}function c(R,h){return[{usr:R.state,key:R.key,idx:h},C(R)]}function l(R,h,y){return!v.length||(v.call({action:R,location:h,retry:y}),!1)}function u(R){m=R;var h=a();g=h[0],w=h[1],B.call({action:m,location:w})}function d(R,h){var y=H.Push,L=b(R,h);function V(){d(R,h)}if(l(y,L,V)){var O=c(L,g+1),$=O[0],q=O[1];try{o.pushState($,"",q)}catch{n.location.assign(q)}u(y)}}function S(R,h){var y=H.Replace,L=b(R,h);function V(){S(R,h)}if(l(y,L,V)){var O=c(L,g),$=O[0],q=O[1];o.replaceState($,"",q),u(y)}}function U(R){o.go(R)}var k={get action(){return m},get location(){return w},createHref:C,push:d,replace:S,go:U,back:function(){U(-1)},forward:function(){U(1)},listen:function(h){return B.push(h)},block:function(h){var y=v.push(h);return v.length===1&&n.addEventListener(xt,jt),function(){y(),v.length||n.removeEventListener(xt,jt)}}};return k}function Bn(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var h=Pt(n.location.hash.substr(1)),y=h.pathname,L=y===void 0?"/":y,V=h.search,O=V===void 0?"":V,$=h.hash,q=$===void 0?"":$,I=o.state||{};return[I.idx,mt({pathname:L,search:O,hash:q,state:I.usr||null,key:I.key||"default"})]}var s=null;function p(){if(s)v.call(s),s=null;else{var h=H.Pop,y=a(),L=y[0],V=y[1];if(v.length)if(L!=null){var O=g-L;O&&(s={action:h,location:V,retry:function(){k(O*-1)}},k(O))}else process.env.NODE_ENV!=="production"&&at(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else d(h)}}n.addEventListener(ir,p),n.addEventListener(Vn,function(){var h=a(),y=h[1];st(y)!==st(w)&&p()});var m=H.Pop,f=a(),g=f[0],w=f[1],B=yt(),v=yt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function C(){var h=document.querySelector("base"),y="";if(h&&h.getAttribute("href")){var L=n.location.href,V=L.indexOf("#");y=V===-1?L:L.slice(0,V)}return y}function b(h){return C()+"#"+(typeof h=="string"?h:st(h))}function c(h,y){return y===void 0&&(y=null),mt(K({pathname:w.pathname,hash:"",search:""},typeof h=="string"?Pt(h):h,{state:y,key:Ot()}))}function l(h,y){return[{usr:h.state,key:h.key,idx:y},b(h)]}function u(h,y,L){return!v.length||(v.call({action:h,location:y,retry:L}),!1)}function d(h){m=h;var y=a();g=y[0],w=y[1],B.call({action:m,location:w})}function S(h,y){var L=H.Push,V=c(h,y);function O(){S(h,y)}if(process.env.NODE_ENV!=="production"&&at(V.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),u(L,V,O)){var $=l(V,g+1),q=$[0],I=$[1];try{o.pushState(q,"",I)}catch{n.location.assign(I)}d(L)}}function U(h,y){var L=H.Replace,V=c(h,y);function O(){U(h,y)}if(process.env.NODE_ENV!=="production"&&at(V.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),u(L,V,O)){var $=l(V,g),q=$[0],I=$[1];o.replaceState(q,"",I),d(L)}}function k(h){o.go(h)}var R={get action(){return m},get location(){return w},createHref:b,push:S,replace:U,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(y){return B.push(y)},block:function(y){var L=v.push(y);return v.length===1&&n.addEventListener(xt,jt),function(){L(),v.length||n.removeEventListener(xt,jt)}}};return R}function ur(t){t===void 0&&(t={});var e=t,r=e.initialEntries,n=r===void 0?["/"]:r,o=e.initialIndex,a=n.map(function(d){var S=mt(K({pathname:"/",search:"",hash:"",state:null,key:Ot()},typeof d=="string"?Pt(d):d));return process.env.NODE_ENV!=="production"&&at(S.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")"),S}),s=fr(o??a.length-1,0,a.length-1),p=H.Pop,m=a[s],f=yt(),g=yt();function w(d){return typeof d=="string"?d:st(d)}function B(d,S){return S===void 0&&(S=null),mt(K({pathname:m.pathname,search:"",hash:""},typeof d=="string"?Pt(d):d,{state:S,key:Ot()}))}function v(d,S,U){return!g.length||(g.call({action:d,location:S,retry:U}),!1)}function C(d,S){p=d,m=S,f.call({action:p,location:m})}function b(d,S){var U=H.Push,k=B(d,S);function R(){b(d,S)}process.env.NODE_ENV!=="production"&&at(m.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")"),v(U,k,R)&&(s+=1,a.splice(s,a.length,k),C(U,k))}function c(d,S){var U=H.Replace,k=B(d,S);function R(){c(d,S)}process.env.NODE_ENV!=="production"&&at(m.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")"),v(U,k,R)&&(a[s]=k,C(U,k))}function l(d){var S=fr(s+d,0,a.length-1),U=H.Pop,k=a[S];function R(){l(d)}v(U,k,R)&&(s=S,C(U,k))}var u={get index(){return s},get action(){return p},get location(){return m},createHref:w,push:b,replace:c,go:l,back:function(){l(-1)},forward:function(){l(1)},listen:function(S){return f.push(S)},block:function(S){return g.push(S)}};return u}function fr(t,e,r){return Math.min(Math.max(t,e),r)}function jt(t){t.preventDefault(),t.returnValue=""}function yt(){var t=[];return{get length(){return t.length},push:function(r){return t.push(r),function(){t=t.filter(function(n){return n!==r})}},call:function(r){t.forEach(function(n){return n&&n(r)})}}}function Ot(){return Math.random().toString(36).substr(2,8)}function st(t){var e=t.pathname,r=e===void 0?"/":e,n=t.search,o=n===void 0?"":n,a=t.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function Pt(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const lr=Symbol();function Cn(t,e){const r=i.reactive({...t}),n=s=>{Object.assign(r,{[lr]:!1,...s})},o=r,a=dn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:n}}function _(t){return!t.startsWith("http")?jn(t):xn(t)}function xn(t){const{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}}function jn(t){const{pathname:e,search:r,searchParams:n,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:r,searchParams:n,hash:o}}function On(t){return e=>{const{host:r}=_(e);return!(r===void 0||r===t)}}function Zn({mode:t,listener:e}){const r=$n(t),n=(m,f)=>{if(f!=null&&f.replace){r.replace(m,f.state);return}r.push(m,f==null?void 0:f.state)},o=()=>{const m=st(r.location);r.replace(m)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(e)},stopListening:()=>{a==null||a()}}}function $n(t="auto"){switch(t){case"auto":return Qt()?cr():ur();case"browser":return cr();case"memory":return ur();case"hash":return Bn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function Hn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function _n(t){const e=a=>i.markRaw(t[a]??Hn(a)),r=a=>{const s=i.markRaw(e(a)),p={id:Xt(),component:s,meta:{},state:{}};return{id:p.id,matched:p,matches:[p],name:a,query:Kt(""),params:{},state:{},href:"/",hash:"",[lr]:!0}},n=a=>{if(!a){o.value=null;return}const s=e(a);o.value={type:a,component:s}},o=i.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class qn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function In(t){if(t)return t;if(Qt())return window.location.toString();throw new qn}function dr(t){return!!t&&typeof t=="object"}const Zt=!0;function Dn(t,e,r){if(dr(t)&&e in t){const n=t[e];return typeof n=="string"?tt(n,r,Zt):n}return tt(void 0,r,Zt)}function pr(t,e){const r={};for(const[n,o]of Object.entries(t)){const a=Dn(e,n,o);r[n]=a}return r}function Jn(t,e,r){if(dr(t)&&e in t){const n=t[e];return et(n,r,Zt)}return et(void 0,r,Zt)}const hr=(t,e)=>{const r={};for(const[n,o]of Object.entries(t)){const a=Jn(e,n,o);r[n]=a}return r};function Tn(){const t=i.reactive(new Map),e=Qt()?s():null,r=p=>{t.set(p,!1),e==null||e.observe(p)},n=p=>{t.delete(p),e==null||e.unobserve(p)},o=()=>{e==null||e.disconnect()},a=p=>t.get(p)??!1;function s(){return new IntersectionObserver(p=>{p.forEach(m=>{t.set(m.target,m.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class Fn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function mr(t,e,r){const n=Jr(e.value,r),o=Ue(n),[a]=Ne(t,new RegExp(o,"g"));return a}function yr(t,e,r,n){const o=Wt(e,r),a=et(n,e.params[r],o);return t.replace(Le(r),a)}function gr({protocol:t,host:e,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");t&&(s.protocol=t),e&&(s.host=e),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const p=s.toString().replace(/^https:\/\/localhost\/*/,"/");return $t(p)}function Mn(t,e={}){const{params:r={},query:n}=e,o=Gn(t.query,r),a=re(o,n),s=Rr(t.path,r),p=t.hash.value?Rr(t.hash,r):e.hash,m=Wn(t.host,r),{protocol:f,host:g}=_(m);return gr({protocol:f,host:g,pathname:s,searchParams:a,hash:p})}function Wn(t,e){const r=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((n,o)=>yr(n,t,o,e[o]),r)}function Rr(t,e){return Object.keys(t.params).reduce((r,n)=>yr(r,t,n,e[n]),t.value)}function Gn(t,e){const r=new URLSearchParams(t.value);if(!t.value)return r;for(const[n,o]of Array.from(r.entries())){const a=zt(o);if(!a)continue;const p=Gt(o),m=et(e[a],t.params[a],p),f=e[a]===void 0&&m==="";p&&f?r.delete(n,o):r.set(n,m)}return r}const zn=(t,e)=>{try{se(t,e)}catch{return!1}return!0},se=(t,e)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=_(e);return{...ie(t.host,`${r}//${n}`),...ie(t.path,o),...Qn(t.query,a),...ie(t.hash,s)}};function ie(t,e){const r={},n=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const s=mr(n,t,o),p=Wt(t,o),m=tt(s,a,p);r[o]=m}return r}function Qn(t,e){const r={},n=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[a,s]of Array.from(n.entries())){const p=zt(s);if(!p)continue;const f=Gt(s),g=o.get(a)??void 0,w=tt(g,t.params[p],f);r[p]=w}return r}function Kn(t,e={},r={}){const n=Mn(t,{params:e,query:r.query,hash:r.hash}),{search:o,hash:a}=_(n);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,query:Kt(o),params:se(t,n),state:pr(t.state,r.state),hash:a,href:n}}const Yn=t=>"name"in t.matched&&!!t.matched.name,Xn=(t,e)=>{const{pathname:r}=_(e);return Ir(t).test(r)},to=(t,e)=>{const{search:r}=_(e);return Dr(t).every(o=>o.test(r))},ce=(t,e)=>{const{hash:r}=_(e),{value:n}=t.hash;return F(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function eo(t){const{searchParams:e,pathname:r}=_(t),n=-1,o=1;return(a,s)=>{const p=Er(a,e),m=wr(a,r),f=Er(s,e),g=wr(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:p+m>f+g?n:p+m<f+g?o:ce(a,t)?n:ce(s,t)?o:0}}function wr(t,e){const r=Object.keys(t.path.params).filter(o=>Wt(t.path,o)).map(o=>o),n=r.filter(o=>mr(e,t.path,o)===void 0);return r.length-n.length}function Er(t,e){const r=new URLSearchParams(e),n=new URLSearchParams(t.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const ro=[Yn,Xn,to,ce,zn];function no(t,e){const r=eo(e);return t.filter(n=>ro.every(o=>o(n,e))).sort(r)}function oo(t,e,r){const n=no(t,e);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=_(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Kt(a),params:se(o,e),state:pr(o.state,r),hash:s,href:$t(e)}}function br(t,e){const r=typeof t=="string"?_(t):t,n=typeof e=="string"?_(e):e,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return gr({protocol:F(n.protocol)?n.protocol:r.protocol,host:F(n.host)?n.host:r.host,pathname:F(n.pathname)?n.pathname:r.pathname,searchParams:re(a,o),hash:F(n.hash)?n.hash:r.hash})}function ao(t,e){return F(e)?t.map(r=>{const n=`${e}${r.path.value}`;return{...r,path:M(n,r.path.params)}}):t}class so extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function io(t){const e=t.map(({name:r})=>r);for(const r of e)if(ye(e,r)>1)throw new so(r)}function co(t,e=[],r){const n=[...t,...e.map(o=>o.routes)].flat();return io(n),ao(n,r)}function uo(t={},e=[]){const r=new ot;return gt("onBeforeRouteEnter",t,e).forEach(n=>r.onBeforeRouteEnter.add(n)),gt("onBeforeRouteUpdate",t,e).forEach(n=>r.onBeforeRouteUpdate.add(n)),gt("onBeforeRouteLeave",t,e).forEach(n=>r.onBeforeRouteLeave.add(n)),gt("onAfterRouteEnter",t,e).forEach(n=>r.onAfterRouteEnter.add(n)),gt("onAfterRouteUpdate",t,e).forEach(n=>r.onAfterRouteUpdate.add(n)),gt("onAfterRouteLeave",t,e).forEach(n=>r.onAfterRouteLeave.add(n)),r}function gt(t,e,r){return[e[t],...r.map(o=>o[t])].flat().filter(o=>o!==void 0)}function fo(t,e,r=[]){const n=co(t,r,e==null?void 0:e.base),o=vn();o.addGlobalRouteHooks(uo(e,r));const a=Yt(),s=an(),p=Rn(),m=Tn(),f=Zn({mode:e==null?void 0:e.historyMode,listener:({location:P})=>{const x=st(P);w(x,{state:P.state,replace:!0})}});function g(P,x={}){return oo(n,P,x.state)}async function w(P,x={}){const Q=a();if(f.stopListening(),L(P)){f.update(P,x);return}const J=g(P,x)??u("NotFound"),D=bo(Q),Y=await o.runBeforeRouteHooks({to:J,from:D});switch(Y.status){case"ABORT":return;case"PUSH":f.update(P,x),await v(...Y.to);return;case"REJECT":f.update(P,x),c(Y.type);break;case"SUCCESS":f.update(P,x),c(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(Y)}`)}const ue=Q;s.setProps(J).then(T=>{if(ue===Q)switch(T.status){case"SUCCESS":break;case"PUSH":v(...T.to);break;case"REJECT":c(T.type);break;default:const fe=T;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(fe)}`)}}),k(J);const W=await o.runAfterRouteHooks({to:J,from:D});switch(W.status){case"PUSH":await v(...W.to);break;case"REJECT":c(W.type);break;case"SUCCESS":break;default:const T=W;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(T)}`)}f.startListening()}const B=(P,x={},Q={})=>{const J=n.find(D=>D.name===P);if(!J)throw new Fn(String(P));return Kn(J,x,Q)},v=(P,x,Q)=>{if(Z(P)){const W={...x},T=br(P,{searchParams:W.query,hash:W.hash});return w(T,W)}if(typeof P=="string"){const{replace:W,...T}={...Q},fe={...x},le=B(P,fe,T),Po=hr({...le.matched.state},{...le.state,...T.state});return w(le.href,{replace:W,state:Po})}const{replace:J,...D}={...x},Y=hr({...P.matched.state},{...P.state,...D.state}),ue=br(P.href,{searchParams:D.query,hash:D.hash});return w(ue,{replace:J,state:Y})},C=(P,x,Q)=>{if(Z(P)){const D={...x,replace:!0};return v(P,D)}if(typeof P=="string"){const D={...Q,replace:!0},Y={...x};return v(P,Y,D)}const J={...x,replace:!0};return v(P,J)},b=P=>{c(P)},{setRejection:c,rejection:l,getRejectionRoute:u}=_n({...r.reduce((P,x)=>({...P,...x.rejections}),{}),...e==null?void 0:e.rejections}),d=u("NotFound"),{currentRoute:S,routerRoute:U,updateRoute:k}=Cn(d,v),R=In(e==null?void 0:e.initialUrl),h=f.location.state,{host:y}=_(R),L=On(y);let V=!1;const O=i.ref(!1),{promise:$,resolve:q}=Promise.withResolvers();async function I(){if(V)return $;V=!0,Br(n)&&await Cr(),await w(R,{replace:!0,state:h}),f.startListening(),q(),O.value=!0}function Pr(){f.stopListening()}function bo(P){return tn(P)?null:{...S}}function So(P){o.setVueApp(P),s.setVueApp(P),P.component("RouterView",ae),P.component("RouterLink",Ke),P.provide(Ye,l),P.provide(nr,o),P.provide(Te,s),P.provide(tr,p),P.provide(We,m),P.provide(me,Ar),I()}const Ar={route:U,resolve:B,find:g,push:v,replace:C,reject:b,refresh:f.refresh,forward:f.forward,back:f.back,go:f.go,install:So,isExternal:L,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:e==null?void 0:e.prefetch,start:I,started:O,stop:Pr};return Ar}function lo(t){return{routes:t.routes??[],rejections:t.rejections??{},...t}}function Sr(t){return{get:(e,{invalid:r})=>{for(const n of t){const o=Hr(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:r})=>{for(const n of t){const o=_r(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)}}}const po={separator:","};function ho(t,e={}){const{separator:r}={...po,...e},n=Sr(t);return{get:(o,a)=>o.split(r).map(s=>n.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>n.set(s,a)).join(r)}}}const mo={separator:","};function yo(t,e={}){const{separator:r}={...mo,...e};return{get:n=>{const o=n.split(r);return t.map((a,s)=>tt(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${n.length} values`);return t.map((a,s)=>et(n.at(s),a)).join(r)}}}const go=M,Ro=M,wo=M;function Eo(t){const e=Xt(),r=$e(t.name),n=rt(t.path),o=rt(t.query),a=rt(t.hash),s=t.meta??{},p=rt(t.host),m=i.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:m,matches:[m],name:r,host:p,path:n,query:o,hash:a,meta:s,depth:1,state:{}},g=Be(t)?Ze(t.parent,f):f;return ct(g.path.params,g.query.params,g.host.params,g.hash.params),g}A.DuplicateParamsError=de,A.MetaPropertyConflict=pe,A.RouterLink=Ke,A.RouterNotInstalledError=X,A.RouterView=ae,A.UseRouteInvalidError=he,A.arrayOf=ho,A.asUrl=$t,A.createExternalRoute=Eo,A.createParam=Re,A.createRoute=nt,A.createRouter=fo,A.createRouterPlugin=lo,A.host=Ro,A.isRoute=Ct,A.isUrl=Z,A.onAfterRouteLeave=Ln,A.onAfterRouteUpdate=Nn,A.onBeforeRouteLeave=kn,A.onBeforeRouteUpdate=Un,A.path=go,A.query=wo,A.tupleOf=yo,A.unionOf=Sr,A.useLink=Qe,A.useRoute=ne,A.useRouter=Rt,A.withDefault=Lr,A.withParams=M,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
`)}return d}function B(b,c,l){return[b,c,l.id,JSON.stringify(l.params)].join("-")}function v(b){return xe(b)?[{id:b.id,name:"default",props:b.props}]:Oe(b)?Object.entries(b.props).map(([c,l])=>({id:b.id,name:c,props:l})):[]}function C(b){for(const c of r.keys())b.includes(c)||r.delete(c)}return{getPrefetchProps:s,setPrefetchProps:p,getProps:f,setProps:y,setVueApp:t}}function Fe(){const t=i.inject(Te);if(!t)throw new X;return t}const sn=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Me(t){return t.name===sn.name&&"__asyncLoader"in t}const We=Symbol("visibilityObserver");function cn(t){const e=i.inject(We);if(!e)throw new X;return i.watch(t,(n,o)=>{n&&e.observe(n),o&&e.unobserve(o)},{immediate:!0}),i.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:i.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function Ge(t,e,r){i.watch(t,(n,o)=>{n&&n.addEventListener(e,r),o&&o.removeEventListener(e,r)},{immediate:!0}),i.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,r)})}function un(t){const e=new Map,r=i.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Fe(),{isElementVisible:a}=cn(r),s=()=>{const f=Array.from(e.values()).reduce((g,w)=>(Object.assign(g,w),g),{});o(f)};i.watch(()=>i.toValue(t),({route:f,...g})=>{e.clear(),f&&y("eager",f,g)},{immediate:!0}),i.watch(a,f=>{const{route:g,...w}=i.toValue(t);!g||!f||y("lazy",g,w)},{immediate:!0}),Ge(r,"focusin",p),Ge(r,"mouseover",p);function p(){const{route:f,...g}=i.toValue(t);f&&y("intent",f,g)}function y(f,g,w){fn(f,g,w),e.has(f)||e.set(f,n(f,g,w))}return{element:r,commit:s}}function fn(t,e,r){e.matches.forEach(n=>{He({...r,routePrefetch:n.prefetch},"components")===t&&(Ce(n)&&Me(n.component)&&n.component.__asyncLoader(),je(n)&&Object.values(n.components).forEach(a=>{Me(a)&&a.__asyncLoader()}))})}const ze=Symbol("isRouterRouteSymbol");function ln(t){return typeof t=="object"&&t!==null&&ze in t}function dn(t,e){function r(c,l,u){if(typeof c=="object"){const S={...t.params,...c};return e(t.name,S,l)}const d={...t.params,[c]:l};return e(t.name,d,u)}const n=(...c)=>{const l=new URLSearchParams(t.query);l.set(...c),r({},{query:l})},o=(...c)=>{const l=new URLSearchParams(t.query);l.append(...c),r({},{query:l})},a=(...c)=>{const l=new URLSearchParams(t.query);l.delete(...c),r({},{query:l})},{id:s,matched:p,matches:y,name:f,hash:g,href:w}=i.toRefs(t),B=i.computed({get(){return new Proxy(t.params,{set(c,l,u){return r(l,u),!0}})},set(c){r(c)}}),v=i.computed({get(){return new Proxy(t.query,{get(c,l,u){switch(l){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(c,l,u)}}})},set(c){r({},{query:c})}}),C=i.computed({get(){return new Proxy(t.state,{set(c,l,u){return r({},{state:{...t.state,[l]:u}}),!0}})},set(c){r({},{state:c})}});return i.reactive({id:s,matched:p,matches:y,state:C,query:v,hash:g,params:B,name:f,href:w,update:r,[ze]:!0})}function Ct(t,e,{exact:r}={}){return ln(t)?e===void 0?!0:r?t.matched.name===e:t.matches.map(n=>n.name).includes(e):!1}function re(...t){const e=new URLSearchParams;for(const r of t){const n=new URLSearchParams(r);for(const[o,a]of n.entries())e.append(o,a)}return e}function Qe(t,e={},r={}){const n=Rt(),o=i.computed(()=>{const c=i.toValue(t);return typeof c!="string"?c:Z(c)?n.find(c,i.toValue(r)):n.resolve(c,i.toValue(e),i.toValue(r))}),a=i.computed(()=>{if(o.value)return o.value.href;const c=i.toValue(t);if(Z(c))return c;console.error(new Error("Failed to resolve route in RouterLink."))}),s=i.computed(()=>Ct(n.route)&&n.route.matches.some(c=>{var l;return c.id===((l=o.value)==null?void 0:l.id)})),p=i.computed(()=>{var c;return n.route.id===((c=o.value)==null?void 0:c.id)}),y=i.computed(()=>Ct(n.route)&&Nr(o.value)&&n.route.href.startsWith(o.value.href)),f=i.computed(()=>{var c;return n.route.href===((c=o.value)==null?void 0:c.href)}),g=i.computed(()=>!!a.value&&n.isExternal(a.value)),w=i.computed(()=>{const c=i.toValue(t);return typeof c!="string"||Z(c)?i.toValue(e):i.toValue(r)}),{element:B,commit:v}=un(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:w.value.prefetch})),C=c=>{v();const l={replace:(c==null?void 0:c.replace)??w.value.replace,query:re(w.value.query,c==null?void 0:c.query),hash:(c==null?void 0:c.hash)??w.value.hash,state:{...w.value.state,...c==null?void 0:c.state}},u=i.toValue(t);return Z(u)||typeof u=="object"?n.push(u,l):n.push(u,i.toValue(e),l)};return{element:B,route:o,href:a,isMatch:s,isExactMatch:p,isActive:y,isExactActive:f,isExternal:g,push:C,replace:c=>C({...c,replace:!0})}}const pn=["href"],hn={name:"RouterLink"},Ke=i.defineComponent({...hn,props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,r=Rt(),n=i.computed(()=>C(e.to)),o=i.computed(()=>b(e.to)),a=i.computed(()=>{const{to:l,...u}=e;return u}),{element:s,isMatch:p,isExactMatch:y,isActive:f,isExactActive:g,isExternal:w,push:B}=Qe(()=>typeof e.to=="function"?e.to(r.resolve):e.to,a),v=i.computed(()=>({"router-link--match":p.value,"router-link--exact-match":y.value,"router-link--active":f.value,"router-link--exact-active":g.value}));function C(l){if(typeof l=="function"){const u=l(r.resolve);return C(u)}return Z(l)?r.find(l):l}function b(l){if(typeof l=="function"){const u=l(r.resolve);return b(u)}return Z(l)?l:l==null?void 0:l.href}function c(l){l.preventDefault(),B()}return(l,u)=>(i.openBlock(),i.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:i.normalizeClass(["router-link",v.value]),onClick:c},[i.renderSlot(l.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:n.value,isMatch:i.unref(p),isExactMatch:i.unref(y),isActive:i.unref(f),isExactActive:i.unref(g),isExternal:i.unref(w)})))],10,pn))}}),Ye=Symbol();function yn(){const t=i.inject(Ye);if(!t)throw new X;return t}function ne(t,e){const r=Rt();function n(){if(!t)return;if(!Ct(r.route,t,e))throw new he(t,r.route.name)}return i.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const Xe=Symbol();function oe(){return i.inject(Xe,0)}function mn(t,e,r){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=i.getCurrentInstance(),o=Fe(),a=ne();return()=>{const s=o.getProps(t.id,e,a);return s instanceof Error?"":It(s)?n!=null&&n.suspense?i.h(Rn,{component:r,props:s}):i.h(gn,{component:r,props:s}):i.h(r,s)}}})}const gn=i.defineComponent(t=>{const e=i.ref();return i.watch(()=>t.props,async r=>{e.value=await r},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),Rn=i.defineComponent(async t=>{const e=i.ref();return e.value=await t.props,i.watch(()=>e.value,async r=>{e.value=await r},{deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),tr=Symbol();function wn(){const t=new Map;return{getRouteComponents:r=>{const n=t.get(r.id);if(n)return n;const o=En(r);return t.set(r.id,o),o}}}function En(t){return je(t)?er(t,t.components):Ce(t)?er(t,{default:t.component}):{default:ae}}function er(t,e){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,mn(t,r,n)]))}function bn(){const t=i.inject(tr);if(!t)throw new X;return t}const Sn={name:"RouterView"},ae=i.defineComponent({...Sn,props:{name:{default:"default"}},setup(t){const e=ne(),r=Rt(),n=yn(),o=oe();i.onServerPrefetch(async()=>{await r.start()});const{getRouteComponents:a}=bn();i.provide(Xe,o+1);const s=i.computed(()=>{if(!r.started.value)return null;if(n.value)return n.value.component;const p=e.matches.at(o);return p?a(p)[t.name]:null});return(p,y)=>s.value?i.renderSlot(p.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(e),component:s.value,rejection:i.unref(n)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value)))]):i.createCommentVNode("",!0)}});class ot{constructor(){G(this,"onBeforeRouteEnter",new Set);G(this,"onBeforeRouteUpdate",new Set);G(this,"onBeforeRouteLeave",new Set);G(this,"onAfterRouteEnter",new Set);G(this,"onAfterRouteUpdate",new Set);G(this,"onAfterRouteLeave",new Set)}}const Et=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},bt=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},St=(t,e,r)=>{var n,o;return((n=t.matches.at(r))==null?void 0:n.id)===((o=e==null?void 0:e.matches.at(r))==null?void 0:o.id)};function rr(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Et;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return St;case"onBeforeRouteLeave":case"onAfterRouteLeave":return bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function Pn(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&Et(t,e,o)&&it(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&St(t,e,o)&&it(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&bt(t,e,o)&&it(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function An(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onAfterRouteEnter&&Et(t,e,o)&&it(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&St(t,e,o)&&it(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onAfterRouteLeave&&bt(t,e,o)&&it(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function vn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Et(t,e,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),St(t,e,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{bt(t,e,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function kn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Et(t,e,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),St(t,e,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{bt(t,e,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}const nr=Symbol();function Un(){const{setVueApp:t,runWithContext:e}=Je(),r={global:new ot,component:new ot},{reject:n,push:o,replace:a,abort:s}=Ie(),p=u=>(r.global.onBeforeRouteEnter.add(u),()=>r.global.onBeforeRouteEnter.delete(u)),y=u=>(r.global.onBeforeRouteUpdate.add(u),()=>r.global.onBeforeRouteUpdate.delete(u)),f=u=>(r.global.onBeforeRouteLeave.add(u),()=>r.global.onBeforeRouteLeave.delete(u)),g=u=>(r.global.onAfterRouteEnter.add(u),()=>r.global.onAfterRouteEnter.delete(u)),w=u=>(r.global.onAfterRouteUpdate.add(u),()=>r.global.onAfterRouteUpdate.delete(u)),B=u=>(r.global.onAfterRouteLeave.add(u),()=>r.global.onAfterRouteLeave.delete(u));async function v({to:u,from:d}){const{global:S,component:U}=r,k=Pn(u,d),R=vn(u,d,S),h=[...R.onBeforeRouteEnter,...k.onBeforeRouteEnter,...R.onBeforeRouteUpdate,...k.onBeforeRouteUpdate,...U.onBeforeRouteUpdate,...R.onBeforeRouteLeave,...k.onBeforeRouteLeave,...U.onBeforeRouteLeave];try{const m=h.map(L=>e(()=>L(u,{from:d,reject:n,push:o,replace:a,abort:s})));await Promise.all(m)}catch(m){if(m instanceof ht||m instanceof Bt||m instanceof qe)return m.response;throw m}return{status:"SUCCESS"}}async function C({to:u,from:d}){const{global:S,component:U}=r,k=An(u,d),R=kn(u,d,S),h=[...U.onAfterRouteLeave,...k.onAfterRouteLeave,...R.onAfterRouteLeave,...U.onAfterRouteUpdate,...k.onAfterRouteUpdate,...R.onAfterRouteUpdate,...U.onAfterRouteEnter,...k.onAfterRouteEnter,...R.onAfterRouteEnter];try{const m=h.map(L=>e(()=>L(u,{from:d,reject:n,push:o,replace:a})));await Promise.all(m)}catch(m){if(m instanceof ht||m instanceof Bt)return m.response;throw m}return{status:"SUCCESS"}}return{runBeforeRouteHooks:v,runAfterRouteHooks:C,addComponentBeforeRouteHook:({lifecycle:u,depth:d,hook:S})=>{const U=rr(u),k=r.component[u],R=(h,m)=>{if(U(h,m.from,d))return S(h,m)};return k.add(R),()=>k.delete(R)},addComponentAfterRouteHook:({lifecycle:u,depth:d,hook:S})=>{const U=rr(u),k=r.component[u],R=(h,m)=>{if(U(h,m.from,d))return S(h,m)};return k.add(R),()=>k.delete(R)},addGlobalRouteHooks:u=>{u.onBeforeRouteEnter.forEach(d=>p(d)),u.onBeforeRouteUpdate.forEach(d=>y(d)),u.onBeforeRouteLeave.forEach(d=>f(d)),u.onAfterRouteEnter.forEach(d=>g(d)),u.onAfterRouteUpdate.forEach(d=>w(d)),u.onAfterRouteLeave.forEach(d=>B(d))},onBeforeRouteEnter:p,onBeforeRouteUpdate:y,onBeforeRouteLeave:f,onAfterRouteEnter:g,onAfterRouteUpdate:w,onAfterRouteLeave:B,setVueApp:t}}function or(){const t=i.inject(nr);if(!t)throw new X;return t}function ar(t){return e=>{const r=oe(),o=or().addComponentBeforeRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}function sr(t){return e=>{const r=oe(),o=or().addComponentAfterRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}const Ln=ar("onBeforeRouteLeave"),Nn=ar("onBeforeRouteUpdate"),Vn=sr("onAfterRouteLeave"),Bn=sr("onAfterRouteUpdate");function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},K.apply(null,arguments)}var _;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(_||(_={}));var yt=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function at(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var xt="beforeunload",Cn="hashchange",ir="popstate";function cr(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var R=n.location,h=R.pathname,m=R.search,L=R.hash,V=o.state||{};return[V.idx,yt({pathname:h,search:m,hash:L,state:V.usr||null,key:V.key||"default"})]}var s=null;function p(){if(s)v.call(s),s=null;else{var R=_.Pop,h=a(),m=h[0],L=h[1];if(v.length)if(m!=null){var V=g-m;V&&(s={action:R,location:L,retry:function(){U(V*-1)}},U(V))}else process.env.NODE_ENV!=="production"&&at(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else u(R)}}n.addEventListener(ir,p);var y=_.Pop,f=a(),g=f[0],w=f[1],B=mt(),v=mt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function C(R){return typeof R=="string"?R:st(R)}function b(R,h){return h===void 0&&(h=null),yt(K({pathname:w.pathname,hash:"",search:""},typeof R=="string"?Pt(R):R,{state:h,key:Ot()}))}function c(R,h){return[{usr:R.state,key:R.key,idx:h},C(R)]}function l(R,h,m){return!v.length||(v.call({action:R,location:h,retry:m}),!1)}function u(R){y=R;var h=a();g=h[0],w=h[1],B.call({action:y,location:w})}function d(R,h){var m=_.Push,L=b(R,h);function V(){d(R,h)}if(l(m,L,V)){var O=c(L,g+1),$=O[0],q=O[1];try{o.pushState($,"",q)}catch{n.location.assign(q)}u(m)}}function S(R,h){var m=_.Replace,L=b(R,h);function V(){S(R,h)}if(l(m,L,V)){var O=c(L,g),$=O[0],q=O[1];o.replaceState($,"",q),u(m)}}function U(R){o.go(R)}var k={get action(){return y},get location(){return w},createHref:C,push:d,replace:S,go:U,back:function(){U(-1)},forward:function(){U(1)},listen:function(h){return B.push(h)},block:function(h){var m=v.push(h);return v.length===1&&n.addEventListener(xt,jt),function(){m(),v.length||n.removeEventListener(xt,jt)}}};return k}function xn(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var h=Pt(n.location.hash.substr(1)),m=h.pathname,L=m===void 0?"/":m,V=h.search,O=V===void 0?"":V,$=h.hash,q=$===void 0?"":$,I=o.state||{};return[I.idx,yt({pathname:L,search:O,hash:q,state:I.usr||null,key:I.key||"default"})]}var s=null;function p(){if(s)v.call(s),s=null;else{var h=_.Pop,m=a(),L=m[0],V=m[1];if(v.length)if(L!=null){var O=g-L;O&&(s={action:h,location:V,retry:function(){k(O*-1)}},k(O))}else process.env.NODE_ENV!=="production"&&at(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else d(h)}}n.addEventListener(ir,p),n.addEventListener(Cn,function(){var h=a(),m=h[1];st(m)!==st(w)&&p()});var y=_.Pop,f=a(),g=f[0],w=f[1],B=mt(),v=mt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function C(){var h=document.querySelector("base"),m="";if(h&&h.getAttribute("href")){var L=n.location.href,V=L.indexOf("#");m=V===-1?L:L.slice(0,V)}return m}function b(h){return C()+"#"+(typeof h=="string"?h:st(h))}function c(h,m){return m===void 0&&(m=null),yt(K({pathname:w.pathname,hash:"",search:""},typeof h=="string"?Pt(h):h,{state:m,key:Ot()}))}function l(h,m){return[{usr:h.state,key:h.key,idx:m},b(h)]}function u(h,m,L){return!v.length||(v.call({action:h,location:m,retry:L}),!1)}function d(h){y=h;var m=a();g=m[0],w=m[1],B.call({action:y,location:w})}function S(h,m){var L=_.Push,V=c(h,m);function O(){S(h,m)}if(process.env.NODE_ENV!=="production"&&at(V.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),u(L,V,O)){var $=l(V,g+1),q=$[0],I=$[1];try{o.pushState(q,"",I)}catch{n.location.assign(I)}d(L)}}function U(h,m){var L=_.Replace,V=c(h,m);function O(){U(h,m)}if(process.env.NODE_ENV!=="production"&&at(V.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),u(L,V,O)){var $=l(V,g),q=$[0],I=$[1];o.replaceState(q,"",I),d(L)}}function k(h){o.go(h)}var R={get action(){return y},get location(){return w},createHref:b,push:S,replace:U,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(m){return B.push(m)},block:function(m){var L=v.push(m);return v.length===1&&n.addEventListener(xt,jt),function(){L(),v.length||n.removeEventListener(xt,jt)}}};return R}function ur(t){t===void 0&&(t={});var e=t,r=e.initialEntries,n=r===void 0?["/"]:r,o=e.initialIndex,a=n.map(function(d){var S=yt(K({pathname:"/",search:"",hash:"",state:null,key:Ot()},typeof d=="string"?Pt(d):d));return process.env.NODE_ENV!=="production"&&at(S.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")"),S}),s=fr(o??a.length-1,0,a.length-1),p=_.Pop,y=a[s],f=mt(),g=mt();function w(d){return typeof d=="string"?d:st(d)}function B(d,S){return S===void 0&&(S=null),yt(K({pathname:y.pathname,search:"",hash:""},typeof d=="string"?Pt(d):d,{state:S,key:Ot()}))}function v(d,S,U){return!g.length||(g.call({action:d,location:S,retry:U}),!1)}function C(d,S){p=d,y=S,f.call({action:p,location:y})}function b(d,S){var U=_.Push,k=B(d,S);function R(){b(d,S)}process.env.NODE_ENV!=="production"&&at(y.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")"),v(U,k,R)&&(s+=1,a.splice(s,a.length,k),C(U,k))}function c(d,S){var U=_.Replace,k=B(d,S);function R(){c(d,S)}process.env.NODE_ENV!=="production"&&at(y.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")"),v(U,k,R)&&(a[s]=k,C(U,k))}function l(d){var S=fr(s+d,0,a.length-1),U=_.Pop,k=a[S];function R(){l(d)}v(U,k,R)&&(s=S,C(U,k))}var u={get index(){return s},get action(){return p},get location(){return y},createHref:w,push:b,replace:c,go:l,back:function(){l(-1)},forward:function(){l(1)},listen:function(S){return f.push(S)},block:function(S){return g.push(S)}};return u}function fr(t,e,r){return Math.min(Math.max(t,e),r)}function jt(t){t.preventDefault(),t.returnValue=""}function mt(){var t=[];return{get length(){return t.length},push:function(r){return t.push(r),function(){t=t.filter(function(n){return n!==r})}},call:function(r){t.forEach(function(n){return n&&n(r)})}}}function Ot(){return Math.random().toString(36).substr(2,8)}function st(t){var e=t.pathname,r=e===void 0?"/":e,n=t.search,o=n===void 0?"":n,a=t.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function Pt(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const lr=Symbol();function jn(t,e){const r=i.reactive({...t}),n=s=>{Object.assign(r,{[lr]:!1,...s})},o=r,a=dn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:n}}function H(t){return!t.startsWith("http")?Zn(t):On(t)}function On(t){const{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}}function Zn(t){const{pathname:e,search:r,searchParams:n,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:r,searchParams:n,hash:o}}function $n(t){return e=>{const{host:r}=H(e);return!(r===void 0||r===t)}}function _n({mode:t,listener:e}){const r=Hn(t),n=(y,f)=>{if(f!=null&&f.replace){r.replace(y,f.state);return}r.push(y,f==null?void 0:f.state)},o=()=>{const y=st(r.location);r.replace(y)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(e)},stopListening:()=>{a==null||a()}}}function Hn(t="auto"){switch(t){case"auto":return Qt()?cr():ur();case"browser":return cr();case"memory":return ur();case"hash":return xn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function qn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function In(t){const e=a=>i.markRaw(t[a]??qn(a)),r=a=>{const s=i.markRaw(e(a)),p={id:Xt(),component:s,meta:{},state:{}};return{id:p.id,matched:p,matches:[p],name:a,query:Kt(""),params:{},state:{},href:"/",hash:"",[lr]:!0}},n=a=>{if(!a){o.value=null;return}const s=e(a);o.value={type:a,component:s}},o=i.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class Dn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jn(t){if(t)return t;if(Qt())return window.location.toString();throw new Dn}function dr(t){return!!t&&typeof t=="object"}const Zt=!0;function Tn(t,e,r){if(dr(t)&&e in t){const n=t[e];return typeof n=="string"?tt(n,r,Zt):n}return tt(void 0,r,Zt)}function pr(t,e){const r={};for(const[n,o]of Object.entries(t)){const a=Tn(e,n,o);r[n]=a}return r}function Fn(t,e,r){if(dr(t)&&e in t){const n=t[e];return et(n,r,Zt)}return et(void 0,r,Zt)}const hr=(t,e)=>{const r={};for(const[n,o]of Object.entries(t)){const a=Fn(e,n,o);r[n]=a}return r};function Mn(){const t=i.reactive(new Map),e=Qt()?s():null,r=p=>{t.set(p,!1),e==null||e.observe(p)},n=p=>{t.delete(p),e==null||e.unobserve(p)},o=()=>{e==null||e.disconnect()},a=p=>t.get(p)??!1;function s(){return new IntersectionObserver(p=>{p.forEach(y=>{t.set(y.target,y.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class Wn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function yr(t,e,r){const n=Jr(e.value,r),o=Ue(n),[a]=Ne(t,new RegExp(o,"g"));return a}function mr(t,e,r,n){const o=Wt(e,r),a=et(n,e.params[r],o);return t.replace(Le(r),a)}function gr({protocol:t,host:e,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");t&&(s.protocol=t),e&&(s.host=e),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const p=s.toString().replace(/^https:\/\/localhost\/*/,"/");return $t(p)}function Gn(t,e={}){const{params:r={},query:n}=e,o=Qn(t.query,r),a=re(o,n),s=Rr(t.path,r),p=t.hash.value?Rr(t.hash,r):e.hash,y=zn(t.host,r),{protocol:f,host:g}=H(y);return gr({protocol:f,host:g,pathname:s,searchParams:a,hash:p})}function zn(t,e){const r=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((n,o)=>mr(n,t,o,e[o]),r)}function Rr(t,e){return Object.keys(t.params).reduce((r,n)=>mr(r,t,n,e[n]),t.value)}function Qn(t,e){const r=new URLSearchParams(t.value);if(!t.value)return r;for(const[n,o]of Array.from(r.entries())){const a=zt(o);if(!a)continue;const p=Gt(o),y=et(e[a],t.params[a],p),f=e[a]===void 0&&y==="";p&&f?r.delete(n,o):r.set(n,y)}return r}const Kn=(t,e)=>{try{se(t,e)}catch{return!1}return!0},se=(t,e)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=H(e);return{...ie(t.host,`${r}//${n}`),...ie(t.path,o),...Yn(t.query,a),...ie(t.hash,s)}};function ie(t,e){const r={},n=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const s=yr(n,t,o),p=Wt(t,o),y=tt(s,a,p);r[o]=y}return r}function Yn(t,e){const r={},n=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[a,s]of Array.from(n.entries())){const p=zt(s);if(!p)continue;const f=Gt(s),g=o.get(a)??void 0,w=tt(g,t.params[p],f);r[p]=w}return r}function Xn(t,e={},r={}){const n=Gn(t,{params:e,query:r.query,hash:r.hash}),{search:o,hash:a}=H(n);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,query:Kt(o),params:se(t,n),state:pr(t.state,r.state),hash:a,href:n}}const to=t=>"name"in t.matched&&!!t.matched.name,eo=(t,e)=>{const{pathname:r}=H(e);return Ir(t).test(r)},ro=(t,e)=>{const{search:r}=H(e);return Dr(t).every(o=>o.test(r))},ce=(t,e)=>{const{hash:r}=H(e),{value:n}=t.hash;return F(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function no(t){const{searchParams:e,pathname:r}=H(t),n=-1,o=1;return(a,s)=>{const p=Er(a,e),y=wr(a,r),f=Er(s,e),g=wr(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:p+y>f+g?n:p+y<f+g?o:ce(a,t)?n:ce(s,t)?o:0}}function wr(t,e){const r=Object.keys(t.path.params).filter(o=>Wt(t.path,o)).map(o=>o),n=r.filter(o=>yr(e,t.path,o)===void 0);return r.length-n.length}function Er(t,e){const r=new URLSearchParams(e),n=new URLSearchParams(t.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const oo=[to,eo,ro,ce,Kn];function ao(t,e){const r=no(e);return t.filter(n=>oo.every(o=>o(n,e))).sort(r)}function so(t,e,r){const n=ao(t,e);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=H(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Kt(a),params:se(o,e),state:pr(o.state,r),hash:s,href:$t(e)}}function br(t,e){const r=typeof t=="string"?H(t):t,n=typeof e=="string"?H(e):e,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return gr({protocol:F(n.protocol)?n.protocol:r.protocol,host:F(n.host)?n.host:r.host,pathname:F(n.pathname)?n.pathname:r.pathname,searchParams:re(a,o),hash:F(n.hash)?n.hash:r.hash})}function io(t,e){return F(e)?t.map(r=>{const n=`${e}${r.path.value}`;return{...r,path:M(n,r.path.params)}}):t}class co extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function uo(t){const e=t.map(({name:r})=>r);for(const r of e)if(me(e,r)>1)throw new co(r)}function fo(t,e=[],r){const n=[...t,...e.map(o=>o.routes)].flat();return uo(n),io(n,r)}function lo(t={},e=[]){const r=new ot;return gt("onBeforeRouteEnter",t,e).forEach(n=>r.onBeforeRouteEnter.add(n)),gt("onBeforeRouteUpdate",t,e).forEach(n=>r.onBeforeRouteUpdate.add(n)),gt("onBeforeRouteLeave",t,e).forEach(n=>r.onBeforeRouteLeave.add(n)),gt("onAfterRouteEnter",t,e).forEach(n=>r.onAfterRouteEnter.add(n)),gt("onAfterRouteUpdate",t,e).forEach(n=>r.onAfterRouteUpdate.add(n)),gt("onAfterRouteLeave",t,e).forEach(n=>r.onAfterRouteLeave.add(n)),r}function gt(t,e,r){return[e[t],...r.map(o=>o[t])].flat().filter(o=>o!==void 0)}function po(t,e,r=[]){const n=fo(t,r,e==null?void 0:e.base),o=Un();o.addGlobalRouteHooks(lo(e,r));const a=Yt(),s=an(),p=wn(),y=Mn(),f=_n({mode:e==null?void 0:e.historyMode,listener:({location:P})=>{const x=st(P);w(x,{state:P.state,replace:!0})}});function g(P,x={}){return so(n,P,x.state)}async function w(P,x={}){const Q=a();if(f.stopListening(),L(P)){f.update(P,x);return}const J=g(P,x)??u("NotFound"),D=Po(Q),Y=await o.runBeforeRouteHooks({to:J,from:D});switch(Y.status){case"ABORT":return;case"PUSH":f.update(P,x),await v(...Y.to);return;case"REJECT":f.update(P,x),c(Y.type);break;case"SUCCESS":f.update(P,x),c(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(Y)}`)}const ue=Q;s.setProps(J).then(T=>{if(ue===Q)switch(T.status){case"SUCCESS":break;case"PUSH":v(...T.to);break;case"REJECT":c(T.type);break;default:const fe=T;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(fe)}`)}}),k(J);const W=await o.runAfterRouteHooks({to:J,from:D});switch(W.status){case"PUSH":await v(...W.to);break;case"REJECT":c(W.type);break;case"SUCCESS":break;default:const T=W;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(T)}`)}f.startListening()}const B=(P,x={},Q={})=>{const J=n.find(D=>D.name===P);if(!J)throw new Wn(String(P));return Xn(J,x,Q)},v=(P,x,Q)=>{if(Z(P)){const W={...x},T=br(P,{searchParams:W.query,hash:W.hash});return w(T,W)}if(typeof P=="string"){const{replace:W,...T}={...Q},fe={...x},le=B(P,fe,T),vo=hr({...le.matched.state},{...le.state,...T.state});return w(le.href,{replace:W,state:vo})}const{replace:J,...D}={...x},Y=hr({...P.matched.state},{...P.state,...D.state}),ue=br(P.href,{searchParams:D.query,hash:D.hash});return w(ue,{replace:J,state:Y})},C=(P,x,Q)=>{if(Z(P)){const D={...x,replace:!0};return v(P,D)}if(typeof P=="string"){const D={...Q,replace:!0},Y={...x};return v(P,Y,D)}const J={...x,replace:!0};return v(P,J)},b=P=>{c(P)},{setRejection:c,rejection:l,getRejectionRoute:u}=In({...r.reduce((P,x)=>({...P,...x.rejections}),{}),...e==null?void 0:e.rejections}),d=u("NotFound"),{currentRoute:S,routerRoute:U,updateRoute:k}=jn(d,v),R=Jn(e==null?void 0:e.initialUrl),h=f.location.state,{host:m}=H(R),L=$n(m);let V=!1;const O=i.ref(!1),{promise:$,resolve:q}=Promise.withResolvers();async function I(){if(V)return $;V=!0,Br(n)&&await Cr(),await w(R,{replace:!0,state:h}),f.startListening(),q(),O.value=!0}function Pr(){f.stopListening()}function Po(P){return tn(P)?null:{...S}}function Ao(P){o.setVueApp(P),s.setVueApp(P),P.component("RouterView",ae),P.component("RouterLink",Ke),P.provide(Ye,l),P.provide(nr,o),P.provide(Te,s),P.provide(tr,p),P.provide(We,y),P.provide(ye,Ar),I()}const Ar={route:U,resolve:B,find:g,push:v,replace:C,reject:b,refresh:f.refresh,forward:f.forward,back:f.back,go:f.go,install:Ao,isExternal:L,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:e==null?void 0:e.prefetch,start:I,started:O,stop:Pr};return Ar}function ho(t){return{routes:t.routes??[],rejections:t.rejections??{},...t}}function Sr(t){return{get:(e,{invalid:r})=>{for(const n of t){const o=_r(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:r})=>{for(const n of t){const o=Hr(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)}}}const yo={separator:","};function mo(t,e={}){const{separator:r}={...yo,...e},n=Sr(t);return{get:(o,a)=>o.split(r).map(s=>n.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>n.set(s,a)).join(r)}}}const go={separator:","};function Ro(t,e={}){const{separator:r}={...go,...e};return{get:n=>{const o=n.split(r);return t.map((a,s)=>tt(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${n.length} values`);return t.map((a,s)=>et(n.at(s),a)).join(r)}}}const wo=M,Eo=M,bo=M;function So(t){const e=Xt(),r=$e(t.name),n=rt(t.path),o=rt(t.query),a=rt(t.hash),s=t.meta??{},p=rt(t.host),y=i.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:y,matches:[y],name:r,host:p,path:n,query:o,hash:a,meta:s,depth:1,state:{}},g=Be(t)?Ze(t.parent,f):f;return ct(g.path.params,g.query.params,g.host.params,g.hash.params),g}A.DuplicateParamsError=de,A.MetaPropertyConflict=pe,A.RouterLink=Ke,A.RouterNotInstalledError=X,A.RouterView=ae,A.UseRouteInvalidError=he,A.arrayOf=mo,A.asUrl=$t,A.createExternalRoute=So,A.createParam=Re,A.createRoute=nt,A.createRouter=po,A.createRouterPlugin=ho,A.host=Eo,A.isRoute=Ct,A.isUrl=Z,A.onAfterRouteLeave=Vn,A.onAfterRouteUpdate=Bn,A.onBeforeRouteLeave=Ln,A.onBeforeRouteUpdate=Nn,A.path=wo,A.query=bo,A.tupleOf=Ro,A.unionOf=Sr,A.useLink=Qe,A.useRoute=ne,A.useRouter=Rt,A.withDefault=Lr,A.withParams=M,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitbag/router",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.20.
|
|
4
|
+
"version": "0.20.3",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/kitbagjs/router/issues"
|
|
7
7
|
},
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"@kitbag/eslint-config": "1.0.2",
|
|
44
44
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
45
45
|
"@vue/test-utils": "^2.4.6",
|
|
46
|
-
"eslint": "^9.25.
|
|
46
|
+
"eslint": "^9.25.1",
|
|
47
47
|
"globals": "^16.0.0",
|
|
48
48
|
"happy-dom": "^17.4.4",
|
|
49
|
-
"typedoc": "^0.
|
|
50
|
-
"typedoc-plugin-markdown": "^4.
|
|
49
|
+
"typedoc": "^0.28.3",
|
|
50
|
+
"typedoc-plugin-markdown": "^4.6.3",
|
|
51
51
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
52
52
|
"typescript": "^5.8.3",
|
|
53
53
|
"valibot": "^1.0.0",
|
|
54
|
-
"vite": "^6.3.
|
|
54
|
+
"vite": "^6.3.3",
|
|
55
55
|
"vite-plugin-dts": "^4.5.3",
|
|
56
56
|
"vitepress": "^1.6.3",
|
|
57
|
-
"vitest": "^3.1.
|
|
58
|
-
"vue-tsc": "^2.2.
|
|
57
|
+
"vitest": "^3.1.2",
|
|
58
|
+
"vue-tsc": "^2.2.10"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"vue": "^3.5.0",
|