@kitbag/router 0.5.0 → 0.5.2

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