@real-router/core 0.145.1 → 0.146.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cjs/Router-zSJWes6J.js +2 -0
  2. package/dist/cjs/Router-zSJWes6J.js.map +1 -0
  3. package/dist/cjs/Router.d.ts.map +1 -1
  4. package/dist/cjs/api.js +1 -1
  5. package/dist/cjs/api.js.map +1 -1
  6. package/dist/cjs/index.d.ts +2 -2
  7. package/dist/cjs/index.js +1 -1
  8. package/dist/cjs/{internals-BCVsLjA2.js → internals-DahrTlg6.js} +2 -2
  9. package/dist/cjs/{internals-BCVsLjA2.js.map → internals-DahrTlg6.js.map} +1 -1
  10. package/dist/cjs/internals.d.ts +6 -1
  11. package/dist/cjs/internals.d.ts.map +1 -1
  12. package/dist/cjs/types/RouterValidator.d.ts +0 -1
  13. package/dist/cjs/types/RouterValidator.d.ts.map +1 -1
  14. package/dist/cjs/types/api.d.ts +31 -0
  15. package/dist/cjs/types/api.d.ts.map +1 -1
  16. package/dist/cjs/types/internal.d.ts.map +1 -1
  17. package/dist/cjs/types.d.ts +2 -2
  18. package/dist/cjs/validation.js +1 -1
  19. package/dist/esm/Router-CTIT6Ai2.mjs +2 -0
  20. package/dist/esm/Router-CTIT6Ai2.mjs.map +1 -0
  21. package/dist/esm/Router.d.mts.map +1 -1
  22. package/dist/esm/api.mjs +1 -1
  23. package/dist/esm/api.mjs.map +1 -1
  24. package/dist/esm/index.d.mts +2 -2
  25. package/dist/esm/index.mjs +1 -1
  26. package/dist/esm/{internals-IXevjBkq.mjs → internals-CVl6M266.mjs} +2 -2
  27. package/dist/esm/{internals-IXevjBkq.mjs.map → internals-CVl6M266.mjs.map} +1 -1
  28. package/dist/esm/internals.d.mts +6 -1
  29. package/dist/esm/internals.d.mts.map +1 -1
  30. package/dist/esm/types/RouterValidator.d.mts +0 -1
  31. package/dist/esm/types/RouterValidator.d.mts.map +1 -1
  32. package/dist/esm/types/api.d.mts +31 -0
  33. package/dist/esm/types/api.d.mts.map +1 -1
  34. package/dist/esm/types/internal.d.mts.map +1 -1
  35. package/dist/esm/types.d.mts +2 -2
  36. package/dist/esm/validation.mjs +1 -1
  37. package/package.json +1 -1
  38. package/dist/cjs/Router-D2VYAR8i.js +0 -2
  39. package/dist/cjs/Router-D2VYAR8i.js.map +0 -1
  40. package/dist/esm/Router-pk3svKoy.mjs +0 -2
  41. package/dist/esm/Router-pk3svKoy.mjs.map +0 -1
@@ -5,7 +5,7 @@ import { LimitsConfig } from "./types/limits.js";
5
5
  import { AdoptedOrigins, AnyOptions, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DefaultSearchCallback, ForwardToCallback, GuardFn, GuardFnFactory, LeaveFn, LeaveState, Listener, LogCallback, LogLevel, LogLevelConfig, LoggerConfig, Navigator, Options, Plugin, PluginFactory, ReadonlyRoute, Route, RouteConfigUpdate, RouterLogger, SubscribeFn, SubscribeState, Subscription } from "./types/router.js";
6
6
  import { ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, PluginMethod } from "./types/constants.js";
7
7
  import { TreeChangedAdd, TreeChangedClear, TreeChangedEvent, TreeChangedRemove, TreeChangedReplace, TreeChangedUpdate, TreeStructuralPatch } from "./types/tree-changed.js";
8
- import { CheckFn, CheckPositionMap, ContextNamespaceClaim, DependenciesApi, InterceptableMethodMap, InterceptorFn, LifecycleApi, PluginApi, RoutesApi } from "./types/api.js";
8
+ import { CheckFn, CheckPositionMap, ContextNamespaceClaim, DependenciesApi, DiagnosticEventMap, InterceptableMethodMap, InterceptorFn, LifecycleApi, PluginApi, RoutesApi } from "./types/api.js";
9
9
  import { NavigationOptions, StateContext } from "./types.js";
10
10
  import { Router } from "./Router.js";
11
11
  import { RouterValidator } from "./types/RouterValidator.js";
@@ -14,4 +14,4 @@ import { RouterError } from "./RouterError.js";
14
14
  import { createRouter } from "./createRouter.js";
15
15
  import { getNavigator } from "./getNavigator.js";
16
16
  import { resolveForwardChain } from "./namespaces/RoutesNamespace/forwardChain.js";
17
- export { type AdoptedOrigins, type AnyOptions, type CheckFn, type CheckPositionMap, type Constants, type ContextNamespaceClaim, type DefaultDependencies, type DefaultParamsCallback, type DefaultRouteCallback, type DefaultSearchCallback, type DependenciesApi, type ErrorCodeKeys, type ErrorCodeToValueMap, type ErrorCodeValues, type ErrorCodes, type EventMethodMap, type EventName, type EventToNameMap, type EventToPluginMap, type EventsKeys, type ForwardToCallback, type GuardFn, type GuardFnFactory, type InterceptableMethodMap, type InterceptorFn, type LeaveFn, type LeaveState, type LifecycleApi, type LimitsConfig, type Listener, type LogCallback, type LogLevel, type LogLevelConfig, type LoggerConfig, type NavigationOptions, type NavigationTarget, type Navigator, type Options, type Params, type ParamsSearch, type Plugin, type PluginApi, type PluginFactory, type PluginMethod, type QueryParamsMode, type QueryParamsOptions, type ReadonlyRoute, type Route, type RouteConfigUpdate, type RouteParams, type RouteTree, type RouteTreeState, Router, RouterError, type RouterLogger, type RouterValidator, type RoutesApi, type SearchParamPrimitive, type SearchParamValue, type SearchParams, type SerializedRouterState, type SimpleState, type State, type StateContext, type SubscribeFn, type SubscribeState, type Subscription, type TransitionMeta, type TransitionPhase, type TransitionReason, type TreeChangedAdd, type TreeChangedClear, type TreeChangedEvent, type TreeChangedRemove, type TreeChangedReplace, type TreeChangedUpdate, type TreeStructuralPatch, UNKNOWN_ROUTE, type Unsubscribe, constants, createRouter, errorCodes, events, getNavigator, resolveForwardChain };
17
+ export { type AdoptedOrigins, type AnyOptions, type CheckFn, type CheckPositionMap, type Constants, type ContextNamespaceClaim, type DefaultDependencies, type DefaultParamsCallback, type DefaultRouteCallback, type DefaultSearchCallback, type DependenciesApi, type DiagnosticEventMap, type ErrorCodeKeys, type ErrorCodeToValueMap, type ErrorCodeValues, type ErrorCodes, type EventMethodMap, type EventName, type EventToNameMap, type EventToPluginMap, type EventsKeys, type ForwardToCallback, type GuardFn, type GuardFnFactory, type InterceptableMethodMap, type InterceptorFn, type LeaveFn, type LeaveState, type LifecycleApi, type LimitsConfig, type Listener, type LogCallback, type LogLevel, type LogLevelConfig, type LoggerConfig, type NavigationOptions, type NavigationTarget, type Navigator, type Options, type Params, type ParamsSearch, type Plugin, type PluginApi, type PluginFactory, type PluginMethod, type QueryParamsMode, type QueryParamsOptions, type ReadonlyRoute, type Route, type RouteConfigUpdate, type RouteParams, type RouteTree, type RouteTreeState, Router, RouterError, type RouterLogger, type RouterValidator, type RoutesApi, type SearchParamPrimitive, type SearchParamValue, type SearchParams, type SerializedRouterState, type SimpleState, type State, type StateContext, type SubscribeFn, type SubscribeState, type Subscription, type TransitionMeta, type TransitionPhase, type TransitionReason, type TreeChangedAdd, type TreeChangedClear, type TreeChangedEvent, type TreeChangedRemove, type TreeChangedReplace, type TreeChangedUpdate, type TreeStructuralPatch, UNKNOWN_ROUTE, type Unsubscribe, constants, createRouter, errorCodes, events, getNavigator, resolveForwardChain };
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./RouterError-C-p1yaby.js"),t=require("./Router-D2VYAR8i.js"),n=(e=[],n={},r={})=>new t.t(e,n,r),r=Object.freeze,i=new WeakMap,a=e=>{let t=i.get(e);return t||(t=r({navigate:e.navigate,getState:e.getState,isActiveRoute:e.isActiveRoute,canNavigateTo:e.canNavigateTo,subscribe:e.subscribe,subscribeLeave:e.subscribeLeave,isLeaveApproved:e.isLeaveApproved}),i.set(e,t)),t};exports.Router=t.t,exports.RouterError=e.t,exports.UNKNOWN_ROUTE=e.p,exports.constants=e.h,exports.createRouter=n,exports.errorCodes=e.g,exports.events=e._,exports.getNavigator=a,exports.resolveForwardChain=t.v;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./RouterError-C-p1yaby.js"),t=require("./Router-zSJWes6J.js"),n=(e=[],n={},r={})=>new t.t(e,n,r),r=Object.freeze,i=new WeakMap,a=e=>{let t=i.get(e);return t||(t=r({navigate:e.navigate,getState:e.getState,isActiveRoute:e.isActiveRoute,canNavigateTo:e.canNavigateTo,subscribe:e.subscribe,subscribeLeave:e.subscribeLeave,isLeaveApproved:e.isLeaveApproved}),i.set(e,t)),t};exports.Router=t.t,exports.RouterError=e.t,exports.UNKNOWN_ROUTE=e.p,exports.constants=e.h,exports.createRouter=n,exports.errorCodes=e.g,exports.events=e._,exports.getNavigator=a,exports.resolveForwardChain=t.v;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- const e=require("./RouterError-C-p1yaby.js"),t=Object.hasOwn;function n(e,n){if(n.length!==0&&e!=null)for(let r of n){if(!t(e,r))continue;let n;try{n=e[r]}catch{return}if(n!==void 0)return r}}function r(e,t,r,i,o,s){let c=n(r,i);if(c!==void 0)throw TypeError(`[router.${e}] ${a(t,c,typeof o==`function`?o():o,s)}`)}function i(e,t,n,i){r(e,t,n,i,"the `params` bag this call is about to ship — the channel check above it read a different value, so the caller's object answered differently between the two reads")}function a(e,t,n="the `params` argument",r="Pass it in `search` instead"){return`Route "${e}" declares \`${t}\` as a query param, but it was given in ${n} — the path channel. ${r}; the two channels are separate since RFC-4 M2 and the router never moves a key between them.`}const o=e=>e===58||e===42;function s(e){let t=[],n=0;for(let r=0;r<e.length;r+=1)e.charCodeAt(r)===47&&(t.push(e.slice(n,r)),n=r+1);return t.push(e.slice(n)),t}function c(e){let t=e.length;if(t===0)return{kind:`static`,text:``};if(!o(e.charCodeAt(0))){for(let n=0;n<t;n+=1){let r=e.charCodeAt(n);if(r===60||r===62)return{error:`constraint-removed`};if(o(r)&&n+1<t)return{error:`fused-marker`}}return e.charCodeAt(t-1)===63?{error:`name-less`}:{kind:`static`,text:e}}let n=e.charCodeAt(0)===42,r=1;for(;r<t;){let t=e.charCodeAt(r);if(t===60||t===62||t===63)break;r+=1}let i=e.slice(1,r);return i.length===0?{error:`name-less`}:o(i.charCodeAt(i.length-1))?{error:`trailing-marker`}:r<t?e.charCodeAt(r)===63?{error:`optional-removed`}:{error:`constraint-removed`}:n?{kind:`splat`,name:i}:{kind:`param`,name:i}}function l(e){for(let t of s(e)){let e=c(t);if(`error`in e)return e.error}}function u(e){let t=s(e);for(let e=0;e<t.length;e+=1){let n=c(t[e]);if(`error`in n){if(n.error===`optional-removed`){let n=t[e],r=[...t];return r[e]=n.slice(0,n.indexOf(`?`)),{code:`optional-removed`,segment:n,withoutSegment:t.filter((t,n)=>n!==e).join(`/`),requiredForm:r.join(`/`)}}return n.error===`constraint-removed`?{code:`constraint-removed`,segment:t[e]}:void 0}}}const d=/[<>]/u;function f(e){for(let t=0;t<e.length;t+=1){if(e.codePointAt(t)!==63)continue;let n=t+1<e.length?e.codePointAt(t+1):-1;if(n!==-1&&n!==47&&n!==63&&n!==60)return t}return-1}const p=Object.freeze([]),m=Object.freeze({}),h=Object.freeze({urlParams:p,queryParams:p,paramTypeMap:m,pathPattern:``});function g(e,t,n){for(let r of s(e)){if(r.length===0)continue;let e=c(r);`error`in e||e.kind===`static`||(t.push(e.name),n[e.name]=`url`)}}function _(t){let n=[],r=[],i=e.a(),a=f(t);if(a!==-1){let e=t.slice(a+1).split(`&`);for(let t of e){let e=t.trim();e.length>0&&(r.push(e),i[e]=`query`)}t=t.slice(0,a)}return g(t,n,i),v(n,r,e.o(i),t)}function v(e,t,n,r){return{urlParams:e.length===0?p:e,queryParams:t.length===0?p:t,paramTypeMap:e.length===0&&t.length===0?m:n,pathPattern:r}}const y=/^[A-Z_a-z][\w-]*$/,b=/\S/,x=1e4;function S(e,t){if(e===``)throw TypeError(`[router.${t}] Route name cannot be empty`)}function ee(e,t){if(!b.test(e))throw TypeError(`[router.${t}] Route name cannot contain only whitespace`)}function C(e,t){if(e.length>x)throw TypeError(`[router.${t}] Route name exceeds maximum length of ${x} characters`)}function w(e,t){if(e.includes(`.`))throw TypeError(`[router.${t}] Route name "${e}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`)}function te(e,t){if(!y.test(e))throw TypeError(`[router.${t}] Invalid route name "${e}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}function T(e,t){return TypeError(`[router.${e}] ${t}`)}function E(e,t,n,r){let i=new Set;for(let a of e){if(i.has(a))throw T(n,`Invalid path for route "${t}": duplicate parameter name ':${a}' in "${r}" (a param name must be unique within a route — the second binding would overwrite the first)`);i.add(a)}}function D(e,t,n,r){for(let i of e)if(d.test(i))throw T(n,`Invalid path for route "${t}": invalid query-param name "${i}" in "${r}" (a query-param name cannot contain '<' or '>' — it would never round-trip; rename the query param)`)}function O(e){let t=!0,n=!1;for(let r of e){if(r===`/`){t=!0;continue}if(t&&=(n=r===`:`||r===`*`,!1),!n&&r.codePointAt(0)>=128)return!0}return!1}function k(e,t,n){switch(e){case`name-less`:case`trailing-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') without a name in "${n}"`;case`fused-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') must begin a segment, but "${n}" fuses one to a static prefix (use a boundary marker like "/a/:b")`}}function A(e,t){return e.code===`optional-removed`?`Invalid path for route "${t}": optional params are not supported — "${e.segment}". Declare two sibling routes instead: "${e.withoutSegment}" and "${e.requiredForm}" (the route hierarchy already expresses optionality)`:`Invalid path for route "${t}": regex constraints are not supported — '<' and '>' are reserved in path segments ("${e.segment}"). Match the segment as a plain string and validate the value in a guard (canActivate) or app code`}function j(e,t,n,r){if(typeof e!=`string`){let t;throw t=e===null?`null`:Array.isArray(e)?`array`:typeof e,T(n,`Route path must be a string, got ${t}`)}if(e===``)return;if(/\s/.test(e))throw T(n,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw T(n,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes(`//`))throw T(n,`Invalid path for route "${t}": double slashes not allowed in "${e}"`);let{pathPattern:i,urlParams:a,queryParams:o}=_(e);E(a,t,n,e),D(o,t,n,e);let s=u(i);if(s!==void 0)throw T(n,A(s,t));let c=l(i);if(c!==void 0)throw T(n,k(c,t,e));if(O(i))throw T(n,`Invalid path for route "${t}": non-ASCII static segment in "${e}" — match compares static segments raw and rejects non-ASCII input, so this route would never match. Percent-encode it (e.g. '/caf%C3%A9') or use a param`);let d=r&&r.paramMeta.urlParams.length>0;if(e.startsWith(`~`)&&d)throw T(n,`Absolute path "${e}" cannot be used under parent route with URL parameters`)}const M=Object.getOwnPropertyDescriptor,N=Object.keys,P=Object.getPrototypeOf;function F(e){if(e===null)return`null`;if(typeof e==`object`){try{let t=e.constructor;if(typeof t==`function`&&t.name!==`Object`)return t.name||`object`}catch{}return`object`}return typeof e}function I(e){for(let t of N(e)){let n=M(e,t);if(n&&(n.get||n.set))return!0}return!1}function L(e,t){if(!e||typeof e!=`object`)throw TypeError(`[router.${t}] Route must be an object, got ${F(e)}`);let n=P(e);if(n!==Object.prototype&&n!==null)throw TypeError(`[router.${t}] Route must be a plain object, got ${F(e)}`);if(I(e))throw TypeError(`[router.${t}] Route must not have getters or setters`)}function R(e,t){if(e.encodeParams!==void 0&&typeof e.encodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" encodeParams must be a function`)}function z(e,t){if(e.decodeParams!==void 0&&typeof e.decodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" decodeParams must be a function`)}function B(e,t){if(typeof e.name!=`string`)throw TypeError(`[router.${t}] Route name must be a string, got ${F(e.name)}`);let n=e.name;S(n,t),ee(n,t),C(n,t),!n.startsWith(`@@`)&&(w(n,t),te(n,t))}function V(e,t){if(!t.includes(`.`))return e.children.get(t);let n=e;for(let e of t.split(`.`))if(n=n.children.get(e),!n)return;return n}function H(e,t,n){if(V(e,t))throw Error(`[router.${n}] Route "${t}" already exists`)}function U(e,t,n){if(e.has(t))throw Error(`[router.${n}] Duplicate route "${t}" in batch`);e.add(t)}function W(e,t,n,r){let i=t===``?e:V(e,t);if(i){for(let e of i.children.values())if(e.path===n)throw Error(`[router.${r}] Path "${n}" is already defined`)}}function G(e,t,n,r){let i=e.get(t);if(i?.has(n))throw Error(`[router.${r}] Path "${n}" is already defined`);i?i.add(n):e.set(t,new Set([n]))}function K(e,t,n,r=``,i,a){L(e,t);let o=e;B(o,t),j(o.path,o.name,t,n),R(o,t),z(o,t);let s=o.name,c=r?`${r}.${s}`:s;n&&c&&H(n,c,t),i&&U(i,c,t);let l=o.path,u=r;if(n&&W(n,u,l,t),a&&G(a,u,l,t),o.children!==void 0){if(!Array.isArray(o.children))throw TypeError(`[router.${t}] Route "${s}" children must be an array, got ${F(o.children)}`);for(let e of o.children)K(e,t,n,c,i,a)}}const q=new WeakMap,J=Symbol.for(`real-router.router`);function Y(e){try{return e?.[J]===!0}catch{return!1}}function X(e){let t=q.get(e);if(!t)throw TypeError(Y(e)?"[real-router] This IS a router, but not one this copy of @real-router/core built. Core identifies a router by object identity, so it is either wrapped in a Proxy (Vue `reactive()` / Pinia — store it with `markRaw`), or your dependency tree holds two copies of @real-router/core — dedupe it to one.":`[real-router] Invalid router instance — not found in internals registry`);return t}function Z(e,t,n,i){r(t,n,i,e.getDeclaredQueryNames(n))}function Q(t){if(t())throw e.n(new e.t(e.g.ROUTER_DISPOSED))}function ne(e,t){q.set(e,t),Object.defineProperty(e,J,{value:!0})}function $(e,t,n,r){let i=t;for(let t of e){let e=i,n=r===void 0?e:(...t)=>r(e(...t));i=(...e)=>t(n,...e)}return i(...n)}const re={start:`start`,forwardState:`forwardState`},ie={"buildPath:params":`buildPath:params`,"buildPathResolved:params":`buildPathResolved:params`,"canNavigateTo:entry":`canNavigateTo:entry`,"canNavigateTo:params":`canNavigateTo:params`,"navigate:entry":`navigate:entry`,"navigate:params":`navigate:params`,"addRoute:batch":`addRoute:batch`,"replaceRoutes:batch":`replaceRoutes:batch`,"removeRoute:entry":`removeRoute:entry`,"updateRoute:entry":`updateRoute:entry`,"hasRoute:entry":`hasRoute:entry`,"getRoute:entry":`getRoute:entry`,"forwardState:entry":`forwardState:entry`,"buildNavigationState:state":`buildNavigationState:state`,"addActivateGuard:entry":`addActivateGuard:entry`,"addDeactivateGuard:entry":`addDeactivateGuard:entry`,"removeActivateGuard:entry":`removeActivateGuard:entry`,"removeDeactivateGuard:entry":`removeDeactivateGuard:entry`};function ae(e,t,...n){let r=e.get(t);if(r===void 0)return;let i=r.length;for(let e=0;e<i&&e<r.length;e++)r[e](...n)}function oe(e,t,n){return((...r)=>{let i=n.get(e);return!i||i.length===0?t(...r):$(i,t,r)})}function se(e,t,n,r,i){return(a,o,s)=>{let c=n.get(e);return!c||c.length===0?t(a,o,s):$(c,t,i(a,o,s),r)}}Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return r}});
2
- //# sourceMappingURL=internals-BCVsLjA2.js.map
1
+ const e=require("./RouterError-C-p1yaby.js"),t=Object.hasOwn;function n(e,n){if(n.length!==0&&e!=null)for(let r of n){if(!t(e,r))continue;let n;try{n=e[r]}catch{return}if(n!==void 0)return r}}function r(e,t,r,i,o,s){let c=n(r,i);if(c!==void 0)throw TypeError(`[router.${e}] ${a(t,c,typeof o==`function`?o():o,s)}`)}function i(e,t,n,i){r(e,t,n,i,"the `params` bag this call is about to ship — the channel check above it read a different value, so the caller's object answered differently between the two reads")}function a(e,t,n="the `params` argument",r="Pass it in `search` instead"){return`Route "${e}" declares \`${t}\` as a query param, but it was given in ${n} — the path channel. ${r}; the two channels are separate since RFC-4 M2 and the router never moves a key between them.`}const o=e=>e===58||e===42;function s(e){let t=[],n=0;for(let r=0;r<e.length;r+=1)e.charCodeAt(r)===47&&(t.push(e.slice(n,r)),n=r+1);return t.push(e.slice(n)),t}function c(e){let t=e.length;if(t===0)return{kind:`static`,text:``};if(!o(e.charCodeAt(0))){for(let n=0;n<t;n+=1){let r=e.charCodeAt(n);if(r===60||r===62)return{error:`constraint-removed`};if(o(r)&&n+1<t)return{error:`fused-marker`}}return e.charCodeAt(t-1)===63?{error:`name-less`}:{kind:`static`,text:e}}let n=e.charCodeAt(0)===42,r=1;for(;r<t;){let t=e.charCodeAt(r);if(t===60||t===62||t===63)break;r+=1}let i=e.slice(1,r);return i.length===0?{error:`name-less`}:o(i.charCodeAt(i.length-1))?{error:`trailing-marker`}:r<t?e.charCodeAt(r)===63?{error:`optional-removed`}:{error:`constraint-removed`}:n?{kind:`splat`,name:i}:{kind:`param`,name:i}}function l(e){for(let t of s(e)){let e=c(t);if(`error`in e)return e.error}}function u(e){let t=s(e);for(let e=0;e<t.length;e+=1){let n=c(t[e]);if(`error`in n){if(n.error===`optional-removed`){let n=t[e],r=[...t];return r[e]=n.slice(0,n.indexOf(`?`)),{code:`optional-removed`,segment:n,withoutSegment:t.filter((t,n)=>n!==e).join(`/`),requiredForm:r.join(`/`)}}return n.error===`constraint-removed`?{code:`constraint-removed`,segment:t[e]}:void 0}}}const d=/[<>]/u;function f(e){for(let t=0;t<e.length;t+=1){if(e.codePointAt(t)!==63)continue;let n=t+1<e.length?e.codePointAt(t+1):-1;if(n!==-1&&n!==47&&n!==63&&n!==60)return t}return-1}const p=Object.freeze([]),m=Object.freeze({}),h=Object.freeze({urlParams:p,queryParams:p,paramTypeMap:m,pathPattern:``});function g(e,t,n){for(let r of s(e)){if(r.length===0)continue;let e=c(r);`error`in e||e.kind===`static`||(t.push(e.name),n[e.name]=`url`)}}function _(t){let n=[],r=[],i=e.a(),a=f(t);if(a!==-1){let e=t.slice(a+1).split(`&`);for(let t of e){let e=t.trim();e.length>0&&(r.push(e),i[e]=`query`)}t=t.slice(0,a)}return g(t,n,i),v(n,r,e.o(i),t)}function v(e,t,n,r){return{urlParams:e.length===0?p:e,queryParams:t.length===0?p:t,paramTypeMap:e.length===0&&t.length===0?m:n,pathPattern:r}}const y=/^[A-Z_a-z][\w-]*$/,b=/\S/,x=1e4;function S(e,t){if(e===``)throw TypeError(`[router.${t}] Route name cannot be empty`)}function ee(e,t){if(!b.test(e))throw TypeError(`[router.${t}] Route name cannot contain only whitespace`)}function C(e,t){if(e.length>x)throw TypeError(`[router.${t}] Route name exceeds maximum length of ${x} characters`)}function w(e,t){if(e.includes(`.`))throw TypeError(`[router.${t}] Route name "${e}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`)}function te(e,t){if(!y.test(e))throw TypeError(`[router.${t}] Invalid route name "${e}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}function T(e,t){return TypeError(`[router.${e}] ${t}`)}function E(e,t,n,r){let i=new Set;for(let a of e){if(i.has(a))throw T(n,`Invalid path for route "${t}": duplicate parameter name ':${a}' in "${r}" (a param name must be unique within a route — the second binding would overwrite the first)`);i.add(a)}}function D(e,t,n,r){for(let i of e)if(d.test(i))throw T(n,`Invalid path for route "${t}": invalid query-param name "${i}" in "${r}" (a query-param name cannot contain '<' or '>' — it would never round-trip; rename the query param)`)}function O(e){let t=!0,n=!1;for(let r of e){if(r===`/`){t=!0;continue}if(t&&=(n=r===`:`||r===`*`,!1),!n&&r.codePointAt(0)>=128)return!0}return!1}function k(e,t,n){switch(e){case`name-less`:case`trailing-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') without a name in "${n}"`;case`fused-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') must begin a segment, but "${n}" fuses one to a static prefix (use a boundary marker like "/a/:b")`}}function A(e,t){return e.code===`optional-removed`?`Invalid path for route "${t}": optional params are not supported — "${e.segment}". Declare two sibling routes instead: "${e.withoutSegment}" and "${e.requiredForm}" (the route hierarchy already expresses optionality)`:`Invalid path for route "${t}": regex constraints are not supported — '<' and '>' are reserved in path segments ("${e.segment}"). Match the segment as a plain string and validate the value in a guard (canActivate) or app code`}function j(e,t,n,r){if(typeof e!=`string`){let t;throw t=e===null?`null`:Array.isArray(e)?`array`:typeof e,T(n,`Route path must be a string, got ${t}`)}if(e===``)return;if(/\s/.test(e))throw T(n,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw T(n,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes(`//`))throw T(n,`Invalid path for route "${t}": double slashes not allowed in "${e}"`);let{pathPattern:i,urlParams:a,queryParams:o}=_(e);E(a,t,n,e),D(o,t,n,e);let s=u(i);if(s!==void 0)throw T(n,A(s,t));let c=l(i);if(c!==void 0)throw T(n,k(c,t,e));if(O(i))throw T(n,`Invalid path for route "${t}": non-ASCII static segment in "${e}" — match compares static segments raw and rejects non-ASCII input, so this route would never match. Percent-encode it (e.g. '/caf%C3%A9') or use a param`);let d=r&&r.paramMeta.urlParams.length>0;if(e.startsWith(`~`)&&d)throw T(n,`Absolute path "${e}" cannot be used under parent route with URL parameters`)}const M=Object.getOwnPropertyDescriptor,N=Object.keys,P=Object.getPrototypeOf;function F(e){if(e===null)return`null`;if(typeof e==`object`){try{let t=e.constructor;if(typeof t==`function`&&t.name!==`Object`)return t.name||`object`}catch{}return`object`}return typeof e}function I(e){for(let t of N(e)){let n=M(e,t);if(n&&(n.get||n.set))return!0}return!1}function L(e,t){if(!e||typeof e!=`object`)throw TypeError(`[router.${t}] Route must be an object, got ${F(e)}`);let n=P(e);if(n!==Object.prototype&&n!==null)throw TypeError(`[router.${t}] Route must be a plain object, got ${F(e)}`);if(I(e))throw TypeError(`[router.${t}] Route must not have getters or setters`)}function R(e,t){if(e.encodeParams!==void 0&&typeof e.encodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" encodeParams must be a function`)}function z(e,t){if(e.decodeParams!==void 0&&typeof e.decodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" decodeParams must be a function`)}function B(e,t){if(typeof e.name!=`string`)throw TypeError(`[router.${t}] Route name must be a string, got ${F(e.name)}`);let n=e.name;S(n,t),ee(n,t),C(n,t),!n.startsWith(`@@`)&&(w(n,t),te(n,t))}function V(e,t){if(!t.includes(`.`))return e.children.get(t);let n=e;for(let e of t.split(`.`))if(n=n.children.get(e),!n)return;return n}function H(e,t,n){if(V(e,t))throw Error(`[router.${n}] Route "${t}" already exists`)}function U(e,t,n){if(e.has(t))throw Error(`[router.${n}] Duplicate route "${t}" in batch`);e.add(t)}function W(e,t,n,r){let i=t===``?e:V(e,t);if(i){for(let e of i.children.values())if(e.path===n)throw Error(`[router.${r}] Path "${n}" is already defined`)}}function G(e,t,n,r){let i=e.get(t);if(i?.has(n))throw Error(`[router.${r}] Path "${n}" is already defined`);i?i.add(n):e.set(t,new Set([n]))}function K(e,t,n,r=``,i,a){L(e,t);let o=e;B(o,t),j(o.path,o.name,t,n),R(o,t),z(o,t);let s=o.name,c=r?`${r}.${s}`:s;n&&c&&H(n,c,t),i&&U(i,c,t);let l=o.path,u=r;if(n&&W(n,u,l,t),a&&G(a,u,l,t),o.children!==void 0){if(!Array.isArray(o.children))throw TypeError(`[router.${t}] Route "${s}" children must be an array, got ${F(o.children)}`);for(let e of o.children)K(e,t,n,c,i,a)}}const q=new WeakMap,J=Symbol.for(`real-router.router`);function Y(e){try{return e?.[J]===!0}catch{return!1}}function X(e){let t=q.get(e);if(!t)throw TypeError(Y(e)?"[real-router] This IS a router, but not one this copy of @real-router/core built. Core identifies a router by object identity, so it is either wrapped in a Proxy (Vue `reactive()` / Pinia — store it with `markRaw`), or your dependency tree holds two copies of @real-router/core — dedupe it to one.":`[real-router] Invalid router instance — not found in internals registry`);return t}function Z(e,t,n,i){r(t,n,i,e.getDeclaredQueryNames(n))}function Q(t){if(t())throw e.n(new e.t(e.g.ROUTER_DISPOSED))}function ne(e,t){q.set(e,t),Object.defineProperty(e,J,{value:!0})}function $(e,t,n,r){let i=t;for(let t of e){let e=i,n=r===void 0?e:(...t)=>r(e(...t));i=(...e)=>t(n,...e)}return i(...n)}const re={start:`start`,forwardState:`forwardState`},ie={PLUGIN_AFTER_START:`PLUGIN_AFTER_START`},ae={"buildPath:params":`buildPath:params`,"buildPathResolved:params":`buildPathResolved:params`,"canNavigateTo:entry":`canNavigateTo:entry`,"canNavigateTo:params":`canNavigateTo:params`,"navigate:entry":`navigate:entry`,"navigate:params":`navigate:params`,"addRoute:batch":`addRoute:batch`,"replaceRoutes:batch":`replaceRoutes:batch`,"removeRoute:entry":`removeRoute:entry`,"updateRoute:entry":`updateRoute:entry`,"hasRoute:entry":`hasRoute:entry`,"getRoute:entry":`getRoute:entry`,"forwardState:entry":`forwardState:entry`,"buildNavigationState:state":`buildNavigationState:state`,"addActivateGuard:entry":`addActivateGuard:entry`,"addDeactivateGuard:entry":`addDeactivateGuard:entry`,"removeActivateGuard:entry":`removeActivateGuard:entry`,"removeDeactivateGuard:entry":`removeDeactivateGuard:entry`};function oe(e,t,...n){let r=e.get(t);if(r===void 0)return;let i=r.length;for(let e=0;e<i&&e<r.length;e++)r[e](...n)}function se(e,t,n){return((...r)=>{let i=n.get(e);return!i||i.length===0?t(...r):$(i,t,r)})}function ce(e,t,n,r,i){return(a,o,s)=>{let c=n.get(e);return!c||c.length===0?t(a,o,s):$(c,t,i(a,o,s),r)}}Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return s}});
2
+ //# sourceMappingURL=internals-DahrTlg6.js.map