@kitbag/router 0.5.3 → 0.5.4
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 +5 -5
- package/dist/kitbag-router.js +230 -230
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(p,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(p=typeof globalThis<"u"?globalThis:p||self,i(p["@kitbag/router"]={},p.Vue))})(this,function(p,i){"use strict";var In=Object.defineProperty;var Fn=(p,i,M)=>i in p?In(p,i,{enumerable:!0,configurable:!0,writable:!0,value:M}):p[i]=M;var V=(p,i,M)=>(Fn(p,typeof i!="symbol"?i+"":i,M),M);class M 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 ot extends Error{constructor(){super("Router not installed")}}class Vt extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const dt=Symbol();function at(){const t=i.inject(dt);if(!t)throw new ot;return t}class Y extends Error{}function F(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function qt(t,e={},n={}){const o=at(),r=i.computed(()=>i.toValue(t)),a=i.computed(()=>i.toValue(e)),s=i.computed(()=>i.toValue(n)),c=i.computed(()=>{if(F(r.value))return r.value;try{return o.resolve(r.value,a.value,s.value)}catch(y){throw y instanceof Y&&console.error(`Failed to resolve route "${r.value.toString()}" in RouterLink.`,y),y}}),u=i.computed(()=>o.find(c.value,s.value)),l=i.computed(()=>!!u.value&&o.route.matches.includes(u.value.matched)),d=i.computed(()=>!!u.value&&o.route.matched===u.value.matched);return{route:u,href:c,isMatch:l,isExactMatch:d,push:y=>o.push(c.value,{},{...s.value,...y}),replace:y=>o.replace(c.value,{},{...s.value,...y})}}const mt=Symbol();function _t(){const t=i.inject(mt);if(!t)throw new ot;return t}function Rt(t,e){return[t,e].filter(n=>!!n).join(".")}const Ot=Symbol("isRouterRouteSymbol");function Le(t){return typeof t=="object"&&t!==null&&Ot in t}function Be(t,e){function n(l,d,y){if(typeof l=="object"){const g={...t.params,...l};return e(t.key,g,d)}const S={...t.params,[l]:d};return e(t.key,S,y)}const{matched:o,matches:r,key:a,query:s,params:c}=i.toRefs(t),u=i.reactive({matched:o,matches:r,query:s,params:c,key:a,update:n,[Ot]:!0});return new Proxy(u,{get:(l,d,y)=>d==="params"?new Proxy(t.params,{set(S,g,x){return n(g,x),!0}}):Reflect.get(l,d,y)})}function Wt(t,e,{exact:n}={}){if(!Le(t))return!1;if(e===void 0)return!0;const o=Ue(t);if(n){const r=o.at(-1);return e===r}return o.includes(e)}function Ue(t){return t.matches.map(n=>n.name).reduce((n,o)=>{const r=n.pop(),a=o?[Rt(r,o)]:[];return r?[...n,r,...a]:a},[])}function Dt(t,e){const n=at();function o(){if(!t)return;if(!Wt(n.route,t,e))throw new Vt(t,n.route.key)}return i.watch(n.route,o,{immediate:!0,deep:!0}),n.route}const Mt=Symbol();function yt(){return i.inject(Mt,0)}class st{constructor(){V(this,"onBeforeRouteEnter",new Set);V(this,"onBeforeRouteUpdate",new Set);V(this,"onBeforeRouteLeave",new Set);V(this,"onAfterRouteEnter",new Set);V(this,"onAfterRouteUpdate",new Set);V(this,"onAfterRouteLeave",new Set)}}class Tt extends Error{}class et extends Error{constructor(n){super("Error occurred during a router push operation.");V(this,"to");this.to=n}}class gt extends Error{constructor(n){super(`Routing action rejected: ${n}`);V(this,"type");this.type=n}}function X(t){return Array.isArray(t)?t:[t]}function $e(t,e){const n=new st;return t.matches.forEach((o,r)=>{o.onBeforeRouteEnter&&wt(t,e,r)&&X(o.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),o.onBeforeRouteUpdate&&vt(t,e,r)&&X(o.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((o,r)=>{o.onBeforeRouteLeave&&Et(t,e,r)&&X(o.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function Ne(t,e){const n=new st;return t.matches.forEach((o,r)=>{o.onAfterRouteEnter&&wt(t,e,r)&&X(o.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),o.onAfterRouteUpdate&&vt(t,e,r)&&X(o.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((o,r)=>{o.onAfterRouteLeave&&Et(t,e,r)&&X(o.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function je(){const t=s=>{throw new gt(s)},e=(...s)=>{throw new et(s)},n=(s,c,u)=>{if(F(s)){const y=c??{};throw new et([s,{...y,replace:!0}])}const l=c,d=u??{};throw new et([s,l,{...d,replace:!0}])},o=()=>{throw new Tt};async function r({to:s,from:c,hooks:u}){const{global:l,component:d}=u,y=$e(s,c),S=[...l.onBeforeRouteEnter,...y.onBeforeRouteEnter,...l.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...d.onBeforeRouteUpdate,...l.onBeforeRouteLeave,...y.onBeforeRouteLeave,...d.onBeforeRouteLeave];try{const g=S.map(x=>x(s,{from:c,reject:t,push:e,replace:n,abort:o}));await Promise.all(g)}catch(g){if(g instanceof et)return{status:"PUSH",to:g.to};if(g instanceof gt)return{status:"REJECT",type:g.type};if(g instanceof Tt)return{status:"ABORT"};throw g}return{status:"SUCCESS"}}async function a({to:s,from:c,hooks:u}){const{global:l,component:d}=u,y=Ne(s,c),S=[...d.onAfterRouteLeave,...y.onAfterRouteLeave,...l.onAfterRouteLeave,...d.onAfterRouteUpdate,...y.onAfterRouteUpdate,...l.onAfterRouteUpdate,...d.onAfterRouteEnter,...y.onAfterRouteEnter,...l.onAfterRouteEnter];try{const g=S.map(x=>x(s,{from:c,reject:t,push:e,replace:n}));await Promise.all(g)}catch(g){if(g instanceof et)return{status:"PUSH",to:g.to};if(g instanceof gt)return{status:"REJECT",type:g.type};throw g}return{status:"SUCCESS"}}return{runBeforeRouteHooks:r,runAfterRouteHooks:a}}const wt=(t,e,n)=>{const o=t.matches,r=(e==null?void 0:e.matches)??[];return o.length<n||o[n]!==r[n]},Et=(t,e,n)=>{const o=t.matches,r=(e==null?void 0:e.matches)??[];return o.length<n||o[n]!==r[n]},vt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function It(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return wt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return vt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Et;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}class He{constructor(){V(this,"global",new st);V(this,"component",new st)}addBeforeRouteHook({lifecycle:e,timing:n,depth:o,hook:r}){const a=It(e),s=this[n][e],c=(u,l)=>{if(a(u,l.from,o))return r(u,l)};return s.add(c),()=>s.delete(c)}addAfterRouteHook({lifecycle:e,timing:n,depth:o,hook:r}){const a=It(e),s=this[n][e],c=(u,l)=>{if(a(u,l.from,o))return r(u,l)};return s.add(c),()=>s.delete(c)}}const Ft=Symbol();function Ce(){const t=new He;return{onBeforeRouteEnter:c=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:c,timing:"global",depth:0}),onBeforeRouteUpdate:c=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:c,timing:"global",depth:0}),onBeforeRouteLeave:c=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:c,timing:"global",depth:0}),onAfterRouteEnter:c=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:c,timing:"global",depth:0}),onAfterRouteUpdate:c=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:c,timing:"global",depth:0}),onAfterRouteLeave:c=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:c,timing:"global",depth:0}),hooks:t}}function Jt(){const t=i.inject(Ft);if(!t)throw new ot;return t}function Qt(t){return e=>{const n=yt(),r=Jt().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(r),r}}function Pt(t){return e=>{const n=yt(),r=Jt().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(r),r}}const Ve=Qt("onBeforeRouteUpdate"),qe=Qt("onBeforeRouteLeave"),_e=Pt("onAfterRouteEnter"),Oe=Pt("onAfterRouteUpdate"),We=Pt("onAfterRouteLeave"),De=["href"],Kt=i.defineComponent({__name:"routerLink",props:{to:{type:[String,Function]},query:{},replace:{type:Boolean}},setup(t){const e=t,n=at(),o=i.computed(()=>F(e.to)?e.to:e.to(n.resolve)),r=i.computed(()=>{const{to:y,...S}=e;return S}),{href:a,isMatch:s,isExactMatch:c}=qt(o),u=i.computed(()=>({"router-link--match":s.value,"router-link--exact-match":c.value})),l=i.computed(()=>n.isExternal(o.value));function d(y){y.preventDefault(),n.push(a.value,r.value)}return(y,S)=>(i.openBlock(),i.createElementBlock("a",{href:o.value,class:i.normalizeClass(["router-link",u.value]),onClick:d},[i.renderSlot(y.$slots,"default",i.normalizeProps(i.guardReactiveProps({resolved:o.value,isMatch:i.unref(s),isExactMatch:i.unref(c),isExternal:l.value})))],10,De))}});function bt(t){return"children"in t}function Gt(t){return bt(t)&&!("component"in t)&&!("components"in t)}function zt(t){return typeof t=="object"&&t!==null&&"component"in t}function Yt(t){return typeof t=="object"&&t!==null&&"components"in t}const St=i.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=Dt(),o=_t(),r=yt();i.provide(Mt,r+1);const a=i.computed(()=>{if(o.value)return o.value.component;const c=n.matches.at(r);if(!c)return null;const l=s(c)[e];return l?typeof l=="function"?i.defineAsyncComponent(l):l:null});function s(c){return Yt(c)?c.components:zt(c)?{default:c.component}:{}}return(c,u)=>i.renderSlot(c.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:i.unref(n),component:a.value,rejection:i.unref(o)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.value)))])}});function Me(t,e){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>i.h(Te(t,n)):()=>i.h(t,n)}})}function Te(t,e){return i.defineComponent({name:"AsyncPropsWrapper",expose:[],async setup(){const n=await e;return()=>i.h(t,n)}})}const q="[",D="]";function Ie(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Xt(t){return typeof t=="function"&&Ie(t)}function nt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Zt(t){return nt(t)&&t.defaultValue!==void 0}function Fe(t,e){return oe(t,e)}function kt(t){return typeof t=="string"&&t.length>0}function Je(t,e){return t[e]??String}const $={invalid:t=>{throw new Y(t)}},Qe={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},te={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()}},ee={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},ne={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},re={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 At(t,e,n=!1){if(t===void 0||!kt(t)){if(Zt(e))return e.defaultValue;if(n)return;throw new Y}if(e===String)return Qe.get(t,$);if(e===Boolean)return te.get(t,$);if(e===Number)return ee.get(t,$);if(e===Date)return ne.get(t,$);if(e===JSON)return re.get(t,$);if(Xt(e))return e(t,$);if(nt(e))return e.get(t,$);if(e instanceof RegExp){if(e.test(t))return t;throw new Y}return t}function xt(t,e,n=!1){if(t===void 0){if(n)return"";throw new Y}if(e===Boolean)return te.set(t,$);if(e===Number)return ee.set(t,$);if(e===Date)return ne.set(t,$);if(e===JSON)return re.set(t,$);if(nt(e))return e.set(t,$);try{return t.toString()}catch{throw new Y}}function oe(t,e){return nt(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>At(n,t),set:n=>xt(n,t),defaultValue:e}}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},T.apply(this,arguments)}var U;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(U||(U={}));var Z=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function J(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var ct="beforeunload",Ke="hashchange",ae="popstate";function se(t){t===void 0&&(t={});var e=t,n=e.window,o=n===void 0?document.defaultView:n,r=o.history;function a(){var m=o.location,f=m.pathname,h=m.search,E=m.hash,P=r.state||{};return[P.idx,Z({pathname:f,search:h,hash:E,state:P.usr||null,key:P.key||"default"})]}var s=null;function c(){if(s)g.call(s),s=null;else{var m=U.Pop,f=a(),h=f[0],E=f[1];if(g.length)if(h!=null){var P=d-h;P&&(s={action:m,location:E,retry:function(){b(P*-1)}},b(P))}else process.env.NODE_ENV!=="production"&&J(!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 O(m)}}o.addEventListener(ae,c);var u=U.Pop,l=a(),d=l[0],y=l[1],S=tt(),g=tt();d==null&&(d=0,r.replaceState(T({},r.state,{idx:d}),""));function x(m){return typeof m=="string"?m:Q(m)}function L(m,f){return f===void 0&&(f=null),Z(T({pathname:y.pathname,hash:"",search:""},typeof m=="string"?rt(m):m,{state:f,key:ut()}))}function _(m,f){return[{usr:m.state,key:m.key,idx:f},x(m)]}function N(m,f,h){return!g.length||(g.call({action:m,location:f,retry:h}),!1)}function O(m){u=m;var f=a();d=f[0],y=f[1],S.call({action:u,location:y})}function R(m,f){var h=U.Push,E=L(m,f);function P(){R(m,f)}if(N(h,E,P)){var A=_(E,d+1),B=A[0],j=A[1];try{r.pushState(B,"",j)}catch{o.location.assign(j)}O(h)}}function w(m,f){var h=U.Replace,E=L(m,f);function P(){w(m,f)}if(N(h,E,P)){var A=_(E,d),B=A[0],j=A[1];r.replaceState(B,"",j),O(h)}}function b(m){r.go(m)}var k={get action(){return u},get location(){return y},createHref:x,push:R,replace:w,go:b,back:function(){b(-1)},forward:function(){b(1)},listen:function(f){return S.push(f)},block:function(f){var h=g.push(f);return g.length===1&&o.addEventListener(ct,it),function(){h(),g.length||o.removeEventListener(ct,it)}}};return k}function Ge(t){t===void 0&&(t={});var e=t,n=e.window,o=n===void 0?document.defaultView:n,r=o.history;function a(){var f=rt(o.location.hash.substr(1)),h=f.pathname,E=h===void 0?"/":h,P=f.search,A=P===void 0?"":P,B=f.hash,j=B===void 0?"":B,H=r.state||{};return[H.idx,Z({pathname:E,search:A,hash:j,state:H.usr||null,key:H.key||"default"})]}var s=null;function c(){if(s)g.call(s),s=null;else{var f=U.Pop,h=a(),E=h[0],P=h[1];if(g.length)if(E!=null){var A=d-E;A&&(s={action:f,location:P,retry:function(){k(A*-1)}},k(A))}else process.env.NODE_ENV!=="production"&&J(!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 R(f)}}o.addEventListener(ae,c),o.addEventListener(Ke,function(){var f=a(),h=f[1];Q(h)!==Q(y)&&c()});var u=U.Pop,l=a(),d=l[0],y=l[1],S=tt(),g=tt();d==null&&(d=0,r.replaceState(T({},r.state,{idx:d}),""));function x(){var f=document.querySelector("base"),h="";if(f&&f.getAttribute("href")){var E=o.location.href,P=E.indexOf("#");h=P===-1?E:E.slice(0,P)}return h}function L(f){return x()+"#"+(typeof f=="string"?f:Q(f))}function _(f,h){return h===void 0&&(h=null),Z(T({pathname:y.pathname,hash:"",search:""},typeof f=="string"?rt(f):f,{state:h,key:ut()}))}function N(f,h){return[{usr:f.state,key:f.key,idx:h},L(f)]}function O(f,h,E){return!g.length||(g.call({action:f,location:h,retry:E}),!1)}function R(f){u=f;var h=a();d=h[0],y=h[1],S.call({action:u,location:y})}function w(f,h){var E=U.Push,P=_(f,h);function A(){w(f,h)}if(process.env.NODE_ENV!=="production"&&J(P.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(f)+")"),O(E,P,A)){var B=N(P,d+1),j=B[0],H=B[1];try{r.pushState(j,"",H)}catch{o.location.assign(H)}R(E)}}function b(f,h){var E=U.Replace,P=_(f,h);function A(){b(f,h)}if(process.env.NODE_ENV!=="production"&&J(P.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(f)+")"),O(E,P,A)){var B=N(P,d),j=B[0],H=B[1];r.replaceState(j,"",H),R(E)}}function k(f){r.go(f)}var m={get action(){return u},get location(){return y},createHref:L,push:w,replace:b,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return S.push(h)},block:function(h){var E=g.push(h);return g.length===1&&o.addEventListener(ct,it),function(){E(),g.length||o.removeEventListener(ct,it)}}};return m}function ce(t){t===void 0&&(t={});var e=t,n=e.initialEntries,o=n===void 0?["/"]:n,r=e.initialIndex,a=o.map(function(R){var w=Z(T({pathname:"/",search:"",hash:"",state:null,key:ut()},typeof R=="string"?rt(R):R));return process.env.NODE_ENV!=="production"&&J(w.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(R)+")"),w}),s=ie(r??a.length-1,0,a.length-1),c=U.Pop,u=a[s],l=tt(),d=tt();function y(R){return typeof R=="string"?R:Q(R)}function S(R,w){return w===void 0&&(w=null),Z(T({pathname:u.pathname,search:"",hash:""},typeof R=="string"?rt(R):R,{state:w,key:ut()}))}function g(R,w,b){return!d.length||(d.call({action:R,location:w,retry:b}),!1)}function x(R,w){c=R,u=w,l.call({action:c,location:u})}function L(R,w){var b=U.Push,k=S(R,w);function m(){L(R,w)}process.env.NODE_ENV!=="production"&&J(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(R)+")"),g(b,k,m)&&(s+=1,a.splice(s,a.length,k),x(b,k))}function _(R,w){var b=U.Replace,k=S(R,w);function m(){_(R,w)}process.env.NODE_ENV!=="production"&&J(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(R)+")"),g(b,k,m)&&(a[s]=k,x(b,k))}function N(R){var w=ie(s+R,0,a.length-1),b=U.Pop,k=a[w];function m(){N(R)}g(b,k,m)&&(s=w,x(b,k))}var O={get index(){return s},get action(){return c},get location(){return u},createHref:y,push:L,replace:_,go:N,back:function(){N(-1)},forward:function(){N(1)},listen:function(w){return l.push(w)},block:function(w){return d.push(w)}};return O}function ie(t,e,n){return Math.min(Math.max(t,e),n)}function it(t){t.preventDefault(),t.returnValue=""}function tt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(o){return o!==n})}},call:function(n){t.forEach(function(o){return o&&o(n)})}}}function ut(){return Math.random().toString(36).substr(2,8)}function Q(t){var e=t.pathname,n=e===void 0?"/":e,o=t.search,r=o===void 0?"":o,a=t.hash,s=a===void 0?"":a;return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function rt(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var o=t.indexOf("?");o>=0&&(e.search=t.substr(o),t=t.substr(0,o)),t&&(e.pathname=t)}return e}function ze(t,e){const n=i.reactive({...t}),o=s=>{Object.assign(n,{...s})},r=n,a=Be(r,e);return{currentRoute:r,routerRoute:a,updateRoute:o}}function K(t){return!t.startsWith("http")?Xe(t):Ye(t)}function Ye(t){const{protocol:e,host:n,pathname:o,search:r,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:n,pathname:o,search:r,searchParams:a,hash:s}}function Xe(t){const{pathname:e,search:n,searchParams:o,hash:r}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:o,hash:r}}function Ze(t){return e=>{const{host:n}=K(e);return!(n===void 0||n===t)}}function ue(){return typeof window<"u"&&typeof window.document<"u"}function tn({mode:t,listener:e}){const n=en(t),o=(u,l)=>{if(l!=null&&l.replace)return n.replace(u);n.push(u)},r=()=>{const u=Q(n.location);return n.replace(u)};let a;return{...n,update:o,refresh:r,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function en(t="auto"){switch(t){case"auto":return ue()?se():ce();case"browser":return se();case"memory":return ce();case"hash":return Ge();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function nn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function fe(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}const le=Symbol();function rn({rejections:t}){const e=s=>{const c={...t};return i.markRaw(c[s]??nn(s))},n=s=>{const c=i.markRaw(e(s)),u={name:s,path:"",component:c,meta:{}};return{matched:u,matches:[u],key:s,query:fe(""),params:{},[le]:!0}},o=s=>le in s,r=s=>{if(!s){a.value=null;return}const c=e(s);a.value={type:s,component:c}},a=i.ref(null);return{setRejection:r,rejection:a,getRejectionRoute:n,isRejectionRoute:o}}class on extends Error{constructor(e){super(`Route disabled: "${e}"`)}}class an extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Lt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let o=0;const r=n.reduce((s,c)=>{const u=Lt(t.slice(o,c.index));u.length&&s.push(u);const[l]=c;return s.push(l),o=c.index+l.length,s},[]),a=t.slice(o);return a&&r.push(a),r}function cn(t){const e=he(t.path.toString());return new RegExp(`^${e}$`,"i")}function un(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!Ut(n)).map(([n,o])=>{const r=he(o);return new RegExp(`${Lt(n)}=${r}(&|$)`,"i")})}function he(t){return sn(t,new RegExp(fn,"g")).map(e=>e.startsWith(q)?pe(e):Lt(e)).join("")}function pe(t){return[ln,hn].reduce((e,n)=>n(e),t)}const fn=`\\${q}\\??([\\w-_]+)\\${D}`,Bt=`\\${q}\\?([\\w-_]+)\\${D}`,de=`\\${q}([\\w-_]+)\\${D}`;function ln(t){return t.replace(new RegExp(Bt,"g"),".*")}function Ut(t){return new RegExp(Bt,"g").test(t)}function hn(t){return t.replace(new RegExp(de,"g"),".+")}function ft(t){const[e]=lt(t,new RegExp(Bt,"g")),[n]=lt(t,new RegExp(de,"g"));return e??n}function lt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...o])=>o.map(r=>kt(r)?r:""))}function me(t,e,n){const o=ye(e,n),[r]=lt(t,o);return r}function Re(t,e){if(!e)return t;const{name:n,param:o,value:r}=e,a=ye(t,n);return lt(t,a).reduce((c,u)=>u===void 0?c:c.replace(u,()=>xt(r,o,n.startsWith("?"))),t)}function ye(t,e){const n=[pn,dn,pe].reduce((o,r)=>r(o,e),t);return new RegExp(n,"g")}function pn(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${q}\\${e}\\${D}`,"g");return t.replace(n,"(.*)")}function dn(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${q}${e}\\${D}`,"g");return t.replace(n,"(.+)")}function ge(t,...e){return e.reduce((n,o)=>{if(!o)return n;const r=new URLSearchParams(o).toString();return Object.keys(r).length===0?n:n.includes("?")?`${n}&${r}`:`${n}?${r}`},t)}function mn(t,e={}){const{params:n={},query:o}=e,r=Rn(t.host,n),a=yn(t.path,n),s=gn(t.query,n);return ge(`${r}${a}`,s,o)}function Rn(t,e){const n=t.toString();return Object.entries(t.params).reduce((o,[r,a])=>{const s=ft(`${q}${r}${D}`);return s?Re(o,{name:r,param:a,value:e[s]}):o},n)}function yn(t,e){const n=t.toString();return Object.entries(t.params).reduce((o,[r,a])=>{const s=ft(`${q}${r}${D}`);return s?Re(o,{name:r,param:a,value:e[s]}):o},n)}function gn(t,e){const n=t.toString();if(!n)return{};const o=new URLSearchParams(n);return Array.from(o.entries()).reduce((r,[a,s])=>{const c=ft(s);if(!c)return{...r,[a]:s};const l=xt(e[c],t.params[c],Ut(s)),d=e[c]===void 0&&l==="";return Ut(s)&&d?r:{...r,[a]:l}},{})}function wn(t){return(e,n,o)=>{if(F(e))return ge(e,(n??{}).query);const r=n??{},a=o??{},s=t.find(u=>u.key===e);if(!s)throw new an(String(e));if(s.matched.disabled)throw new on(String(e));return mn(s,{params:r,query:a.query})}}class En extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function vn(t){if(t)return t;if(ue())return window.location.toString();throw new En}const Pn=(t,e)=>{try{we(t,e)}catch{return!1}return!0},we=(t,e)=>{const{pathname:n,search:o}=K(e);return{...bn(t.path,n),...Sn(t.query,o)}};function bn(t,e){const n={},o=decodeURIComponent(e);for(const[r,a]of Object.entries(t.params)){const s=r.startsWith("?"),c=s?r.slice(1):r,u=me(o,t.toString(),r),l=At(u,a,s);n[c]=l}return n}function Sn(t,e){const n={},o=new URLSearchParams(e);for(const[r,a]of Object.entries(t.params)){const s=r.startsWith("?"),c=s?r.slice(1):r,u=o.get(c)??void 0,l=At(u,a,s);n[c]=l}return n}const kn=t=>"name"in t.matched&&!!t.matched.name,An=(t,e)=>{const{pathname:n}=K(e);return cn(t).test(n)},xn=(t,e)=>{const{search:n}=K(e);return un(t).every(r=>r.test(n))};function Ln(t){const{searchParams:e,pathname:n}=K(t),o=-1,r=1;return(a,s)=>{const c=ve(a,e),u=Ee(a,n),l=ve(s,e),d=Ee(s,n);return a.depth>s.depth?o:a.depth<s.depth?r:c+u>l+d?o:c+u<l+d?r:0}}function Ee(t,e){const n=Object.keys(t.path.params).filter(r=>r.startsWith("?")).map(r=>r),o=n.filter(r=>me(e,t.path.toString(),r)===void 0);return n.length-o.length}function ve(t,e){const n=new URLSearchParams(t.query.toString()),o=Array.from(n.keys()),r=o.filter(a=>!e.has(a));return o.length-r.length}const Bn=[kn,An,xn,Pn];function $t(t,e){const n=Ln(e),o=t.filter(u=>Bn.every(l=>l(u,e))).sort(n);if(o.length===0)return;const[r]=o,{search:a}=K(e),s=fe(a),c=we(r,e);return{matched:r.matched,matches:r.matches,key:r.key,query:s,params:c}}function Nt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Un(t){return t.every(e=>Array.isArray(e))}function $n(t,e={}){const n=Un(t)?t.flat():t,o=wn(n),r=tn({mode:e.historyMode,listener:()=>{const v=Q(location);x(v)}}),{runBeforeRouteHooks:a,runAfterRouteHooks:s}=je(),{hooks:c,onBeforeRouteEnter:u,onAfterRouteUpdate:l,onBeforeRouteLeave:d,onAfterRouteEnter:y,onBeforeRouteUpdate:S,onAfterRouteLeave:g}=Ce();async function x(v,{replace:C}={}){if(r.stopListening(),A(v))return r.update(v,{replace:C});const W=$t(n,v)??b("NotFound"),G={...m},z=await a({to:W,from:G,hooks:c});switch(z.status){case"ABORT":return;case"PUSH":r.update(v,{replace:C}),await L(...z.to);return;case"REJECT":r.update(v,{replace:C}),R(z.type),h(W);break;case"SUCCESS":r.update(v,{replace:C}),R(null),h(W);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`)}const I=await s({to:W,from:G,hooks:c});switch(I.status){case"PUSH":await L(...I.to);break;case"REJECT":R(I.type);break;case"SUCCESS":break;default:const pt=I;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(pt)}`)}r.startListening()}const L=(v,C,W)=>{if(F(v)){const pt={...C},Tn=o(v,pt);return x(Tn,{replace:pt.replace})}const G={...W},I=o(v,C??{},G);return x(I,{replace:G.replace})},_=(v,C,W)=>{if(F(v)){const I={...C,replace:!0};return L(v,I)}const G=C??{},z={...W,replace:!0};return L(v,G,z)},N=v=>R(v),O=(v,C={})=>{if(!F(v)){const W=o(v,C);return $t(n,W)}if(!A(v))return $t(n,v)},{setRejection:R,rejection:w,getRejectionRoute:b}=rn(e),k=b("NotFound"),{currentRoute:m,routerRoute:f,updateRoute:h}=ze(k,L);r.startListening();const E=vn(e.initialUrl),{host:P}=K(E),A=Ze(P),B=x(E,{replace:!0});function j(v){v.component("RouterView",St),v.component("RouterLink",Kt),v.provide(mt,w),v.provide(Ft,c),v.provide(dt,H)}const H={route:f,resolve:o,push:L,replace:_,reject:N,find:O,refresh:r.refresh,forward:r.forward,back:r.back,go:r.go,install:j,initialized:B,isExternal:A,onBeforeRouteEnter:u,onAfterRouteUpdate:l,onBeforeRouteLeave:d,onAfterRouteEnter:y,onBeforeRouteUpdate:S,onAfterRouteLeave:g};return H}function ht(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(jn));for(const n of e)if(Nn(e,n)>1)throw new M(n)}function Nn(t,e){return t.filter(n=>e===n).length}function jn(t){return t.startsWith("?")?t.slice(1):t}function Pe(t,e){ht(t.params,e.params);const n=`${t.path}${e.path}`;return{path:n,params:{...t.params,...e.params},toString:()=>n}}function be(t,e){ht(t.params,e.params);const n=[t.query,e.query].filter(kt).join("&");return{query:n,params:{...t.params,...e.params},toString:()=>n}}function jt(t,e){const n=new RegExp(`\\${q}(\\??[\\w-_]+)\\${D}`,"g");return Array.from(t.matchAll(n)).reduce((r,[a,s])=>{const c=ft(a);if(!c)return r;const u=Je(e,c);return ht([c],r),r[s]=u,r},{})}function Se(t,e){return{host:t,params:jt(t,e),toString:()=>t}}function ke(t,e){return{path:t,params:jt(t,e),toString:()=>t}}function Hn(t){return Nt(t)&&typeof t.path=="string"}function Ae(t){return Hn(t)?t:ke(t,{})}function Ht(t,e){return{query:t,params:jt(t,e),toString:()=>t}}function Cn(t){return Nt(t)&&typeof t.query=="string"}function xe(t){return t===void 0?Ht("",{}):Cn(t)?t:Ht(t,{})}function Vn(t){const e=t.reduce((n,o)=>{const r=qn(o);return bt(o)&&n.push(...o.children.map(a=>({...a,key:Rt(r.key,a.key),path:Pe(r.path,a.path),query:be(r.query,a.query),matches:[r.matched,...a.matches],depth:a.depth+1}))),n.push(r),n},[]);return Ct(e),e}function qn(t){const e=_n(t),n=Ae(t.path),o=xe(t.query),r=i.markRaw({meta:{},...e});return{matched:r,matches:[r],key:t.name??"",path:n,query:o,depth:1,disabled:t.disabled??!1,host:Se("",{})}}function Ct(t){t.forEach(({path:e,query:n,host:o})=>{ht(e.params,n.params,o.params)})}function _n(t){return Gt(t)?{...t,component:St}:t}function On(t){return Nt(t)&&typeof t.host=="string"}function Wn(t){return On(t)?t:Se(t,{})}function Dn(t){const e=t.reduce((n,o)=>{const r=Mn(o);return o.children&&n.push(...o.children.map(a=>({...a,key:Rt(r.key,a.key),path:Pe(r.path,a.path),query:be(r.query,a.query),matches:[r.matched,...a.matches],depth:a.depth+1,host:r.host}))),n.push(r),n},[]);return Ct(e),e}function Mn(t){const e=Ae(t.path),n=xe(t.query),o=Wn(t.host??"");return{matched:i.markRaw({meta:{},...t,name:t.name??"",children:[]}),matches:[],key:t.name??"",host:o,path:e,query:n,depth:1,disabled:t.disabled??!1}}p.DuplicateParamsError=M,p.RouterLink=Kt,p.RouterNotInstalledError=ot,p.RouterView=St,p.UseRouteInvalidError=Vt,p.component=Me,p.createExternalRoutes=Dn,p.createParam=oe,p.createRouter=$n,p.createRoutes=Vn,p.isParamGetSet=nt,p.isParamGetter=Xt,p.isParamWithDefault=Zt,p.isParentRoute=bt,p.isParentRouteWithoutComponent=Gt,p.isRoute=Wt,p.isRouteWithComponent=zt,p.isRouteWithComponents=Yt,p.onAfterRouteEnter=_e,p.onAfterRouteLeave=Oe,p.onAfterRouteUpdate=We,p.onBeforeRouteLeave=Ve,p.onBeforeRouteUpdate=qe,p.paramEnd=D,p.paramStart=q,p.path=ke,p.query=Ht,p.routerInjectionKey=dt,p.routerRejectionKey=mt,p.throwIfDuplicateParamsAreFound=Ct,p.useLink=qt,p.useRejection=_t,p.useRoute=Dt,p.useRouter=at,p.withDefault=Fe,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(p,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(p=typeof globalThis<"u"?globalThis:p||self,i(p["@kitbag/router"]={},p.Vue))})(this,function(p,i){"use strict";var In=Object.defineProperty;var Fn=(p,i,M)=>i in p?In(p,i,{enumerable:!0,configurable:!0,writable:!0,value:M}):p[i]=M;var V=(p,i,M)=>(Fn(p,typeof i!="symbol"?i+"":i,M),M);class M 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 ot extends Error{constructor(){super("Router not installed")}}class qt extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const dt=Symbol();function at(){const t=i.inject(dt);if(!t)throw new ot;return t}class Y extends Error{}function F(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function _t(t,e={},n={}){const o=at(),r=i.computed(()=>i.toValue(t)),a=i.computed(()=>i.toValue(e)),s=i.computed(()=>i.toValue(n)),c=i.computed(()=>{if(F(r.value))return r.value;try{return o.resolve(r.value,a.value,s.value)}catch(y){throw y instanceof Y&&console.error(`Failed to resolve route "${r.value.toString()}" in RouterLink.`,y),y}}),u=i.computed(()=>o.find(c.value,s.value)),l=i.computed(()=>!!u.value&&o.route.matches.includes(u.value.matched)),d=i.computed(()=>!!u.value&&o.route.matched===u.value.matched);return{route:u,href:c,isMatch:l,isExactMatch:d,push:y=>o.push(c.value,{},{...s.value,...y}),replace:y=>o.replace(c.value,{},{...s.value,...y})}}const mt=Symbol();function Ot(){const t=i.inject(mt);if(!t)throw new ot;return t}function Rt(t,e){return[t,e].filter(n=>!!n).join(".")}const Wt=Symbol("isRouterRouteSymbol");function Le(t){return typeof t=="object"&&t!==null&&Wt in t}function Be(t,e){function n(l,d,y){if(typeof l=="object"){const g={...t.params,...l};return e(t.key,g,d)}const S={...t.params,[l]:d};return e(t.key,S,y)}const{matched:o,matches:r,key:a,query:s,params:c}=i.toRefs(t),u=i.reactive({matched:o,matches:r,query:s,params:c,key:a,update:n,[Wt]:!0});return new Proxy(u,{get:(l,d,y)=>d==="params"?new Proxy(t.params,{set(S,g,x){return n(g,x),!0}}):Reflect.get(l,d,y)})}function Dt(t,e,{exact:n}={}){if(!Le(t))return!1;if(e===void 0)return!0;const o=Ue(t);if(n){const r=o.at(-1);return e===r}return o.includes(e)}function Ue(t){return t.matches.map(n=>n.name).reduce((n,o)=>{const r=n.pop(),a=o?[Rt(r,o)]:[];return r?[...n,r,...a]:a},[])}function Mt(t,e){const n=at();function o(){if(!t)return;if(!Dt(n.route,t,e))throw new qt(t,n.route.key)}return i.watch(n.route,o,{immediate:!0,deep:!0}),n.route}const Tt=Symbol();function yt(){return i.inject(Tt,0)}class st{constructor(){V(this,"onBeforeRouteEnter",new Set);V(this,"onBeforeRouteUpdate",new Set);V(this,"onBeforeRouteLeave",new Set);V(this,"onAfterRouteEnter",new Set);V(this,"onAfterRouteUpdate",new Set);V(this,"onAfterRouteLeave",new Set)}}class It extends Error{}class et extends Error{constructor(n){super("Error occurred during a router push operation.");V(this,"to");this.to=n}}class gt extends Error{constructor(n){super(`Routing action rejected: ${n}`);V(this,"type");this.type=n}}function X(t){return Array.isArray(t)?t:[t]}function $e(t,e){const n=new st;return t.matches.forEach((o,r)=>{o.onBeforeRouteEnter&&wt(t,e,r)&&X(o.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),o.onBeforeRouteUpdate&&vt(t,e,r)&&X(o.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((o,r)=>{o.onBeforeRouteLeave&&Et(t,e,r)&&X(o.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function Ne(t,e){const n=new st;return t.matches.forEach((o,r)=>{o.onAfterRouteEnter&&wt(t,e,r)&&X(o.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),o.onAfterRouteUpdate&&vt(t,e,r)&&X(o.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((o,r)=>{o.onAfterRouteLeave&&Et(t,e,r)&&X(o.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function je(){const t=s=>{throw new gt(s)},e=(...s)=>{throw new et(s)},n=(s,c,u)=>{if(F(s)){const y=c??{};throw new et([s,{...y,replace:!0}])}const l=c,d=u??{};throw new et([s,l,{...d,replace:!0}])},o=()=>{throw new It};async function r({to:s,from:c,hooks:u}){const{global:l,component:d}=u,y=$e(s,c),S=[...l.onBeforeRouteEnter,...y.onBeforeRouteEnter,...l.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...d.onBeforeRouteUpdate,...l.onBeforeRouteLeave,...y.onBeforeRouteLeave,...d.onBeforeRouteLeave];try{const g=S.map(x=>x(s,{from:c,reject:t,push:e,replace:n,abort:o}));await Promise.all(g)}catch(g){if(g instanceof et)return{status:"PUSH",to:g.to};if(g instanceof gt)return{status:"REJECT",type:g.type};if(g instanceof It)return{status:"ABORT"};throw g}return{status:"SUCCESS"}}async function a({to:s,from:c,hooks:u}){const{global:l,component:d}=u,y=Ne(s,c),S=[...d.onAfterRouteLeave,...y.onAfterRouteLeave,...l.onAfterRouteLeave,...d.onAfterRouteUpdate,...y.onAfterRouteUpdate,...l.onAfterRouteUpdate,...d.onAfterRouteEnter,...y.onAfterRouteEnter,...l.onAfterRouteEnter];try{const g=S.map(x=>x(s,{from:c,reject:t,push:e,replace:n}));await Promise.all(g)}catch(g){if(g instanceof et)return{status:"PUSH",to:g.to};if(g instanceof gt)return{status:"REJECT",type:g.type};throw g}return{status:"SUCCESS"}}return{runBeforeRouteHooks:r,runAfterRouteHooks:a}}const wt=(t,e,n)=>{const o=t.matches,r=(e==null?void 0:e.matches)??[];return o.length<n||o[n]!==r[n]},Et=(t,e,n)=>{const o=t.matches,r=(e==null?void 0:e.matches)??[];return o.length<n||o[n]!==r[n]},vt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function Ft(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return wt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return vt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Et;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}class He{constructor(){V(this,"global",new st);V(this,"component",new st)}addBeforeRouteHook({lifecycle:e,timing:n,depth:o,hook:r}){const a=Ft(e),s=this[n][e],c=(u,l)=>{if(a(u,l.from,o))return r(u,l)};return s.add(c),()=>s.delete(c)}addAfterRouteHook({lifecycle:e,timing:n,depth:o,hook:r}){const a=Ft(e),s=this[n][e],c=(u,l)=>{if(a(u,l.from,o))return r(u,l)};return s.add(c),()=>s.delete(c)}}const Jt=Symbol();function Ce(){const t=new He;return{onBeforeRouteEnter:c=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:c,timing:"global",depth:0}),onBeforeRouteUpdate:c=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:c,timing:"global",depth:0}),onBeforeRouteLeave:c=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:c,timing:"global",depth:0}),onAfterRouteEnter:c=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:c,timing:"global",depth:0}),onAfterRouteUpdate:c=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:c,timing:"global",depth:0}),onAfterRouteLeave:c=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:c,timing:"global",depth:0}),hooks:t}}function Qt(){const t=i.inject(Jt);if(!t)throw new ot;return t}function Kt(t){return e=>{const n=yt(),r=Qt().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(r),r}}function Pt(t){return e=>{const n=yt(),r=Qt().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(r),r}}const Ve=Kt("onBeforeRouteUpdate"),qe=Kt("onBeforeRouteLeave"),_e=Pt("onAfterRouteEnter"),Oe=Pt("onAfterRouteUpdate"),We=Pt("onAfterRouteLeave"),De=["href"],Gt=i.defineComponent({__name:"routerLink",props:{to:{type:[String,Function]},query:{},replace:{type:Boolean}},setup(t){const e=t,n=at(),o=i.computed(()=>F(e.to)?e.to:e.to(n.resolve)),r=i.computed(()=>{const{to:y,...S}=e;return S}),{href:a,isMatch:s,isExactMatch:c}=_t(o),u=i.computed(()=>({"router-link--match":s.value,"router-link--exact-match":c.value})),l=i.computed(()=>n.isExternal(o.value));function d(y){y.preventDefault(),n.push(a.value,r.value)}return(y,S)=>(i.openBlock(),i.createElementBlock("a",{href:o.value,class:i.normalizeClass(["router-link",u.value]),onClick:d},[i.renderSlot(y.$slots,"default",i.normalizeProps(i.guardReactiveProps({resolved:o.value,isMatch:i.unref(s),isExactMatch:i.unref(c),isExternal:l.value})))],10,De))}});function bt(t){return"children"in t}function zt(t){return bt(t)&&!("component"in t)&&!("components"in t)}function Yt(t){return typeof t=="object"&&t!==null&&"component"in t}function Xt(t){return typeof t=="object"&&t!==null&&"components"in t}const St=i.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=Mt(),o=Ot(),r=yt();i.provide(Tt,r+1);const a=i.computed(()=>{if(o.value)return o.value.component;const c=n.matches.at(r);if(!c)return null;const l=s(c)[e];return l?typeof l=="function"?i.defineAsyncComponent(l):l:null});function s(c){return Xt(c)?c.components:Yt(c)?{default:c.component}:{}}return(c,u)=>i.renderSlot(c.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:i.unref(n),component:a.value,rejection:i.unref(o)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.value)))])}});function Me(t,e){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>i.h(Te(t,n)):()=>i.h(t,n)}})}function Te(t,e){return i.defineComponent({name:"AsyncPropsWrapper",expose:[],async setup(){const n=await e;return()=>i.h(t,n)}})}const q="[",D="]";function Ie(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Zt(t){return typeof t=="function"&&Ie(t)}function nt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function te(t){return nt(t)&&t.defaultValue!==void 0}function Fe(t,e){return ae(t,e)}function kt(t){return typeof t=="string"&&t.length>0}function Je(t,e){return t[e]??String}const $={invalid:t=>{throw new Y(t)}},Qe={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},ee={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()}},ne={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},re={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},oe={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 At(t,e,n=!1){if(t===void 0||!kt(t)){if(te(e))return e.defaultValue;if(n)return;throw new Y}if(e===String)return Qe.get(t,$);if(e===Boolean)return ee.get(t,$);if(e===Number)return ne.get(t,$);if(e===Date)return re.get(t,$);if(e===JSON)return oe.get(t,$);if(Zt(e))return e(t,$);if(nt(e))return e.get(t,$);if(e instanceof RegExp){if(e.test(t))return t;throw new Y}return t}function xt(t,e,n=!1){if(t===void 0){if(n)return"";throw new Y}if(e===Boolean)return ee.set(t,$);if(e===Number)return ne.set(t,$);if(e===Date)return re.set(t,$);if(e===JSON)return oe.set(t,$);if(nt(e))return e.set(t,$);try{return t.toString()}catch{throw new Y}}function ae(t,e){return nt(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>At(n,t),set:n=>xt(n,t),defaultValue:e}}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},T.apply(this,arguments)}var U;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(U||(U={}));var Z=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function J(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var ct="beforeunload",Ke="hashchange",se="popstate";function ce(t){t===void 0&&(t={});var e=t,n=e.window,o=n===void 0?document.defaultView:n,r=o.history;function a(){var m=o.location,f=m.pathname,h=m.search,E=m.hash,P=r.state||{};return[P.idx,Z({pathname:f,search:h,hash:E,state:P.usr||null,key:P.key||"default"})]}var s=null;function c(){if(s)g.call(s),s=null;else{var m=U.Pop,f=a(),h=f[0],E=f[1];if(g.length)if(h!=null){var P=d-h;P&&(s={action:m,location:E,retry:function(){b(P*-1)}},b(P))}else process.env.NODE_ENV!=="production"&&J(!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 O(m)}}o.addEventListener(se,c);var u=U.Pop,l=a(),d=l[0],y=l[1],S=tt(),g=tt();d==null&&(d=0,r.replaceState(T({},r.state,{idx:d}),""));function x(m){return typeof m=="string"?m:Q(m)}function L(m,f){return f===void 0&&(f=null),Z(T({pathname:y.pathname,hash:"",search:""},typeof m=="string"?rt(m):m,{state:f,key:ut()}))}function _(m,f){return[{usr:m.state,key:m.key,idx:f},x(m)]}function N(m,f,h){return!g.length||(g.call({action:m,location:f,retry:h}),!1)}function O(m){u=m;var f=a();d=f[0],y=f[1],S.call({action:u,location:y})}function R(m,f){var h=U.Push,E=L(m,f);function P(){R(m,f)}if(N(h,E,P)){var A=_(E,d+1),B=A[0],j=A[1];try{r.pushState(B,"",j)}catch{o.location.assign(j)}O(h)}}function w(m,f){var h=U.Replace,E=L(m,f);function P(){w(m,f)}if(N(h,E,P)){var A=_(E,d),B=A[0],j=A[1];r.replaceState(B,"",j),O(h)}}function b(m){r.go(m)}var k={get action(){return u},get location(){return y},createHref:x,push:R,replace:w,go:b,back:function(){b(-1)},forward:function(){b(1)},listen:function(f){return S.push(f)},block:function(f){var h=g.push(f);return g.length===1&&o.addEventListener(ct,it),function(){h(),g.length||o.removeEventListener(ct,it)}}};return k}function Ge(t){t===void 0&&(t={});var e=t,n=e.window,o=n===void 0?document.defaultView:n,r=o.history;function a(){var f=rt(o.location.hash.substr(1)),h=f.pathname,E=h===void 0?"/":h,P=f.search,A=P===void 0?"":P,B=f.hash,j=B===void 0?"":B,H=r.state||{};return[H.idx,Z({pathname:E,search:A,hash:j,state:H.usr||null,key:H.key||"default"})]}var s=null;function c(){if(s)g.call(s),s=null;else{var f=U.Pop,h=a(),E=h[0],P=h[1];if(g.length)if(E!=null){var A=d-E;A&&(s={action:f,location:P,retry:function(){k(A*-1)}},k(A))}else process.env.NODE_ENV!=="production"&&J(!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 R(f)}}o.addEventListener(se,c),o.addEventListener(Ke,function(){var f=a(),h=f[1];Q(h)!==Q(y)&&c()});var u=U.Pop,l=a(),d=l[0],y=l[1],S=tt(),g=tt();d==null&&(d=0,r.replaceState(T({},r.state,{idx:d}),""));function x(){var f=document.querySelector("base"),h="";if(f&&f.getAttribute("href")){var E=o.location.href,P=E.indexOf("#");h=P===-1?E:E.slice(0,P)}return h}function L(f){return x()+"#"+(typeof f=="string"?f:Q(f))}function _(f,h){return h===void 0&&(h=null),Z(T({pathname:y.pathname,hash:"",search:""},typeof f=="string"?rt(f):f,{state:h,key:ut()}))}function N(f,h){return[{usr:f.state,key:f.key,idx:h},L(f)]}function O(f,h,E){return!g.length||(g.call({action:f,location:h,retry:E}),!1)}function R(f){u=f;var h=a();d=h[0],y=h[1],S.call({action:u,location:y})}function w(f,h){var E=U.Push,P=_(f,h);function A(){w(f,h)}if(process.env.NODE_ENV!=="production"&&J(P.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(f)+")"),O(E,P,A)){var B=N(P,d+1),j=B[0],H=B[1];try{r.pushState(j,"",H)}catch{o.location.assign(H)}R(E)}}function b(f,h){var E=U.Replace,P=_(f,h);function A(){b(f,h)}if(process.env.NODE_ENV!=="production"&&J(P.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(f)+")"),O(E,P,A)){var B=N(P,d),j=B[0],H=B[1];r.replaceState(j,"",H),R(E)}}function k(f){r.go(f)}var m={get action(){return u},get location(){return y},createHref:L,push:w,replace:b,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return S.push(h)},block:function(h){var E=g.push(h);return g.length===1&&o.addEventListener(ct,it),function(){E(),g.length||o.removeEventListener(ct,it)}}};return m}function ie(t){t===void 0&&(t={});var e=t,n=e.initialEntries,o=n===void 0?["/"]:n,r=e.initialIndex,a=o.map(function(R){var w=Z(T({pathname:"/",search:"",hash:"",state:null,key:ut()},typeof R=="string"?rt(R):R));return process.env.NODE_ENV!=="production"&&J(w.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(R)+")"),w}),s=ue(r??a.length-1,0,a.length-1),c=U.Pop,u=a[s],l=tt(),d=tt();function y(R){return typeof R=="string"?R:Q(R)}function S(R,w){return w===void 0&&(w=null),Z(T({pathname:u.pathname,search:"",hash:""},typeof R=="string"?rt(R):R,{state:w,key:ut()}))}function g(R,w,b){return!d.length||(d.call({action:R,location:w,retry:b}),!1)}function x(R,w){c=R,u=w,l.call({action:c,location:u})}function L(R,w){var b=U.Push,k=S(R,w);function m(){L(R,w)}process.env.NODE_ENV!=="production"&&J(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(R)+")"),g(b,k,m)&&(s+=1,a.splice(s,a.length,k),x(b,k))}function _(R,w){var b=U.Replace,k=S(R,w);function m(){_(R,w)}process.env.NODE_ENV!=="production"&&J(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(R)+")"),g(b,k,m)&&(a[s]=k,x(b,k))}function N(R){var w=ue(s+R,0,a.length-1),b=U.Pop,k=a[w];function m(){N(R)}g(b,k,m)&&(s=w,x(b,k))}var O={get index(){return s},get action(){return c},get location(){return u},createHref:y,push:L,replace:_,go:N,back:function(){N(-1)},forward:function(){N(1)},listen:function(w){return l.push(w)},block:function(w){return d.push(w)}};return O}function ue(t,e,n){return Math.min(Math.max(t,e),n)}function it(t){t.preventDefault(),t.returnValue=""}function tt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(o){return o!==n})}},call:function(n){t.forEach(function(o){return o&&o(n)})}}}function ut(){return Math.random().toString(36).substr(2,8)}function Q(t){var e=t.pathname,n=e===void 0?"/":e,o=t.search,r=o===void 0?"":o,a=t.hash,s=a===void 0?"":a;return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function rt(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var o=t.indexOf("?");o>=0&&(e.search=t.substr(o),t=t.substr(0,o)),t&&(e.pathname=t)}return e}function ze(t,e){const n=i.reactive({...t}),o=s=>{Object.assign(n,{...s})},r=n,a=Be(r,e);return{currentRoute:r,routerRoute:a,updateRoute:o}}function K(t){return!t.startsWith("http")?Xe(t):Ye(t)}function Ye(t){const{protocol:e,host:n,pathname:o,search:r,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:n,pathname:o,search:r,searchParams:a,hash:s}}function Xe(t){const{pathname:e,search:n,searchParams:o,hash:r}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:o,hash:r}}function Ze(t){return e=>{const{host:n}=K(e);return!(n===void 0||n===t)}}function fe(){return typeof window<"u"&&typeof window.document<"u"}function tn({mode:t,listener:e}){const n=en(t),o=(u,l)=>{if(l!=null&&l.replace)return n.replace(u);n.push(u)},r=()=>{const u=Q(n.location);return n.replace(u)};let a;return{...n,update:o,refresh:r,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function en(t="auto"){switch(t){case"auto":return fe()?ce():ie();case"browser":return ce();case"memory":return ie();case"hash":return Ge();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function nn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function le(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}const he=Symbol();function rn({rejections:t}){const e=s=>{const c={...t};return i.markRaw(c[s]??nn(s))},n=s=>{const c=i.markRaw(e(s)),u={name:s,path:"",component:c,meta:{}};return{matched:u,matches:[u],key:s,query:le(""),params:{},[he]:!0}},o=s=>he in s,r=s=>{if(!s){a.value=null;return}const c=e(s);a.value={type:s,component:c}},a=i.ref(null);return{setRejection:r,rejection:a,getRejectionRoute:n,isRejectionRoute:o}}class on extends Error{constructor(e){super(`Route disabled: "${e}"`)}}class an extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Lt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let o=0;const r=n.reduce((s,c)=>{const u=Lt(t.slice(o,c.index));u.length&&s.push(u);const[l]=c;return s.push(l),o=c.index+l.length,s},[]),a=t.slice(o);return a&&r.push(a),r}function cn(t){const e=pe(t.path.toString());return new RegExp(`^${e}$`,"i")}function un(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!Ut(n)).map(([n,o])=>{const r=pe(o);return new RegExp(`${Lt(n)}=${r}(&|$)`,"i")})}function pe(t){return sn(t,new RegExp(fn,"g")).map(e=>e.startsWith(q)?de(e):Lt(e)).join("")}function de(t){return[ln,hn].reduce((e,n)=>n(e),t)}const fn=`\\${q}\\??([\\w-_]+)\\${D}`,Bt=`\\${q}\\?([\\w-_]+)\\${D}`,me=`\\${q}([\\w-_]+)\\${D}`;function ln(t){return t.replace(new RegExp(Bt,"g"),".*")}function Ut(t){return new RegExp(Bt,"g").test(t)}function hn(t){return t.replace(new RegExp(me,"g"),".+")}function ft(t){const[e]=lt(t,new RegExp(Bt,"g")),[n]=lt(t,new RegExp(me,"g"));return e??n}function lt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...o])=>o.map(r=>kt(r)?r:""))}function Re(t,e,n){const o=ge(e,n),[r]=lt(t,o);return r}function ye(t,e){if(!e)return t;const{name:n,param:o,value:r}=e,a=ge(t,n);return lt(t,a).reduce((c,u)=>u===void 0?c:c.replace(u,()=>xt(r,o,n.startsWith("?"))),t)}function ge(t,e){const n=[pn,dn,de].reduce((o,r)=>r(o,e),t);return new RegExp(n,"g")}function pn(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${q}\\${e}\\${D}`,"g");return t.replace(n,"(.*)")}function dn(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${q}${e}\\${D}`,"g");return t.replace(n,"(.+)")}function we(t,...e){return e.reduce((n,o)=>{if(!o)return n;const r=new URLSearchParams(o).toString();return Object.keys(r).length===0?n:n.includes("?")?`${n}&${r}`:`${n}?${r}`},t)}function mn(t,e={}){const{params:n={},query:o}=e,r=Rn(t.host,n),a=yn(t.path,n),s=gn(t.query,n);return we(`${r}${a}`,s,o)}function Rn(t,e){const n=t.toString();return Object.entries(t.params).reduce((o,[r,a])=>{const s=ft(`${q}${r}${D}`);return s?ye(o,{name:r,param:a,value:e[s]}):o},n)}function yn(t,e){const n=t.toString();return Object.entries(t.params).reduce((o,[r,a])=>{const s=ft(`${q}${r}${D}`);return s?ye(o,{name:r,param:a,value:e[s]}):o},n)}function gn(t,e){const n=t.toString();if(!n)return{};const o=new URLSearchParams(n);return Array.from(o.entries()).reduce((r,[a,s])=>{const c=ft(s);if(!c)return{...r,[a]:s};const l=xt(e[c],t.params[c],Ut(s)),d=e[c]===void 0&&l==="";return Ut(s)&&d?r:{...r,[a]:l}},{})}function wn(t){return(e,n,o)=>{if(F(e))return we(e,(n??{}).query);const r=n??{},a=o??{},s=t.find(u=>u.key===e);if(!s)throw new an(String(e));if(s.matched.disabled)throw new on(String(e));return mn(s,{params:r,query:a.query})}}class En extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function vn(t){if(t)return t;if(fe())return window.location.toString();throw new En}const Pn=(t,e)=>{try{Ee(t,e)}catch{return!1}return!0},Ee=(t,e)=>{const{pathname:n,search:o}=K(e);return{...bn(t.path,n),...Sn(t.query,o)}};function bn(t,e){const n={},o=decodeURIComponent(e);for(const[r,a]of Object.entries(t.params)){const s=r.startsWith("?"),c=s?r.slice(1):r,u=Re(o,t.toString(),r),l=At(u,a,s);n[c]=l}return n}function Sn(t,e){const n={},o=new URLSearchParams(e);for(const[r,a]of Object.entries(t.params)){const s=r.startsWith("?"),c=s?r.slice(1):r,u=o.get(c)??void 0,l=At(u,a,s);n[c]=l}return n}const kn=t=>"name"in t.matched&&!!t.matched.name,An=(t,e)=>{const{pathname:n}=K(e);return cn(t).test(n)},xn=(t,e)=>{const{search:n}=K(e);return un(t).every(r=>r.test(n))};function Ln(t){const{searchParams:e,pathname:n}=K(t),o=-1,r=1;return(a,s)=>{const c=Pe(a,e),u=ve(a,n),l=Pe(s,e),d=ve(s,n);return a.depth>s.depth?o:a.depth<s.depth?r:c+u>l+d?o:c+u<l+d?r:0}}function ve(t,e){const n=Object.keys(t.path.params).filter(r=>r.startsWith("?")).map(r=>r),o=n.filter(r=>Re(e,t.path.toString(),r)===void 0);return n.length-o.length}function Pe(t,e){const n=new URLSearchParams(t.query.toString()),o=Array.from(n.keys()),r=o.filter(a=>!e.has(a));return o.length-r.length}const Bn=[kn,An,xn,Pn];function $t(t,e){const n=Ln(e),o=t.filter(u=>Bn.every(l=>l(u,e))).sort(n);if(o.length===0)return;const[r]=o,{search:a}=K(e),s=le(a),c=Ee(r,e);return{matched:r.matched,matches:r.matches,key:r.key,query:s,params:c}}function Nt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Un(t){return t.every(e=>Array.isArray(e))}function $n(t,e={}){const n=Un(t)?t.flat():t,o=wn(n),r=tn({mode:e.historyMode,listener:()=>{const v=Q(location);x(v)}}),{runBeforeRouteHooks:a,runAfterRouteHooks:s}=je(),{hooks:c,onBeforeRouteEnter:u,onAfterRouteUpdate:l,onBeforeRouteLeave:d,onAfterRouteEnter:y,onBeforeRouteUpdate:S,onAfterRouteLeave:g}=Ce();async function x(v,{replace:C}={}){if(r.stopListening(),A(v))return r.update(v,{replace:C});const W=$t(n,v)??b("NotFound"),G={...m},z=await a({to:W,from:G,hooks:c});switch(z.status){case"ABORT":return;case"PUSH":r.update(v,{replace:C}),await L(...z.to);return;case"REJECT":r.update(v,{replace:C}),R(z.type),h(W);break;case"SUCCESS":r.update(v,{replace:C}),R(null),h(W);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`)}const I=await s({to:W,from:G,hooks:c});switch(I.status){case"PUSH":await L(...I.to);break;case"REJECT":R(I.type);break;case"SUCCESS":break;default:const pt=I;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(pt)}`)}r.startListening()}const L=(v,C,W)=>{if(F(v)){const pt={...C},Tn=o(v,pt);return x(Tn,{replace:pt.replace})}const G={...W},I=o(v,C??{},G);return x(I,{replace:G.replace})},_=(v,C,W)=>{if(F(v)){const I={...C,replace:!0};return L(v,I)}const G=C??{},z={...W,replace:!0};return L(v,G,z)},N=v=>R(v),O=(v,C={})=>{if(!F(v)){const W=o(v,C);return $t(n,W)}if(!A(v))return $t(n,v)},{setRejection:R,rejection:w,getRejectionRoute:b}=rn(e),k=b("NotFound"),{currentRoute:m,routerRoute:f,updateRoute:h}=ze(k,L);r.startListening();const E=vn(e.initialUrl),{host:P}=K(E),A=Ze(P),B=x(E,{replace:!0});function j(v){v.component("RouterView",St),v.component("RouterLink",Gt),v.provide(mt,w),v.provide(Jt,c),v.provide(dt,H)}const H={route:f,resolve:o,push:L,replace:_,reject:N,find:O,refresh:r.refresh,forward:r.forward,back:r.back,go:r.go,install:j,initialized:B,isExternal:A,onBeforeRouteEnter:u,onAfterRouteUpdate:l,onBeforeRouteLeave:d,onAfterRouteEnter:y,onBeforeRouteUpdate:S,onAfterRouteLeave:g};return H}function ht(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(jn));for(const n of e)if(Nn(e,n)>1)throw new M(n)}function Nn(t,e){return t.filter(n=>e===n).length}function jn(t){return t.startsWith("?")?t.slice(1):t}function be(t,e){ht(t.params,e.params);const n=`${t.path}${e.path}`;return{path:n,params:{...t.params,...e.params},toString:()=>n}}function Se(t,e){ht(t.params,e.params);const n=[t.query,e.query].filter(kt).join("&");return{query:n,params:{...t.params,...e.params},toString:()=>n}}function jt(t,e){const n=new RegExp(`\\${q}(\\??[\\w-_]+)\\${D}`,"g");return Array.from(t.matchAll(n)).reduce((r,[a,s])=>{const c=ft(a);if(!c)return r;const u=Je(e,c);return ht([c],r),r[s]=u,r},{})}function ke(t,e){return{host:t,params:jt(t,e),toString:()=>t}}function Ht(t,e){return{path:t,params:jt(t,e),toString:()=>t}}function Hn(t){return Nt(t)&&typeof t.path=="string"}function Ae(t){return t===void 0?Ht("",{}):Hn(t)?t:Ht(t,{})}function Ct(t,e){return{query:t,params:jt(t,e),toString:()=>t}}function Cn(t){return Nt(t)&&typeof t.query=="string"}function xe(t){return t===void 0?Ct("",{}):Cn(t)?t:Ct(t,{})}function Vn(t){const e=t.reduce((n,o)=>{const r=qn(o);return bt(o)&&n.push(...o.children.map(a=>({...a,key:Rt(r.key,a.key),path:be(r.path,a.path),query:Se(r.query,a.query),matches:[r.matched,...a.matches],depth:a.depth+1}))),n.push(r),n},[]);return Vt(e),e}function qn(t){const e=_n(t),n=Ae(t.path),o=xe(t.query),r=i.markRaw({meta:{},...e});return{matched:r,matches:[r],key:t.name??"",path:n,query:o,depth:1,disabled:t.disabled??!1,host:ke("",{})}}function Vt(t){t.forEach(({path:e,query:n,host:o})=>{ht(e.params,n.params,o.params)})}function _n(t){return zt(t)?{...t,component:St}:t}function On(t){return Nt(t)&&typeof t.host=="string"}function Wn(t){return On(t)?t:ke(t,{})}function Dn(t){const e=t.reduce((n,o)=>{const r=Mn(o);return o.children&&n.push(...o.children.map(a=>({...a,key:Rt(r.key,a.key),path:be(r.path,a.path),query:Se(r.query,a.query),matches:[r.matched,...a.matches],depth:a.depth+1,host:r.host}))),n.push(r),n},[]);return Vt(e),e}function Mn(t){const e=Ae(t.path),n=xe(t.query),o=Wn(t.host??"");return{matched:i.markRaw({meta:{},...t,name:t.name??"",children:[]}),matches:[],key:t.name??"",host:o,path:e,query:n,depth:1,disabled:t.disabled??!1}}p.DuplicateParamsError=M,p.RouterLink=Gt,p.RouterNotInstalledError=ot,p.RouterView=St,p.UseRouteInvalidError=qt,p.component=Me,p.createExternalRoutes=Dn,p.createParam=ae,p.createRouter=$n,p.createRoutes=Vn,p.isParamGetSet=nt,p.isParamGetter=Zt,p.isParamWithDefault=te,p.isParentRoute=bt,p.isParentRouteWithoutComponent=zt,p.isRoute=Dt,p.isRouteWithComponent=Yt,p.isRouteWithComponents=Xt,p.onAfterRouteEnter=_e,p.onAfterRouteLeave=Oe,p.onAfterRouteUpdate=We,p.onBeforeRouteLeave=Ve,p.onBeforeRouteUpdate=qe,p.paramEnd=D,p.paramStart=q,p.path=Ht,p.query=Ct,p.routerInjectionKey=dt,p.routerRejectionKey=mt,p.throwIfDuplicateParamsAreFound=Vt,p.useLink=_t,p.useRejection=Ot,p.useRoute=Mt,p.useRouter=at,p.withDefault=Fe,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|