@kitbag/router 0.11.0 → 0.11.1

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.
@@ -290,13 +290,9 @@ export declare class DuplicateParamsError extends Error {
290
290
  */
291
291
  declare type ExtractParamName<TParam extends PropertyKey> = TParam extends `?${infer Param}` ? Param extends '' ? never : Param : TParam extends '' ? never : TParam;
292
292
 
293
- declare type ExtractParamsFromHostString<THost extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = THost extends `${string}${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? {
294
- [P in Param]: ExtractPathParamType<Param, TParams>;
295
- } & ExtractParamsFromHostString<Rest, TParams> : Record<never, never>;
293
+ declare type ExtractParamsFromHostString<THost extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = THost extends `${string}${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? Record<Param, ExtractPathParamType<Param, TParams>> & ExtractParamsFromHostString<Rest, TParams> : Record<never, never>;
296
294
 
297
- declare type ExtractParamsFromPathString<TPath extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = TPath extends `${string}${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? {
298
- [P in Param]: ExtractPathParamType<Param, TParams>;
299
- } & ExtractParamsFromPathString<Rest, TParams> : Record<never, never>;
295
+ declare type ExtractParamsFromPathString<TPath extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = TPath extends `${string}${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? Record<Param, ExtractPathParamType<Param, TParams>> & ExtractParamsFromPathString<Rest, TParams> : Record<never, never>;
300
296
 
301
297
  /**
302
298
  * Extracts the actual type from a parameter type, handling getters, setters, and potential undefined values.
@@ -329,9 +325,7 @@ declare type ExtractParamTypeWithoutLosingOptional<TParam extends Param, TParamK
329
325
  */
330
326
  declare type ExtractPathParamType<TParam extends string, TParams extends Record<string, Param | undefined>> = TParam extends `?${infer OptionalParam}` ? OptionalParam extends keyof TParams ? TParams[OptionalParam] : StringConstructor : TParam extends keyof TParams ? TParams[TParam] : StringConstructor;
331
327
 
332
- declare type ExtractQueryParamsFromQueryString<TQuery extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = TQuery extends `${string}=${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? {
333
- [P in Param]: ExtractPathParamType<Param, TParams>;
334
- } & ExtractQueryParamsFromQueryString<Rest, TParams> : Record<never, never>;
328
+ declare type ExtractQueryParamsFromQueryString<TQuery extends string, TParams extends Record<string, Param | undefined> = Record<never, never>> = TQuery extends `${string}=${ParamStart}${infer Param}${ParamEnd}${infer Rest}` ? Record<Param, ExtractPathParamType<Param, TParams>> & ExtractQueryParamsFromQueryString<Rest, TParams> : Record<never, never>;
335
329
 
336
330
  /**
337
331
  * Extracts combined types of path and query parameters for a given route, creating a unified parameter object.
@@ -425,6 +419,8 @@ declare type IsRouteOptions = {
425
419
 
426
420
  declare type IsRouteUnnamed<T extends Route> = StringHasValue<T['name']> extends true ? false : true;
427
421
 
422
+ export declare function isUrl(value: unknown): value is Url;
423
+
428
424
  declare type MakeOptional<T> = {
429
425
  [P in WithOptionalProperties<T>]?: T[P];
430
426
  } & {
@@ -1084,11 +1080,11 @@ name?: string | undefined;
1084
1080
  route: Readonly<{
1085
1081
  id: string;
1086
1082
  name: string;
1087
- matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
1083
+ matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
1088
1084
  id: string;
1089
1085
  meta: Record<string, unknown>;
1090
1086
  };
1091
- matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
1087
+ matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
1092
1088
  id: string;
1093
1089
  meta: Record<string, unknown>;
1094
1090
  })[];
@@ -1123,11 +1119,11 @@ name?: string | undefined;
1123
1119
  route: Readonly<{
1124
1120
  id: string;
1125
1121
  name: string;
1126
- matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
1122
+ matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
1127
1123
  id: string;
1128
1124
  meta: Record<string, unknown>;
1129
1125
  };
1130
- matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithoutComponents | WithComponent | WithComponents) & (WithoutParent | WithParent) & (WithoutState | WithState) & {
1126
+ matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
1131
1127
  id: string;
1132
1128
  meta: Record<string, unknown>;
1133
1129
  })[];
@@ -1162,7 +1158,7 @@ name?: string | undefined;
1162
1158
  /**
1163
1159
  * Represents an immutable array of Route instances. Return value of `createRoute`, expected param for `createRouter`.
1164
1160
  */
1165
- export declare type Routes = Readonly<Route[]>;
1161
+ export declare type Routes = readonly Route[];
1166
1162
 
1167
1163
  declare type RoutesMap<TRoutes extends Routes = []> = {
1168
1164
  [K in TRoutes[number] as AsNamedRoute<K>['name']]: AsNamedRoute<K>;
@@ -1194,7 +1190,7 @@ declare type ToPath<T extends string | Path | undefined> = T extends string ? Pa
1194
1190
 
1195
1191
  declare type ToQuery<T extends string | Query | undefined> = T extends string ? Query<T, {}> : T extends undefined ? Query<'', {}> : unknown extends T ? Query<'', {}> : T;
1196
1192
 
1197
- declare type Url = `http://${string}` | `https://${string}` | `/${string}` | '/';
1193
+ export declare type Url = `http://${string}` | `https://${string}` | `/${string}` | '/';
1198
1194
 
1199
1195
  export declare type UseLink = {
1200
1196
  /**
@@ -1,6 +1,6 @@
1
1
  var Ye = Object.defineProperty;
2
2
  var Xe = (t, e, n) => e in t ? Ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var M = (t, e, n) => (Xe(t, typeof e != "symbol" ? e + "" : e, n), n);
3
+ var M = (t, e, n) => Xe(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { defineComponent as ut, h as pt, ref as ie, inject as it, toRefs as Ze, reactive as $t, markRaw as dt, defineAsyncComponent as tn, watch as fe, toValue as ht, toRef as en, computed as V, onUnmounted as le, openBlock as he, createElementBlock as nn, normalizeClass as rn, renderSlot as pe, normalizeProps as de, guardReactiveProps as on, unref as ot, resolveComponent as an, provide as sn, mergeProps as cn, createBlock as un, resolveDynamicComponent as fn, createCommentVNode as ln } from "vue";
5
5
  class St extends Error {
6
6
  constructor() {
@@ -845,12 +845,14 @@ function Wn(t) {
845
845
  }
846
846
  function Dn({ mode: t, listener: e }) {
847
847
  const n = Tn(t), r = (c, f) => {
848
- if (f != null && f.replace)
849
- return n.replace(c, f.state);
848
+ if (f != null && f.replace) {
849
+ n.replace(c, f.state);
850
+ return;
851
+ }
850
852
  n.push(c, f == null ? void 0 : f.state);
851
853
  }, o = () => {
852
854
  const c = K(n.location);
853
- return n.replace(c);
855
+ n.replace(c);
854
856
  };
855
857
  let a;
856
858
  return {
@@ -1523,8 +1525,10 @@ function Kr(t, e) {
1523
1525
  onAfterRouteLeave: E
1524
1526
  } = Gn();
1525
1527
  async function A(R, L = {}) {
1526
- if (s.stopListening(), C(R))
1527
- return s.update(R, L);
1528
+ if (s.stopListening(), C(R)) {
1529
+ s.update(R, L);
1530
+ return;
1531
+ }
1528
1532
  const O = Nt(r, R, L.state) ?? m("NotFound"), _ = { ...d }, z = await u({ to: O, from: _, hooks: f });
1529
1533
  switch (z.status) {
1530
1534
  case "ABORT":
@@ -1572,7 +1576,9 @@ function Kr(t, e) {
1572
1576
  }
1573
1577
  const _ = { ...O, replace: !0 }, I = a(R, L ?? {}, _), q = Kt(R), kt = oe((q == null ? void 0 : q.state) ?? {}, _.state);
1574
1578
  return A(I, { ..._, state: kt });
1575
- }, g = (R) => b(R), v = (R, L = {}) => {
1579
+ }, g = (R) => {
1580
+ b(R);
1581
+ }, v = (R, L = {}) => {
1576
1582
  if (!W(R)) {
1577
1583
  const O = a(R, L);
1578
1584
  return Nt(r, O);
@@ -1892,6 +1898,7 @@ export {
1892
1898
  Kr as createRouter,
1893
1899
  Bn as isParamWithDefault,
1894
1900
  Mr as isRoute,
1901
+ W as isUrl,
1895
1902
  Xr as onAfterRouteEnter,
1896
1903
  Zr as onAfterRouteLeave,
1897
1904
  to as onAfterRouteUpdate,
@@ -1 +1 @@
1
- (function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@kitbag/router"]={},y.Vue))})(this,function(y,l){"use strict";var Br=Object.defineProperty;var Lr=(y,l,O)=>l in y?Br(y,l,{enumerable:!0,configurable:!0,writable:!0,value:O}):y[l]=O;var J=(y,l,O)=>(Lr(y,typeof l!="symbol"?l+"":l,O),O);class O extends Error{constructor(){super("Router not installed")}}function ot(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ge(t){return t.every(e=>Array.isArray(e))}function at(t){return typeof t=="string"&&t.length>0}function lt(t){const e=at(t)?t.replace(/^#/,""):void 0;function n(){return e!==void 0}function r(){return n()?`#${t}`:""}return{value:e,hasValue:n,toString:r}}function ze(t,e){return lt(`${t.value??""}${e.value??""}`)}class Ye extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function Xe(t,e){return Ze(t,e),{...t,...e}}function Ze(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new Ye(n)}class Jt extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}function X(t){return Array.isArray(t)?t:[t]}function Qt(t,e){return t.filter(n=>e===n).length}function Z(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(tn));for(const n of e)if(Qt(e,n)>1)throw new Jt(n)}function tn(t){return t.startsWith("?")?t.slice(1):t}function en(t,e){Z(t.params,e.params);const n=`${t.value}${e.value}`;return{value:n,params:{...t.params,...e.params},toString:()=>n}}function nn(t,e){Z(t.params,e.params);const n=[t.value,e.value].filter(at).join("&");return{value:n,params:{...t.params,...e.params},toString:()=>n}}function rn(t,e){return Z(t,e),{...t,...e}}function on(t){return"host"in t&&!!t.host}function Kt(t){return"parent"in t&&!!t.parent}function Et(t){return"component"in t&&!!t.component}function St(t){return"components"in t&&!!t.components}function an(t){return"state"in t&&!!t.state}function Gt(t,e){return{...e,path:en(t.path,e.path),query:nn(t.query,e.query),meta:Xe(t.meta,e.meta),state:rn(t.state,e.state),hash:ze(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function zt(){return typeof window<"u"&&typeof window.document<"u"}function Yt(t,e){return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>l.h(cn(t,n)):()=>l.h(t,n)}})}function cn(t,e){return l.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=l.ref();return(async()=>n.value=await e)(),()=>n.value?l.h(t,n.value):""}})}class tt extends Error{}const M="[",Q="]";function sn(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function un(t){return typeof t=="function"&&sn(t)}function ht(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Xt(t){return ht(t)&&t.defaultValue!==void 0}function fn(t,e){return re(t,e)}function ln(t,e){return t[e]??String}const H={invalid:t=>{throw new tt(t)}},hn={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Zt={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()}},te={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()}},ee={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()}},ne={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 ct(t,e,n=!1){if(t===void 0||!at(t)){if(Xt(e))return e.defaultValue;if(n)return;throw new tt}if(e===String)return hn.get(t,H);if(e===Boolean)return Zt.get(t,H);if(e===Number)return te.get(t,H);if(e===Date)return ee.get(t,H);if(e===JSON)return ne.get(t,H);if(un(e))return e(t,H);if(ht(e))return e.get(t,H);if(e instanceof RegExp){if(e.test(t))return t;throw new tt}return t}function st(t,e,n=!1){if(t===void 0){if(n)return"";throw new tt}if(e===Boolean)return Zt.set(t,H);if(e===Number)return te.set(t,H);if(e===Date)return ee.set(t,H);if(e===JSON)return ne.set(t,H);if(ht(e))return e.set(t,H);try{return t.toString()}catch{throw new tt}}function re(t,e){return ht(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>ct(n,t),set:n=>st(n,t),defaultValue:e}}function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},K.apply(this,arguments)}var j;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(j||(j={}));var et=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function z(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var pt="beforeunload",pn="hashchange",oe="popstate";function ae(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var g=r.location,h=g.pathname,m=g.search,E=g.hash,S=o.state||{};return[S.idx,et({pathname:h,search:m,hash:E,state:S.usr||null,key:S.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var g=j.Pop,h=a(),m=h[0],E=h[1];if(d.length)if(m!=null){var S=i-m;S&&(c={action:g,location:E,retry:function(){k(S*-1)}},k(S))}else process.env.NODE_ENV!=="production"&&z(!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 _(g)}}r.addEventListener(oe,u);var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(K({},o.state,{idx:i}),""));function A(g){return typeof g=="string"?g:Y(g)}function b(g,h){return h===void 0&&(h=null),et(K({pathname:p.pathname,hash:"",search:""},typeof g=="string"?ut(g):g,{state:h,key:mt()}))}function x(g,h){return[{usr:g.state,key:g.key,idx:h},A(g)]}function L(g,h,m){return!d.length||(d.call({action:g,location:h,retry:m}),!1)}function _(g){s=g;var h=a();i=h[0],p=h[1],v.call({action:s,location:p})}function R(g,h){var m=j.Push,E=b(g,h);function S(){R(g,h)}if(L(m,E,S)){var U=x(E,i+1),C=U[0],V=U[1];try{o.pushState(C,"",V)}catch{r.location.assign(V)}_(m)}}function P(g,h){var m=j.Replace,E=b(g,h);function S(){P(g,h)}if(L(m,E,S)){var U=x(E,i),C=U[0],V=U[1];o.replaceState(C,"",V),_(m)}}function k(g){o.go(g)}var B={get action(){return s},get location(){return p},createHref:A,push:R,replace:P,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return v.push(h)},block:function(h){var m=d.push(h);return d.length===1&&r.addEventListener(pt,dt),function(){m(),d.length||r.removeEventListener(pt,dt)}}};return B}function dn(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=ut(r.location.hash.substr(1)),m=h.pathname,E=m===void 0?"/":m,S=h.search,U=S===void 0?"":S,C=h.hash,V=C===void 0?"":C,$=o.state||{};return[$.idx,et({pathname:E,search:U,hash:V,state:$.usr||null,key:$.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var h=j.Pop,m=a(),E=m[0],S=m[1];if(d.length)if(E!=null){var U=i-E;U&&(c={action:h,location:S,retry:function(){B(U*-1)}},B(U))}else process.env.NODE_ENV!=="production"&&z(!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(h)}}r.addEventListener(oe,u),r.addEventListener(pn,function(){var h=a(),m=h[1];Y(m)!==Y(p)&&u()});var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(K({},o.state,{idx:i}),""));function A(){var h=document.querySelector("base"),m="";if(h&&h.getAttribute("href")){var E=r.location.href,S=E.indexOf("#");m=S===-1?E:E.slice(0,S)}return m}function b(h){return A()+"#"+(typeof h=="string"?h:Y(h))}function x(h,m){return m===void 0&&(m=null),et(K({pathname:p.pathname,hash:"",search:""},typeof h=="string"?ut(h):h,{state:m,key:mt()}))}function L(h,m){return[{usr:h.state,key:h.key,idx:m},b(h)]}function _(h,m,E){return!d.length||(d.call({action:h,location:m,retry:E}),!1)}function R(h){s=h;var m=a();i=m[0],p=m[1],v.call({action:s,location:p})}function P(h,m){var E=j.Push,S=x(h,m);function U(){P(h,m)}if(process.env.NODE_ENV!=="production"&&z(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),_(E,S,U)){var C=L(S,i+1),V=C[0],$=C[1];try{o.pushState(V,"",$)}catch{r.location.assign($)}R(E)}}function k(h,m){var E=j.Replace,S=x(h,m);function U(){k(h,m)}if(process.env.NODE_ENV!=="production"&&z(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),_(E,S,U)){var C=L(S,i),V=C[0],$=C[1];o.replaceState(V,"",$),R(E)}}function B(h){o.go(h)}var g={get action(){return s},get location(){return p},createHref:b,push:P,replace:k,go:B,back:function(){B(-1)},forward:function(){B(1)},listen:function(m){return v.push(m)},block:function(m){var E=d.push(m);return d.length===1&&r.addEventListener(pt,dt),function(){E(),d.length||r.removeEventListener(pt,dt)}}};return g}function ce(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(R){var P=et(K({pathname:"/",search:"",hash:"",state:null,key:mt()},typeof R=="string"?ut(R):R));return process.env.NODE_ENV!=="production"&&z(P.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(R)+")"),P}),c=se(o??a.length-1,0,a.length-1),u=j.Pop,s=a[c],f=nt(),i=nt();function p(R){return typeof R=="string"?R:Y(R)}function v(R,P){return P===void 0&&(P=null),et(K({pathname:s.pathname,search:"",hash:""},typeof R=="string"?ut(R):R,{state:P,key:mt()}))}function d(R,P,k){return!i.length||(i.call({action:R,location:P,retry:k}),!1)}function A(R,P){u=R,s=P,f.call({action:u,location:s})}function b(R,P){var k=j.Push,B=v(R,P);function g(){b(R,P)}process.env.NODE_ENV!=="production"&&z(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(R)+")"),d(k,B,g)&&(c+=1,a.splice(c,a.length,B),A(k,B))}function x(R,P){var k=j.Replace,B=v(R,P);function g(){x(R,P)}process.env.NODE_ENV!=="production"&&z(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(R)+")"),d(k,B,g)&&(a[c]=B,A(k,B))}function L(R){var P=se(c+R,0,a.length-1),k=j.Pop,B=a[P];function g(){L(R)}d(k,B,g)&&(c=P,A(k,B))}var _={get index(){return c},get action(){return u},get location(){return s},createHref:p,push:b,replace:x,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(P){return f.push(P)},block:function(P){return i.push(P)}};return _}function se(t,e,n){return Math.min(Math.max(t,e),n)}function dt(t){t.preventDefault(),t.returnValue=""}function nt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function mt(){return Math.random().toString(36).substr(2,8)}function Y(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function ut(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}class ue extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const bt=Symbol();function ie(){const t=l.inject(bt);if(!t)throw new O;return t}const At=Symbol();function gt(){const t=l.inject(At);if(!t)throw new O;return t}const fe=Symbol("isRouterRouteSymbol");function mn(t){return typeof t=="object"&&t!==null&&fe in t}function gn(t,e){function n(v,d,A){if(typeof v=="object"){const x={...t.params,...v};return e(t.name,x,d)}const b={...t.params,[v]:d};return e(t.name,b,A)}const{id:r,matched:o,matches:a,name:c,query:u,params:s,state:f,hash:i}=l.toRefs(t),p=l.reactive({id:r,matched:o,matches:a,state:f,query:u,hash:i,params:s,name:c,update:n,[fe]:!0});return new Proxy(p,{get:(v,d,A)=>d==="params"?new Proxy(t.params,{set(b,x,L){return n(x,L),!0}}):d==="state"?new Proxy(t.state,{set(b,x,L){return n({},{state:{...t.state,[x]:L}}),!0}}):Reflect.get(v,d,A)})}const le=Symbol();function Rn(t,e){const n=l.reactive({...t}),r=c=>{Object.assign(n,{[le]:!1,...c})},o=n,a=gn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:r}}function W(t){return!t.startsWith("http")?wn(t):yn(t)}function yn(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}}function wn(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function vn(t){return e=>{const{host:n}=W(e);return!(n===void 0||n===t)}}function Pn({mode:t,listener:e}){const n=En(t),r=(s,f)=>{if(f!=null&&f.replace)return n.replace(s,f.state);n.push(s,f==null?void 0:f.state)},o=()=>{const s=Y(n.location);return n.replace(s)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function En(t="auto"){switch(t){case"auto":return zt()?ae():ce();case"browser":return ae();case"memory":return ce();case"hash":return dn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}class Rt{constructor(){J(this,"onBeforeRouteEnter",new Set);J(this,"onBeforeRouteUpdate",new Set);J(this,"onBeforeRouteLeave",new Set);J(this,"onAfterRouteEnter",new Set);J(this,"onAfterRouteUpdate",new Set);J(this,"onAfterRouteLeave",new Set)}}class he extends Error{}class it extends Error{constructor(n){super("Error occurred during a router push operation.");J(this,"to");this.to=n}}class kt extends Error{constructor(n){super(`Routing action rejected: ${n}`);J(this,"type");this.type=n}}function Sn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&xt(t,e,o)&&X(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Lt(t,e,o)&&X(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Bt(t,e,o)&&X(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function bn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&xt(t,e,o)&&X(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Lt(t,e,o)&&X(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Bt(t,e,o)&&X(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function T(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function An(){const t=c=>{throw new kt(c)},e=(...c)=>{throw new it(c)},n=(c,u,s)=>{if(T(c)){const p=u??{};throw new it([c,{...p,replace:!0}])}const f=u,i=s??{};throw new it([c,f,{...i,replace:!0}])},r=()=>{throw new he};async function o({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=Sn(c,u),v=[...f.onBeforeRouteEnter,...p.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...p.onBeforeRouteUpdate,...i.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...p.onBeforeRouteLeave,...i.onBeforeRouteLeave];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};if(d instanceof he)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=bn(c,u),v=[...i.onAfterRouteLeave,...p.onAfterRouteLeave,...f.onAfterRouteLeave,...i.onAfterRouteUpdate,...p.onAfterRouteUpdate,...f.onAfterRouteUpdate,...i.onAfterRouteEnter,...p.onAfterRouteEnter,...f.onAfterRouteEnter];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const xt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Bt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Lt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function pe(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return xt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Lt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function kn(){const t={global:new Rt,component:new Rt};function e({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}return{...t,addBeforeRouteHook:e,addAfterRouteHook:n}}const de=Symbol();function xn(){const t=kn();return{onBeforeRouteEnter:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:u,timing:"global",depth:0}),onBeforeRouteUpdate:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:u,timing:"global",depth:0}),onBeforeRouteLeave:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:u,timing:"global",depth:0}),onAfterRouteEnter:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:u,timing:"global",depth:0}),onAfterRouteUpdate:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:u,timing:"global",depth:0}),onAfterRouteLeave:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:u,timing:"global",depth:0}),hooks:t}}function Bn(t){return l.defineComponent(()=>()=>l.h("h1",t),{name:t,props:[]})}function me(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}function Ln(){let t=0;return()=>(++t).toString()}const Ut=Ln();function Un({rejections:t}){const e=a=>{const c={...t};return l.markRaw(c[a]??Bn(a))},n=a=>{const c=l.markRaw(e(a)),u={id:Ut(),name:a,component:c,meta:{},state:{}};return{id:u.id,matched:u,matches:[u],name:a,query:me(""),params:{},state:{},[le]:!0}},r=a=>{if(!a){o.value=null;return}const c=e(a);o.value={type:a,component:c}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Nn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Nt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((c,u)=>{const s=Nt(t.slice(r,u.index));s.length&&c.push(s);const[f]=u;return c.push(f),r=u.index+f.length,c},[]),a=t.slice(r);return a&&o.push(a),o}function jn(t){const e=ge(t.path.toString());return new RegExp(`^${e}$`,"i")}function $n(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!jt(n)).map(([n,r])=>{const o=ge(r);return new RegExp(`${Nt(n)}=${o}(&|$)`,"i")})}function ge(t){return Cn(t,new RegExp(Hn,"g")).map(e=>e.startsWith(M)?Re(e):Nt(e)).join("")}function Re(t){return[Vn,On].reduce((e,n)=>n(e),t)}const Hn=`\\${M}\\??([\\w-_]+)\\${Q}`,Ct=`\\${M}\\?([\\w-_]+)\\${Q}`,ye=`\\${M}([\\w-_]+)\\${Q}`;function Vn(t){return t.replace(new RegExp(Ct,"g"),".*")}function jt(t){return new RegExp(Ct,"g").test(t)}function On(t){return t.replace(new RegExp(ye,"g"),".+")}function yt(t){const[e]=wt(t,new RegExp(Ct,"g")),[n]=wt(t,new RegExp(ye,"g"));return e??n}function wt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>at(o)?o:""))}function we(t,e,n){const r=Pe(e,n),[o]=wt(t,r);return o}function ve(t,e){if(!e)return t;const{name:n,param:r,value:o}=e,a=Pe(t,n);return wt(t,a).reduce((u,s)=>s===void 0?u:u.replace(s,()=>st(o,r,n.startsWith("?"))),t)}function Pe(t,e){const n=[_n,qn,Re].reduce((r,o)=>o(r,e),t);return new RegExp(n,"g")}function _n(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${M}\\${e}\\${Q}`,"g");return t.replace(n,"(.*)")}function qn(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${M}${e}\\${Q}`,"g");return t.replace(n,"(.+)")}function Ee(t,...e){return e.reduce((n,r)=>{if(!r)return n;const o=new URLSearchParams(r).toString();return Object.keys(o).length===0?n:n.includes("?")?`${n}&${o}`:`${n}?${o}`},t)}function Dn(t,e={}){const{params:n={},query:r}=e,o=Mn(t.host,n),a=Wn(t.path,n),c=Tn(t.query,n),u=Ee(`${o}${a}`,c,r),s=lt(t.hash.value??e.hash).toString();return`${u}${s}`}function Mn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${M}${o}${Q}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Wn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${M}${o}${Q}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Tn(t,e){const n=t.toString();if(!n)return{};const r=new URLSearchParams(n);return Array.from(r.entries()).reduce((o,[a,c])=>{const u=yt(c);if(!u)return{...o,[a]:c};const f=st(e[u],t.params[u],jt(c)),i=e[u]===void 0&&f==="";return jt(c)&&i?o:{...o,[a]:f}},{})}function In(t){return(e,n,r)=>{if(T(e))return Ee(e,(n??{}).query);const o=n??{},a=r??{},c=t.find(s=>s.name===e);if(!c)throw new Nn(String(e));return Dn(c,{params:o,query:a.query,hash:a.hash})}}class Fn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jn(t){if(t)return t;if(zt())return window.location.toString();throw new Fn}const Qn=(t,e)=>{try{Se(t,e)}catch{return!1}return!0},Se=(t,e)=>{const{pathname:n,search:r}=W(e);return{...Kn(t.path,n),...Gn(t.query,r)}};function Kn(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=we(r,t.toString(),o),f=ct(s,a,c);n[u]=f}return n}function Gn(t,e){const n={},r=new URLSearchParams(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=r.get(u)??void 0,f=ct(s,a,c);n[u]=f}return n}const zn=t=>"name"in t.matched&&!!t.matched.name,Yn=(t,e)=>{const{pathname:n}=W(e);return jn(t).test(n)},Xn=(t,e)=>{const{search:n}=W(e);return $n(t).every(o=>o.test(n))},Zn=(t,e)=>{const{hash:n}=W(e),r=t.hash.toString();return!t.hash.hasValue()||r.toLowerCase()===n.toLowerCase()};function tr(t){const{searchParams:e,pathname:n}=W(t),r=-1,o=1;return(a,c)=>{const u=Ae(a,e),s=be(a,n),f=Ae(c,e),i=be(c,n);if(a.depth>c.depth)return r;if(a.depth<c.depth)return o;if(u+s>f+i)return r;if(u+s<f+i)return o;const{hash:p}=W(t);return a.hash.toString()===p?r:c.hash.toString()===p?o:0}}function be(t,e){const n=Object.keys(t.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>we(e,t.path.toString(),o)===void 0);return n.length-r.length}function Ae(t,e){const n=new URLSearchParams(t.query.toString()),r=Array.from(n.keys()),o=r.filter(a=>!e.has(a));return r.length-o.length}function ke(t){return!!t&&typeof t=="object"}const vt=!0;function er(t,e,n){if(ke(t)&&e in t){const r=t[e];if(typeof r=="string")return ct(r,n,vt)}return ct(void 0,n,vt)}function nr(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=er(e,r,o);n[r]=a}return n}function rr(t,e,n){if(ke(t)&&e in t){const r=t[e];return st(r,n,vt)}return st(void 0,n,vt)}const xe=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=rr(e,r,o);n[r]=a}return n},or=[zn,Yn,Xn,Zn,Qn];function $t(t,e,n){const r=tr(e),o=t.filter(s=>or.every(f=>f(s,e))).sort(r);if(o.length===0)return;const[a]=o,{search:c,hash:u}=W(e);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:me(c),params:Se(a,e),state:nr(a.state,n),hash:u}}function Ht(t,e){const n=new RegExp(`\\${M}(\\??[\\w-_]+)\\${Q}`,"g");return Array.from(t.matchAll(n)).reduce((o,[a,c])=>{const u=yt(a);if(!u)return o;const s=ln(e,u);return Z([u],o),o[c]=s,o},{})}function Be(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function ar(t){return ot(t)&&typeof t.hash=="string"}function Le(t){return t===void 0?lt():ar(t)?t:lt(t)}function Vt(t){return t===void 0?"":t}function Ot(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function cr(t){return ot(t)&&typeof t.value=="string"}function Ue(t){return t===void 0?Ot("",{}):cr(t)?t:Ot(t,{})}function _t(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function sr(t){return ot(t)&&typeof t.value=="string"}function Ne(t){return t===void 0?_t("",{}):sr(t)?t:_t(t,{})}function I(t){const e=Ut(),n=Vt(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=an(t)?t.state:{},s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,path:r,query:o,hash:a,meta:c,state:u,depth:1,host:Be("",{}),prefetch:t.prefetch},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params),i}function ur(t,e){if(!at(e))return t;const n=I({path:e});return t.map(r=>I({parent:n,...r}))}class ir extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function fr(t){const e=t.map(({name:n})=>n);for(const n of e)if(Qt(e,n)>1)throw new ir(n)}function lr(t,e){const n=Ge(t)?t.flat():t,r=ur(n,e==null?void 0:e.base);fr(r);const o=mr(),a=In(r),c=Pn({mode:e==null?void 0:e.historyMode,listener:({location:w})=>{const N=Y(w);x(N,{state:w.state})}}),{runBeforeRouteHooks:u,runAfterRouteHooks:s}=An(),{hooks:f,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b}=xn();async function x(w,N={}){if(c.stopListening(),$(w))return c.update(w,N);const q=$t(r,w,N.state)??g("NotFound"),D={...m},rt=await u({to:q,from:D,hooks:f});switch(rt.status){case"ABORT":return;case"PUSH":c.update(w,N),await L(...rt.to);return;case"REJECT":c.update(w,N),k(rt.type);break;case"SUCCESS":c.update(w,N),k(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(rt)}`)}o.setProps(q),S(q);const G=await s({to:q,from:D,hooks:f});switch(G.status){case"PUSH":await L(...G.to);break;case"REJECT":k(G.type);break;case"SUCCESS":break;default:const F=G;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(F)}`)}c.startListening()}const L=(w,N,q)=>{if(T(w)){const ft={...N},Ft=a(w,ft);return x(Ft,ft)}const D={...q},G=a(w,N??{},D),F=Qe(w),It=xe((F==null?void 0:F.state)??{},D.state);return x(G,{...D,state:It})},_=(w,N,q)=>{if(T(w)){const ft={...N,replace:!0},Ft=a(w,ft);return x(Ft,ft)}const D={...q,replace:!0},G=a(w,N??{},D),F=Qe(w),It=xe((F==null?void 0:F.state)??{},D.state);return x(G,{...D,state:It})},R=w=>k(w),P=(w,N={})=>{if(!T(w)){const q=a(w,N);return $t(r,q)}if(!$(w))return $t(r,w)},{setRejection:k,rejection:B,getRejectionRoute:g}=Un(e??{}),h=g("NotFound"),{currentRoute:m,routerRoute:E,updateRoute:S}=Rn(h,L);c.startListening();const U=Jn(e==null?void 0:e.initialUrl),C=c.location.state,{host:V}=W(U),$=vn(V);let Tt=!1;async function Je(){Tt||(await x(U,{replace:!0,state:C}),Tt=!0)}function Qe(w){return r.find(N=>N.name===w)}function xr(w){w.component("RouterView",Ie),w.component("RouterLink",Te),w.provide(bt,B),w.provide(de,f),w.provide($e,o),w.provide(At,Ke),Je()}const Ke={route:E,resolve:a,push:L,replace:_,reject:R,find:P,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:xr,isExternal:$,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b,prefetch:e==null?void 0:e.prefetch,start:Je};return Ke}const Pt={template:"<div>This is component</div>"},qt=I({name:"parentA",path:"/parentA/[paramA]"}),Ce=I({parent:qt,name:"parentA.childA",path:"/[?paramB]"}),hr=I({parent:qt,name:"parentA.childB",path:"/[paramD]",component:Pt}),pr=I({parent:Ce,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Pt});I({name:"parentB",path:"/parentB",component:Pt}),I({name:"parentC",path:"/",component:Pt});const dr={components:!0,props:!1};function je({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){return Dt(n,r)??Dt(e,r)??Dt(t,r)??dr[r]}function Dt(t,e){return ot(t)?t[e]:t}const $e=Symbol();function mr(){const t=l.reactive(new Map),e=(s,f)=>s.matches.filter(i=>je({...f,routePrefetch:i.prefetch},"props")).flatMap(i=>c(i)).reduce((i,{id:p,name:v,props:d})=>{const A=a(p,v,s);return i[A]=d==null?void 0:d(s.params),i},{}),n=s=>{Object.entries(s).forEach(([f,i])=>{t.set(f,i)})},r=s=>{const i=s.matches.flatMap(c).reduce((p,{id:v,name:d,props:A})=>{const b=a(v,d,s);if(!A||t.has(b))return p;const x=A(s.params);return t.set(b,x),p.push(b),p},[]);u(i)},o=(s,f,i)=>{const p=a(s,f,i);return t.get(p)};function a(s,f,i){return[s,f,i.id,JSON.stringify(i.params)].join("-")}function c(s){return St(s)?Object.entries(s.props??{}).map(([f,i])=>({id:s.id,name:f,props:i})):Et(s)?[{id:s.id,name:"default",props:s.props}]:[]}function u(s){for(const f in t.keys())s.includes(f)||t.delete(f)}return{getPrefetchProps:e,setPrefetchProps:n,getProps:o,setProps:r}}function He(){const t=l.inject($e);if(!t)throw new O;return t}const gr=l.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Ve(t){return t.name===gr.name&&"setup"in t}function Rr(t){let e={};const{getPrefetchProps:n,setPrefetchProps:r}=He();return l.watch(()=>l.toValue(t),({route:a,...c})=>{a&&(yr(a,c),e=n(a,c))},{immediate:!0}),{commit:()=>{r(e)}}}function yr(t,{routerPrefetch:e,linkPrefetch:n}){t.matches.forEach(r=>{je({routePrefetch:r.prefetch,routerPrefetch:e,linkPrefetch:n},"components")&&(Et(r)&&Ve(r.component)&&r.component.setup(),St(r)&&Object.values(r.components).forEach(a=>{Ve(a)&&a.setup()}))})}function Oe(t,e={},n={}){const r=gt(),o=l.toRef(t),a=l.computed(()=>T(o.value)?{}:l.toValue(e)),c=l.computed(()=>T(o.value)?l.toValue(e):l.toValue(n)),u=l.computed(()=>{if(T(o.value))return o.value;try{return r.resolve(o.value,a.value,c.value)}catch(b){throw b instanceof tt&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,b),b}}),s=l.computed(()=>r.find(u.value,c.value)),f=l.computed(()=>!!s.value&&r.route.matches.includes(s.value.matched)),i=l.computed(()=>!!s.value&&r.route.matched===s.value.matched),p=l.computed(()=>r.isExternal(u.value)),{commit:v}=Rr(()=>({route:s.value,routerPrefetch:r.prefetch,linkPrefetch:c.value.prefetch})),d=b=>(v(),r.push(u.value,{...c.value,...b}));return{route:s,href:u,isMatch:f,isExactMatch:i,isExternal:p,push:d,replace:b=>d(b)}}function _e(t,e,{exact:n}={}){if(!mn(t))return!1;if(e===void 0)return!0;const r=t.matches.map(o=>Vt(o.name));if(n){const o=r.at(-1);return e===o}return r.includes(e)}function qe(t,e){const n=gt();function r(){if(!t)return;if(!_e(n.route,t,e))throw new ue(t,n.route.name)}return l.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const De=Symbol();function Mt(){return l.inject(De,0)}function Me(){const t=l.inject(de);if(!t)throw new O;return t}function We(t){return e=>{const n=Mt(),o=Me().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}function Wt(t){return e=>{const n=Mt(),o=Me().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}const wr=We("onBeforeRouteUpdate"),vr=We("onBeforeRouteLeave"),Pr=Wt("onAfterRouteEnter"),Er=Wt("onAfterRouteUpdate"),Sr=Wt("onAfterRouteLeave"),br=["href"],Te=l.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,n=gt(),r=l.computed(()=>T(e.to)?e.to:e.to(n.resolve)),o=l.computed(()=>{const{to:p,...v}=e;return v}),{isMatch:a,isExactMatch:c,isExternal:u,push:s}=Oe(r,o),f=l.computed(()=>({"router-link--match":a.value,"router-link--exact-match":c.value}));function i(p){p.preventDefault(),s()}return(p,v)=>(l.openBlock(),l.createElementBlock("a",{href:r.value,class:l.normalizeClass(["router-link",f.value]),onClick:i},[l.renderSlot(p.$slots,"default",l.normalizeProps(l.guardReactiveProps({resolved:r.value,isMatch:l.unref(a),isExactMatch:l.unref(c),isExternal:l.unref(u)})))],10,br))}}),Ie=l.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=qe(),r=ie(),o=Mt(),{getProps:a}=He(),c=l.resolveComponent("RouterView",!0);l.provide(De,o+1);const u=l.computed(()=>{if(r.value)return r.value.component;const i=n.matches.at(o);if(!i)return null;const p=s(i),v=a(i.id,e,n);return p?v?Yt(p,()=>v):p:null});function s(i){return f(i)[e]}function f(i){return St(i)?i.components:Et(i)?{default:i.component}:typeof c=="string"?{}:{default:c}}return(i,p)=>u.value?l.renderSlot(i.$slots,"default",l.normalizeProps(l.mergeProps({key:0},{route:l.unref(n),component:u.value,rejection:l.unref(r)})),()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.value)))]):l.createCommentVNode("",!0)}});function Ar(t){return ot(t)&&typeof t.value=="string"}function Fe(t){return Ar(t)?t:Be(t,{})}function kr(t){const e=Ut(),n=Vt(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=on(t)?Fe(t.host):Fe(""),s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,host:u,path:r,query:o,hash:a,meta:c,depth:1,state:{}},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params,i.host.params),i}y.DuplicateParamsError=Jt,y.RouterLink=Te,y.RouterNotInstalledError=O,y.RouterView=Ie,y.UseRouteInvalidError=ue,y.component=Yt,y.createExternalRoute=kr,y.createParam=re,y.createRoute=I,y.createRouter=lr,y.isParamWithDefault=Xt,y.isRoute=_e,y.onAfterRouteEnter=Pr,y.onAfterRouteLeave=Er,y.onAfterRouteUpdate=Sr,y.onBeforeRouteLeave=wr,y.onBeforeRouteUpdate=vr,y.path=Ot,y.query=_t,y.routerInjectionKey=At,y.routerRejectionKey=bt,y.useLink=Oe,y.useRejection=ie,y.useRoute=qe,y.useRouter=gt,y.withDefault=fn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
1
+ (function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@kitbag/router"]={},y.Vue))})(this,function(y,l){"use strict";var Br=Object.defineProperty;var Lr=(y,l,O)=>l in y?Br(y,l,{enumerable:!0,configurable:!0,writable:!0,value:O}):y[l]=O;var J=(y,l,O)=>Lr(y,typeof l!="symbol"?l+"":l,O);class O extends Error{constructor(){super("Router not installed")}}function ot(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ge(t){return t.every(e=>Array.isArray(e))}function at(t){return typeof t=="string"&&t.length>0}function lt(t){const e=at(t)?t.replace(/^#/,""):void 0;function n(){return e!==void 0}function r(){return n()?`#${t}`:""}return{value:e,hasValue:n,toString:r}}function ze(t,e){return lt(`${t.value??""}${e.value??""}`)}class Ye extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function Xe(t,e){return Ze(t,e),{...t,...e}}function Ze(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new Ye(n)}class Jt extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}function X(t){return Array.isArray(t)?t:[t]}function Qt(t,e){return t.filter(n=>e===n).length}function Z(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(tn));for(const n of e)if(Qt(e,n)>1)throw new Jt(n)}function tn(t){return t.startsWith("?")?t.slice(1):t}function en(t,e){Z(t.params,e.params);const n=`${t.value}${e.value}`;return{value:n,params:{...t.params,...e.params},toString:()=>n}}function nn(t,e){Z(t.params,e.params);const n=[t.value,e.value].filter(at).join("&");return{value:n,params:{...t.params,...e.params},toString:()=>n}}function rn(t,e){return Z(t,e),{...t,...e}}function on(t){return"host"in t&&!!t.host}function Kt(t){return"parent"in t&&!!t.parent}function Et(t){return"component"in t&&!!t.component}function St(t){return"components"in t&&!!t.components}function an(t){return"state"in t&&!!t.state}function Gt(t,e){return{...e,path:en(t.path,e.path),query:nn(t.query,e.query),meta:Xe(t.meta,e.meta),state:rn(t.state,e.state),hash:ze(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function zt(){return typeof window<"u"&&typeof window.document<"u"}function Yt(t,e){return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>l.h(cn(t,n)):()=>l.h(t,n)}})}function cn(t,e){return l.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=l.ref();return(async()=>n.value=await e)(),()=>n.value?l.h(t,n.value):""}})}class tt extends Error{}const W="[",Q="]";function sn(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function un(t){return typeof t=="function"&&sn(t)}function ht(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Xt(t){return ht(t)&&t.defaultValue!==void 0}function fn(t,e){return re(t,e)}function ln(t,e){return t[e]??String}const H={invalid:t=>{throw new tt(t)}},hn={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Zt={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()}},te={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()}},ee={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()}},ne={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 ct(t,e,n=!1){if(t===void 0||!at(t)){if(Xt(e))return e.defaultValue;if(n)return;throw new tt}if(e===String)return hn.get(t,H);if(e===Boolean)return Zt.get(t,H);if(e===Number)return te.get(t,H);if(e===Date)return ee.get(t,H);if(e===JSON)return ne.get(t,H);if(un(e))return e(t,H);if(ht(e))return e.get(t,H);if(e instanceof RegExp){if(e.test(t))return t;throw new tt}return t}function st(t,e,n=!1){if(t===void 0){if(n)return"";throw new tt}if(e===Boolean)return Zt.set(t,H);if(e===Number)return te.set(t,H);if(e===Date)return ee.set(t,H);if(e===JSON)return ne.set(t,H);if(ht(e))return e.set(t,H);try{return t.toString()}catch{throw new tt}}function re(t,e){return ht(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>ct(n,t),set:n=>st(n,t),defaultValue:e}}function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},K.apply(this,arguments)}var j;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(j||(j={}));var et=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function z(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var pt="beforeunload",pn="hashchange",oe="popstate";function ae(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var g=r.location,h=g.pathname,m=g.search,E=g.hash,S=o.state||{};return[S.idx,et({pathname:h,search:m,hash:E,state:S.usr||null,key:S.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var g=j.Pop,h=a(),m=h[0],E=h[1];if(d.length)if(m!=null){var S=i-m;S&&(c={action:g,location:E,retry:function(){k(S*-1)}},k(S))}else process.env.NODE_ENV!=="production"&&z(!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(g)}}r.addEventListener(oe,u);var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(K({},o.state,{idx:i}),""));function A(g){return typeof g=="string"?g:Y(g)}function b(g,h){return h===void 0&&(h=null),et(K({pathname:p.pathname,hash:"",search:""},typeof g=="string"?ut(g):g,{state:h,key:mt()}))}function x(g,h){return[{usr:g.state,key:g.key,idx:h},A(g)]}function L(g,h,m){return!d.length||(d.call({action:g,location:h,retry:m}),!1)}function q(g){s=g;var h=a();i=h[0],p=h[1],v.call({action:s,location:p})}function R(g,h){var m=j.Push,E=b(g,h);function S(){R(g,h)}if(L(m,E,S)){var U=x(E,i+1),C=U[0],V=U[1];try{o.pushState(C,"",V)}catch{r.location.assign(V)}q(m)}}function P(g,h){var m=j.Replace,E=b(g,h);function S(){P(g,h)}if(L(m,E,S)){var U=x(E,i),C=U[0],V=U[1];o.replaceState(C,"",V),q(m)}}function k(g){o.go(g)}var B={get action(){return s},get location(){return p},createHref:A,push:R,replace:P,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return v.push(h)},block:function(h){var m=d.push(h);return d.length===1&&r.addEventListener(pt,dt),function(){m(),d.length||r.removeEventListener(pt,dt)}}};return B}function dn(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=ut(r.location.hash.substr(1)),m=h.pathname,E=m===void 0?"/":m,S=h.search,U=S===void 0?"":S,C=h.hash,V=C===void 0?"":C,$=o.state||{};return[$.idx,et({pathname:E,search:U,hash:V,state:$.usr||null,key:$.key||"default"})]}var c=null;function u(){if(c)d.call(c),c=null;else{var h=j.Pop,m=a(),E=m[0],S=m[1];if(d.length)if(E!=null){var U=i-E;U&&(c={action:h,location:S,retry:function(){B(U*-1)}},B(U))}else process.env.NODE_ENV!=="production"&&z(!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(h)}}r.addEventListener(oe,u),r.addEventListener(pn,function(){var h=a(),m=h[1];Y(m)!==Y(p)&&u()});var s=j.Pop,f=a(),i=f[0],p=f[1],v=nt(),d=nt();i==null&&(i=0,o.replaceState(K({},o.state,{idx:i}),""));function A(){var h=document.querySelector("base"),m="";if(h&&h.getAttribute("href")){var E=r.location.href,S=E.indexOf("#");m=S===-1?E:E.slice(0,S)}return m}function b(h){return A()+"#"+(typeof h=="string"?h:Y(h))}function x(h,m){return m===void 0&&(m=null),et(K({pathname:p.pathname,hash:"",search:""},typeof h=="string"?ut(h):h,{state:m,key:mt()}))}function L(h,m){return[{usr:h.state,key:h.key,idx:m},b(h)]}function q(h,m,E){return!d.length||(d.call({action:h,location:m,retry:E}),!1)}function R(h){s=h;var m=a();i=m[0],p=m[1],v.call({action:s,location:p})}function P(h,m){var E=j.Push,S=x(h,m);function U(){P(h,m)}if(process.env.NODE_ENV!=="production"&&z(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),q(E,S,U)){var C=L(S,i+1),V=C[0],$=C[1];try{o.pushState(V,"",$)}catch{r.location.assign($)}R(E)}}function k(h,m){var E=j.Replace,S=x(h,m);function U(){k(h,m)}if(process.env.NODE_ENV!=="production"&&z(S.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),q(E,S,U)){var C=L(S,i),V=C[0],$=C[1];o.replaceState(V,"",$),R(E)}}function B(h){o.go(h)}var g={get action(){return s},get location(){return p},createHref:b,push:P,replace:k,go:B,back:function(){B(-1)},forward:function(){B(1)},listen:function(m){return v.push(m)},block:function(m){var E=d.push(m);return d.length===1&&r.addEventListener(pt,dt),function(){E(),d.length||r.removeEventListener(pt,dt)}}};return g}function ce(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(R){var P=et(K({pathname:"/",search:"",hash:"",state:null,key:mt()},typeof R=="string"?ut(R):R));return process.env.NODE_ENV!=="production"&&z(P.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(R)+")"),P}),c=se(o??a.length-1,0,a.length-1),u=j.Pop,s=a[c],f=nt(),i=nt();function p(R){return typeof R=="string"?R:Y(R)}function v(R,P){return P===void 0&&(P=null),et(K({pathname:s.pathname,search:"",hash:""},typeof R=="string"?ut(R):R,{state:P,key:mt()}))}function d(R,P,k){return!i.length||(i.call({action:R,location:P,retry:k}),!1)}function A(R,P){u=R,s=P,f.call({action:u,location:s})}function b(R,P){var k=j.Push,B=v(R,P);function g(){b(R,P)}process.env.NODE_ENV!=="production"&&z(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(R)+")"),d(k,B,g)&&(c+=1,a.splice(c,a.length,B),A(k,B))}function x(R,P){var k=j.Replace,B=v(R,P);function g(){x(R,P)}process.env.NODE_ENV!=="production"&&z(s.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(R)+")"),d(k,B,g)&&(a[c]=B,A(k,B))}function L(R){var P=se(c+R,0,a.length-1),k=j.Pop,B=a[P];function g(){L(R)}d(k,B,g)&&(c=P,A(k,B))}var q={get index(){return c},get action(){return u},get location(){return s},createHref:p,push:b,replace:x,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(P){return f.push(P)},block:function(P){return i.push(P)}};return q}function se(t,e,n){return Math.min(Math.max(t,e),n)}function dt(t){t.preventDefault(),t.returnValue=""}function nt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function mt(){return Math.random().toString(36).substr(2,8)}function Y(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function ut(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}class ue extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const bt=Symbol();function ie(){const t=l.inject(bt);if(!t)throw new O;return t}const At=Symbol();function gt(){const t=l.inject(At);if(!t)throw new O;return t}const fe=Symbol("isRouterRouteSymbol");function mn(t){return typeof t=="object"&&t!==null&&fe in t}function gn(t,e){function n(v,d,A){if(typeof v=="object"){const x={...t.params,...v};return e(t.name,x,d)}const b={...t.params,[v]:d};return e(t.name,b,A)}const{id:r,matched:o,matches:a,name:c,query:u,params:s,state:f,hash:i}=l.toRefs(t),p=l.reactive({id:r,matched:o,matches:a,state:f,query:u,hash:i,params:s,name:c,update:n,[fe]:!0});return new Proxy(p,{get:(v,d,A)=>d==="params"?new Proxy(t.params,{set(b,x,L){return n(x,L),!0}}):d==="state"?new Proxy(t.state,{set(b,x,L){return n({},{state:{...t.state,[x]:L}}),!0}}):Reflect.get(v,d,A)})}const le=Symbol();function Rn(t,e){const n=l.reactive({...t}),r=c=>{Object.assign(n,{[le]:!1,...c})},o=n,a=gn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:r}}function T(t){return!t.startsWith("http")?wn(t):yn(t)}function yn(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}}function wn(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function vn(t){return e=>{const{host:n}=T(e);return!(n===void 0||n===t)}}function Pn({mode:t,listener:e}){const n=En(t),r=(s,f)=>{if(f!=null&&f.replace){n.replace(s,f.state);return}n.push(s,f==null?void 0:f.state)},o=()=>{const s=Y(n.location);n.replace(s)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function En(t="auto"){switch(t){case"auto":return zt()?ae():ce();case"browser":return ae();case"memory":return ce();case"hash":return dn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}class Rt{constructor(){J(this,"onBeforeRouteEnter",new Set);J(this,"onBeforeRouteUpdate",new Set);J(this,"onBeforeRouteLeave",new Set);J(this,"onAfterRouteEnter",new Set);J(this,"onAfterRouteUpdate",new Set);J(this,"onAfterRouteLeave",new Set)}}class he extends Error{}class it extends Error{constructor(n){super("Error occurred during a router push operation.");J(this,"to");this.to=n}}class kt extends Error{constructor(n){super(`Routing action rejected: ${n}`);J(this,"type");this.type=n}}function Sn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&xt(t,e,o)&&X(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Lt(t,e,o)&&X(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Bt(t,e,o)&&X(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function bn(t,e){const n=new Rt;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&xt(t,e,o)&&X(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Lt(t,e,o)&&X(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Bt(t,e,o)&&X(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function _(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function An(){const t=c=>{throw new kt(c)},e=(...c)=>{throw new it(c)},n=(c,u,s)=>{if(_(c)){const p=u??{};throw new it([c,{...p,replace:!0}])}const f=u,i=s??{};throw new it([c,f,{...i,replace:!0}])},r=()=>{throw new he};async function o({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=Sn(c,u),v=[...f.onBeforeRouteEnter,...p.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...p.onBeforeRouteUpdate,...i.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...p.onBeforeRouteLeave,...i.onBeforeRouteLeave];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};if(d instanceof he)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:c,from:u,hooks:s}){const{global:f,component:i}=s,p=bn(c,u),v=[...i.onAfterRouteLeave,...p.onAfterRouteLeave,...f.onAfterRouteLeave,...i.onAfterRouteUpdate,...p.onAfterRouteUpdate,...f.onAfterRouteUpdate,...i.onAfterRouteEnter,...p.onAfterRouteEnter,...f.onAfterRouteEnter];try{const d=v.map(A=>A(c,{from:u,reject:t,push:e,replace:n}));await Promise.all(d)}catch(d){if(d instanceof it)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const xt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Bt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Lt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function pe(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return xt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Lt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function kn(){const t={global:new Rt,component:new Rt};function e({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:c}){const u=pe(r),s=t[o][r],f=(i,p)=>{if(u(i,p.from,a))return c(i,p)};return s.add(f),()=>s.delete(f)}return{...t,addBeforeRouteHook:e,addAfterRouteHook:n}}const de=Symbol();function xn(){const t=kn();return{onBeforeRouteEnter:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:u,timing:"global",depth:0}),onBeforeRouteUpdate:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:u,timing:"global",depth:0}),onBeforeRouteLeave:u=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:u,timing:"global",depth:0}),onAfterRouteEnter:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:u,timing:"global",depth:0}),onAfterRouteUpdate:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:u,timing:"global",depth:0}),onAfterRouteLeave:u=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:u,timing:"global",depth:0}),hooks:t}}function Bn(t){return l.defineComponent(()=>()=>l.h("h1",t),{name:t,props:[]})}function me(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}function Ln(){let t=0;return()=>(++t).toString()}const Ut=Ln();function Un({rejections:t}){const e=a=>{const c={...t};return l.markRaw(c[a]??Bn(a))},n=a=>{const c=l.markRaw(e(a)),u={id:Ut(),name:a,component:c,meta:{},state:{}};return{id:u.id,matched:u,matches:[u],name:a,query:me(""),params:{},state:{},[le]:!0}},r=a=>{if(!a){o.value=null;return}const c=e(a);o.value={type:a,component:c}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Nn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Nt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((c,u)=>{const s=Nt(t.slice(r,u.index));s.length&&c.push(s);const[f]=u;return c.push(f),r=u.index+f.length,c},[]),a=t.slice(r);return a&&o.push(a),o}function jn(t){const e=ge(t.path.toString());return new RegExp(`^${e}$`,"i")}function $n(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!jt(n)).map(([n,r])=>{const o=ge(r);return new RegExp(`${Nt(n)}=${o}(&|$)`,"i")})}function ge(t){return Cn(t,new RegExp(Hn,"g")).map(e=>e.startsWith(W)?Re(e):Nt(e)).join("")}function Re(t){return[Vn,On].reduce((e,n)=>n(e),t)}const Hn=`\\${W}\\??([\\w-_]+)\\${Q}`,Ct=`\\${W}\\?([\\w-_]+)\\${Q}`,ye=`\\${W}([\\w-_]+)\\${Q}`;function Vn(t){return t.replace(new RegExp(Ct,"g"),".*")}function jt(t){return new RegExp(Ct,"g").test(t)}function On(t){return t.replace(new RegExp(ye,"g"),".+")}function yt(t){const[e]=wt(t,new RegExp(Ct,"g")),[n]=wt(t,new RegExp(ye,"g"));return e??n}function wt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>at(o)?o:""))}function we(t,e,n){const r=Pe(e,n),[o]=wt(t,r);return o}function ve(t,e){if(!e)return t;const{name:n,param:r,value:o}=e,a=Pe(t,n);return wt(t,a).reduce((u,s)=>s===void 0?u:u.replace(s,()=>st(o,r,n.startsWith("?"))),t)}function Pe(t,e){const n=[_n,qn,Re].reduce((r,o)=>o(r,e),t);return new RegExp(n,"g")}function _n(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${W}\\${e}\\${Q}`,"g");return t.replace(n,"(.*)")}function qn(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${W}${e}\\${Q}`,"g");return t.replace(n,"(.+)")}function Ee(t,...e){return e.reduce((n,r)=>{if(!r)return n;const o=new URLSearchParams(r).toString();return Object.keys(o).length===0?n:n.includes("?")?`${n}&${o}`:`${n}?${o}`},t)}function Dn(t,e={}){const{params:n={},query:r}=e,o=Mn(t.host,n),a=Wn(t.path,n),c=Tn(t.query,n),u=Ee(`${o}${a}`,c,r),s=lt(t.hash.value??e.hash).toString();return`${u}${s}`}function Mn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${Q}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Wn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${Q}`);return c?ve(r,{name:o,param:a,value:e[c]}):r},n)}function Tn(t,e){const n=t.toString();if(!n)return{};const r=new URLSearchParams(n);return Array.from(r.entries()).reduce((o,[a,c])=>{const u=yt(c);if(!u)return{...o,[a]:c};const f=st(e[u],t.params[u],jt(c)),i=e[u]===void 0&&f==="";return jt(c)&&i?o:{...o,[a]:f}},{})}function In(t){return(e,n,r)=>{if(_(e))return Ee(e,(n??{}).query);const o=n??{},a=r??{},c=t.find(s=>s.name===e);if(!c)throw new Nn(String(e));return Dn(c,{params:o,query:a.query,hash:a.hash})}}class Fn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jn(t){if(t)return t;if(zt())return window.location.toString();throw new Fn}const Qn=(t,e)=>{try{Se(t,e)}catch{return!1}return!0},Se=(t,e)=>{const{pathname:n,search:r}=T(e);return{...Kn(t.path,n),...Gn(t.query,r)}};function Kn(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=we(r,t.toString(),o),f=ct(s,a,c);n[u]=f}return n}function Gn(t,e){const n={},r=new URLSearchParams(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),u=c?o.slice(1):o,s=r.get(u)??void 0,f=ct(s,a,c);n[u]=f}return n}const zn=t=>"name"in t.matched&&!!t.matched.name,Yn=(t,e)=>{const{pathname:n}=T(e);return jn(t).test(n)},Xn=(t,e)=>{const{search:n}=T(e);return $n(t).every(o=>o.test(n))},Zn=(t,e)=>{const{hash:n}=T(e),r=t.hash.toString();return!t.hash.hasValue()||r.toLowerCase()===n.toLowerCase()};function tr(t){const{searchParams:e,pathname:n}=T(t),r=-1,o=1;return(a,c)=>{const u=Ae(a,e),s=be(a,n),f=Ae(c,e),i=be(c,n);if(a.depth>c.depth)return r;if(a.depth<c.depth)return o;if(u+s>f+i)return r;if(u+s<f+i)return o;const{hash:p}=T(t);return a.hash.toString()===p?r:c.hash.toString()===p?o:0}}function be(t,e){const n=Object.keys(t.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>we(e,t.path.toString(),o)===void 0);return n.length-r.length}function Ae(t,e){const n=new URLSearchParams(t.query.toString()),r=Array.from(n.keys()),o=r.filter(a=>!e.has(a));return r.length-o.length}function ke(t){return!!t&&typeof t=="object"}const vt=!0;function er(t,e,n){if(ke(t)&&e in t){const r=t[e];if(typeof r=="string")return ct(r,n,vt)}return ct(void 0,n,vt)}function nr(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=er(e,r,o);n[r]=a}return n}function rr(t,e,n){if(ke(t)&&e in t){const r=t[e];return st(r,n,vt)}return st(void 0,n,vt)}const xe=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=rr(e,r,o);n[r]=a}return n},or=[zn,Yn,Xn,Zn,Qn];function $t(t,e,n){const r=tr(e),o=t.filter(s=>or.every(f=>f(s,e))).sort(r);if(o.length===0)return;const[a]=o,{search:c,hash:u}=T(e);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:me(c),params:Se(a,e),state:nr(a.state,n),hash:u}}function Ht(t,e){const n=new RegExp(`\\${W}(\\??[\\w-_]+)\\${Q}`,"g");return Array.from(t.matchAll(n)).reduce((o,[a,c])=>{const u=yt(a);if(!u)return o;const s=ln(e,u);return Z([u],o),o[c]=s,o},{})}function Be(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function ar(t){return ot(t)&&typeof t.hash=="string"}function Le(t){return t===void 0?lt():ar(t)?t:lt(t)}function Vt(t){return t===void 0?"":t}function Ot(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function cr(t){return ot(t)&&typeof t.value=="string"}function Ue(t){return t===void 0?Ot("",{}):cr(t)?t:Ot(t,{})}function _t(t,e){return{value:t,params:Ht(t,e),toString:()=>t}}function sr(t){return ot(t)&&typeof t.value=="string"}function Ne(t){return t===void 0?_t("",{}):sr(t)?t:_t(t,{})}function I(t){const e=Ut(),n=Vt(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=an(t)?t.state:{},s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,path:r,query:o,hash:a,meta:c,state:u,depth:1,host:Be("",{}),prefetch:t.prefetch},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params),i}function ur(t,e){if(!at(e))return t;const n=I({path:e});return t.map(r=>I({parent:n,...r}))}class ir extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function fr(t){const e=t.map(({name:n})=>n);for(const n of e)if(Qt(e,n)>1)throw new ir(n)}function lr(t,e){const n=Ge(t)?t.flat():t,r=ur(n,e==null?void 0:e.base);fr(r);const o=mr(),a=In(r),c=Pn({mode:e==null?void 0:e.historyMode,listener:({location:w})=>{const N=Y(w);x(N,{state:w.state})}}),{runBeforeRouteHooks:u,runAfterRouteHooks:s}=An(),{hooks:f,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b}=xn();async function x(w,N={}){if(c.stopListening(),$(w)){c.update(w,N);return}const D=$t(r,w,N.state)??g("NotFound"),M={...m},rt=await u({to:D,from:M,hooks:f});switch(rt.status){case"ABORT":return;case"PUSH":c.update(w,N),await L(...rt.to);return;case"REJECT":c.update(w,N),k(rt.type);break;case"SUCCESS":c.update(w,N),k(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(rt)}`)}o.setProps(D),S(D);const G=await s({to:D,from:M,hooks:f});switch(G.status){case"PUSH":await L(...G.to);break;case"REJECT":k(G.type);break;case"SUCCESS":break;default:const F=G;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(F)}`)}c.startListening()}const L=(w,N,D)=>{if(_(w)){const ft={...N},Ft=a(w,ft);return x(Ft,ft)}const M={...D},G=a(w,N??{},M),F=Qe(w),It=xe((F==null?void 0:F.state)??{},M.state);return x(G,{...M,state:It})},q=(w,N,D)=>{if(_(w)){const ft={...N,replace:!0},Ft=a(w,ft);return x(Ft,ft)}const M={...D,replace:!0},G=a(w,N??{},M),F=Qe(w),It=xe((F==null?void 0:F.state)??{},M.state);return x(G,{...M,state:It})},R=w=>{k(w)},P=(w,N={})=>{if(!_(w)){const D=a(w,N);return $t(r,D)}if(!$(w))return $t(r,w)},{setRejection:k,rejection:B,getRejectionRoute:g}=Un(e??{}),h=g("NotFound"),{currentRoute:m,routerRoute:E,updateRoute:S}=Rn(h,L);c.startListening();const U=Jn(e==null?void 0:e.initialUrl),C=c.location.state,{host:V}=T(U),$=vn(V);let Tt=!1;async function Je(){Tt||(await x(U,{replace:!0,state:C}),Tt=!0)}function Qe(w){return r.find(N=>N.name===w)}function xr(w){w.component("RouterView",Ie),w.component("RouterLink",Te),w.provide(bt,B),w.provide(de,f),w.provide($e,o),w.provide(At,Ke),Je()}const Ke={route:E,resolve:a,push:L,replace:q,reject:R,find:P,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:xr,isExternal:$,onBeforeRouteEnter:i,onAfterRouteUpdate:p,onBeforeRouteLeave:v,onAfterRouteEnter:d,onBeforeRouteUpdate:A,onAfterRouteLeave:b,prefetch:e==null?void 0:e.prefetch,start:Je};return Ke}const Pt={template:"<div>This is component</div>"},qt=I({name:"parentA",path:"/parentA/[paramA]"}),Ce=I({parent:qt,name:"parentA.childA",path:"/[?paramB]"}),hr=I({parent:qt,name:"parentA.childB",path:"/[paramD]",component:Pt}),pr=I({parent:Ce,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Pt});I({name:"parentB",path:"/parentB",component:Pt}),I({name:"parentC",path:"/",component:Pt});const dr={components:!0,props:!1};function je({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){return Dt(n,r)??Dt(e,r)??Dt(t,r)??dr[r]}function Dt(t,e){return ot(t)?t[e]:t}const $e=Symbol();function mr(){const t=l.reactive(new Map),e=(s,f)=>s.matches.filter(i=>je({...f,routePrefetch:i.prefetch},"props")).flatMap(i=>c(i)).reduce((i,{id:p,name:v,props:d})=>{const A=a(p,v,s);return i[A]=d==null?void 0:d(s.params),i},{}),n=s=>{Object.entries(s).forEach(([f,i])=>{t.set(f,i)})},r=s=>{const i=s.matches.flatMap(c).reduce((p,{id:v,name:d,props:A})=>{const b=a(v,d,s);if(!A||t.has(b))return p;const x=A(s.params);return t.set(b,x),p.push(b),p},[]);u(i)},o=(s,f,i)=>{const p=a(s,f,i);return t.get(p)};function a(s,f,i){return[s,f,i.id,JSON.stringify(i.params)].join("-")}function c(s){return St(s)?Object.entries(s.props??{}).map(([f,i])=>({id:s.id,name:f,props:i})):Et(s)?[{id:s.id,name:"default",props:s.props}]:[]}function u(s){for(const f in t.keys())s.includes(f)||t.delete(f)}return{getPrefetchProps:e,setPrefetchProps:n,getProps:o,setProps:r}}function He(){const t=l.inject($e);if(!t)throw new O;return t}const gr=l.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Ve(t){return t.name===gr.name&&"setup"in t}function Rr(t){let e={};const{getPrefetchProps:n,setPrefetchProps:r}=He();return l.watch(()=>l.toValue(t),({route:a,...c})=>{a&&(yr(a,c),e=n(a,c))},{immediate:!0}),{commit:()=>{r(e)}}}function yr(t,{routerPrefetch:e,linkPrefetch:n}){t.matches.forEach(r=>{je({routePrefetch:r.prefetch,routerPrefetch:e,linkPrefetch:n},"components")&&(Et(r)&&Ve(r.component)&&r.component.setup(),St(r)&&Object.values(r.components).forEach(a=>{Ve(a)&&a.setup()}))})}function Oe(t,e={},n={}){const r=gt(),o=l.toRef(t),a=l.computed(()=>_(o.value)?{}:l.toValue(e)),c=l.computed(()=>_(o.value)?l.toValue(e):l.toValue(n)),u=l.computed(()=>{if(_(o.value))return o.value;try{return r.resolve(o.value,a.value,c.value)}catch(b){throw b instanceof tt&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,b),b}}),s=l.computed(()=>r.find(u.value,c.value)),f=l.computed(()=>!!s.value&&r.route.matches.includes(s.value.matched)),i=l.computed(()=>!!s.value&&r.route.matched===s.value.matched),p=l.computed(()=>r.isExternal(u.value)),{commit:v}=Rr(()=>({route:s.value,routerPrefetch:r.prefetch,linkPrefetch:c.value.prefetch})),d=b=>(v(),r.push(u.value,{...c.value,...b}));return{route:s,href:u,isMatch:f,isExactMatch:i,isExternal:p,push:d,replace:b=>d(b)}}function _e(t,e,{exact:n}={}){if(!mn(t))return!1;if(e===void 0)return!0;const r=t.matches.map(o=>Vt(o.name));if(n){const o=r.at(-1);return e===o}return r.includes(e)}function qe(t,e){const n=gt();function r(){if(!t)return;if(!_e(n.route,t,e))throw new ue(t,n.route.name)}return l.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const De=Symbol();function Mt(){return l.inject(De,0)}function Me(){const t=l.inject(de);if(!t)throw new O;return t}function We(t){return e=>{const n=Mt(),o=Me().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}function Wt(t){return e=>{const n=Mt(),o=Me().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return l.onUnmounted(o),o}}const wr=We("onBeforeRouteUpdate"),vr=We("onBeforeRouteLeave"),Pr=Wt("onAfterRouteEnter"),Er=Wt("onAfterRouteUpdate"),Sr=Wt("onAfterRouteLeave"),br=["href"],Te=l.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,n=gt(),r=l.computed(()=>_(e.to)?e.to:e.to(n.resolve)),o=l.computed(()=>{const{to:p,...v}=e;return v}),{isMatch:a,isExactMatch:c,isExternal:u,push:s}=Oe(r,o),f=l.computed(()=>({"router-link--match":a.value,"router-link--exact-match":c.value}));function i(p){p.preventDefault(),s()}return(p,v)=>(l.openBlock(),l.createElementBlock("a",{href:r.value,class:l.normalizeClass(["router-link",f.value]),onClick:i},[l.renderSlot(p.$slots,"default",l.normalizeProps(l.guardReactiveProps({resolved:r.value,isMatch:l.unref(a),isExactMatch:l.unref(c),isExternal:l.unref(u)})))],10,br))}}),Ie=l.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=qe(),r=ie(),o=Mt(),{getProps:a}=He(),c=l.resolveComponent("RouterView",!0);l.provide(De,o+1);const u=l.computed(()=>{if(r.value)return r.value.component;const i=n.matches.at(o);if(!i)return null;const p=s(i),v=a(i.id,e,n);return p?v?Yt(p,()=>v):p:null});function s(i){return f(i)[e]}function f(i){return St(i)?i.components:Et(i)?{default:i.component}:typeof c=="string"?{}:{default:c}}return(i,p)=>u.value?l.renderSlot(i.$slots,"default",l.normalizeProps(l.mergeProps({key:0},{route:l.unref(n),component:u.value,rejection:l.unref(r)})),()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.value)))]):l.createCommentVNode("",!0)}});function Ar(t){return ot(t)&&typeof t.value=="string"}function Fe(t){return Ar(t)?t:Be(t,{})}function kr(t){const e=Ut(),n=Vt(t.name),r=Ue(t.path),o=Ne(t.query),a=Le(t.hash),c=t.meta??{},u=on(t)?Fe(t.host):Fe(""),s=l.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:s,matches:[s],name:n,host:u,path:r,query:o,hash:a,meta:c,depth:1,state:{}},i=Kt(t)?Gt(t.parent,f):f;return Z(i.path.params,i.query.params,i.host.params),i}y.DuplicateParamsError=Jt,y.RouterLink=Te,y.RouterNotInstalledError=O,y.RouterView=Ie,y.UseRouteInvalidError=ue,y.component=Yt,y.createExternalRoute=kr,y.createParam=re,y.createRoute=I,y.createRouter=lr,y.isParamWithDefault=Xt,y.isRoute=_e,y.isUrl=_,y.onAfterRouteEnter=Pr,y.onAfterRouteLeave=Er,y.onAfterRouteUpdate=Sr,y.onBeforeRouteLeave=wr,y.onBeforeRouteUpdate=vr,y.path=Ot,y.query=_t,y.routerInjectionKey=At,y.routerRejectionKey=bt,y.useLink=Oe,y.useRejection=ie,y.useRoute=qe,y.useRouter=gt,y.withDefault=fn,Object.defineProperty(y,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.11.0",
4
+ "version": "0.11.1",
5
5
  "bugs": {
6
6
  "url": "https://github.com/kitbagjs/router/issues"
7
7
  },
@@ -33,10 +33,11 @@
33
33
  }
34
34
  },
35
35
  "devDependencies": {
36
- "@prefecthq/eslint-config": "^1.0.31",
36
+ "@kitbag/eslint-config": "1.0.1",
37
37
  "@vitejs/plugin-vue": "^5.0.4",
38
38
  "@vue/test-utils": "^2.4.3",
39
- "eslint": "^8.54.0",
39
+ "eslint": "^9.14.0",
40
+ "globals": "^15.11.0",
40
41
  "happy-dom": "^12.10.3",
41
42
  "typedoc": "^0.25.13",
42
43
  "typedoc-plugin-markdown": "^4.0.0",