@kitbag/router 0.20.6 → 0.20.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/echo.d.ts +6 -0
- package/dist/components/helloWorld.d.ts +2 -0
- package/dist/components/rejection.d.ts +2 -0
- package/dist/components/routerLink.browser.spec.d.ts +1 -0
- package/dist/components/routerLink.d.ts +36 -0
- package/dist/components/routerView.browser.spec.d.ts +1 -0
- package/dist/components/routerView.d.ts +20 -0
- package/dist/components/routerView.spec.d.ts +1 -0
- package/dist/compositions/useComponentsStore.d.ts +5 -0
- package/dist/compositions/useEventListener.d.ts +2 -0
- package/dist/compositions/useLink.d.ts +16 -0
- package/dist/compositions/usePrefetching.d.ts +14 -0
- package/dist/compositions/usePropStore.d.ts +7 -0
- package/dist/compositions/useQueryValue.browser.spec.d.ts +1 -0
- package/dist/compositions/useQueryValue.d.ts +15 -0
- package/dist/compositions/useRejection.d.ts +7 -0
- package/dist/compositions/useRoute.browser.spec.d.ts +1 -0
- package/dist/compositions/useRoute.d.ts +16 -0
- package/dist/compositions/useRouter.d.ts +3 -0
- package/dist/compositions/useRouterDepth.d.ts +8 -0
- package/dist/compositions/useRouterHooks.d.ts +4 -0
- package/dist/compositions/useVisibilityObserver.d.ts +8 -0
- package/dist/errors/callbackContextAbortError.d.ts +5 -0
- package/dist/errors/callbackContextPushError.d.ts +5 -0
- package/dist/errors/callbackContextRejectionError.d.ts +6 -0
- package/dist/errors/duplicateNamesError.d.ts +11 -0
- package/dist/errors/duplicateParamsError.d.ts +13 -0
- package/dist/errors/initialRouteMissingError.d.ts +3 -0
- package/dist/errors/invalidRouteParamValueError.d.ts +2 -0
- package/dist/errors/metaPropertyConflict.d.ts +8 -0
- package/dist/errors/routeNotFoundError.d.ts +6 -0
- package/dist/errors/routerNotInstalledError.d.ts +7 -0
- package/dist/errors/useRouteInvalidError.d.ts +13 -0
- package/dist/guards/routes.d.ts +46 -0
- package/dist/guards/routes.spec-d.d.ts +1 -0
- package/dist/keys.d.ts +3 -0
- package/dist/kitbag-router.d.ts +2 -1433
- package/dist/kitbag-router.js +2067 -1959
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +302 -0
- package/dist/models/RouteHooks.d.ts +9 -0
- package/dist/models/RouterRouteHooks.d.ts +10 -0
- package/dist/services/arrayOf.d.ts +7 -0
- package/dist/services/arrayOf.spec.d.ts +1 -0
- package/dist/services/combineHash.d.ts +4 -0
- package/dist/services/combineHash.spec.d.ts +1 -0
- package/dist/services/combineMeta.d.ts +2 -0
- package/dist/services/combineMeta.spec.d.ts +1 -0
- package/dist/services/combinePath.d.ts +12 -0
- package/dist/services/combinePath.spec-d.d.ts +1 -0
- package/dist/services/combinePath.spec.d.ts +1 -0
- package/dist/services/combineQuery.d.ts +13 -0
- package/dist/services/combineQuery.spec.d.ts +1 -0
- package/dist/services/combineState.d.ts +3 -0
- package/dist/services/combineState.spec.d.ts +1 -0
- package/dist/services/component.browser.spec.d.ts +1 -0
- package/dist/services/component.d.ts +12 -0
- package/dist/services/createCallbackContext.d.ts +44 -0
- package/dist/services/createComponentHooks.d.ts +11 -0
- package/dist/services/createComponentsStore.d.ts +7 -0
- package/dist/services/createCurrentRoute.d.ts +13 -0
- package/dist/services/createExternalRoute.d.ts +3 -0
- package/dist/services/createExternalRoute.spec.d.ts +1 -0
- package/dist/services/createIsExternal.d.ts +1 -0
- package/dist/services/createIsExternal.spec.d.ts +1 -0
- package/dist/services/createParam.d.ts +6 -0
- package/dist/services/createPropStore.d.ts +13 -0
- package/dist/services/createResolvedRoute.d.ts +4 -0
- package/dist/services/createResolvedRouteForUrl.browser.spec.d.ts +1 -0
- package/dist/services/createResolvedRouteForUrl.d.ts +3 -0
- package/dist/services/createResolvedRouteQuery.d.ts +5 -0
- package/dist/services/createRoute.d.ts +4 -0
- package/dist/services/createRoute.spec-d.d.ts +1 -0
- package/dist/services/createRoute.spec.d.ts +1 -0
- package/dist/services/createRouteId.d.ts +1 -0
- package/dist/services/createRouter.browser.spec.d.ts +1 -0
- package/dist/services/createRouter.d.ts +28 -0
- package/dist/services/createRouter.spec-d.d.ts +1 -0
- package/dist/services/createRouter.spec.d.ts +1 -0
- package/dist/services/createRouterAssets.d.ts +118 -0
- package/dist/services/createRouterCallbackContext.d.ts +45 -0
- package/dist/services/createRouterHistory.browser.spec.d.ts +1 -0
- package/dist/services/createRouterHistory.d.ts +20 -0
- package/dist/services/createRouterHooks.d.ts +20 -0
- package/dist/services/createRouterKeyStore.d.ts +3 -0
- package/dist/services/createRouterPlugin.browser.spec.d.ts +1 -0
- package/dist/services/createRouterPlugin.d.ts +4 -0
- package/dist/services/createRouterReject.d.ts +16 -0
- package/dist/services/createRouterRoute.d.ts +7 -0
- package/dist/services/createRouterRoute.spec.d.ts +1 -0
- package/dist/services/createUniqueIdSequence.d.ts +2 -0
- package/dist/services/createVisibilityObserver.d.ts +7 -0
- package/dist/services/createVueAppStore.d.ts +8 -0
- package/dist/services/getGlobalHooksForRouter.d.ts +4 -0
- package/dist/services/getGlobalRouteHooks.d.ts +5 -0
- package/dist/services/getInitialUrl.browser.spec.d.ts +1 -0
- package/dist/services/getInitialUrl.d.ts +1 -0
- package/dist/services/getInitialUrl.spec.d.ts +1 -0
- package/dist/services/getMatchesForUrl.d.ts +2 -0
- package/dist/services/getMatchesForUrl.spec.d.ts +1 -0
- package/dist/services/getParamsForString.d.ts +2 -0
- package/dist/services/getRouteHooks.d.ts +10 -0
- package/dist/services/getRouteHooks.spec.d.ts +1 -0
- package/dist/services/getRoutesForRouter.d.ts +9 -0
- package/dist/services/getRoutesForRouter.spec.d.ts +1 -0
- package/dist/services/hooks.browser.spec.d.ts +1 -0
- package/dist/services/hooks.d.ts +8 -0
- package/dist/services/hooks.spec.d.ts +1 -0
- package/dist/services/insertBaseRoute.d.ts +2 -0
- package/dist/services/insertBaseRoute.spec.d.ts +1 -0
- package/dist/services/paramValidation.d.ts +4 -0
- package/dist/services/paramValidation.spec.d.ts +1 -0
- package/dist/services/params.d.ts +7 -0
- package/dist/services/params.spec.d.ts +1 -0
- package/dist/services/paramsFinder.d.ts +3 -0
- package/dist/services/paramsFinder.spec.d.ts +1 -0
- package/dist/services/routeMatchRules.d.ts +5 -0
- package/dist/services/routeMatchRules.spec.d.ts +1 -0
- package/dist/services/routeMatchScore.d.ts +7 -0
- package/dist/services/routeMatchScore.spec.d.ts +1 -0
- package/dist/services/routeRegex.d.ts +18 -0
- package/dist/services/routeRegex.spec.d.ts +1 -0
- package/dist/services/state.d.ts +9 -0
- package/dist/services/state.spec.d.ts +1 -0
- package/dist/services/tupleOf.d.ts +10 -0
- package/dist/services/tupleOf.spec.d.ts +1 -0
- package/dist/services/unionOf.d.ts +3 -0
- package/dist/services/unionOf.spec.d.ts +1 -0
- package/dist/services/urlAssembly.d.ts +10 -0
- package/dist/services/urlAssembly.spec.d.ts +1 -0
- package/dist/services/urlCombine.d.ts +2 -0
- package/dist/services/urlCombine.spec.d.ts +1 -0
- package/dist/services/urlCreator.d.ts +2 -0
- package/dist/services/urlCreator.spec.d.ts +1 -0
- package/dist/services/urlParser.d.ts +2 -0
- package/dist/services/urlParser.spec.d.ts +1 -0
- package/dist/services/valibot.d.ts +7 -0
- package/dist/services/valibot.spec-d.d.ts +1 -0
- package/dist/services/valibot.spec.d.ts +1 -0
- package/dist/services/withDefault.d.ts +5 -0
- package/dist/services/withParams.d.ts +15 -0
- package/dist/services/withParams.spec-d.d.ts +1 -0
- package/dist/services/withParams.spec.d.ts +1 -0
- package/dist/services/zod.d.ts +11 -0
- package/dist/services/zod.spec-d.d.ts +1 -0
- package/dist/services/zod.spec.d.ts +1 -0
- package/dist/tests/hooks.spec.d.ts +1 -0
- package/dist/tests/routeProps.browser.spec.d.ts +1 -0
- package/dist/tests/routeProps.spec.d.ts +1 -0
- package/dist/types/createRouteOptions.d.ts +120 -0
- package/dist/types/hooks.d.ts +129 -0
- package/dist/types/meta.d.ts +2 -0
- package/dist/types/name.d.ts +2 -0
- package/dist/types/paramTypes.d.ts +14 -0
- package/dist/types/params.d.ts +71 -0
- package/dist/types/prefetch.d.ts +27 -0
- package/dist/types/props.d.ts +23 -0
- package/dist/types/querySource.d.ts +1 -0
- package/dist/types/register.d.ts +68 -0
- package/dist/types/register.spec.d.ts +1 -0
- package/dist/types/resolved.d.ts +47 -0
- package/dist/types/resolved.spec-d.d.ts +1 -0
- package/dist/types/route.d.ts +76 -0
- package/dist/types/route.spec-d.d.ts +1 -0
- package/dist/types/routeMatchRule.d.ts +2 -0
- package/dist/types/routeUpdate.d.ts +9 -0
- package/dist/types/routeWithParams.d.ts +5 -0
- package/dist/types/routeWithParams.spec-d.d.ts +1 -0
- package/dist/types/router.d.ts +186 -0
- package/dist/types/routerLink.d.ts +16 -0
- package/dist/types/routerPlugin.d.ts +18 -0
- package/dist/types/routerPush.d.ts +33 -0
- package/dist/types/routerReject.d.ts +3 -0
- package/dist/types/routerReplace.d.ts +20 -0
- package/dist/types/routerResolve.d.ts +15 -0
- package/dist/types/routerRoute.d.ts +16 -0
- package/dist/types/routesMap.d.ts +9 -0
- package/dist/types/routesMap.spec-ts.d.ts +1 -0
- package/dist/types/state.d.ts +18 -0
- package/dist/types/url.d.ts +23 -0
- package/dist/types/useLink.d.ts +51 -0
- package/dist/types/utilities.d.ts +22 -0
- package/dist/utilities/array.d.ts +2 -0
- package/dist/utilities/checkDuplicateKeys.d.ts +1 -0
- package/dist/utilities/checkDuplicateKeys.spec.d.ts +1 -0
- package/dist/utilities/checkDuplicateNames.d.ts +2 -0
- package/dist/utilities/checkDuplicateNames.spec.d.ts +1 -0
- package/dist/utilities/components.d.ts +6 -0
- package/dist/utilities/components.spec.d.ts +1 -0
- package/dist/utilities/guards.d.ts +5 -0
- package/dist/utilities/guards.spec.d.ts +1 -0
- package/dist/utilities/index.d.ts +6 -0
- package/dist/utilities/isBrowser.browser.spec.d.ts +1 -0
- package/dist/utilities/isBrowser.d.ts +1 -0
- package/dist/utilities/isBrowser.spec.d.ts +1 -0
- package/dist/utilities/makeOptional.d.ts +9 -0
- package/dist/utilities/prefetch.d.ts +4 -0
- package/dist/utilities/prefetch.spec.d.ts +1 -0
- package/dist/utilities/promises.d.ts +1 -0
- package/dist/utilities/props.d.ts +6 -0
- package/dist/utilities/testHelpers.d.ts +144 -0
- package/dist/utilities/urlSearchParams.d.ts +2 -0
- package/dist/utilities/urlSearchParams.spec.d.ts +1 -0
- package/package.json +12 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(A,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(A=typeof globalThis<"u"?globalThis:A||self,i(A["@kitbag/router"]={},A.Vue))})(this,function(A,i){"use strict";var No=Object.defineProperty;var Vo=(A,i,Z)=>i in A?No(A,i,{enumerable:!0,configurable:!0,writable:!0,value:Z}):A[i]=Z;var G=(A,i,Z)=>Vo(A,typeof i!="symbol"?i+"":i,Z);function Z(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function _t(t){return Z(t)?t:`/${t}`}class pe 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 he extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}class tt extends Error{constructor(){super("Router not installed")}}class ye extends Error{constructor(e,r){super(`useRoute called with incorrect route. Given ${e}, expected ${r}`)}}const me=Symbol();function Rt(){const t=i.inject(me);if(!t)throw new tt;return t}function it(t){return Array.isArray(t)?t:[t]}function ge(t,e){return t.filter(r=>e===r).length}function ct(...t){const e=t.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of e)if(ge(e,r)>1)throw new pe(r)}class Q extends Error{}const wt="[",At="]";function kr(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Ur(t){return typeof t=="function"&&kr(t)}function vt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Re(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function we(t,e){return vt(t)?{...t,defaultValue:e??t.defaultValue}:{get:r=>et(r,t),set:r=>z(r,t),defaultValue:e}}function Lr(t){return vt(t)&&t.defaultValue!==void 0}function Nr(t,e){return we(t,e)}function Vr(t){return t!==void 0}function ut(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F(t){return typeof t=="string"&&t.length>0}let E=null;async function Cr(){const{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:y,ZodArray:f,ZodTuple:g,ZodUnion:w,ZodDiscriminatedUnion:C,ZodRecord:v,ZodMap:B,ZodSet:b,ZodIntersection:c,ZodPromise:l,ZodFunction:u}=await import("zod");return{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:y,ZodArray:f,ZodTuple:g,ZodUnion:w,ZodDiscriminatedUnion:C,ZodRecord:v,ZodMap:B,ZodSet:b,ZodIntersection:c,ZodPromise:l,ZodFunction:u}}function Br(t){return Object.values(t).some(e=>Object.values(e.host.params).some(r=>qt(r))||Object.values(e.path.params).some(r=>qt(r))||Object.values(e.query.params).some(r=>qt(r)))}function qt(t){return ut(t)&&"parse"in t&&typeof t.parse=="function"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="zod"}async function xr(){try{E=await Cr()}catch{throw new Error("Failed to initialize Zod")}}function Ee(t){return E?t instanceof E.ZodSchema:!1}function be(t){return{get:(e,{invalid:r})=>{try{return Ht(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return It(e,t)}catch{throw r()}}}}const jr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ft(t,e){if(typeof e=="string"&&jr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function lt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function kt(t,e){return E!=null&&E.ZodString&&t instanceof E.ZodString?1:E!=null&&E.ZodString&&e instanceof E.ZodString?-1:0}function Ht(t,e){if(!E)throw new Error("Zod is not initialized");if(e instanceof E.ZodString)return e.parse(t);if(e instanceof E.ZodBoolean)return e.parse(!!t);if(e instanceof E.ZodDate)return e.parse(new Date(t));if(e instanceof E.ZodNumber)return e.parse(Number(t));if(e instanceof E.ZodLiteral)return lt([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof E.ZodObject)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodEnum)return e.parse(t);if(e instanceof E.ZodNativeEnum)return lt([()=>e.parse(Number(t)),()=>e.parse(t)]);if(e instanceof E.ZodArray||e instanceof E.ZodTuple)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>Ht(t,n));return lt(r)}if(e instanceof E.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>Ht(t,n));return lt(r)}if(e instanceof E.ZodRecord)return e.parse(JSON.parse(t,ft));if(e instanceof E.ZodMap)return e.parse(new Map(JSON.parse(t,ft)));if(e instanceof E.ZodSet)return e.parse(new Set(JSON.parse(t,ft)));if(e instanceof E.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof E.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof E.ZodFunction)throw new Error("Function schemas are not supported");return e.parse(t)}function It(t,e){if(!E)throw new Error("Zod is not initialized");if(e instanceof E.ZodString)return e.parse(t);if(e instanceof E.ZodBoolean)return e.parse(t).toString();if(e instanceof E.ZodDate)return e.parse(t).toISOString();if(e instanceof E.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof E.ZodLiteral)return e.parse(t).toString();if(e instanceof E.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof E.ZodEnum)return e.parse(t);if(e instanceof E.ZodNativeEnum)return e.parse(t).toString();if(e instanceof E.ZodArray||e instanceof E.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof E.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>It(t,n));return lt(r)}if(e instanceof E.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>It(t,n));return lt(r)}if(e instanceof E.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof E.ZodMap){const r=e.parse(t);return JSON.stringify(Array.from(r.entries()))}if(e instanceof E.ZodSet){const r=e.parse(t);return JSON.stringify(Array.from(r.values()))}if(e instanceof E.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof E.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof E.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(e.parse(t))}function Dt(t){return typeof t=="object"&&t!==null&&"then"in t}function N(t,e){const r=t["~standard"].validate(e);if(Dt(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function Or(t){return ut(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function Se(t){return Or(t)}function Pe(t){return{get:(e,{invalid:r})=>{try{return Jt(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Tt(e,t)}catch{throw r()}}}}const Zr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function dt(t,e){if(typeof e=="string"&&Zr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function pt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Ut(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function Jt(t,e){if(e.type==="boolean")return N(e,!!t);if(e.type==="date")return N(e,new Date(t));if(e.type==="number")return N(e,Number(t));if(e.type==="literal")return pt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="object")return N(e,JSON.parse(t,dt));if(e.type==="enum")return pt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="array"||e.type==="tuple")return N(e,JSON.parse(t,dt));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Jt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Jt(t,n));return pt(r)}if(e.type==="record")return N(e,JSON.parse(t,dt));if(e.type==="map")return N(e,new Map(JSON.parse(t,dt)));if(e.type==="set")return N(e,new Set(JSON.parse(t,dt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return N(e,t)}function Tt(t,e){if(e.type==="string"||e.type==="boolean")return N(e,t).toString();if(e.type==="date")return N(e,t).toISOString();if(e.type==="number")return N(e,Number(t)).toString();if(e.type==="literal")return N(e,t).toString();if(e.type==="object")return JSON.stringify(N(e,t));if(e.type==="enum"||e.type==="nativeEnum")return N(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(N(e,t));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Tt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Tt(t,n));return pt(r)}if(e.type==="record")return JSON.stringify(N(e,t));if(e.type==="map"){const r=N(e,t);return JSON.stringify(Array.from(r.entries()))}if(e.type==="set"){const r=N(e,t);return JSON.stringify(Array.from(r.values()))}if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(N(e,t))}function $r(t,e){return t[e]??String}const j={invalid:t=>{throw new Q(t)}},Ae={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Ft={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()}},Mt={get:(t,{invalid:e})=>{const r=Number(t);if(isNaN(r))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},ve={get:(t,{invalid:e})=>{const r=new Date(t);if(isNaN(r.getTime()))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ke={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function _r(t,e){switch(typeof e){case"string":return Ae.get(t,j)===e;case"number":return Mt.get(t,j)===e;case"boolean":return Ft.get(t,j)===e;default:return!1}}function et(t,e,r=!1){if(t===void 0||!F(t)){if(Lr(e))return e.defaultValue;if(r)return;throw new Q}if(e===String)return Ae.get(t,j);if(e===Boolean)return Ft.get(t,j);if(e===Number)return Mt.get(t,j);if(e===Date)return ve.get(t,j);if(e===JSON)return ke.get(t,j);if(Ur(e))return e(t,j);if(vt(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new Q}if(Re(e)){if(_r(t,e))return e;throw new Q}return Ee(e)?be(e).get(t,j):Se(e)?Pe(e).get(t,j):t}function Wt(t,e,r=!1){try{return et(t,e,r)}catch(n){if(n instanceof Q)return;throw n}}function qr(t,e,r=!1){try{return z(t,e,r)}catch(n){if(n instanceof Q)return;throw n}}function z(t,e,r=!1){if(t===void 0){if(r)return"";throw new Q}if(e===Boolean)return Ft.set(t,j);if(e===Number)return Mt.set(t,j);if(e===Date)return ve.set(t,j);if(e===JSON)return ke.set(t,j);if(vt(e))return e.set(t,j);if(Re(e)){if(e!==t)throw new Q;return t.toString()}if(Ee(e))return be(e).set(t,j);if(Se(e))return Pe(e).set(t,j);try{return t.toString()}catch{throw new Q}}function Gt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hr(t,e){const r=Array.from(t.matchAll(e));if(r.length===0)return[t];let n=0;const o=r.reduce((s,p)=>{const y=Gt(t.slice(n,p.index));y.length&&s.push(y);const[f]=p;return s.push(f),n=p.index+f.length,s},[]),a=t.slice(n);return a&&o.push(a),o}function Ir(t){const e=Ue(t.path.value);return new RegExp(`^${e}$`,"i")}function Dr(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,r])=>!zt(r)).map(([r,n])=>{const o=Ue(n);return new RegExp(`${Gt(r)}=${o}(&|$)`,"i")})}function Ue(t){return Hr(t,new RegExp(Lt,"g")).map(e=>e.startsWith(wt)?Le(e):Gt(e)).join("")}function Le(t){return t.replace(new RegExp(Lt,"g"),Fr)}function Jr(t,e){const r=Ne(e);return t.replace(r,Mr)}function Qt(t,e){return Wr(e).test(t.value)}function zt(t){return new RegExp(Tr,"g").test(t)}const Lt=`\\${wt}\\??([\\w-_]+)\\${At}`,Tr=`\\${wt}\\?([\\w-_]+)\\${At}`,Fr=".*",Mr="(.*)";function Kt(t){const[e]=Ve(t,new RegExp(Lt,"g"));return e}function Ne(t){return new RegExp(`\\${wt}\\??${t}\\${At}`,"g")}function Wr(t){return new RegExp(`\\${wt}\\?${t}\\${At}`,"g")}function Ve(t,e){return Array.from(t.matchAll(e)).flatMap(([,...n])=>n.map(o=>F(o)?o:""))}function Gr(t="",e={}){return F(t)?Array.from(t.matchAll(new RegExp(Lt,"g"))).reduce((n,[o,a])=>{const s=Kt(o);if(!s)return n;const p=$r(e,s);return ct([s],n),n[a]=p,n},{}):{}}function Qr(t){return ut(t)&&typeof t.value=="string"}function rt(t){return t===void 0?M():Qr(t)?t:M(t,{})}function M(t,e){return{value:t??"",params:Gr(t,e)}}function Ce(t,e){ct(t.params,e.params);const r=`${t.value}${e.value}`;return M(r,{...t.params,...e.params})}function zr(t,e){return Ce(t,e)}function Kr(t,e){return Yr(t,e),{...t,...e}}function Yr(t,e){const r=Object.keys(t).find(n=>n in e&&typeof e[n]!=typeof t[n]);if(r)throw new he(r)}function Xr(t,e){ct(t.params,e.params);const r=[t.value,e.value].filter(F).join("&");return M(r,{...t.params,...e.params})}function tn(t,e){return ct(t,e),{...t,...e}}function Be(t){return"parent"in t&&!!t.parent}function xe(t){return"component"in t&&!!t.component}function je(t){return"props"in t&&typeof t.props=="function"}function Oe(t){return"components"in t&&!!t.components}function Ze(t){return"props"in t&&typeof t.props=="object"}function $e(t,e){return{...e,path:Ce(t.path,e.path),query:Xr(t.query,e.query),meta:Kr(t.meta,e.meta),state:tn(t.state,e.state),hash:zr(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function Yt(){return typeof window<"u"&&typeof window.document<"u"}function Xt(t){const e=new URLSearchParams(t);return{get:(...r)=>e.get(...r),getAll:(...r)=>e.getAll(...r),set:(...r)=>{e.set(...r)},append:(...r)=>{e.append(...r)},delete:(...r)=>{e.delete(...r)},toString:(...r)=>e.toString(...r),forEach:(...r)=>{e.forEach(...r)},entries:(...r)=>e.entries(...r),keys:(...r)=>e.keys(...r),values:(...r)=>e.values(...r),has:(...r)=>e.has(...r),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function te(){let t=0;return()=>(++t).toString()}const en=te()();function rn(t){return t===en}const ee=te();function _e(t){return t===void 0?"":t}function nt(t,e){const r=ee(),n=_e(t.name),o=rt(t.path),a=rt(t.query),s=rt(t.hash),p=t.meta??{},y=t.state??{},f=i.markRaw({id:r,meta:p,state:y,...t,props:e}),g={id:r,matched:f,matches:[f],name:n,path:o,query:a,hash:s,meta:p,state:y,depth:1,host:M(),prefetch:t.prefetch},w=Be(t)?$e(t.parent,g):g;return ct(w.path.params,w.query.params,w.hash.params),w}const Nt={template:"<div>This is component</div>"},re=nt({name:"parentA",path:"/parentA/[paramA]"}),qe=nt({parent:re,name:"parentA.childA",path:"/childA/[?paramB]"}),nn=nt({parent:re,name:"parentA.childB",path:"/childB/[paramD]",component:Nt}),on=nt({parent:qe,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Nt});nt({name:"parentB",path:"/parentB",component:Nt}),nt({name:"parentC",path:"/",component:Nt});const an="lazy",sn={components:!0,props:!1};function Vt(t){return["eager","lazy","intent"].includes(t)}function He({routerPrefetch:t,routePrefetch:e,linkPrefetch:r},n){const o=ne(r,n),a=ne(e,n),s=ne(t,n),p=[o,a,s,sn[n],an].reduce((y,f)=>Vt(y)?y:y===!0&&Vt(f)?f:y===!0&&!Vt(f)?y:y===void 0?f:y,void 0);return Vt(p)?p:!1}function ne(t,e){return ut(t)?t[e]:t}class Ie extends Error{constructor(){super("Uncaught CallbackContextAbortError");G(this,"response");this.response={status:"ABORT"}}}class ht extends Error{constructor(r){super("Uncaught CallbackContextPushError");G(this,"response");this.response={status:"PUSH",to:r}}}class Ct extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");G(this,"response");this.response={status:"REJECT",type:r}}}function De(){return{reject:o=>{throw new Ct(o)},push:(...o)=>{throw new ht(o)},replace:(o,a,s)=>{if(Z(o)){const f=a??{};throw new ht([o,{...f,replace:!0}])}const p=a,y=s??{};throw new ht([o,p,{...y,replace:!0}])},abort:()=>{throw new Ie}}}function Je(t){try{const e=t();return Dt(e)?e.catch(r=>r):e}catch(e){return e}}function Te(){let t=null;function e(n){t=n}function r(n){return t?t.runWithContext(n):n()}return{setVueApp:e,runWithContext:r}}const Fe=Symbol();function cn(){const{setVueApp:t,runWithContext:e}=Te(),r=i.reactive(new Map),{push:n,replace:o,reject:a}=De(),s=(b,c,l)=>c.matches.filter(u=>He({...l,routePrefetch:u.prefetch},"props")===b).flatMap(u=>v(u)).reduce((u,{id:d,name:S,props:U})=>{if(!U)return u;const k=C(d,S,c),R=e(()=>Je(()=>U(c,{push:n,replace:o,reject:a,parent:g(c,!0)})));return u[k]=R,u},{}),p=b=>{Object.entries(b).forEach(([c,l])=>{r.set(c,l)})},y=async b=>{const c=b.matches.flatMap(v),l=[],u=[];for(const{id:d,name:S,props:U}of c){if(!U)continue;const k=C(d,S,b);if(l.push(k),!r.has(k)){const R=e(()=>Je(()=>U(b,{push:n,replace:o,reject:a,parent:g(b)})));r.set(k,R)}u.push((async()=>{const R=await r.get(k);if(R instanceof Error)throw R})())}B(l);try{return await Promise.all(u),{status:"SUCCESS"}}catch(d){if(d instanceof ht||d instanceof Ct)return d.response;throw d}},f=(b,c,l)=>{const u=C(b,c,l);return r.get(u)};function g(b,c=!1){const l=b.matches.at(-2);if(l)return je(l)?{name:l.name??"",get props(){return w(l,"default",b,c)}}:Ze(l)?{name:l.name??"",props:new Proxy({},{get(u,d){return typeof d!="string"?Reflect.get(u,d):w(l,d,b,c)}})}:{name:l.name??"",props:void 0}}function w(b,c,l,u=!1){const d=f(b.id,c,l);if(u&&!d){const S=b.name??"unknown",U=l.name||"unknown";console.warn(`
|
|
2
|
-
Unable to access parent props "${
|
|
1
|
+
(function(L,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(L=typeof globalThis<"u"?globalThis:L||self,l(L["@kitbag/router"]={},L.Vue))})(this,function(L,l){"use strict";class bt extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}function ie(e){return Array.isArray(e)?e:[e]}function vt(e,t){return e.filter(n=>t===n).length}function ce(...e){const t=e.flatMap(n=>Array.isArray(n)?n:Object.keys(n));for(const n of t)if(vt(t,n)>1)throw new bt(n)}class z extends Error{}const ye="[",Ue="]";function Ln(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function Vn(e){return typeof e=="function"&&Ln(e)}function ke(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function St(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Pt(e,t){return ke(e)?{...e,defaultValue:t??e.defaultValue}:{get:n=>te(n,e),set:n=>Y(n,e),defaultValue:t}}function Nn(e){return ke(e)&&e.defaultValue!==void 0}function Bn(e,t){return Pt(e,t)}function Cn(e){return e!==void 0}function ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I(e){return typeof e=="string"&&e.length>0}let A=null;async function On(){const{ZodSchema:e,ZodString:t,ZodBoolean:n,ZodDate:r,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:f,ZodArray:d,ZodTuple:R,ZodUnion:h,ZodDiscriminatedUnion:U,ZodRecord:v,ZodMap:C,ZodSet:g,ZodIntersection:k,ZodPromise:m,ZodFunction:w}=await import("zod");return{ZodSchema:e,ZodString:t,ZodBoolean:n,ZodDate:r,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:f,ZodArray:d,ZodTuple:R,ZodUnion:h,ZodDiscriminatedUnion:U,ZodRecord:v,ZodMap:C,ZodSet:g,ZodIntersection:k,ZodPromise:m,ZodFunction:w}}function xn(e){return Object.values(e).some(t=>Object.values(t.host.params).some(n=>$e(n))||Object.values(t.path.params).some(n=>$e(n))||Object.values(t.query.params).some(n=>$e(n)))}function $e(e){return ue(e)&&"parse"in e&&typeof e.parse=="function"&&"~standard"in e&&ue(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="zod"}async function jn(){try{A=await On()}catch{throw new Error("Failed to initialize Zod")}}function At(e){return A?e instanceof A.ZodSchema:!1}function Ut(e){return{get:(t,{invalid:n})=>{try{return qe(t,e)}catch{throw n()}},set:(t,{invalid:n})=>{try{return De(t,e)}catch{throw n()}}}}const Zn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function fe(e,t){if(typeof t=="string"&&Zn.test(t)){const n=new Date(t);return isNaN(n.getTime())?t:n}return t}function le(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Le(e,t){return A?.ZodString&&e instanceof A.ZodString?1:A?.ZodString&&t instanceof A.ZodString?-1:0}function qe(e,t){if(!A)throw new Error("Zod is not initialized");if(t instanceof A.ZodString)return t.parse(e);if(t instanceof A.ZodBoolean)return t.parse(!!e);if(t instanceof A.ZodDate)return t.parse(new Date(e));if(t instanceof A.ZodNumber)return t.parse(Number(e));if(t instanceof A.ZodLiteral)return le([()=>t.parse(Number(e)),()=>t.parse(!!e),()=>t.parse(e)]);if(t instanceof A.ZodObject)return t.parse(JSON.parse(e,fe));if(t instanceof A.ZodEnum)return t.parse(e);if(t instanceof A.ZodNativeEnum)return le([()=>t.parse(Number(e)),()=>t.parse(e)]);if(t instanceof A.ZodArray||t instanceof A.ZodTuple)return t.parse(JSON.parse(e,fe));if(t instanceof A.ZodUnion){const n=Array.from(t._def.options).sort(Le).map(r=>()=>qe(e,r));return le(n)}if(t instanceof A.ZodDiscriminatedUnion){const n=Array.from(t.options).sort(Le).map(r=>()=>qe(e,r));return le(n)}if(t instanceof A.ZodRecord)return t.parse(JSON.parse(e,fe));if(t instanceof A.ZodMap)return t.parse(new Map(JSON.parse(e,fe)));if(t instanceof A.ZodSet)return t.parse(new Set(JSON.parse(e,fe)));if(t instanceof A.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof A.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof A.ZodFunction)throw new Error("Function schemas are not supported");return t.parse(e)}function De(e,t){if(!A)throw new Error("Zod is not initialized");if(t instanceof A.ZodString)return t.parse(e);if(t instanceof A.ZodBoolean)return t.parse(e).toString();if(t instanceof A.ZodDate)return t.parse(e).toISOString();if(t instanceof A.ZodNumber)return t.parse(Number(e)).toString();if(t instanceof A.ZodLiteral)return t.parse(e).toString();if(t instanceof A.ZodObject)return JSON.stringify(t.parse(e));if(t instanceof A.ZodEnum)return t.parse(e);if(t instanceof A.ZodNativeEnum)return t.parse(e).toString();if(t instanceof A.ZodArray||t instanceof A.ZodTuple)return JSON.stringify(t.parse(e));if(t instanceof A.ZodUnion){const n=Array.from(t._def.options).sort(Le).map(r=>()=>De(e,r));return le(n)}if(t instanceof A.ZodDiscriminatedUnion){const n=Array.from(t.options).sort(Le).map(r=>()=>De(e,r));return le(n)}if(t instanceof A.ZodRecord)return JSON.stringify(t.parse(e));if(t instanceof A.ZodMap){const n=t.parse(e);return JSON.stringify(Array.from(n.entries()))}if(t instanceof A.ZodSet){const n=t.parse(e);return JSON.stringify(Array.from(n.values()))}if(t instanceof A.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof A.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof A.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(t.parse(e))}function _e(e){return typeof e=="object"&&e!==null&&"then"in e}function B(e,t){const n=e["~standard"].validate(t);if(_e(n))throw new Error("Promise schemas are not supported");if(n.issues)throw new Error("Validation failed");return n.value}function Hn(e){return ue(e)&&"type"in e&&typeof e.type=="string"&&"~standard"in e&&ue(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="valibot"}function kt(e){return Hn(e)}function Lt(e){return{get:(t,{invalid:n})=>{try{return Ie(t,e)}catch{throw n()}},set:(t,{invalid:n})=>{try{return Je(t,e)}catch{throw n()}}}}const $n=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pe(e,t){if(typeof t=="string"&&$n.test(t)){const n=new Date(t);return isNaN(n.getTime())?t:n}return t}function de(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Ve(e,t){return e.type==="string"?1:t.type==="string"?-1:0}function Ie(e,t){if(t.type==="boolean")return B(t,!!e);if(t.type==="date")return B(t,new Date(e));if(t.type==="number")return B(t,Number(e));if(t.type==="literal")return de([()=>B(t,Number(e)),()=>B(t,!!e),()=>B(t,e)]);if(t.type==="object")return B(t,JSON.parse(e,pe));if(t.type==="enum")return de([()=>B(t,Number(e)),()=>B(t,!!e),()=>B(t,e)]);if(t.type==="array"||t.type==="tuple")return B(t,JSON.parse(e,pe));if(t.type==="union"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Ie(e,r));return de(n)}if(t.type==="variant"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Ie(e,r));return de(n)}if(t.type==="record")return B(t,JSON.parse(e,pe));if(t.type==="map")return B(t,new Map(JSON.parse(e,pe)));if(t.type==="set")return B(t,new Set(JSON.parse(e,pe)));if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return B(t,e)}function Je(e,t){if(t.type==="string"||t.type==="boolean")return B(t,e).toString();if(t.type==="date")return B(t,e).toISOString();if(t.type==="number")return B(t,Number(e)).toString();if(t.type==="literal")return B(t,e).toString();if(t.type==="object")return JSON.stringify(B(t,e));if(t.type==="enum"||t.type==="nativeEnum")return B(t,e).toString();if(t.type==="array"||t.type==="tuple")return JSON.stringify(B(t,e));if(t.type==="union"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Je(e,r));return de(n)}if(t.type==="variant"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Je(e,r));return de(n)}if(t.type==="record")return JSON.stringify(B(t,e));if(t.type==="map"){const n=B(t,e);return JSON.stringify(Array.from(n.entries()))}if(t.type==="set"){const n=B(t,e);return JSON.stringify(Array.from(n.values()))}if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(B(t,e))}function qn(e,t){return e[t]??String}const x={invalid:e=>{throw new z(e)}},Vt={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},Te={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},Me={get:(e,{invalid:t})=>{const n=Number(e);if(isNaN(n))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},Nt={get:(e,{invalid:t})=>{const n=new Date(e);if(isNaN(n.getTime()))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},Bt={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function Dn(e,t){switch(typeof t){case"string":return Vt.get(e,x)===t;case"number":return Me.get(e,x)===t;case"boolean":return Te.get(e,x)===t;default:return!1}}function te(e,t,n=!1){if(e===void 0||!I(e)){if(Nn(t))return t.defaultValue;if(n)return;throw new z}if(t===String)return Vt.get(e,x);if(t===Boolean)return Te.get(e,x);if(t===Number)return Me.get(e,x);if(t===Date)return Nt.get(e,x);if(t===JSON)return Bt.get(e,x);if(Vn(t))return t(e,x);if(ke(t))return t.get(e,x);if(t instanceof RegExp){if(t.test(e))return e;throw new z}if(St(t)){if(Dn(e,t))return t;throw new z}return At(t)?Ut(t).get(e,x):kt(t)?Lt(t).get(e,x):e}function Fe(e,t,n=!1){try{return te(e,t,n)}catch(r){if(r instanceof z)return;throw r}}function _n(e,t,n=!1){try{return Y(e,t,n)}catch(r){if(r instanceof z)return;throw r}}function Y(e,t,n=!1){if(e===void 0){if(n)return"";throw new z}if(t===Boolean)return Te.set(e,x);if(t===Number)return Me.set(e,x);if(t===Date)return Nt.set(e,x);if(t===JSON)return Bt.set(e,x);if(ke(t))return t.set(e,x);if(St(t)){if(t!==e)throw new z;return e.toString()}if(At(t))return Ut(t).set(e,x);if(kt(t))return Lt(t).set(e,x);try{return e.toString()}catch{throw new z}}function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function In(e,t){const n=Array.from(e.matchAll(t));if(n.length===0)return[e];let r=0;const o=n.reduce((s,i)=>{const f=We(e.slice(r,i.index));f.length&&s.push(f);const[d]=i;return s.push(d),r=i.index+d.length,s},[]),a=e.slice(r);return a&&o.push(a),o}function Jn(e){const t=Ct(e.path.value);return new RegExp(`^${t}$`,"i")}function Tn(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,n])=>!Qe(n)).map(([n,r])=>{const o=Ct(r);return new RegExp(`${We(n)}=${o}(&|$)`,"i")})}function Ct(e){return In(e,new RegExp(Ne,"g")).map(t=>t.startsWith(ye)?Ot(t):We(t)).join("")}function Ot(e){return e.replace(new RegExp(Ne,"g"),Wn)}function Mn(e,t){const n=xt(t);return e.replace(n,Gn)}function Ge(e,t){return Qn(t).test(e.value)}function Qe(e){return new RegExp(Fn,"g").test(e)}const Ne=`\\${ye}\\??([\\w-_]+)\\${Ue}`,Fn=`\\${ye}\\?([\\w-_]+)\\${Ue}`,Wn=".*",Gn="(.*)";function ze(e){const[t]=jt(e,new RegExp(Ne,"g"));return t}function xt(e){return new RegExp(`\\${ye}\\??${e}\\${Ue}`,"g")}function Qn(e){return new RegExp(`\\${ye}\\?${e}\\${Ue}`,"g")}function jt(e,t){return Array.from(e.matchAll(t)).flatMap(([,...r])=>r.map(o=>I(o)?o:""))}function zn(e="",t={}){return I(e)?Array.from(e.matchAll(new RegExp(Ne,"g"))).reduce((r,[o,a])=>{const s=ze(o);if(!s)return r;const i=qn(t,s);return ce([s],r),r[a]=i,r},{}):{}}function Yn(e){return ue(e)&&typeof e.value=="string"}function ne(e){return e===void 0?G():Yn(e)?e:G(e,{})}function G(e,t){return{value:e??"",params:zn(e,t)}}function Zt(e,t){ce(e.params,t.params);const n=`${e.value}${t.value}`;return G(n,{...e.params,...t.params})}function Kn(e,t){return Zt(e,t)}class Ht extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function Xn(e,t){return er(e,t),{...e,...t}}function er(e,t){const n=Object.keys(e).find(r=>r in t&&typeof t[r]!=typeof e[r]);if(n)throw new Ht(n)}function tr(e,t){ce(e.params,t.params);const n=[e.value,t.value].filter(I).join("&");return G(n,{...e.params,...t.params})}function nr(e,t){return ce(e,t),{...e,...t}}function Ye(e){return"parent"in e&&!!e.parent}function Ke(e){return"component"in e&&!!e.component}function Xe(e){return"props"in e&&typeof e.props=="function"}function et(e){return"components"in e&&!!e.components}function tt(e){return"props"in e&&typeof e.props=="object"}function nt(e,t){return{...t,path:Zt(e.path,t.path),query:tr(e.query,t.query),meta:Xn(e.meta,t.meta),state:nr(e.state,t.state),hash:Kn(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function q(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function rt(e){return q(e)?e:`/${e}`}class re extends Error{constructor(){super("Router not installed")}}class $t extends Error{constructor(t,n){super(`useRoute called with incorrect route. Given ${t}, expected ${n}`)}}function ot(){let e=0;return()=>(++e).toString()}const rr=ot()();function or(e){return e===rr}const at=ot();function qt(e){return e===void 0?"":e}function oe(e,t){const n=at(),r=qt(e.name),o=ne(e.path),a=ne(e.query),s=ne(e.hash),i=e.meta??{},f=e.state??{},d=l.markRaw({id:n,meta:i,state:f,...e,props:t}),R={id:n,matched:d,matches:[d],name:r,path:o,query:a,hash:s,meta:i,state:f,depth:1,host:G(),prefetch:e.prefetch},h=Ye(e)?nt(e.parent,R):R;return ce(h.path.params,h.query.params,h.hash.params),h}function ar(e){const t=at(),n=qt(e.name),r=ne(e.path),o=ne(e.query),a=ne(e.hash),s=e.meta??{},i=ne(e.host),f=l.markRaw({id:t,meta:{},state:{},...e}),d={id:t,matched:f,matches:[f],name:n,host:i,path:r,query:o,hash:a,meta:s,depth:1,state:{}},R=Ye(e)?nt(e.parent,d):d;return ce(R.path.params,R.query.params,R.host.params,R.hash.params),R}function ge(){const e=new Map;return t=>{const n=e.get(t);if(!n){const r=Symbol();return e.set(t,r),r}return n}}const sr=ge();function st(e){const t=sr(e);return({increment:n=!1}={})=>{const r=l.inject(t,0);return n&&l.provide(t,r+1),r}}const we=(e,t,n)=>{const r=e.matches,o=t?.matches??[];return r.at(n)?.id!==o.at(n)?.id},Ee=(e,t,n)=>{const r=e.matches,o=t?.matches??[];return r.at(n)?.id!==o.at(n)?.id},be=(e,t,n)=>e.matches.at(n)?.id===t?.matches.at(n)?.id;function Dt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return we;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return be;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Ee;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}class _t{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function ir(e,t){const n=new _t;return e.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&we(e,t,o)&&ie(r.onBeforeRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteEnter is deprecated. Use router.onBeforeRouteEnter instead"),n.onBeforeRouteEnter.add(a)}),r.onBeforeRouteUpdate&&be(e,t,o)&&ie(r.onBeforeRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteUpdate is deprecated. Use router.onBeforeRouteUpdate instead"),n.onBeforeRouteUpdate.add(a)})}),t?.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Ee(e,t,o)&&ie(r.onBeforeRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteLeave is deprecated. Use router.onBeforeRouteLeave instead"),n.onBeforeRouteLeave.add(a)})}),n}function cr(e,t){const n=new _t;return e.matches.forEach((r,o)=>{r.onAfterRouteEnter&&we(e,t,o)&&ie(r.onAfterRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteEnter is deprecated. Use router.onAfterRouteEnter instead"),n.onAfterRouteEnter.add(a)}),r.onAfterRouteUpdate&&be(e,t,o)&&ie(r.onAfterRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteUpdate is deprecated. Use router.onAfterRouteUpdate instead"),n.onAfterRouteUpdate.add(a)})}),t?.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Ee(e,t,o)&&ie(r.onAfterRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteLeave is deprecated. Use router.onAfterRouteLeave instead"),n.onAfterRouteLeave.add(a)})}),n}class K extends Error{response;constructor(t){super("Uncaught CallbackContextPushError"),this.response={status:"PUSH",to:t}}}class ve extends Error{response;constructor(t){super("Uncaught CallbackContextRejectionError"),this.response={status:"REJECT",type:t}}}class it extends Error{response;constructor(){super("Uncaught CallbackContextAbortError"),this.response={status:"ABORT"}}}class Se{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function ur(e,t,n){const r=new Se;return e.matches.forEach((o,a)=>{we(e,t,a)&&n.onBeforeRouteEnter.forEach(s=>r.onBeforeRouteEnter.add(s)),be(e,t,a)&&n.onBeforeRouteUpdate.forEach(s=>r.onBeforeRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{Ee(e,t,a)&&n.onBeforeRouteLeave.forEach(s=>r.onBeforeRouteLeave.add(s))}),r}function fr(e,t,n){const r=new Se;return e.matches.forEach((o,a)=>{we(e,t,a)&&n.onAfterRouteEnter.forEach(s=>r.onAfterRouteEnter.add(s)),be(e,t,a)&&n.onAfterRouteUpdate.forEach(s=>r.onAfterRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{Ee(e,t,a)&&n.onAfterRouteLeave.forEach(s=>r.onAfterRouteLeave.add(s))}),r}function It(){let e=null;function t(r){e=r}function n(r){return e?e.runWithContext(r):r()}return{setVueApp:t,runWithContext:n}}function lr(e){return{reject:a=>{throw new ve(a)},push:(...a)=>{throw new K(a)},replace:(a,s,i)=>{if(q(a)){const R=s??{};throw new K([a,{...R,replace:!0}])}const f=s,d=i??{};throw new K([a,f,{...d,replace:!0}])},abort:()=>{throw new it}}}const Jt=ge();function pr(e){const{setVueApp:t,runWithContext:n}=It(),r={global:new Se,component:new Se},{reject:o,push:a,replace:s,abort:i}=lr(),f=c=>(r.global.onBeforeRouteEnter.add(c),()=>r.global.onBeforeRouteEnter.delete(c)),d=c=>(r.global.onBeforeRouteUpdate.add(c),()=>r.global.onBeforeRouteUpdate.delete(c)),R=c=>(r.global.onBeforeRouteLeave.add(c),()=>r.global.onBeforeRouteLeave.delete(c)),h=c=>(r.global.onAfterRouteEnter.add(c),()=>r.global.onAfterRouteEnter.delete(c)),U=c=>(r.global.onAfterRouteUpdate.add(c),()=>r.global.onAfterRouteUpdate.delete(c)),v=c=>(r.global.onAfterRouteLeave.add(c),()=>r.global.onAfterRouteLeave.delete(c));async function C({to:c,from:u}){const{global:S,component:V}=r,y=ir(c,u),p=ur(c,u,S),E=[...p.onBeforeRouteEnter,...y.onBeforeRouteEnter,...p.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...V.onBeforeRouteUpdate,...p.onBeforeRouteLeave,...y.onBeforeRouteLeave,...V.onBeforeRouteLeave];try{const b=E.map(N=>n(()=>N(c,{from:u,reject:o,push:a,replace:s,abort:i})));await Promise.all(b)}catch(b){if(b instanceof K||b instanceof ve||b instanceof it)return b.response;throw b}return{status:"SUCCESS"}}async function g({to:c,from:u}){const{global:S,component:V}=r,y=cr(c,u),p=fr(c,u,S),E=[...V.onAfterRouteLeave,...y.onAfterRouteLeave,...p.onAfterRouteLeave,...V.onAfterRouteUpdate,...y.onAfterRouteUpdate,...p.onAfterRouteUpdate,...V.onAfterRouteEnter,...y.onAfterRouteEnter,...p.onAfterRouteEnter];try{const b=E.map(N=>n(()=>N(c,{from:u,reject:o,push:a,replace:s})));await Promise.all(b)}catch(b){if(b instanceof K||b instanceof ve)return b.response;throw b}return{status:"SUCCESS"}}return{runBeforeRouteHooks:C,runAfterRouteHooks:g,addComponentBeforeRouteHook:({lifecycle:c,depth:u,hook:S})=>{const V=Dt(c),y=r.component[c],p=(E,b)=>{if(V(E,b.from,u))return S(E,b)};return y.add(p),()=>y.delete(p)},addComponentAfterRouteHook:({lifecycle:c,depth:u,hook:S})=>{const V=Dt(c),y=r.component[c],p=(E,b)=>{if(V(E,b.from,u))return S(E,b)};return y.add(p),()=>y.delete(p)},addGlobalRouteHooks:c=>{c.onBeforeRouteEnter.forEach(u=>f(u)),c.onBeforeRouteUpdate.forEach(u=>d(u)),c.onBeforeRouteLeave.forEach(u=>R(u)),c.onAfterRouteEnter.forEach(u=>h(u)),c.onAfterRouteUpdate.forEach(u=>U(u)),c.onAfterRouteLeave.forEach(u=>v(u))},onBeforeRouteEnter:f,onBeforeRouteUpdate:d,onBeforeRouteLeave:R,onAfterRouteEnter:h,onAfterRouteUpdate:U,onAfterRouteLeave:v,setVueApp:t}}function Tt(e){const t=Jt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}function Mt(e,t){const n=st(e),r=Tt(e);return o=>{const a=n(),i=r().addComponentBeforeRouteHook({lifecycle:t,hook:o,depth:a-1});return l.onUnmounted(i),i}}function Ft(e,t){const n=st(e),r=Tt(e);return o=>{const a=n(),i=r().addComponentAfterRouteHook({lifecycle:t,hook:o,depth:a-1});return l.onUnmounted(i),i}}function dr(e){const t=Mt(e,"onBeforeRouteLeave"),n=Mt(e,"onBeforeRouteUpdate"),r=Ft(e,"onAfterRouteLeave"),o=Ft(e,"onAfterRouteUpdate");return{onBeforeRouteLeave:t,onBeforeRouteUpdate:n,onAfterRouteLeave:r,onAfterRouteUpdate:o}}const Wt=ge();function hr(e){const t=Wt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}const Gt=ge();function mr(e){const t=Gt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}function Pe(e){return()=>{const t=l.inject(e);if(!t)throw new re;return t}}const Qt=Symbol("isRouterRouteSymbol");function Rr(e,t){return typeof t=="object"&&t!==null&&Qt in t&&e in t}function yr(e,t,n){function r(m,w,c){if(typeof m=="object"){const S={...t.params,...m};return n(t.name,S,w)}const u={...t.params,[m]:w};return n(t.name,u,c)}const o=(...m)=>{const w=new URLSearchParams(t.query);w.set(...m),r({},{query:w})},a=(...m)=>{const w=new URLSearchParams(t.query);w.append(...m),r({},{query:w})},s=(...m)=>{const w=new URLSearchParams(t.query);w.delete(...m),r({},{query:w})},{id:i,matched:f,matches:d,name:R,hash:h,href:U}=l.toRefs(t),v=l.computed({get(){return new Proxy(t.params,{set(m,w,c){return r(w,c),!0}})},set(m){r(m)}}),C=l.computed({get(){return new Proxy(t.query,{get(m,w,c){switch(w){case"append":return a;case"set":return o;case"delete":return s;default:return Reflect.get(m,w,c)}}})},set(m){r({},{query:m})}}),g=l.computed({get(){return new Proxy(t.state,{set(m,w,c){return r({},{state:{...t.state,[w]:c}}),!0}})},set(m){r({},{state:m})}});return l.reactive({id:i,matched:f,matches:d,state:g,query:C,hash:h,params:v,name:R,href:U,update:r,[Qt]:!0,[e]:!0})}function ct(e){return(t,n,{exact:r}={})=>Rr(e,t)?n===void 0?!0:r?t.matched.name===n:t.matches.map(o=>o.name).includes(n):!1}function Be(e){const t=Pe(e),n=ct(e);return(r,o)=>{const a=t();function s(){if(!r)return;if(!n(a.route,r,o))throw new $t(r,a.route.name)}return l.watch(a.route,s,{immediate:!0,deep:!0}),a.route}}function ut(e){const t=Be(e),n=Pe(e),r=mr(e),o=st(e),a=hr(e);return l.defineComponent((s,i)=>{const f=t(),d=n(),R=r(),h=o({increment:!0});l.onServerPrefetch(async()=>{await d.start()});const{getRouteComponents:U}=a(),v=l.computed(()=>{if(!d.started.value)return null;if(R.value)return R.value.component;const C=f.matches.at(h);if(!C)return null;const g=U(C),k=s.name??"default";return g[k]});return()=>i.slots.default?i.slots.default({route:f,component:v,rejection:R.value}):v.value?l.h(v.value):null},{name:"RouterView",props:["name"]})}const zt=ge();function Yt(e){const t=zt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}const gr="lazy",wr={components:!0,props:!1};function Ce(e){return["eager","lazy","intent"].includes(e)}function Kt({routerPrefetch:e,routePrefetch:t,linkPrefetch:n},r){const o=ft(n,r),a=ft(t,r),s=ft(e,r),i=[o,a,s,wr[r],gr].reduce((f,d)=>Ce(f)?f:f===!0&&Ce(d)?d:f===!0&&!Ce(d)?f:f===void 0?d:f,void 0);return Ce(i)?i:!1}function ft(e,t){return ue(e)?e[t]:e}const Er=l.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Xt(e){return e.name===Er.name&&"__asyncLoader"in e}const en=Symbol("visibilityObserver");function br(e){const t=l.inject(en);if(!t)throw new re;return l.watch(e,(r,o)=>{r&&t.observe(r),o&&t.unobserve(o)},{immediate:!0}),l.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:l.computed(()=>e.value?t.isElementVisible(e.value):!1)}}function tn(e,t,n){l.watch(e,(r,o)=>{r&&r.addEventListener(t,n),o&&o.removeEventListener(t,n)},{immediate:!0}),l.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,n)})}function vr(e){const t=Yt(e);return n=>{const r=new Map,o=l.ref(),{getPrefetchProps:a,setPrefetchProps:s}=t(),{isElementVisible:i}=br(o),f=()=>{const h=Array.from(r.values()).reduce((U,v)=>(Object.assign(U,v),U),{});s(h)};l.watch(()=>l.toValue(n),({route:h,...U})=>{r.clear(),h&&R("eager",h,U)},{immediate:!0}),l.watch(i,h=>{const{route:U,...v}=l.toValue(n);!U||!h||R("lazy",U,v)},{immediate:!0}),tn(o,"focusin",d),tn(o,"mouseover",d);function d(){const{route:h,...U}=l.toValue(n);h&&R("intent",h,U)}function R(h,U,v){Sr(h,U,v),r.has(h)||r.set(h,a(h,U,v))}return{element:o,commit:f}}}function Sr(e,t,n){t.matches.forEach(r=>{Kt({...n,routePrefetch:r.prefetch},"components")===e&&(Ke(r)&&Xt(r.component)&&r.component.__asyncLoader(),et(r)&&Object.values(r.components).forEach(a=>{Xt(a)&&a.__asyncLoader()}))})}function lt(...e){const t=new URLSearchParams;for(const n of e){const r=new URLSearchParams(n);for(const[o,a]of r.entries())t.append(o,a)}return t}function nn(e){const t=Pe(e),n=vr(e),r=ct(e);return(o,a={},s={})=>{const i=t(),f=l.computed(()=>{const u=l.toValue(o);return typeof u!="string"?u:q(u)?i.find(u,l.toValue(s)):i.resolve(u,l.toValue(a),l.toValue(s))}),d=l.computed(()=>{if(f.value)return f.value.href;const u=l.toValue(o);if(q(u))return u;console.error(new Error("Failed to resolve route in RouterLink."))}),R=l.computed(()=>r(i.route)&&i.route.matches.some(u=>u.id===f.value?.id)),h=l.computed(()=>i.route.id===f.value?.id),U=l.computed(()=>r(i.route)&&Cn(f.value)&&i.route.href.startsWith(f.value.href)),v=l.computed(()=>i.route.href===f.value?.href),C=l.computed(()=>!!d.value&&i.isExternal(d.value)),g=l.computed(()=>{const u=l.toValue(o);return typeof u!="string"||q(u)?l.toValue(a):l.toValue(s)}),{element:k,commit:m}=n(()=>({route:f.value,routerPrefetch:i.prefetch,linkPrefetch:g.value.prefetch})),w=u=>{m();const S={replace:u?.replace??g.value.replace,query:lt(g.value.query,u?.query),hash:u?.hash??g.value.hash,state:{...g.value.state,...u?.state}},V=l.toValue(o);return q(V)||typeof V=="object"?i.push(V,S):i.push(V,l.toValue(a),S)};return{element:k,route:f,href:d,isMatch:R,isExactMatch:h,isActive:U,isExactActive:v,isExternal:C,push:w,replace:u=>w({...u,replace:!0})}}}function rn(e){const t=Pe(e),n=nn(e);return l.defineComponent((r,o)=>{const a=t(),s=l.computed(()=>m(r.to)),i=l.computed(()=>w(r.to)),f=l.computed(()=>{const{to:u,...S}=r;return S}),{element:d,isMatch:R,isExactMatch:h,isActive:U,isExactActive:v,isExternal:C,push:g}=n(()=>typeof r.to=="function"?r.to(a.resolve):r.to,f),k=l.computed(()=>({"router-link--match":R.value,"router-link--exact-match":h.value,"router-link--active":U.value,"router-link--exact-active":v.value}));function m(u){if(typeof u=="function"){const S=u(a.resolve);return m(S)}return q(u)?a.find(u):u}function w(u){if(typeof u=="function"){const S=u(a.resolve);return w(S)}return q(u)?u:u?.href}function c(u){u.preventDefault(),g()}return()=>l.h("a",{href:i.value,class:["router-link",k.value],ref:d,onClick:c},o.slots.default?.({route:s.value,isMatch:R.value,isExactMatch:h.value,isActive:U.value,isExactActive:v.value,isExternal:C.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function Pr(e){const t=Be(e);return(n,r=String)=>{const o=t(),a=l.computed({get(){const i=o.query.get(l.toValue(n));return i===null?null:Fe(i,r)},set(i){o.query.set(l.toValue(n),Y(i,r))}}),s=l.computed({get(){return o.query.getAll(l.toValue(n)).map(f=>Fe(f,r)).filter(f=>f!==null)},set(i){const f=new URLSearchParams(o.query);f.delete(l.toValue(n)),i.forEach(d=>{f.append(l.toValue(n),Y(d,r))}),o.query=f}});return{value:a,values:s,remove:()=>{o.query.delete(l.toValue(n))}}}}function on(e){const t=typeof e=="object"?e.key:e,{onBeforeRouteLeave:n,onBeforeRouteUpdate:r,onAfterRouteLeave:o,onAfterRouteUpdate:a}=dr(t),s=ct(t),i=ut(t),f=rn(t),d=Be(t),R=Pe(t),h=Pr(t),U=nn(t);return{onBeforeRouteLeave:n,onBeforeRouteUpdate:r,onAfterRouteLeave:o,onAfterRouteUpdate:a,isRoute:s,RouterView:i,RouterLink:f,useRoute:d,useRouter:R,useQueryValue:h,useLink:U}}function Ar(e){return{routes:e.routes??[],rejections:e.rejections??{},...e}}function an(e){return{get:(t,{invalid:n})=>{for(const r of e){const o=Fe(t,r);if(o!==void 0)return o}throw n(`Value ${t} does not satisfy any of the possible values`)},set:(t,{invalid:n})=>{for(const r of e){const o=_n(t,r);if(o!==void 0)return o}throw n(`Value ${t} does not satisfy any of the possible values`)}}}const Ur={separator:","};function kr(e,t={}){const{separator:n}={...Ur,...t},r=an(e);return{get:(o,a)=>o.split(n).map(s=>r.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>r.set(s,a)).join(n)}}}const Lr={separator:","};function Vr(e,t={}){const{separator:n}={...Lr,...t};return{get:r=>{const o=r.split(n);return e.map((a,s)=>te(o.at(s),a))},set:(r,{invalid:o})=>{if(!Array.isArray(r))throw o("Expected a tuple");if(r.length!==e.length)throw o(`Expected tuple with ${e.length} values but received ${r.length} values`);return e.map((a,s)=>Y(r.at(s),a)).join(n)}}}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var he=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function ae(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var Oe="beforeunload",Nr="hashchange",sn="popstate";function cn(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var y=r.location,p=y.pathname,E=y.search,b=y.hash,N=o.state||{};return[N.idx,he({pathname:p,search:E,hash:b,state:N.usr||null,key:N.key||"default"})]}var s=null;function i(){if(s)v.call(s),s=null;else{var y=H.Pop,p=a(),E=p[0],b=p[1];if(v.length)if(E!=null){var N=R-E;N&&(s={action:y,location:b,retry:function(){S(N*-1)}},S(N))}else process.env.NODE_ENV!=="production"&&ae(!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 w(y)}}r.addEventListener(sn,i);var f=H.Pop,d=a(),R=d[0],h=d[1],U=me(),v=me();R==null&&(R=0,o.replaceState(X({},o.state,{idx:R}),""));function C(y){return typeof y=="string"?y:se(y)}function g(y,p){return p===void 0&&(p=null),he(X({pathname:h.pathname,hash:"",search:""},typeof y=="string"?Ae(y):y,{state:p,key:je()}))}function k(y,p){return[{usr:y.state,key:y.key,idx:p},C(y)]}function m(y,p,E){return!v.length||(v.call({action:y,location:p,retry:E}),!1)}function w(y){f=y;var p=a();R=p[0],h=p[1],U.call({action:f,location:h})}function c(y,p){var E=H.Push,b=g(y,p);function N(){c(y,p)}if(m(E,b,N)){var j=k(b,R+1),Z=j[0],$=j[1];try{o.pushState(Z,"",$)}catch{r.location.assign($)}w(E)}}function u(y,p){var E=H.Replace,b=g(y,p);function N(){u(y,p)}if(m(E,b,N)){var j=k(b,R),Z=j[0],$=j[1];o.replaceState(Z,"",$),w(E)}}function S(y){o.go(y)}var V={get action(){return f},get location(){return h},createHref:C,push:c,replace:u,go:S,back:function(){S(-1)},forward:function(){S(1)},listen:function(p){return U.push(p)},block:function(p){var E=v.push(p);return v.length===1&&r.addEventListener(Oe,xe),function(){E(),v.length||r.removeEventListener(Oe,xe)}}};return V}function Br(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var p=Ae(r.location.hash.substr(1)),E=p.pathname,b=E===void 0?"/":E,N=p.search,j=N===void 0?"":N,Z=p.hash,$=Z===void 0?"":Z,T=o.state||{};return[T.idx,he({pathname:b,search:j,hash:$,state:T.usr||null,key:T.key||"default"})]}var s=null;function i(){if(s)v.call(s),s=null;else{var p=H.Pop,E=a(),b=E[0],N=E[1];if(v.length)if(b!=null){var j=R-b;j&&(s={action:p,location:N,retry:function(){V(j*-1)}},V(j))}else process.env.NODE_ENV!=="production"&&ae(!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 c(p)}}r.addEventListener(sn,i),r.addEventListener(Nr,function(){var p=a(),E=p[1];se(E)!==se(h)&&i()});var f=H.Pop,d=a(),R=d[0],h=d[1],U=me(),v=me();R==null&&(R=0,o.replaceState(X({},o.state,{idx:R}),""));function C(){var p=document.querySelector("base"),E="";if(p&&p.getAttribute("href")){var b=r.location.href,N=b.indexOf("#");E=N===-1?b:b.slice(0,N)}return E}function g(p){return C()+"#"+(typeof p=="string"?p:se(p))}function k(p,E){return E===void 0&&(E=null),he(X({pathname:h.pathname,hash:"",search:""},typeof p=="string"?Ae(p):p,{state:E,key:je()}))}function m(p,E){return[{usr:p.state,key:p.key,idx:E},g(p)]}function w(p,E,b){return!v.length||(v.call({action:p,location:E,retry:b}),!1)}function c(p){f=p;var E=a();R=E[0],h=E[1],U.call({action:f,location:h})}function u(p,E){var b=H.Push,N=k(p,E);function j(){u(p,E)}if(process.env.NODE_ENV!=="production"&&ae(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(p)+")"),w(b,N,j)){var Z=m(N,R+1),$=Z[0],T=Z[1];try{o.pushState($,"",T)}catch{r.location.assign(T)}c(b)}}function S(p,E){var b=H.Replace,N=k(p,E);function j(){S(p,E)}if(process.env.NODE_ENV!=="production"&&ae(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(p)+")"),w(b,N,j)){var Z=m(N,R),$=Z[0],T=Z[1];o.replaceState($,"",T),c(b)}}function V(p){o.go(p)}var y={get action(){return f},get location(){return h},createHref:g,push:u,replace:S,go:V,back:function(){V(-1)},forward:function(){V(1)},listen:function(E){return U.push(E)},block:function(E){var b=v.push(E);return v.length===1&&r.addEventListener(Oe,xe),function(){b(),v.length||r.removeEventListener(Oe,xe)}}};return y}function un(e){e===void 0&&(e={});var t=e,n=t.initialEntries,r=n===void 0?["/"]:n,o=t.initialIndex,a=r.map(function(c){var u=he(X({pathname:"/",search:"",hash:"",state:null,key:je()},typeof c=="string"?Ae(c):c));return process.env.NODE_ENV!=="production"&&ae(u.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(c)+")"),u}),s=fn(o??a.length-1,0,a.length-1),i=H.Pop,f=a[s],d=me(),R=me();function h(c){return typeof c=="string"?c:se(c)}function U(c,u){return u===void 0&&(u=null),he(X({pathname:f.pathname,search:"",hash:""},typeof c=="string"?Ae(c):c,{state:u,key:je()}))}function v(c,u,S){return!R.length||(R.call({action:c,location:u,retry:S}),!1)}function C(c,u){i=c,f=u,d.call({action:i,location:f})}function g(c,u){var S=H.Push,V=U(c,u);function y(){g(c,u)}process.env.NODE_ENV!=="production"&&ae(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(c)+")"),v(S,V,y)&&(s+=1,a.splice(s,a.length,V),C(S,V))}function k(c,u){var S=H.Replace,V=U(c,u);function y(){k(c,u)}process.env.NODE_ENV!=="production"&&ae(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(c)+")"),v(S,V,y)&&(a[s]=V,C(S,V))}function m(c){var u=fn(s+c,0,a.length-1),S=H.Pop,V=a[u];function y(){m(c)}v(S,V,y)&&(s=u,C(S,V))}var w={get index(){return s},get action(){return i},get location(){return f},createHref:h,push:g,replace:k,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(u){return d.push(u)},block:function(u){return R.push(u)}};return w}function fn(e,t,n){return Math.min(Math.max(e,t),n)}function xe(e){e.preventDefault(),e.returnValue=""}function me(){var e=[];return{get length(){return e.length},push:function(n){return e.push(n),function(){e=e.filter(function(r){return r!==n})}},call:function(n){e.forEach(function(r){return r&&r(n)})}}}function je(){return Math.random().toString(36).substr(2,8)}function se(e){var t=e.pathname,n=t===void 0?"/":t,r=e.search,o=r===void 0?"":r,a=e.hash,s=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function Ae(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Cr(e,t,n){const r=l.reactive({...t}),o=i=>{Object.assign(r,{...i})},a=r,s=yr(e,a,n);return{currentRoute:a,routerRoute:s,updateRoute:o}}function D(e){return!e.startsWith("http")?xr(e):Or(e)}function Or(e){const{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}}function xr(e){const{pathname:t,search:n,searchParams:r,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:n,searchParams:r,hash:o}}function jr(e){return t=>{const{host:n}=D(t);return!(n===void 0||n===e)}}function Zr(){return{reject:o=>{throw new ve(o)},push:(...o)=>{throw new K(o)},replace:(o,a,s)=>{if(q(o)){const d=a??{};throw new K([o,{...d,replace:!0}])}const i=a,f=s??{};throw new K([o,i,{...f,replace:!0}])},abort:()=>{throw new it}}}function ln(e){try{const t=e();return _e(t)?t.catch(n=>n):t}catch(t){return t}}function Hr(){const{setVueApp:e,runWithContext:t}=It(),n=l.reactive(new Map),{push:r,replace:o,reject:a}=Zr(),s=(g,k,m)=>k.matches.filter(w=>Kt({...m,routePrefetch:w.prefetch},"props")===g).flatMap(w=>v(w)).reduce((w,{id:c,name:u,props:S})=>{if(!S)return w;const V=U(c,u,k),y=t(()=>ln(()=>S(k,{push:r,replace:o,reject:a,parent:R(k,!0)})));return w[V]=y,w},{}),i=g=>{Object.entries(g).forEach(([k,m])=>{n.set(k,m)})},f=async g=>{const k=g.matches.flatMap(v),m=[],w=[];for(const{id:c,name:u,props:S}of k){if(!S)continue;const V=U(c,u,g);if(m.push(V),!n.has(V)){const y=t(()=>ln(()=>S(g,{push:r,replace:o,reject:a,parent:R(g)})));n.set(V,y)}w.push((async()=>{const y=await n.get(V);if(y instanceof Error)throw y})())}C(m);try{return await Promise.all(w),{status:"SUCCESS"}}catch(c){if(c instanceof K||c instanceof ve)return c.response;throw c}},d=(g,k,m)=>{const w=U(g,k,m);return n.get(w)};function R(g,k=!1){const m=g.matches.at(-2);if(m)return Xe(m)?{name:m.name??"",get props(){return h(m,"default",g,k)}}:tt(m)?{name:m.name??"",props:new Proxy({},{get(w,c){return typeof c!="string"?Reflect.get(w,c):h(m,c,g,k)}})}:{name:m.name??"",props:void 0}}function h(g,k,m,w=!1){const c=d(g.id,k,m);if(w&&!c){const u=g.name??"unknown",S=m.name||"unknown";console.warn(`
|
|
2
|
+
Unable to access parent props "${k}" from route "${u}" while prefetching props for route "${S}".
|
|
3
3
|
This may occur if the parent route's props were not also prefetched.
|
|
4
|
-
`)}return d}function C(b,c,l){return[b,c,l.id,JSON.stringify(l.params)].join("-")}function v(b){return je(b)?[{id:b.id,name:"default",props:b.props}]:Ze(b)?Object.entries(b.props).map(([c,l])=>({id:b.id,name:c,props:l})):[]}function B(b){for(const c of r.keys())b.includes(c)||r.delete(c)}return{getPrefetchProps:s,setPrefetchProps:p,getProps:f,setProps:y,setVueApp:t}}function Me(){const t=i.inject(Fe);if(!t)throw new tt;return t}const un=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function We(t){return t.name===un.name&&"__asyncLoader"in t}const Ge=Symbol("visibilityObserver");function fn(t){const e=i.inject(Ge);if(!e)throw new tt;return i.watch(t,(n,o)=>{n&&e.observe(n),o&&e.unobserve(o)},{immediate:!0}),i.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:i.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function Qe(t,e,r){i.watch(t,(n,o)=>{n&&n.addEventListener(e,r),o&&o.removeEventListener(e,r)},{immediate:!0}),i.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,r)})}function ln(t){const e=new Map,r=i.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Me(),{isElementVisible:a}=fn(r),s=()=>{const f=Array.from(e.values()).reduce((g,w)=>(Object.assign(g,w),g),{});o(f)};i.watch(()=>i.toValue(t),({route:f,...g})=>{e.clear(),f&&y("eager",f,g)},{immediate:!0}),i.watch(a,f=>{const{route:g,...w}=i.toValue(t);!g||!f||y("lazy",g,w)},{immediate:!0}),Qe(r,"focusin",p),Qe(r,"mouseover",p);function p(){const{route:f,...g}=i.toValue(t);f&&y("intent",f,g)}function y(f,g,w){dn(f,g,w),e.has(f)||e.set(f,n(f,g,w))}return{element:r,commit:s}}function dn(t,e,r){e.matches.forEach(n=>{He({...r,routePrefetch:n.prefetch},"components")===t&&(xe(n)&&We(n.component)&&n.component.__asyncLoader(),Oe(n)&&Object.values(n.components).forEach(a=>{We(a)&&a.__asyncLoader()}))})}const ze=Symbol("isRouterRouteSymbol");function pn(t){return typeof t=="object"&&t!==null&&ze in t}function hn(t,e){function r(c,l,u){if(typeof c=="object"){const S={...t.params,...c};return e(t.name,S,l)}const d={...t.params,[c]:l};return e(t.name,d,u)}const n=(...c)=>{const l=new URLSearchParams(t.query);l.set(...c),r({},{query:l})},o=(...c)=>{const l=new URLSearchParams(t.query);l.append(...c),r({},{query:l})},a=(...c)=>{const l=new URLSearchParams(t.query);l.delete(...c),r({},{query:l})},{id:s,matched:p,matches:y,name:f,hash:g,href:w}=i.toRefs(t),C=i.computed({get(){return new Proxy(t.params,{set(c,l,u){return r(l,u),!0}})},set(c){r(c)}}),v=i.computed({get(){return new Proxy(t.query,{get(c,l,u){switch(l){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(c,l,u)}}})},set(c){r({},{query:c})}}),B=i.computed({get(){return new Proxy(t.state,{set(c,l,u){return r({},{state:{...t.state,[l]:u}}),!0}})},set(c){r({},{state:c})}});return i.reactive({id:s,matched:p,matches:y,state:B,query:v,hash:g,params:C,name:f,href:w,update:r,[ze]:!0})}function Bt(t,e,{exact:r}={}){return pn(t)?e===void 0?!0:r?t.matched.name===e:t.matches.map(n=>n.name).includes(e):!1}function oe(...t){const e=new URLSearchParams;for(const r of t){const n=new URLSearchParams(r);for(const[o,a]of n.entries())e.append(o,a)}return e}function Ke(t,e={},r={}){const n=Rt(),o=i.computed(()=>{const c=i.toValue(t);return typeof c!="string"?c:Z(c)?n.find(c,i.toValue(r)):n.resolve(c,i.toValue(e),i.toValue(r))}),a=i.computed(()=>{if(o.value)return o.value.href;const c=i.toValue(t);if(Z(c))return c;console.error(new Error("Failed to resolve route in RouterLink."))}),s=i.computed(()=>Bt(n.route)&&n.route.matches.some(c=>{var l;return c.id===((l=o.value)==null?void 0:l.id)})),p=i.computed(()=>{var c;return n.route.id===((c=o.value)==null?void 0:c.id)}),y=i.computed(()=>Bt(n.route)&&Vr(o.value)&&n.route.href.startsWith(o.value.href)),f=i.computed(()=>{var c;return n.route.href===((c=o.value)==null?void 0:c.href)}),g=i.computed(()=>!!a.value&&n.isExternal(a.value)),w=i.computed(()=>{const c=i.toValue(t);return typeof c!="string"||Z(c)?i.toValue(e):i.toValue(r)}),{element:C,commit:v}=ln(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:w.value.prefetch})),B=c=>{v();const l={replace:(c==null?void 0:c.replace)??w.value.replace,query:oe(w.value.query,c==null?void 0:c.query),hash:(c==null?void 0:c.hash)??w.value.hash,state:{...w.value.state,...c==null?void 0:c.state}},u=i.toValue(t);return Z(u)||typeof u=="object"?n.push(u,l):n.push(u,i.toValue(e),l)};return{element:C,route:o,href:a,isMatch:s,isExactMatch:p,isActive:y,isExactActive:f,isExternal:g,push:B,replace:c=>B({...c,replace:!0})}}const yn=["href"],mn={name:"RouterLink"},Ye=i.defineComponent({...mn,props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,r=Rt(),n=i.computed(()=>B(e.to)),o=i.computed(()=>b(e.to)),a=i.computed(()=>{const{to:l,...u}=e;return u}),{element:s,isMatch:p,isExactMatch:y,isActive:f,isExactActive:g,isExternal:w,push:C}=Ke(()=>typeof e.to=="function"?e.to(r.resolve):e.to,a),v=i.computed(()=>({"router-link--match":p.value,"router-link--exact-match":y.value,"router-link--active":f.value,"router-link--exact-active":g.value}));function B(l){if(typeof l=="function"){const u=l(r.resolve);return B(u)}return Z(l)?r.find(l):l}function b(l){if(typeof l=="function"){const u=l(r.resolve);return b(u)}return Z(l)?l:l==null?void 0:l.href}function c(l){l.preventDefault(),C()}return(l,u)=>(i.openBlock(),i.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:i.normalizeClass(["router-link",v.value]),onClick:c},[i.renderSlot(l.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:n.value,isMatch:i.unref(p),isExactMatch:i.unref(y),isActive:i.unref(f),isExactActive:i.unref(g),isExternal:i.unref(w)})))],10,yn))}}),Xe=Symbol();function gn(){const t=i.inject(Xe);if(!t)throw new tt;return t}function xt(t,e){const r=Rt();function n(){if(!t)return;if(!Bt(r.route,t,e))throw new ye(t,r.route.name)}return i.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const tr=Symbol();function ae(){return i.inject(tr,0)}function Rn(t,e,r){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=i.getCurrentInstance(),o=Me(),a=xt();return()=>{const s=o.getProps(t.id,e,a);return s instanceof Error?"":Dt(s)?n!=null&&n.suspense?i.h(En,{component:r,props:s}):i.h(wn,{component:r,props:s}):i.h(r,s)}}})}const wn=i.defineComponent(t=>{const e=i.ref();return i.watch(()=>t.props,async r=>{e.value=await r},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),En=i.defineComponent(async t=>{const e=i.ref();return e.value=await t.props,i.watch(()=>e.value,async r=>{e.value=await r},{deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),er=Symbol();function bn(){const t=new Map;return{getRouteComponents:r=>{const n=t.get(r.id);if(n)return n;const o=Sn(r);return t.set(r.id,o),o}}}function Sn(t){return Oe(t)?rr(t,t.components):xe(t)?rr(t,{default:t.component}):{default:se}}function rr(t,e){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Rn(t,r,n)]))}function Pn(){const t=i.inject(er);if(!t)throw new tt;return t}const An={name:"RouterView"},se=i.defineComponent({...An,props:{name:{default:"default"}},setup(t){const e=xt(),r=Rt(),n=gn(),o=ae();i.onServerPrefetch(async()=>{await r.start()});const{getRouteComponents:a}=Pn();i.provide(tr,o+1);const s=i.computed(()=>{if(!r.started.value)return null;if(n.value)return n.value.component;const p=e.matches.at(o);return p?a(p)[t.name]:null});return(p,y)=>s.value?i.renderSlot(p.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(e),component:s.value,rejection:i.unref(n)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value)))]):i.createCommentVNode("",!0)}});function vn(t,e=String){const r=xt(),n=i.computed({get(){const a=r.query.get(i.toValue(t));return a===null?null:Wt(a,e)},set(a){r.query.set(i.toValue(t),z(a,e))}}),o=i.computed({get(){return r.query.getAll(i.toValue(t)).map(s=>Wt(s,e)).filter(s=>s!==null)},set(a){const s=new URLSearchParams(r.query);s.delete(i.toValue(t)),a.forEach(p=>{s.append(i.toValue(t),z(p,e))}),r.query=s}});return{value:n,values:o,remove:()=>{r.query.delete(i.toValue(t))}}}class ot{constructor(){G(this,"onBeforeRouteEnter",new Set);G(this,"onBeforeRouteUpdate",new Set);G(this,"onBeforeRouteLeave",new Set);G(this,"onAfterRouteEnter",new Set);G(this,"onAfterRouteUpdate",new Set);G(this,"onAfterRouteLeave",new Set)}}const Et=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},bt=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},St=(t,e,r)=>{var n,o;return((n=t.matches.at(r))==null?void 0:n.id)===((o=e==null?void 0:e.matches.at(r))==null?void 0:o.id)};function nr(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Et;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return St;case"onBeforeRouteLeave":case"onAfterRouteLeave":return bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function kn(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&Et(t,e,o)&&it(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&St(t,e,o)&&it(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&bt(t,e,o)&&it(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function Un(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onAfterRouteEnter&&Et(t,e,o)&&it(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&St(t,e,o)&&it(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onAfterRouteLeave&&bt(t,e,o)&&it(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function Ln(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Et(t,e,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),St(t,e,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{bt(t,e,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function Nn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Et(t,e,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),St(t,e,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{bt(t,e,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}const or=Symbol();function Vn(){const{setVueApp:t,runWithContext:e}=Te(),r={global:new ot,component:new ot},{reject:n,push:o,replace:a,abort:s}=De(),p=u=>(r.global.onBeforeRouteEnter.add(u),()=>r.global.onBeforeRouteEnter.delete(u)),y=u=>(r.global.onBeforeRouteUpdate.add(u),()=>r.global.onBeforeRouteUpdate.delete(u)),f=u=>(r.global.onBeforeRouteLeave.add(u),()=>r.global.onBeforeRouteLeave.delete(u)),g=u=>(r.global.onAfterRouteEnter.add(u),()=>r.global.onAfterRouteEnter.delete(u)),w=u=>(r.global.onAfterRouteUpdate.add(u),()=>r.global.onAfterRouteUpdate.delete(u)),C=u=>(r.global.onAfterRouteLeave.add(u),()=>r.global.onAfterRouteLeave.delete(u));async function v({to:u,from:d}){const{global:S,component:U}=r,k=kn(u,d),R=Ln(u,d,S),h=[...R.onBeforeRouteEnter,...k.onBeforeRouteEnter,...R.onBeforeRouteUpdate,...k.onBeforeRouteUpdate,...U.onBeforeRouteUpdate,...R.onBeforeRouteLeave,...k.onBeforeRouteLeave,...U.onBeforeRouteLeave];try{const m=h.map(L=>e(()=>L(u,{from:d,reject:n,push:o,replace:a,abort:s})));await Promise.all(m)}catch(m){if(m instanceof ht||m instanceof Ct||m instanceof Ie)return m.response;throw m}return{status:"SUCCESS"}}async function B({to:u,from:d}){const{global:S,component:U}=r,k=Un(u,d),R=Nn(u,d,S),h=[...U.onAfterRouteLeave,...k.onAfterRouteLeave,...R.onAfterRouteLeave,...U.onAfterRouteUpdate,...k.onAfterRouteUpdate,...R.onAfterRouteUpdate,...U.onAfterRouteEnter,...k.onAfterRouteEnter,...R.onAfterRouteEnter];try{const m=h.map(L=>e(()=>L(u,{from:d,reject:n,push:o,replace:a})));await Promise.all(m)}catch(m){if(m instanceof ht||m instanceof Ct)return m.response;throw m}return{status:"SUCCESS"}}return{runBeforeRouteHooks:v,runAfterRouteHooks:B,addComponentBeforeRouteHook:({lifecycle:u,depth:d,hook:S})=>{const U=nr(u),k=r.component[u],R=(h,m)=>{if(U(h,m.from,d))return S(h,m)};return k.add(R),()=>k.delete(R)},addComponentAfterRouteHook:({lifecycle:u,depth:d,hook:S})=>{const U=nr(u),k=r.component[u],R=(h,m)=>{if(U(h,m.from,d))return S(h,m)};return k.add(R),()=>k.delete(R)},addGlobalRouteHooks:u=>{u.onBeforeRouteEnter.forEach(d=>p(d)),u.onBeforeRouteUpdate.forEach(d=>y(d)),u.onBeforeRouteLeave.forEach(d=>f(d)),u.onAfterRouteEnter.forEach(d=>g(d)),u.onAfterRouteUpdate.forEach(d=>w(d)),u.onAfterRouteLeave.forEach(d=>C(d))},onBeforeRouteEnter:p,onBeforeRouteUpdate:y,onBeforeRouteLeave:f,onAfterRouteEnter:g,onAfterRouteUpdate:w,onAfterRouteLeave:C,setVueApp:t}}function ar(){const t=i.inject(or);if(!t)throw new tt;return t}function sr(t){return e=>{const r=ae(),o=ar().addComponentBeforeRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}function ir(t){return e=>{const r=ae(),o=ar().addComponentAfterRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}const Cn=sr("onBeforeRouteLeave"),Bn=sr("onBeforeRouteUpdate"),xn=ir("onAfterRouteLeave"),jn=ir("onAfterRouteUpdate");function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Y.apply(null,arguments)}var _;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(_||(_={}));var yt=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function at(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var jt="beforeunload",On="hashchange",cr="popstate";function ur(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var R=n.location,h=R.pathname,m=R.search,L=R.hash,V=o.state||{};return[V.idx,yt({pathname:h,search:m,hash:L,state:V.usr||null,key:V.key||"default"})]}var s=null;function p(){if(s)v.call(s),s=null;else{var R=_.Pop,h=a(),m=h[0],L=h[1];if(v.length)if(m!=null){var V=g-m;V&&(s={action:R,location:L,retry:function(){U(V*-1)}},U(V))}else process.env.NODE_ENV!=="production"&&at(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else u(R)}}n.addEventListener(cr,p);var y=_.Pop,f=a(),g=f[0],w=f[1],C=mt(),v=mt();g==null&&(g=0,o.replaceState(Y({},o.state,{idx:g}),""));function B(R){return typeof R=="string"?R:st(R)}function b(R,h){return h===void 0&&(h=null),yt(Y({pathname:w.pathname,hash:"",search:""},typeof R=="string"?Pt(R):R,{state:h,key:Zt()}))}function c(R,h){return[{usr:R.state,key:R.key,idx:h},B(R)]}function l(R,h,m){return!v.length||(v.call({action:R,location:h,retry:m}),!1)}function u(R){y=R;var h=a();g=h[0],w=h[1],C.call({action:y,location:w})}function d(R,h){var m=_.Push,L=b(R,h);function V(){d(R,h)}if(l(m,L,V)){var O=c(L,g+1),$=O[0],H=O[1];try{o.pushState($,"",H)}catch{n.location.assign(H)}u(m)}}function S(R,h){var m=_.Replace,L=b(R,h);function V(){S(R,h)}if(l(m,L,V)){var O=c(L,g),$=O[0],H=O[1];o.replaceState($,"",H),u(m)}}function U(R){o.go(R)}var k={get action(){return y},get location(){return w},createHref:B,push:d,replace:S,go:U,back:function(){U(-1)},forward:function(){U(1)},listen:function(h){return C.push(h)},block:function(h){var m=v.push(h);return v.length===1&&n.addEventListener(jt,Ot),function(){m(),v.length||n.removeEventListener(jt,Ot)}}};return k}function Zn(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var h=Pt(n.location.hash.substr(1)),m=h.pathname,L=m===void 0?"/":m,V=h.search,O=V===void 0?"":V,$=h.hash,H=$===void 0?"":$,I=o.state||{};return[I.idx,yt({pathname:L,search:O,hash:H,state:I.usr||null,key:I.key||"default"})]}var s=null;function p(){if(s)v.call(s),s=null;else{var h=_.Pop,m=a(),L=m[0],V=m[1];if(v.length)if(L!=null){var O=g-L;O&&(s={action:h,location:V,retry:function(){k(O*-1)}},k(O))}else process.env.NODE_ENV!=="production"&&at(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else d(h)}}n.addEventListener(cr,p),n.addEventListener(On,function(){var h=a(),m=h[1];st(m)!==st(w)&&p()});var y=_.Pop,f=a(),g=f[0],w=f[1],C=mt(),v=mt();g==null&&(g=0,o.replaceState(Y({},o.state,{idx:g}),""));function B(){var h=document.querySelector("base"),m="";if(h&&h.getAttribute("href")){var L=n.location.href,V=L.indexOf("#");m=V===-1?L:L.slice(0,V)}return m}function b(h){return B()+"#"+(typeof h=="string"?h:st(h))}function c(h,m){return m===void 0&&(m=null),yt(Y({pathname:w.pathname,hash:"",search:""},typeof h=="string"?Pt(h):h,{state:m,key:Zt()}))}function l(h,m){return[{usr:h.state,key:h.key,idx:m},b(h)]}function u(h,m,L){return!v.length||(v.call({action:h,location:m,retry:L}),!1)}function d(h){y=h;var m=a();g=m[0],w=m[1],C.call({action:y,location:w})}function S(h,m){var L=_.Push,V=c(h,m);function O(){S(h,m)}if(process.env.NODE_ENV!=="production"&&at(V.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),u(L,V,O)){var $=l(V,g+1),H=$[0],I=$[1];try{o.pushState(H,"",I)}catch{n.location.assign(I)}d(L)}}function U(h,m){var L=_.Replace,V=c(h,m);function O(){U(h,m)}if(process.env.NODE_ENV!=="production"&&at(V.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),u(L,V,O)){var $=l(V,g),H=$[0],I=$[1];o.replaceState(H,"",I),d(L)}}function k(h){o.go(h)}var R={get action(){return y},get location(){return w},createHref:b,push:S,replace:U,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(m){return C.push(m)},block:function(m){var L=v.push(m);return v.length===1&&n.addEventListener(jt,Ot),function(){L(),v.length||n.removeEventListener(jt,Ot)}}};return R}function fr(t){t===void 0&&(t={});var e=t,r=e.initialEntries,n=r===void 0?["/"]:r,o=e.initialIndex,a=n.map(function(d){var S=yt(Y({pathname:"/",search:"",hash:"",state:null,key:Zt()},typeof d=="string"?Pt(d):d));return process.env.NODE_ENV!=="production"&&at(S.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(d)+")"),S}),s=lr(o??a.length-1,0,a.length-1),p=_.Pop,y=a[s],f=mt(),g=mt();function w(d){return typeof d=="string"?d:st(d)}function C(d,S){return S===void 0&&(S=null),yt(Y({pathname:y.pathname,search:"",hash:""},typeof d=="string"?Pt(d):d,{state:S,key:Zt()}))}function v(d,S,U){return!g.length||(g.call({action:d,location:S,retry:U}),!1)}function B(d,S){p=d,y=S,f.call({action:p,location:y})}function b(d,S){var U=_.Push,k=C(d,S);function R(){b(d,S)}process.env.NODE_ENV!=="production"&&at(y.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(d)+")"),v(U,k,R)&&(s+=1,a.splice(s,a.length,k),B(U,k))}function c(d,S){var U=_.Replace,k=C(d,S);function R(){c(d,S)}process.env.NODE_ENV!=="production"&&at(y.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(d)+")"),v(U,k,R)&&(a[s]=k,B(U,k))}function l(d){var S=lr(s+d,0,a.length-1),U=_.Pop,k=a[S];function R(){l(d)}v(U,k,R)&&(s=S,B(U,k))}var u={get index(){return s},get action(){return p},get location(){return y},createHref:w,push:b,replace:c,go:l,back:function(){l(-1)},forward:function(){l(1)},listen:function(S){return f.push(S)},block:function(S){return g.push(S)}};return u}function lr(t,e,r){return Math.min(Math.max(t,e),r)}function Ot(t){t.preventDefault(),t.returnValue=""}function mt(){var t=[];return{get length(){return t.length},push:function(r){return t.push(r),function(){t=t.filter(function(n){return n!==r})}},call:function(r){t.forEach(function(n){return n&&n(r)})}}}function Zt(){return Math.random().toString(36).substr(2,8)}function st(t){var e=t.pathname,r=e===void 0?"/":e,n=t.search,o=n===void 0?"":n,a=t.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function Pt(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const dr=Symbol();function $n(t,e){const r=i.reactive({...t}),n=s=>{Object.assign(r,{[dr]:!1,...s})},o=r,a=hn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:n}}function q(t){return!t.startsWith("http")?qn(t):_n(t)}function _n(t){const{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}}function qn(t){const{pathname:e,search:r,searchParams:n,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:r,searchParams:n,hash:o}}function Hn(t){return e=>{const{host:r}=q(e);return!(r===void 0||r===t)}}function In({mode:t,listener:e}){const r=Dn(t),n=(y,f)=>{if(f!=null&&f.replace){r.replace(y,f.state);return}r.push(y,f==null?void 0:f.state)},o=()=>{const y=st(r.location);r.replace(y)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(e)},stopListening:()=>{a==null||a()}}}function Dn(t="auto"){switch(t){case"auto":return Yt()?ur():fr();case"browser":return ur();case"memory":return fr();case"hash":return Zn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function Jn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function Tn(t){const e=a=>i.markRaw(t[a]??Jn(a)),r=a=>{const s=i.markRaw(e(a)),p={id:ee(),component:s,meta:{},state:{}};return{id:p.id,matched:p,matches:[p],name:a,query:Xt(""),params:{},state:{},href:"/",hash:"",[dr]:!0}},n=a=>{if(!a){o.value=null;return}const s=e(a);o.value={type:a,component:s}},o=i.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class Fn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Mn(t){if(t)return t;if(Yt())return window.location.toString();throw new Fn}function pr(t){return!!t&&typeof t=="object"}const $t=!0;function Wn(t,e,r){if(pr(t)&&e in t){const n=t[e];return typeof n=="string"?et(n,r,$t):n}return et(void 0,r,$t)}function hr(t,e){const r={};for(const[n,o]of Object.entries(t)){const a=Wn(e,n,o);r[n]=a}return r}function Gn(t,e,r){if(pr(t)&&e in t){const n=t[e];return z(n,r,$t)}return z(void 0,r,$t)}const yr=(t,e)=>{const r={};for(const[n,o]of Object.entries(t)){const a=Gn(e,n,o);r[n]=a}return r};function Qn(){const t=i.reactive(new Map),e=Yt()?s():null,r=p=>{t.set(p,!1),e==null||e.observe(p)},n=p=>{t.delete(p),e==null||e.unobserve(p)},o=()=>{e==null||e.disconnect()},a=p=>t.get(p)??!1;function s(){return new IntersectionObserver(p=>{p.forEach(y=>{t.set(y.target,y.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class zn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function mr(t,e,r){const n=Jr(e.value,r),o=Le(n),[a]=Ve(t,new RegExp(o,"g"));return a}function gr(t,e,r,n){const o=Qt(e,r),a=z(n,e.params[r],o);return t.replace(Ne(r),a)}function Rr({protocol:t,host:e,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");t&&(s.protocol=t),e&&(s.host=e),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const p=s.toString().replace(/^https:\/\/localhost\/*/,"/");return _t(p)}function Kn(t,e={}){const{params:r={},query:n}=e,o=Xn(t.query,r),a=oe(o,n),s=wr(t.path,r),p=t.hash.value?wr(t.hash,r):e.hash,y=Yn(t.host,r),{protocol:f,host:g}=q(y);return Rr({protocol:f,host:g,pathname:s,searchParams:a,hash:p})}function Yn(t,e){const r=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((n,o)=>gr(n,t,o,e[o]),r)}function wr(t,e){return Object.keys(t.params).reduce((r,n)=>gr(r,t,n,e[n]),t.value)}function Xn(t,e){const r=new URLSearchParams(t.value);if(!t.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Kt(o);if(!a)continue;const p=zt(o),y=z(e[a],t.params[a],p),f=e[a]===void 0&&y==="";p&&f?r.delete(n,o):r.set(n,y)}return r}const to=(t,e)=>{try{ie(t,e)}catch{return!1}return!0},ie=(t,e)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=q(e);return{...ce(t.host,`${r}//${n}`),...ce(t.path,o),...eo(t.query,a),...ce(t.hash,s)}};function ce(t,e){const r={},n=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const s=mr(n,t,o),p=Qt(t,o),y=et(s,a,p);r[o]=y}return r}function eo(t,e){const r={},n=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[a,s]of Array.from(n.entries())){const p=Kt(s);if(!p)continue;const f=zt(s),g=o.get(a)??void 0,w=et(g,t.params[p],f);r[p]=w}return r}function ro(t,e={},r={}){const n=Kn(t,{params:e,query:r.query,hash:r.hash}),{search:o,hash:a}=q(n);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,query:Xt(o),params:ie(t,n),state:hr(t.state,r.state),hash:a,href:n}}const no=t=>"name"in t.matched&&!!t.matched.name,oo=(t,e)=>{const{pathname:r}=q(e);return Ir(t).test(r)},ao=(t,e)=>{const{search:r}=q(e);return Dr(t).every(o=>o.test(r))},ue=(t,e)=>{const{hash:r}=q(e),{value:n}=t.hash;return F(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function so(t){const{searchParams:e,pathname:r}=q(t),n=-1,o=1;return(a,s)=>{const p=br(a,e),y=Er(a,r),f=br(s,e),g=Er(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:p+y>f+g?n:p+y<f+g?o:ue(a,t)?n:ue(s,t)?o:0}}function Er(t,e){const r=Object.keys(t.path.params).filter(o=>Qt(t.path,o)).map(o=>o),n=r.filter(o=>mr(e,t.path,o)===void 0);return r.length-n.length}function br(t,e){const r=new URLSearchParams(e),n=new URLSearchParams(t.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const io=[no,oo,ao,ue,to];function co(t,e){const r=so(e);return t.filter(n=>io.every(o=>o(n,e))).sort(r)}function uo(t,e,r){const n=co(t,e);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=q(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Xt(a),params:ie(o,e),state:hr(o.state,r),hash:s,href:_t(e)}}function Sr(t,e){const r=typeof t=="string"?q(t):t,n=typeof e=="string"?q(e):e,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return Rr({protocol:F(n.protocol)?n.protocol:r.protocol,host:F(n.host)?n.host:r.host,pathname:F(n.pathname)?n.pathname:r.pathname,searchParams:oe(a,o),hash:F(n.hash)?n.hash:r.hash})}function fo(t,e){return F(e)?t.map(r=>{const n=`${e}${r.path.value}`;return{...r,path:M(n,r.path.params)}}):t}class lo 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 po(t){const e=t.map(({name:r})=>r);for(const r of e)if(ge(e,r)>1)throw new lo(r)}function ho(t,e=[],r){const n=[...t,...e.map(o=>o.routes)].flat();return po(n),fo(n,r)}function yo(t={},e=[]){const r=new ot;return gt("onBeforeRouteEnter",t,e).forEach(n=>r.onBeforeRouteEnter.add(n)),gt("onBeforeRouteUpdate",t,e).forEach(n=>r.onBeforeRouteUpdate.add(n)),gt("onBeforeRouteLeave",t,e).forEach(n=>r.onBeforeRouteLeave.add(n)),gt("onAfterRouteEnter",t,e).forEach(n=>r.onAfterRouteEnter.add(n)),gt("onAfterRouteUpdate",t,e).forEach(n=>r.onAfterRouteUpdate.add(n)),gt("onAfterRouteLeave",t,e).forEach(n=>r.onAfterRouteLeave.add(n)),r}function gt(t,e,r){return[e[t],...r.map(o=>o[t])].flat().filter(o=>o!==void 0)}function mo(t,e,r=[]){const n=ho(t,r,e==null?void 0:e.base),o=Vn();o.addGlobalRouteHooks(yo(e,r));const a=te(),s=cn(),p=bn(),y=Qn(),f=In({mode:e==null?void 0:e.historyMode,listener:({location:P})=>{const x=st(P);w(x,{state:P.state,replace:!0})}});function g(P,x={}){return uo(n,P,x.state)}async function w(P,x={}){const K=a();if(f.stopListening(),L(P)){f.update(P,x);return}const J=g(P,x)??u("NotFound"),D=ko(K),X=await o.runBeforeRouteHooks({to:J,from:D});switch(X.status){case"ABORT":return;case"PUSH":f.update(P,x),await v(...X.to);return;case"REJECT":f.update(P,x),c(X.type);break;case"SUCCESS":f.update(P,x),c(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(X)}`)}const fe=K;s.setProps(J).then(T=>{if(fe===K)switch(T.status){case"SUCCESS":break;case"PUSH":v(...T.to);break;case"REJECT":c(T.type);break;default:const le=T;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(le)}`)}}),k(J);const W=await o.runAfterRouteHooks({to:J,from:D});switch(W.status){case"PUSH":await v(...W.to);break;case"REJECT":c(W.type);break;case"SUCCESS":break;default:const T=W;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(T)}`)}f.startListening()}const C=(P,x={},K={})=>{const J=n.find(D=>D.name===P);if(!J)throw new zn(String(P));return ro(J,x,K)},v=(P,x,K)=>{if(Z(P)){const W={...x},T=Sr(P,{searchParams:W.query,hash:W.hash});return w(T,W)}if(typeof P=="string"){const{replace:W,...T}={...K},le={...x},de=C(P,le,T),Lo=yr({...de.matched.state},{...de.state,...T.state});return w(de.href,{replace:W,state:Lo})}const{replace:J,...D}={...x},X=yr({...P.matched.state},{...P.state,...D.state}),fe=Sr(P.href,{searchParams:D.query,hash:D.hash});return w(fe,{replace:J,state:X})},B=(P,x,K)=>{if(Z(P)){const D={...x,replace:!0};return v(P,D)}if(typeof P=="string"){const D={...K,replace:!0},X={...x};return v(P,X,D)}const J={...x,replace:!0};return v(P,J)},b=P=>{c(P)},{setRejection:c,rejection:l,getRejectionRoute:u}=Tn({...r.reduce((P,x)=>({...P,...x.rejections}),{}),...e==null?void 0:e.rejections}),d=u("NotFound"),{currentRoute:S,routerRoute:U,updateRoute:k}=$n(d,v),R=Mn(e==null?void 0:e.initialUrl),h=f.location.state,{host:m}=q(R),L=Hn(m);let V=!1;const O=i.ref(!1),{promise:$,resolve:H}=Promise.withResolvers();async function I(){if(V)return $;V=!0,Br(n)&&await xr(),await w(R,{replace:!0,state:h}),f.startListening(),H(),O.value=!0}function Ar(){f.stopListening()}function ko(P){return rn(P)?null:{...S}}function Uo(P){o.setVueApp(P),s.setVueApp(P),P.component("RouterView",se),P.component("RouterLink",Ye),P.provide(Xe,l),P.provide(or,o),P.provide(Fe,s),P.provide(er,p),P.provide(Ge,y),P.provide(me,vr),I()}const vr={route:U,resolve:C,find:g,push:v,replace:B,reject:b,refresh:f.refresh,forward:f.forward,back:f.back,go:f.go,install:Uo,isExternal:L,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:e==null?void 0:e.prefetch,start:I,started:O,stop:Ar};return vr}function go(t){return{routes:t.routes??[],rejections:t.rejections??{},...t}}function Pr(t){return{get:(e,{invalid:r})=>{for(const n of t){const o=Wt(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:r})=>{for(const n of t){const o=qr(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)}}}const Ro={separator:","};function wo(t,e={}){const{separator:r}={...Ro,...e},n=Pr(t);return{get:(o,a)=>o.split(r).map(s=>n.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>n.set(s,a)).join(r)}}}const Eo={separator:","};function bo(t,e={}){const{separator:r}={...Eo,...e};return{get:n=>{const o=n.split(r);return t.map((a,s)=>et(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${n.length} values`);return t.map((a,s)=>z(n.at(s),a)).join(r)}}}const So=M,Po=M,Ao=M;function vo(t){const e=ee(),r=_e(t.name),n=rt(t.path),o=rt(t.query),a=rt(t.hash),s=t.meta??{},p=rt(t.host),y=i.markRaw({id:e,meta:{},state:{},...t}),f={id:e,matched:y,matches:[y],name:r,host:p,path:n,query:o,hash:a,meta:s,depth:1,state:{}},g=Be(t)?$e(t.parent,f):f;return ct(g.path.params,g.query.params,g.host.params,g.hash.params),g}A.DuplicateParamsError=pe,A.MetaPropertyConflict=he,A.RouterLink=Ye,A.RouterNotInstalledError=tt,A.RouterView=se,A.UseRouteInvalidError=ye,A.arrayOf=wo,A.asUrl=_t,A.createExternalRoute=vo,A.createParam=we,A.createRoute=nt,A.createRouter=mo,A.createRouterPlugin=go,A.host=Po,A.isRoute=Bt,A.isUrl=Z,A.onAfterRouteLeave=xn,A.onAfterRouteUpdate=jn,A.onBeforeRouteLeave=Cn,A.onBeforeRouteUpdate=Bn,A.path=So,A.query=Ao,A.tupleOf=bo,A.unionOf=Pr,A.useLink=Ke,A.useQueryValue=vn,A.useRoute=xt,A.useRouter=Rt,A.withDefault=Nr,A.withParams=M,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
`)}return c}function U(g,k,m){return[g,k,m.id,JSON.stringify(m.params)].join("-")}function v(g){return Xe(g)?[{id:g.id,name:"default",props:g.props}]:tt(g)?Object.entries(g.props).map(([k,m])=>({id:g.id,name:k,props:m})):[]}function C(g){for(const k of n.keys())g.includes(k)||n.delete(k)}return{getPrefetchProps:s,setPrefetchProps:i,getProps:d,setProps:f,setVueApp:e}}function pt(){return typeof window<"u"&&typeof window.document<"u"}function $r({mode:e,listener:t}){const n=qr(e),r=(f,d)=>{if(d?.replace){n.replace(f,d.state);return}n.push(f,d?.state)},o=()=>{const f=se(n.location);n.replace(f)};let a;return{...n,update:r,refresh:o,startListening:()=>{a?.(),a=n.listen(t)},stopListening:()=>{a?.()}}}function qr(e="auto"){switch(e){case"auto":return pt()?cn():un();case"browser":return cn();case"memory":return un();case"hash":return Br();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}function Dr(e){return l.defineComponent(()=>()=>l.h("h1",e),{name:e,props:[]})}function dt(e){const t=new URLSearchParams(e);return{get:(...n)=>t.get(...n),getAll:(...n)=>t.getAll(...n),set:(...n)=>{t.set(...n)},append:(...n)=>{t.append(...n)},delete:(...n)=>{t.delete(...n)},toString:(...n)=>t.toString(...n),forEach:(...n)=>{t.forEach(...n)},entries:(...n)=>t.entries(...n),keys:(...n)=>t.keys(...n),values:(...n)=>t.values(...n),has:(...n)=>t.has(...n),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function _r(e){const t=a=>l.markRaw(e[a]??Dr(a)),n=a=>{const s=l.markRaw(t(a)),i={id:at(),component:s,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],name:a,query:dt(""),params:{},state:{},href:"/",hash:""}},r=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Ir extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jr(e){if(e)return e;if(pt())return window.location.toString();throw new Ir}function pn(e){return!!e&&typeof e=="object"}const Ze=!0;function Tr(e,t,n){if(pn(e)&&t in e){const r=e[t];return typeof r=="string"?te(r,n,Ze):r}return te(void 0,n,Ze)}function dn(e,t){const n={};for(const[r,o]of Object.entries(e)){const a=Tr(t,r,o);n[r]=a}return n}function Mr(e,t,n){if(pn(e)&&t in e){const r=e[t];return Y(r,n,Ze)}return Y(void 0,n,Ze)}const hn=(e,t)=>{const n={};for(const[r,o]of Object.entries(e)){const a=Mr(t,r,o);n[r]=a}return n};function Fr(){const e=l.reactive(new Map),t=pt()?s():null,n=i=>{e.set(i,!1),t?.observe(i)},r=i=>{e.delete(i),t?.unobserve(i)},o=()=>{t?.disconnect()},a=i=>e.get(i)??!1;function s(){return new IntersectionObserver(i=>{i.forEach(f=>{e.set(f.target,f.isIntersecting)})})}return{observe:n,unobserve:r,disconnect:o,isElementVisible:a}}class Wr extends Error{constructor(t){super(`Route not found: "${t}"`)}}function mn(e,t,n){const r=Mn(t.value,n),o=Ot(r),[a]=jt(e,new RegExp(o,"g"));return a}function Rn(e,t,n,r){const o=Ge(t,n),a=Y(r,t.params[n],o);return e.replace(xt(n),a)}function yn({protocol:e,host:t,pathname:n,search:r,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),n&&(s.pathname=n),o?s.search=new URLSearchParams(o).toString():r&&(s.search=r),a&&(s.hash=a);const i=s.toString().replace(/^https:\/\/localhost\/*/,"/");return rt(i)}function Gr(e,t={}){const{params:n={},query:r}=t,o=zr(e.query,n),a=lt(o,r),s=gn(e.path,n),i=e.hash.value?gn(e.hash,n):t.hash,f=Qr(e.host,n),{protocol:d,host:R}=D(f);return yn({protocol:d,host:R,pathname:s,searchParams:a,hash:i})}function Qr(e,t){const n=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.keys(e.params).reduce((r,o)=>Rn(r,e,o,t[o]),n)}function gn(e,t){return Object.keys(e.params).reduce((n,r)=>Rn(n,e,r,t[r]),e.value)}function zr(e,t){const n=new URLSearchParams(e.value);if(!e.value)return n;for(const[r,o]of Array.from(n.entries())){const a=ze(o);if(!a)continue;const i=Qe(o),f=Y(t[a],e.params[a],i),d=t[a]===void 0&&f==="";i&&d?n.delete(r,o):n.set(r,f)}return n}const Yr=(e,t)=>{try{ht(e,t)}catch{return!1}return!0},ht=(e,t)=>{const{protocol:n,host:r,pathname:o,search:a,hash:s}=D(t);return{...mt(e.host,`${n}//${r}`),...mt(e.path,o),...Kr(e.query,a),...mt(e.hash,s)}};function mt(e,t){const n={},r=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=mn(r,e,o),i=Ge(e,o),f=te(s,a,i);n[o]=f}return n}function Kr(e,t){const n={},r=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,s]of Array.from(r.entries())){const i=ze(s);if(!i)continue;const d=Qe(s),R=o.get(a)??void 0,h=te(R,e.params[i],d);n[i]=h}return n}function Xr(e,t={},n={}){const r=Gr(e,{params:t,query:n.query,hash:n.hash}),{search:o,hash:a}=D(r);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:dt(o),params:ht(e,r),state:dn(e.state,n.state),hash:a,href:r}}const He={template:"<div>This is component</div>"},Rt=oe({name:"parentA",path:"/parentA/[paramA]"}),wn=oe({parent:Rt,name:"parentA.childA",path:"/childA/[?paramB]"}),eo=oe({parent:Rt,name:"parentA.childB",path:"/childB/[paramD]",component:He}),to=oe({parent:wn,name:"parentA.childA.grandChildA",path:"/[paramC]",component:He});oe({name:"parentB",path:"/parentB",component:He}),oe({name:"parentC",path:"/",component:He});const no=e=>"name"in e.matched&&!!e.matched.name,ro=(e,t)=>{const{pathname:n}=D(t);return Jn(e).test(n)},oo=(e,t)=>{const{search:n}=D(t);return Tn(e).every(o=>o.test(n))},yt=(e,t)=>{const{hash:n}=D(t),{value:r}=e.hash;return I(r)?`#${r.replace(/^#*/,"")}`.toLowerCase()===n.toLowerCase():!0};function ao(e){const{searchParams:t,pathname:n}=D(e),r=-1,o=1;return(a,s)=>{const i=bn(a,t),f=En(a,n),d=bn(s,t),R=En(s,n);return a.depth>s.depth?r:a.depth<s.depth?o:i+f>d+R?r:i+f<d+R?o:yt(a,e)?r:yt(s,e)?o:0}}function En(e,t){const n=Object.keys(e.path.params).filter(o=>Ge(e.path,o)).map(o=>o),r=n.filter(o=>mn(t,e.path,o)===void 0);return n.length-r.length}function bn(e,t){const n=new URLSearchParams(t),r=new URLSearchParams(e.query.value),o=Array.from(r.keys()),a=o.filter(s=>!n.has(s));return o.length-a.length}const so=[no,ro,oo,yt,Yr];function io(e,t){const n=ao(t);return e.filter(r=>so.every(o=>o(r,t))).sort(n)}function co(e,t,n){const r=io(e,t);if(!r.length)return;const[o]=r,{searchParams:a,hash:s}=D(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:dt(a),params:ht(o,t),state:dn(o.state,n),hash:s,href:rt(t)}}function vn(e,t){const n=typeof e=="string"?D(e):e,r=typeof t=="string"?D(t):t,o=n.searchParams??new URLSearchParams(n.search),a=r.searchParams??new URLSearchParams(r.search);return yn({protocol:I(r.protocol)?r.protocol:n.protocol,host:I(r.host)?r.host:n.host,pathname:I(r.pathname)?r.pathname:n.pathname,searchParams:lt(a,o),hash:I(r.hash)?r.hash:n.hash})}function uo(e,t){return I(t)?e.map(n=>{const r=`${t}${n.path.value}`;return{...n,path:G(r,n.path.params)}}):e}class fo extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function lo(e){const t=e.map(({name:n})=>n);for(const n of t)if(vt(t,n)>1)throw new fo(n)}function po(e,t=[],n){const r=[...e,...t.map(o=>o.routes)].flat().filter(o=>I(o.name));return lo(r),uo(r,n)}function ho(e={},t=[]){const n=new Se;return Re("onBeforeRouteEnter",e,t).forEach(r=>n.onBeforeRouteEnter.add(r)),Re("onBeforeRouteUpdate",e,t).forEach(r=>n.onBeforeRouteUpdate.add(r)),Re("onBeforeRouteLeave",e,t).forEach(r=>n.onBeforeRouteLeave.add(r)),Re("onAfterRouteEnter",e,t).forEach(r=>n.onAfterRouteEnter.add(r)),Re("onAfterRouteUpdate",e,t).forEach(r=>n.onAfterRouteUpdate.add(r)),Re("onAfterRouteLeave",e,t).forEach(r=>n.onAfterRouteLeave.add(r)),n}function Re(e,t,n){return[t[e],...n.map(o=>o[e])].flat().filter(o=>o!==void 0)}function mo(e,{match:t,name:n,component:r}){const o=Yt(e),a=Be(e);return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const s=l.getCurrentInstance(),i=o(),f=a();return()=>{const d=i.getProps(t.id,n,f);return d instanceof Error?"":_e(d)?s?.suspense?l.h(yo,{component:r,props:d}):l.h(Ro,{component:r,props:d}):l.h(r,d)}}})}const Ro=l.defineComponent(e=>{const t=l.ref();return l.watch(()=>e.props,async n=>{t.value=await n},{immediate:!0,deep:!0}),()=>t.value instanceof Error?"":t.value?l.h(e.component,t.value):""},{props:["component","props"]}),yo=l.defineComponent(async e=>{const t=l.ref();return t.value=await e.props,l.watch(()=>t.value,async n=>{t.value=await n},{deep:!0}),()=>t.value instanceof Error?"":t.value?l.h(e.component,t.value):""},{props:["component","props"]});function go(e){const t=new Map;return{getRouteComponents:r=>{const o=t.get(r.id);if(o)return o;const a=wo(e,r);return t.set(r.id,a),a}}}function wo(e,t){const n=ut(e);return et(t)?Sn(e,t,t.components):Ke(t)?Sn(e,t,{default:t.component}):{default:n}}function Sn(e,t,n){return Object.fromEntries(Object.entries(n).map(([r,o])=>[r,mo(e,{match:t,name:r,component:o})]))}const Pn=Symbol();function Eo(e,t,n=[]){const o=t?.isGlobalRouter??!0?Pn:Symbol(),a=po(e,n,t?.base),s=pr();s.addGlobalRouteHooks(ho(t,n));const i=ot(),f=Hr(),d=go(o),R=Fr(),h=$r({mode:t?.historyMode,listener:({location:P})=>{const O=se(P);v(O,{state:P.state,replace:!0})}});function U(P,O={}){return co(a,P,O.state)}async function v(P,O={}){const M=i();if(h.stopListening(),j(P)){h.update(P,O);return}const F=U(P,O)??u("NotFound"),_=Zo(M),ee=await s.runBeforeRouteHooks({to:F,from:_});switch(ee.status){case"ABORT":return;case"PUSH":h.update(P,O),await g(...ee.to);return;case"REJECT":h.update(P,O),w(ee.type);break;case"SUCCESS":h.update(P,O),w(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(ee)}`)}const gt=M;f.setProps(F).then(W=>{if(gt===M)switch(W.status){case"SUCCESS":break;case"PUSH":g(...W.to);break;case"REJECT":w(W.type);break;default:const wt=W;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(wt)}`)}}),p(F);const Q=await s.runAfterRouteHooks({to:F,from:_});switch(Q.status){case"PUSH":await g(...Q.to);break;case"REJECT":w(Q.type);break;case"SUCCESS":break;default:const W=Q;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(W)}`)}h.startListening()}const C=(P,O={},M={})=>{const F=a.find(_=>_.name===P);if(!F)throw new Wr(P);return Xr(F,O,M)},g=(P,O,M)=>{if(q(P)){const Q={...O},W=vn(P,{searchParams:Q.query,hash:Q.hash});return v(W,Q)}if(typeof P=="string"){const{replace:Q,...W}={...M},wt={...O},Et=C(P,wt,W),$o=hn({...Et.matched.state},{...Et.state,...W.state});return v(Et.href,{replace:Q,state:$o})}const{replace:F,..._}={...O},ee=hn({...P.matched.state},{...P.state,..._.state}),gt=vn(P.href,{searchParams:_.query,hash:_.hash});return v(gt,{replace:F,state:ee})},k=(P,O,M)=>{if(q(P)){const _={...O,replace:!0};return g(P,_)}if(typeof P=="string"){const _={...M,replace:!0},ee={...O};return g(P,ee,_)}const F={...O,replace:!0};return g(P,F)},m=P=>{w(P)},{setRejection:w,rejection:c,getRejectionRoute:u}=_r({...n.reduce((P,O)=>({...P,...O.rejections}),{}),...t?.rejections}),S=u("NotFound"),{currentRoute:V,routerRoute:y,updateRoute:p}=Cr(o,S,g),E=Jr(t?.initialUrl),b=h.location.state,{host:N}=D(E),j=jr(N);let Z=!1;const $=l.ref(!1),{promise:T,resolve:An}=Promise.withResolvers();async function Un(){if(Z)return T;Z=!0,xn(a)&&await jn(),await v(E,{replace:!0,state:b}),h.startListening(),An(),$.value=!0}function jo(){h.stopListening()}function Zo(P){return or(P)?null:{...V}}function Ho(P){s.setVueApp(P),f.setVueApp(P);const O=ut(o),M=rn(o);P.component("RouterView",O),P.component("RouterLink",M),P.provide(Gt(o),c),P.provide(Jt(o),s),P.provide(zt(o),f),P.provide(Wt(o),d),P.provide(en,R),P.provide(o,kn),Un()}const kn={route:y,resolve:C,find:U,push:g,replace:k,reject:m,refresh:h.refresh,forward:h.forward,back:h.back,go:h.go,install:Ho,isExternal:j,onBeforeRouteEnter:s.onBeforeRouteEnter,onBeforeRouteUpdate:s.onBeforeRouteUpdate,onBeforeRouteLeave:s.onBeforeRouteLeave,onAfterRouteEnter:s.onAfterRouteEnter,onAfterRouteUpdate:s.onAfterRouteUpdate,onAfterRouteLeave:s.onAfterRouteLeave,prefetch:t?.prefetch,start:Un,started:$,stop:jo,key:o};return kn}const bo=G,vo=G,So=G,J=on(Pn),Po=J.onBeforeRouteLeave,Ao=J.onBeforeRouteUpdate,Uo=J.onAfterRouteLeave,ko=J.onAfterRouteUpdate,Lo=J.isRoute,Vo=J.RouterView,No=J.RouterLink,Bo=J.useRoute,Co=J.useRouter,Oo=J.useQueryValue,xo=J.useLink;L.DuplicateParamsError=bt,L.MetaPropertyConflict=Ht,L.RouterLink=No,L.RouterNotInstalledError=re,L.RouterView=Vo,L.UseRouteInvalidError=$t,L.arrayOf=kr,L.asUrl=rt,L.combineRoutes=nt,L.createExternalRoute=ar,L.createParam=Pt,L.createRoute=oe,L.createRouter=Eo,L.createRouterAssets=on,L.createRouterPlugin=Ar,L.host=vo,L.isRoute=Lo,L.isUrl=q,L.isWithComponent=Ke,L.isWithComponentProps=Xe,L.isWithComponentPropsRecord=tt,L.isWithComponents=et,L.isWithParent=Ye,L.onAfterRouteLeave=Uo,L.onAfterRouteUpdate=ko,L.onBeforeRouteLeave=Po,L.onBeforeRouteUpdate=Ao,L.path=bo,L.query=So,L.tupleOf=Vr,L.unionOf=an,L.useLink=xo,L.useQueryValue=Oo,L.useRoute=Bo,L.useRouter=Co,L.withDefault=Bn,L.withParams=G,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { withParams } from './services/withParams';
|
|
2
|
+
export * from './types/createRouteOptions';
|
|
3
|
+
export * from './types/hooks';
|
|
4
|
+
export * from './types/paramTypes';
|
|
5
|
+
export * from './types/prefetch';
|
|
6
|
+
export * from './types/props';
|
|
7
|
+
export * from './types/querySource';
|
|
8
|
+
export * from './types/register';
|
|
9
|
+
export * from './types/resolved';
|
|
10
|
+
export * from './types/route';
|
|
11
|
+
export * from './types/router';
|
|
12
|
+
export * from './types/routerLink';
|
|
13
|
+
export * from './types/routerPlugin';
|
|
14
|
+
export * from './types/routerPush';
|
|
15
|
+
export * from './types/routerPush';
|
|
16
|
+
export * from './types/routerReject';
|
|
17
|
+
export * from './types/routerReplace';
|
|
18
|
+
export * from './types/routerReplace';
|
|
19
|
+
export * from './types/routerResolve';
|
|
20
|
+
export * from './types/routerResolve';
|
|
21
|
+
export * from './types/routerRoute';
|
|
22
|
+
export * from './types/url';
|
|
23
|
+
export * from './types/useLink';
|
|
24
|
+
export { DuplicateParamsError } from './errors/duplicateParamsError';
|
|
25
|
+
export { MetaPropertyConflict } from './errors/metaPropertyConflict';
|
|
26
|
+
export { RouterNotInstalledError } from './errors/routerNotInstalledError';
|
|
27
|
+
export { UseRouteInvalidError } from './errors/useRouteInvalidError';
|
|
28
|
+
export { createRoute } from './services/createRoute';
|
|
29
|
+
export { createExternalRoute } from './services/createExternalRoute';
|
|
30
|
+
export { createRouterAssets } from './services/createRouterAssets';
|
|
31
|
+
export { withParams } from './services/withParams';
|
|
32
|
+
export { withDefault } from './services/withDefault';
|
|
33
|
+
export { createRouterPlugin } from './services/createRouterPlugin';
|
|
34
|
+
export { unionOf } from './services/unionOf';
|
|
35
|
+
export { arrayOf } from './services/arrayOf';
|
|
36
|
+
export { tupleOf } from './services/tupleOf';
|
|
37
|
+
export { createParam } from './services/createParam';
|
|
38
|
+
export { createRouter } from './services/createRouter';
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated use `withParams` instead
|
|
41
|
+
* @hidden we don't want to expose this in the api docs
|
|
42
|
+
*/
|
|
43
|
+
export declare const path: typeof withParams;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated use `withParams` instead
|
|
46
|
+
* @hidden we don't want to expose this in the api docs
|
|
47
|
+
*/
|
|
48
|
+
export declare const host: typeof withParams;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated use `withParams` instead
|
|
51
|
+
* @hidden we don't want to expose this in the api docs
|
|
52
|
+
*/
|
|
53
|
+
export declare const query: typeof withParams;
|
|
54
|
+
/**
|
|
55
|
+
* Registers a hook that is called before a route is left. Must be called from setup.
|
|
56
|
+
* This is useful for performing actions or cleanups before navigating away from a route component.
|
|
57
|
+
*
|
|
58
|
+
* @param BeforeRouteHook - The hook callback function
|
|
59
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
60
|
+
* @group Hooks
|
|
61
|
+
*/
|
|
62
|
+
export declare const onBeforeRouteLeave: import('./main').AddRouterBeforeRouteHook<any, string | number | symbol>;
|
|
63
|
+
/**
|
|
64
|
+
* Registers a hook that is called before a route is updated. Must be called from setup.
|
|
65
|
+
* This is particularly useful for handling changes in route parameters or query while staying within the same component.
|
|
66
|
+
*
|
|
67
|
+
* @param BeforeRouteHook - The hook callback function
|
|
68
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
69
|
+
* @group Hooks
|
|
70
|
+
*/
|
|
71
|
+
export declare const onBeforeRouteUpdate: import('./main').AddRouterBeforeRouteHook<any, string | number | symbol>;
|
|
72
|
+
/**
|
|
73
|
+
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
74
|
+
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
|
75
|
+
*
|
|
76
|
+
* @param AfterRouteHook - The hook callback function
|
|
77
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
78
|
+
* @group Hooks
|
|
79
|
+
*/
|
|
80
|
+
export declare const onAfterRouteLeave: import('./main').AddRouterAfterRouteHook<any, string | number | symbol>;
|
|
81
|
+
/**
|
|
82
|
+
* Registers a hook that is called after a route has been updated. Must be called during setup.
|
|
83
|
+
* This is ideal for responding to updates within the same route, such as parameter changes, without full component reloads.
|
|
84
|
+
*
|
|
85
|
+
* @param AfterRouteHook - The hook callback function
|
|
86
|
+
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
87
|
+
* @group Hooks
|
|
88
|
+
*/
|
|
89
|
+
export declare const onAfterRouteUpdate: import('./main').AddRouterAfterRouteHook<any, string | number | symbol>;
|
|
90
|
+
/**
|
|
91
|
+
* A guard to verify if a route or unknown value matches a given route name.
|
|
92
|
+
*
|
|
93
|
+
* @param routeName - The name of the route to check against the current route.
|
|
94
|
+
* @returns True if the current route matches the given route name, false otherwise.
|
|
95
|
+
* @group Type Guards
|
|
96
|
+
*/
|
|
97
|
+
export declare const isRoute: {
|
|
98
|
+
(route: unknown): route is import('./main').RouterRoute;
|
|
99
|
+
<TRoute extends import('./main').RouterRoute<Readonly<{
|
|
100
|
+
id: any;
|
|
101
|
+
matched: any;
|
|
102
|
+
matches: any;
|
|
103
|
+
name: any;
|
|
104
|
+
query: URLSearchParams;
|
|
105
|
+
hash: string;
|
|
106
|
+
params: {
|
|
107
|
+
[x: string]: unknown;
|
|
108
|
+
[x: number]: unknown;
|
|
109
|
+
[x: symbol]: unknown;
|
|
110
|
+
};
|
|
111
|
+
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
112
|
+
href: import('./main').Url;
|
|
113
|
+
}>>, TRouteName extends any>(route: TRoute, routeName: TRouteName, options: import('./guards/routes').IsRouteOptions & {
|
|
114
|
+
exact: true;
|
|
115
|
+
}): route is TRoute & {
|
|
116
|
+
name: TRouteName;
|
|
117
|
+
};
|
|
118
|
+
<TRoute extends import('./main').RouterRoute<Readonly<{
|
|
119
|
+
id: any;
|
|
120
|
+
matched: any;
|
|
121
|
+
matches: any;
|
|
122
|
+
name: any;
|
|
123
|
+
query: URLSearchParams;
|
|
124
|
+
hash: string;
|
|
125
|
+
params: {
|
|
126
|
+
[x: string]: unknown;
|
|
127
|
+
[x: number]: unknown;
|
|
128
|
+
[x: symbol]: unknown;
|
|
129
|
+
};
|
|
130
|
+
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
131
|
+
href: import('./main').Url;
|
|
132
|
+
}>>, TRouteName extends TRoute["name"]>(route: TRoute, routeName: TRouteName, options?: import('./guards/routes').IsRouteOptions): route is TRoute extends import('./main').RouterRoute ? TRouteName extends TRoute["matches"][number]["name"] ? TRoute : never : never;
|
|
133
|
+
(route: unknown, routeName?: string, options?: import('./guards/routes').IsRouteOptions): boolean;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* A component to render the current route's component.
|
|
137
|
+
*
|
|
138
|
+
* @param props - The props to pass to the router view component.
|
|
139
|
+
* @returns The router view component.
|
|
140
|
+
* @group Components
|
|
141
|
+
*/
|
|
142
|
+
export declare const RouterView: import('vue').DefineSetupFnComponent<import('./components/routerView').RouterViewProps, import('vue').EmitsOptions, import('vue').SlotsType<{
|
|
143
|
+
default?: (props: {
|
|
144
|
+
route: import('./main').RouterRoute;
|
|
145
|
+
component: import('vue').Component;
|
|
146
|
+
rejection: import('vue').UnwrapRef<import('./services/createRouterReject').RouterRejection>;
|
|
147
|
+
}) => import('vue').VNode;
|
|
148
|
+
}>, import('./components/routerView').RouterViewProps & ({
|
|
149
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
150
|
+
} | {
|
|
151
|
+
[x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
|
|
152
|
+
}), import('vue').PublicProps>;
|
|
153
|
+
/**
|
|
154
|
+
* A component to render a link to a route or any url.
|
|
155
|
+
*
|
|
156
|
+
* @param props - The props to pass to the router link component.
|
|
157
|
+
* @returns The router link component.
|
|
158
|
+
* @group Components
|
|
159
|
+
*/
|
|
160
|
+
export declare const RouterLink: import('vue').DefineSetupFnComponent<import('./main').RouterLinkProps<import('./main').Router>, import('vue').EmitsOptions, import('vue').SlotsType<{
|
|
161
|
+
default?: (props: {
|
|
162
|
+
route: import('./main').ResolvedRoute | undefined;
|
|
163
|
+
isMatch: boolean;
|
|
164
|
+
isExactMatch: boolean;
|
|
165
|
+
isActive: boolean;
|
|
166
|
+
isExactActive: boolean;
|
|
167
|
+
isExternal: boolean;
|
|
168
|
+
}) => import('vue').VNode[];
|
|
169
|
+
}>, import('./main').RouterPushOptions & ({
|
|
170
|
+
to: import('./main').Url | Readonly<{
|
|
171
|
+
id: string;
|
|
172
|
+
matched: import('./main').CreatedRouteOptions;
|
|
173
|
+
matches: import('./main').CreatedRouteOptions[];
|
|
174
|
+
name: string;
|
|
175
|
+
query: URLSearchParams;
|
|
176
|
+
hash: string;
|
|
177
|
+
params: {
|
|
178
|
+
[x: string]: unknown;
|
|
179
|
+
};
|
|
180
|
+
state: import('./types/state').ExtractRouteStateParamsAsOptional<Record<string, import('./main').Param>>;
|
|
181
|
+
href: import('./main').Url;
|
|
182
|
+
}> | import('./main').ToCallback<import('./main').Router>;
|
|
183
|
+
prefetch?: import('./main').PrefetchConfig;
|
|
184
|
+
} & ({
|
|
185
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
186
|
+
} | {
|
|
187
|
+
[x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
|
|
188
|
+
})), import('vue').PublicProps>;
|
|
189
|
+
/**
|
|
190
|
+
* A composition to access the current route or verify a specific route name within a Vue component.
|
|
191
|
+
* This function provides two overloads:
|
|
192
|
+
* 1. When called without arguments, it returns the current route from the router without types.
|
|
193
|
+
* 2. When called with a route name, it checks if the current active route includes the specified route name.
|
|
194
|
+
*
|
|
195
|
+
* The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route name
|
|
196
|
+
* if provided, throwing an error if the validation fails at any point during the component's lifecycle.
|
|
197
|
+
*
|
|
198
|
+
* @template TRouteName - A string type that should match route name of the registered router, ensuring the route name exists.
|
|
199
|
+
* @param routeName - Optional. The name of the route to validate against the current active routes.
|
|
200
|
+
* @returns The current router route. If a route name is provided, it validates the route name first.
|
|
201
|
+
* @throws {UseRouteInvalidError} Throws an error if the provided route name is not valid or does not match the current route.
|
|
202
|
+
* @group Compositions
|
|
203
|
+
*/
|
|
204
|
+
export declare const useRoute: {
|
|
205
|
+
(): import('./main').RouterRoute<Readonly<{
|
|
206
|
+
id: any;
|
|
207
|
+
matched: any;
|
|
208
|
+
matches: any;
|
|
209
|
+
name: any;
|
|
210
|
+
query: URLSearchParams;
|
|
211
|
+
hash: string;
|
|
212
|
+
params: {
|
|
213
|
+
[x: string]: unknown;
|
|
214
|
+
[x: number]: unknown;
|
|
215
|
+
[x: symbol]: unknown;
|
|
216
|
+
};
|
|
217
|
+
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
218
|
+
href: import('./main').Url;
|
|
219
|
+
}>>;
|
|
220
|
+
<TRouteName extends any>(routeName: TRouteName, options: import('./guards/routes').IsRouteOptions & {
|
|
221
|
+
exact: true;
|
|
222
|
+
}): import('./main').RouterRoute<Readonly<{
|
|
223
|
+
id: any;
|
|
224
|
+
matched: any;
|
|
225
|
+
matches: any;
|
|
226
|
+
name: any;
|
|
227
|
+
query: URLSearchParams;
|
|
228
|
+
hash: string;
|
|
229
|
+
params: {
|
|
230
|
+
[x: string]: unknown;
|
|
231
|
+
[x: number]: unknown;
|
|
232
|
+
[x: symbol]: unknown;
|
|
233
|
+
};
|
|
234
|
+
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
235
|
+
href: import('./main').Url;
|
|
236
|
+
}>> & {
|
|
237
|
+
name: TRouteName;
|
|
238
|
+
};
|
|
239
|
+
<TRouteName extends any>(routeName: TRouteName, options?: import('./guards/routes').IsRouteOptions): import('./main').RouterRoute<Readonly<{
|
|
240
|
+
id: any;
|
|
241
|
+
matched: any;
|
|
242
|
+
matches: any;
|
|
243
|
+
name: any;
|
|
244
|
+
query: URLSearchParams;
|
|
245
|
+
hash: string;
|
|
246
|
+
params: {
|
|
247
|
+
[x: string]: unknown;
|
|
248
|
+
[x: number]: unknown;
|
|
249
|
+
[x: symbol]: unknown;
|
|
250
|
+
};
|
|
251
|
+
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
252
|
+
href: import('./main').Url;
|
|
253
|
+
}>> & {
|
|
254
|
+
name: `${TRouteName}${string}`;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* A composition to access the installed router instance within a Vue component.
|
|
259
|
+
*
|
|
260
|
+
* @returns The installed router instance.
|
|
261
|
+
* @throws {RouterNotInstalledError} Throws an error if the router has not been installed,
|
|
262
|
+
* ensuring the component does not operate without routing functionality.
|
|
263
|
+
* @group Compositions
|
|
264
|
+
*/
|
|
265
|
+
export declare const useRouter: () => import('./main').Router;
|
|
266
|
+
/**
|
|
267
|
+
* A composition to access a specific query value from the current route.
|
|
268
|
+
*
|
|
269
|
+
* @returns The query value from the router.
|
|
270
|
+
* @group Compositions
|
|
271
|
+
*/
|
|
272
|
+
export declare const useQueryValue: {
|
|
273
|
+
(key: import('vue').MaybeRefOrGetter<string>): import('./compositions/useQueryValue').UseQueryValue<string>;
|
|
274
|
+
<TParam extends import('./main').Param>(key: import('vue').MaybeRefOrGetter<string>, param: TParam): import('./compositions/useQueryValue').UseQueryValue<import('./types/params').ExtractParamType<TParam>>;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* A composition to export much of the functionality that drives RouterLink component.
|
|
278
|
+
* Also exports some useful context about routes relationship to current URL and convenience methods
|
|
279
|
+
* for navigating.
|
|
280
|
+
*
|
|
281
|
+
* @param source - The name of the route or a valid URL.
|
|
282
|
+
* @param params - If providing route name, this argument will expect corresponding params.
|
|
283
|
+
* @param options - {@link RouterResolveOptions} Same options as router resolve.
|
|
284
|
+
* @returns {UseLink} Reactive context values for as well as navigation methods.
|
|
285
|
+
* @group Compositions
|
|
286
|
+
*/
|
|
287
|
+
export declare const useLink: {
|
|
288
|
+
<TRouteKey extends any>(name: import('vue').MaybeRefOrGetter<TRouteKey>, params?: import('vue').MaybeRefOrGetter<Record<string, unknown> | {
|
|
289
|
+
[x: string]: unknown;
|
|
290
|
+
[x: number]: unknown;
|
|
291
|
+
[x: symbol]: unknown;
|
|
292
|
+
}> | undefined, options?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions> | undefined): import('./main').UseLink;
|
|
293
|
+
(url: import('vue').MaybeRefOrGetter<import('./main').Url>, options?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions>): import('./main').UseLink;
|
|
294
|
+
(resolvedRoute: import('vue').MaybeRefOrGetter<import('./main').ResolvedRoute | undefined>, options?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions>): import('./main').UseLink;
|
|
295
|
+
(source: import('vue').MaybeRefOrGetter<string | import('./main').ResolvedRoute | undefined>, paramsOrOptions?: import('vue').MaybeRefOrGetter<Record<PropertyKey, unknown> | import('./main').UseLinkOptions>, maybeOptions?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions>): import('./main').UseLink;
|
|
296
|
+
};
|
|
297
|
+
declare module 'vue' {
|
|
298
|
+
interface GlobalComponents {
|
|
299
|
+
RouterView: typeof RouterView;
|
|
300
|
+
RouterLink: typeof RouterLink;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AfterRouteHook, BeforeRouteHook } from '../types/hooks';
|
|
2
|
+
export declare class RouteHooks {
|
|
3
|
+
onBeforeRouteEnter: Set<BeforeRouteHook>;
|
|
4
|
+
onBeforeRouteUpdate: Set<BeforeRouteHook>;
|
|
5
|
+
onBeforeRouteLeave: Set<BeforeRouteHook>;
|
|
6
|
+
onAfterRouteEnter: Set<AfterRouteHook>;
|
|
7
|
+
onAfterRouteUpdate: Set<AfterRouteHook>;
|
|
8
|
+
onAfterRouteLeave: Set<AfterRouteHook>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Routes } from '../types/route';
|
|
2
|
+
import { RouterAfterRouteHook, RouterBeforeRouteHook } from '../types/router';
|
|
3
|
+
export declare class RouterRouteHooks<TRoutes extends Routes = Routes, TRejections extends PropertyKey = PropertyKey> {
|
|
4
|
+
onBeforeRouteEnter: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
5
|
+
onBeforeRouteUpdate: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
6
|
+
onBeforeRouteLeave: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
7
|
+
onAfterRouteEnter: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
8
|
+
onAfterRouteUpdate: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
9
|
+
onAfterRouteLeave: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Param, ParamGetSet } from '../types/paramTypes';
|
|
2
|
+
import { ExtractParamType } from '../types/params';
|
|
3
|
+
type ArrayOfOptions = {
|
|
4
|
+
separator?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function arrayOf<const T extends Param[]>(params: T, options?: ArrayOfOptions): ParamGetSet<ExtractParamType<T[number]>[]>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { WithParams } from './withParams';
|
|
2
|
+
import { CombinePath } from './combinePath';
|
|
3
|
+
export type CombineHash<TParent extends WithParams, TChild extends WithParams> = CombinePath<TParent, TChild>;
|
|
4
|
+
export declare function combineHash<TParentHash extends WithParams, TChildHash extends WithParams>(parentHash: TParentHash, childHash: TChildHash): CombineHash<TParentHash, TChildHash>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type CombineMeta<TParent extends Record<string, unknown>, TChild extends Record<string, unknown>> = TParent & TChild;
|
|
2
|
+
export declare function combineMeta<TParentMeta extends Record<string, unknown>, TChildMeta extends Record<string, unknown>>(parentMeta: TParentMeta, childMeta: TChildMeta): CombineMeta<TParentMeta, TChildMeta>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|