@real-router/validation-plugin 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
- import { PluginFactory } from '@real-router/core';
2
- export { RouterValidator } from '@real-router/core/validation';
1
+ import { PluginFactory } from "@real-router/core";
2
+ import { RouterValidator } from "@real-router/core/validation";
3
3
 
4
+ //#region src/validationPlugin.d.ts
4
5
  declare function validationPlugin(): PluginFactory;
5
-
6
- export { validationPlugin };
6
+ //#endregion
7
+ export { type RouterValidator, validationPlugin };
8
+ //# sourceMappingURL=index.d.ts.map
package/dist/cjs/index.js CHANGED
@@ -1 +1,2 @@
1
- var e=require("@real-router/core"),t=require("@real-router/core/validation"),r=require("@real-router/logger"),o=["replace","reload","force","forceDeactivate","redirected"],n=/\S/,a=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function i(e,t){return new TypeError(`[router.${e}] ${t}`)}function c(e,t=new WeakSet){if(null==e)return!0;const r=typeof e;if("string"===r||"boolean"===r)return!0;if("number"===r)return Number.isFinite(e);if("function"===r||"symbol"===r)return!1;if(Array.isArray(e))return!t.has(e)&&(t.add(e),e.every(e=>c(e,t)));if("object"===r){if(t.has(e))return!1;t.add(e);const r=Object.getPrototypeOf(e);return(null===r||r===Object.prototype)&&Object.values(e).every(e=>c(e,t))}return!1}function s(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}function u(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);if(null!==t&&t!==Object.prototype)return!1;let r=!1;for(const t in e){if(!Object.hasOwn(e,t))continue;const o=e[t];if(!s(o)){const e=typeof o;if("function"===e||"symbol"===e)return!1;r=!0;break}}return!r||c(e)}function f(e){return"object"==typeof e&&null!==e&&function(e){return function(e){return"string"==typeof e&&(""===e||!(e.length>1e4)&&(!!e.startsWith("@@")||a.test(e)))}(e.name)&&"string"==typeof e.path&&u(e.params)}(e)}function d(e){return"string"==typeof e}function l(e){return"boolean"==typeof e}function p(e,t){return e in t}function w(e,t){if("string"!=typeof e)throw i(t,"Route name must be a string, got "+typeof e);if(""!==e){if(!n.test(e))throw i(t,"Route name cannot contain only whitespace");if(e.length>1e4)throw i(t,"Route name exceeds maximum length of 10000 characters. This is a technical safety limit.");if(!e.startsWith("@@")&&!a.test(e))throw i(t,`Invalid route name "${e}". Each segment must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens. Segments are separated by dots (e.g., "users.profile").`)}}function y(e){return null===e?"null":Array.isArray(e)?`array[${e.length}]`:"object"==typeof e?"constructor"in e&&"Object"!==e.constructor.name?e.constructor.name:"object":typeof e}function g(e){return{warn:Math.floor(.2*e),error:Math.floor(.5*e)}}function m(e,t){if("string"!=typeof e)throw new TypeError(`[router.${t}] dependency name must be a string, got ${typeof e}`)}function h(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}] Invalid argument: expected plain object, received ${y(e)}`);for(const r in e)if(Object.getOwnPropertyDescriptor(e,r)?.get)throw new TypeError(`[router.${t}] Getters not allowed: "${r}"`)}function v(e,t){const o=e,n=o.limits?.maxDependencies??100;if(0===n)return;const a=Object.keys(o.dependencies).length,{warn:i,error:c}=g(n);if(a>=n)throw new RangeError(`[router.${t}] Dependency limit exceeded (${n}). Current: ${a}.`);a===c?r.logger.error(`router.${t}`,`${a} dependencies registered! This indicates architectural problems. Hard limit at ${n}.`):a===i&&r.logger.warn(`router.${t}`,`${a} dependencies registered. Consider if all are necessary.`)}function $(e){if(void 0!==e){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError("[cloneRouter] Invalid dependencies: expected plain object or undefined, received "+typeof e);for(const t in e)if(Object.getOwnPropertyDescriptor(e,t)?.get)throw new TypeError(`[cloneRouter] Getters not allowed in dependencies: "${t}"`)}}function b(e,t){r.logger.warn(`router.${t}`,"Router dependency already exists and is being overwritten:",e)}function E(e,t){r.logger.warn(`router.${t}`,"Overwritten:",e.join(", "))}function T(e){r.logger.warn("router.removeDependency",`Attempted to remove non-existent dependency: "${"string"==typeof e?e:String(e)}"`)}var P=new Set(["$start","$stop","$$start","$$cancel","$$success","$$error"]);function j(e){if(!P.has(e))throw new TypeError(`[router.addEventListener] Invalid event name: ${String(e)}. Must be one of: $start, $stop, $$start, $$cancel, $$success, $$error`)}function R(e,t){if(!l(e)&&"function"!=typeof e)throw new TypeError(`[router.${t}] Handler must be a boolean or factory function, got ${y(e)}`)}function A(e,t,o){r.logger.warn(`router.${o}`,`Overwriting existing ${t} handler for route "${e}"`)}function x(e,t){r.logger.warn(`router.${t}`,`Guard for "${e}" returned a Promise. Sync check cannot resolve async guards — returning false.`)}function S(e){if("string"!=typeof e)throw new TypeError(`[router.navigate] Invalid route name: expected string, got ${y(e)}`)}function O(e){if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError(`[router.navigateToDefault] Invalid options: ${y(e)}. Expected NavigationOptions object.`)}function I(e,t){if(!function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=e;for(const e of o){const r=t[e];if(void 0!==r&&"boolean"!=typeof r)return!1}const r=t.signal;return!(void 0!==r&&!(r instanceof AbortSignal))}(e))throw new TypeError(`[router.${t}] Invalid options: ${y(e)}. Expected NavigationOptions object.`)}function D(e,t){if(void 0!==e&&!u(e))throw new TypeError(`[router.${t}] params must be a plain object, got ${y(e)}`)}function k(e){if(void 0!==e&&"string"!=typeof e)throw new TypeError(`[router.start] path must be a string, got ${y(e)}.`);if("string"==typeof e&&""!==e&&!e.startsWith("/"))throw new TypeError(`[router.start] path must start with "/", got "${e}".`)}var M=["strict","never","always","preserve"],N=["default","strict","loose"],F=["default","uri","uriComponent","none"],C={arrayFormat:["none","brackets","index","comma"],booleanFormat:["none","string","empty-true"],nullFormat:["default","hidden"]},L=["all","warn-error","error-only","none"],q=new Set(["defaultRoute","defaultParams","trailingSlash","queryParamsMode","queryParams","urlParamsEncoding","allowNotFound","rewritePathOnMatch","logger","limits"]),_={maxDependencies:{min:0,max:1e4},maxPlugins:{min:0,max:1e3},maxListeners:{min:0,max:1e5},warnListeners:{min:0,max:1e5},maxEventDepth:{min:0,max:100},maxLifecycleHandlers:{min:0,max:1e4}};function B(e,t,r){if("number"!=typeof t||!Number.isInteger(t))throw new TypeError(`[router.${r}] limit "${e}" must be an integer, got ${String(t)}`);const o=_[e];if(t<o.min||t>o.max)throw new RangeError(`[router.${r}] limit "${e}" must be between ${o.min} and ${o.max}, got ${t}`)}function H(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}] invalid limits: expected plain object, got ${typeof e}`);for(const[r,o]of Object.entries(e)){if(!Object.hasOwn(_,r))throw new TypeError(`[router.${t}] unknown limit: "${r}"`);void 0!==o&&B(r,o,t)}}function U(e,t,r,o){if(void 0!==e&&("string"!=typeof e||!r.includes(e))){const n=r.map(e=>`"${e}"`).join(", ");throw new TypeError(`[router.${o}] Invalid "${t}": "${"string"==typeof e?e:`(${typeof e})`}". Must be one of: ${n}`)}}function W(e,t){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`[router.${t}] Invalid options: expected plain object`);const r=e;for(const e of Object.keys(r))if(!q.has(e))throw new TypeError(`[router.${t}] Unknown option: "${e}"`);if(function(e,t){if(void 0!==e&&"string"!=typeof e&&"function"!=typeof e)throw new TypeError(`[router.${t}] Invalid "defaultRoute": expected string or function, got ${typeof e}`)}(r.defaultRoute,t),function(e,t){if(void 0!==e&&"function"!=typeof e&&(!e||"object"!=typeof e||Array.isArray(e)||e.constructor!==Object))throw new TypeError(`[router.${t}] Invalid "defaultParams": expected plain object or function, got ${typeof e}`)}(r.defaultParams,t),U(r.trailingSlash,"trailingSlash",M,t),U(r.queryParamsMode,"queryParamsMode",N,t),U(r.urlParamsEncoding,"urlParamsEncoding",F,t),void 0!==r.allowNotFound&&"boolean"!=typeof r.allowNotFound)throw new TypeError(`[router.${t}] Invalid "allowNotFound": expected boolean, got ${typeof r.allowNotFound}`);if(void 0!==r.rewritePathOnMatch&&"boolean"!=typeof r.rewritePathOnMatch)throw new TypeError(`[router.${t}] Invalid "rewritePathOnMatch": expected boolean, got ${typeof r.rewritePathOnMatch}`);!function(e,t){if(void 0===e)return;if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`[router.${t}] Invalid "queryParams": expected plain object`);const r=e;for(const e of Object.keys(r)){if(!p(e,C))throw new TypeError(`[router.${t}] Invalid "queryParams.${e}": unknown option`);U(r[e],`queryParams.${e}`,C[e],t)}}(r.queryParams,t),function(e,t){if(void 0===e)return;if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`[router.${t}] Invalid "logger": expected plain object`);const r=e;if(void 0!==r.level&&!L.includes(r.level)){const e=L.map(e=>`"${e}"`).join(", ");throw new TypeError(`[router.${t}] Invalid "logger.level": "${"string"==typeof r.level?r.level:`(${typeof r.level})`}". Must be one of: ${e}`)}if(void 0!==r.callback&&"function"!=typeof r.callback)throw new TypeError(`[router.${t}] Invalid "logger.callback": expected function`);if(void 0!==r.callbackIgnoresLevel&&"boolean"!=typeof r.callbackIgnoresLevel)throw new TypeError(`[router.${t}] Invalid "logger.callbackIgnoresLevel": expected boolean`)}(r.logger,t),void 0!==r.limits&&H(r.limits,t)}var G="router.usePlugin",z={onStart:!0,onStop:!0,onTransitionStart:!0,onTransitionSuccess:!0,onTransitionError:!0,onTransitionCancel:!0};function Z(e){for(const t in e)if("teardown"!==t&&!(t in z))throw new TypeError(`[router.usePlugin] Unknown property '${t}'. Plugin must only contain event handlers and optional teardown.`)}function Q(){r.logger.warn(G,"Duplicate factory in batch, will be registered once")}function V(e){r.logger.warn(G,`Property '${e}' is not a function, skipping`)}function K(e){"onStart"===e&&r.logger.warn(G,"Router already started, onStart will not be called")}function J(e,t){const r=["start","buildPath","forwardState"];if("string"!=typeof e||!r.includes(e))throw new TypeError(`[router.addInterceptor] Invalid method: "${String(e)}". Must be one of: ${r.join(", ")}`);if("function"!=typeof t)throw new TypeError("[router.addInterceptor] interceptor must be a function, got "+typeof t)}function X(e,t){if(!e||"object"!=typeof e)throw new TypeError(`[validation-plugin] ${t}: store must be an object`);const r=e;if(!Array.isArray(r.definitions))throw new TypeError(`[validation-plugin] ${t}: store.definitions must be an array`);if(!r.config||"object"!=typeof r.config)throw new TypeError(`[validation-plugin] ${t}: store.config must be an object`);if(!r.tree||"object"!=typeof r.tree)throw new TypeError(`[validation-plugin] ${t}: store.tree must be an object`);return r}function Y(e,t,r=""){for(const o of e){const e=r?`${r}.${o.name}`:o.name;t(o,e),o.children&&Y(o.children,t,e)}}function ee(e,t){const r=t.split(".");let o=e;for(const e of r)if(o=o.children.get(e),!o)return!1;return!0}function te(t,r){try{return e.resolveForwardChain(t,r)}catch(e){throw new Error(`[validation-plugin] ${e.message}`,{cause:e})}}function re(e){const t=new Set;for(const r of e){for(const e of r.paramMeta.urlParams)t.add(e);for(const e of r.paramMeta.spatParams)t.add(e)}return t}function oe(e,t,r){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[validation-plugin] Route "${r}" ${t} cannot be async`)}function ne(e){const t=X(e,"validateExistingRoutes"),r=new Set;Y(t.definitions,(e,t)=>{if("string"!=typeof e.name||!e.name)throw new TypeError(`[validation-plugin] validateExistingRoutes: route has invalid name: ${e.name}`);if("string"!=typeof e.path)throw new TypeError(`[validation-plugin] validateExistingRoutes: route "${t}" has non-string path (${typeof e.path})`);if(r.has(t))throw new Error(`[validation-plugin] validateExistingRoutes: duplicate route name detected: "${t}"`);r.add(t)})}function ae(e){const t=X(e,"validateForwardToConsistency"),{config:r,tree:o,matcher:n}=t;for(const[e,t]of Object.entries(r.forwardMap)){if(!ee(o,t))throw new Error(`[validation-plugin] validateForwardToConsistency: forwardTo target "${t}" does not exist in tree (source route: "${e}")`);const r=n.getSegmentsByName(e),a=n.getSegmentsByName(t);if(r&&a){const o=re(r),n=[...re(a)].filter(e=>!o.has(e));if(n.length>0)throw new Error(`[validation-plugin] validateForwardToConsistency: forwardTo target "${t}" requires params [${n.join(", ")}] not available in source route "${e}"`)}}for(const e of Object.keys(r.forwardMap))te(e,r.forwardMap)}function ie(e){if(!e||"object"!=typeof e)throw new TypeError("[validation-plugin] validateDependenciesStructure: deps must be an object");const t=e;if(!t.dependencies||"object"!=typeof t.dependencies)throw new TypeError("[validation-plugin] validateDependenciesStructure: deps.dependencies must be an object");const r=t.dependencies;for(const e of Object.keys(r))if(Object.getOwnPropertyDescriptor(r,e)?.get)throw new TypeError(`[validation-plugin] validateDependenciesStructure: dependency "${e}" must not use a getter`);if(!t.limits||"object"!=typeof t.limits)throw new TypeError("[validation-plugin] validateDependenciesStructure: deps.limits must be an object");const o=t.limits,n=["maxDependencies","maxPlugins","maxListeners","warnListeners","maxEventDepth","maxLifecycleHandlers"];for(const e of n)if("number"!=typeof o[e])throw new TypeError(`[validation-plugin] validateDependenciesStructure: deps.limits.${e} must be a number, got ${typeof o[e]}`)}function ce(e,t){return new TypeError(`[router.${e}] ${t}`)}var se=/^[A-Z_a-z][\w-]*$/,ue=/\S/;function fe(e){return null===e?"null":"object"==typeof e?"constructor"in e&&"Object"!==e.constructor.name?e.constructor.name:"object":typeof e}function de(e,t){if(!t.includes("."))return e.children.get(t);let r=e;for(const e of t.split("."))if(r=r.children.get(e),!r)return;return r}function le(e,t,r,o="",n,a){!function(e,t){if(!e||"object"!=typeof e)throw new TypeError(`[router.${t}] Route must be an object, got ${fe(e)}`);const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&null!==r)throw new TypeError(`[router.${t}] Route must be a plain object, got ${fe(e)}`);if(function(e){for(const t of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,t);if(r&&(r.get||r.set))return!0}return!1}(e))throw new TypeError(`[router.${t}] Route must not have getters or setters`)}(e,t);const i=e;!function(e,t){if("string"!=typeof e.name)throw new TypeError(`[router.${t}] Route name must be a string, got ${fe(e.name)}`);const r=e.name;if(""===r)throw new TypeError(`[router.${t}] Route name cannot be empty`);if(!ue.test(r))throw new TypeError(`[router.${t}] Route name cannot contain only whitespace`);if(r.length>1e4)throw new TypeError(`[router.${t}] Route name exceeds maximum length of 10000 characters`);if(!r.startsWith("@@")){if(r.includes("."))throw new TypeError(`[router.${t}] Route name "${r}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`);if(!se.test(r))throw new TypeError(`[router.${t}] Invalid route name "${r}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}}(i,t),function(e,t,r,o){if("string"!=typeof e){let t;throw t=null===e?"null":Array.isArray(e)?"array":typeof e,ce(r,`Route path must be a string, got ${t}`)}if(""===e)return;if(/\s/.test(e))throw ce(r,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw ce(r,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes("//"))throw ce(r,`Invalid path for route "${t}": double slashes not allowed in "${e}"`);const n=o&&Object.values(o.paramTypeMap).includes("url");if(e.startsWith("~")&&n)throw ce(r,`Absolute path "${e}" cannot be used under parent route with URL parameters`)}(i.path,i.name,t,r),function(e,t){if(void 0!==e.encodeParams&&"function"!=typeof e.encodeParams)throw new TypeError(`[router.${t}] Route "${String(e.name)}" encodeParams must be a function`)}(i,t),function(e,t){if(void 0!==e.decodeParams&&"function"!=typeof e.decodeParams)throw new TypeError(`[router.${t}] Route "${String(e.name)}" decodeParams must be a function`)}(i,t);const c=i.name,s=o?`${o}.${c}`:c;r&&s&&function(e,t,r){if(de(e,t))throw new Error(`[router.${r}] Route "${t}" already exists`)}(r,s,t),n&&function(e,t,r){if(e.has(t))throw new Error(`[router.${r}] Duplicate route "${t}" in batch`);e.add(t)}(n,s,t);const u=i.path,f=o;if(r&&function(e,t,r,o){const n=""===t?e:de(e,t);if(n)for(const e of n.children.values())if(e.path===r)throw new Error(`[router.${o}] Path "${r}" is already defined`)}(r,f,u,t),a&&function(e,t,r,o){const n=e.get(t);if(n?.has(r))throw new Error(`[router.${o}] Path "${r}" is already defined`);n?n.add(r):e.set(t,new Set([r]))}(a,f,u,t),void 0!==i.children){if(!Array.isArray(i.children))throw new TypeError(`[router.${t}] Route "${c}" children must be an array, got ${fe(i.children)}`);for(const e of i.children)le(e,t,r,s,n,a)}}function pe(e,t){if(void 0!==e.canActivate&&"function"!=typeof e.canActivate)throw new TypeError(`[router.addRoute] canActivate must be a function for route "${t}", got ${y(e.canActivate)}`);if(void 0!==e.canDeactivate&&"function"!=typeof e.canDeactivate)throw new TypeError(`[router.addRoute] canDeactivate must be a function for route "${t}", got ${y(e.canDeactivate)}`);if(void 0!==e.defaultParams){const r=e.defaultParams;if(null===r||"object"!=typeof r||Array.isArray(r))throw new TypeError(`[router.addRoute] defaultParams must be an object for route "${t}", got ${y(e.defaultParams)}`)}if("AsyncFunction"===e.decodeParams?.constructor.name)throw new TypeError(`[router.addRoute] decodeParams cannot be async for route "${t}". Async functions break matchPath/buildPath.`);if("AsyncFunction"===e.encodeParams?.constructor.name)throw new TypeError(`[router.addRoute] encodeParams cannot be async for route "${t}". Async functions break matchPath/buildPath.`);if(function(e,t){if(void 0!==e&&"function"==typeof e){const r="AsyncFunction"===e.constructor.name,o=e.toString().includes("__awaiter");if(r||o)throw new TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${t}". Async functions break matchPath/buildPath.`)}}(e.forwardTo,t),e.children)for(const r of e.children)pe(r,`${t}.${r.name}`)}function we(e){const t=new Set,r=/[*:]([A-Z_a-z]\w*)/g;let o;for(;null!==(o=r.exec(e));)t.add(o[1]);return t}function ye(e){const t=new Set;for(const r of e)for(const e of we(r))t.add(e);return t}function ge(e,t,r="",o=[]){for(const n of e){const e=r?`${r}.${n.name}`:n.name,a=[...o,n.path];if(e===t)return a;if(n.children&&t.startsWith(`${e}.`))return ge(n.children,t,e,a)}throw new Error(`[internal] collectPathsToRoute: route "${t}" not found`)}function me(e,t=""){const r=new Set;for(const o of e){const e=t?`${t}.${o.name}`:o.name;if(r.add(e),o.children)for(const t of me(o.children,e))r.add(t)}return r}function he(e,t=""){const r=new Map;for(const o of e){const e=t?`${t}.${o.name}`:o.name;if(o.forwardTo&&"string"==typeof o.forwardTo&&r.set(e,o.forwardTo),o.children)for(const[t,n]of he(o.children,e))r.set(t,n)}return r}function ve(e,t,r,o){return t?function(e){const t=new Set;for(const r of e){for(const e of r.paramMeta.urlParams)t.add(e);for(const e of r.paramMeta.spatParams)t.add(e)}return t}(function(e,t){const r=[],o=t.includes(".")?t.split("."):[t];""!==e.path&&r.push(e);let n=e;for(const e of o){const t=n.children.get(e);if(!t)return null;r.push(t),n=t}return r}(r,e)??[]):ye(ge(o,e))}function $e(e,t,r,o,n){const a=function(e,t){const r=t.split(".");let o=e;for(const e of r)if(o=o.children.get(e),!o)return!1;return!0}(n,t),i=o.has(t);if(!a&&!i)throw new ReferenceError(`[router.addRoute] forwardTo target "${t}" does not exist for route "${e}"`);const c=ye(ge(r,e)),s=[...ve(t,a,n,r)].filter(e=>!c.has(e));if(s.length>0)throw new Error(`[router.addRoute] forwardTo target "${t}" requires params [${s.join(", ")}] that are not available in source route "${e}"`)}function be(t,r,o){const n=me(t),a=he(t),i={...r};for(const[e,t]of a)i[e]=t;for(const[e,r]of a)$e(e,r,t,n,o);for(const t of Object.keys(i))e.resolveForwardChain(t,i)}function Ee(e,t){if(e.startsWith("@@"))throw new Error(`[router.${t}] Route name "${e}" uses the reserved "@@" prefix. Routes with this prefix are internal and cannot be modified through the public API.`)}function Te(e,t){for(const r of e)r&&"object"==typeof r&&"string"==typeof r.name&&(Ee(r.name,t),r.children&&Te(r.children,t))}function Pe(e){w(e,"removeRoute")}function je(e){if("string"!=typeof e)throw new TypeError(`[router.setRootPath] rootPath must be a string, got ${y(e)}`)}function Re(e){return"AsyncFunction"===e.constructor.name||String(e).includes("__awaiter")}function Ae(e){const t=e;if(void 0!==t.canActivate&&"function"!=typeof t.canActivate)throw new TypeError(`[router.addRoute] canActivate must be a function, got ${y(t.canActivate)}`);if(void 0!==t.canDeactivate&&"function"!=typeof t.canDeactivate)throw new TypeError(`[router.addRoute] canDeactivate must be a function, got ${y(t.canDeactivate)}`)}function xe(e){const t=e,r=t.name;if(void 0!==t.decodeParams&&Re(t.decodeParams))throw new TypeError(`[router.addRoute] decodeParams cannot be async for route "${String(r)}"`);if(void 0!==t.encodeParams&&Re(t.encodeParams))throw new TypeError(`[router.addRoute] encodeParams cannot be async for route "${String(r)}"`);if("function"==typeof t.forwardTo&&Re(t.forwardTo))throw new TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${String(r)}"`)}function Se(e,t,r,o){if(!d(e))throw new TypeError("[router.isActiveRoute] name must be a string, got "+typeof e);if(void 0!==t&&!u(t))throw new TypeError(`[router.isActiveRoute] params must be a plain object, got ${y(t)}`);if(void 0!==r&&"boolean"!=typeof r)throw new TypeError("[router.isActiveRoute] strictEquality must be a boolean, got "+typeof r);if(void 0!==o&&"boolean"!=typeof o)throw new TypeError("[router.isActiveRoute] ignoreQueryParams must be a boolean, got "+typeof o)}function Oe(e,t,r){if(!d(e))throw new TypeError(`[router.${r}] Invalid routeName: ${y(e)}. Expected string.`);if(!u(t))throw new TypeError(`[router.${r}] Invalid routeParams: ${y(t)}. Expected plain object.`)}function Ie(e,t){if(w(e,"updateRoute"),""===e)throw new ReferenceError("[router.updateRoute] Invalid name: empty string. Cannot update root node.");if(null===t)throw new TypeError("[router.updateRoute] updates must be an object, got null");if("object"!=typeof t||Array.isArray(t))throw new TypeError(`[router.updateRoute] updates must be an object, got ${y(t)}`)}function De(e,t){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[router.updateRoute] ${t} cannot be an async function`)}function ke(e,t){if(null!=e){if("function"!=typeof e)throw new TypeError(`[router.updateRoute] ${t} must be a function or null, got ${typeof e}`);De(e,t)}}function Me(e){if(!d(e)||""===e)throw new TypeError("[router.buildPath] route must be a non-empty string, got "+("string"==typeof e?'""':typeof e))}function Ne(e){if(!d(e))throw new TypeError("[router.matchPath] path must be a string, got "+typeof e)}function Fe(e){if(!d(e))throw new TypeError("[router.shouldUpdateNode] nodeName must be a string, got "+typeof e)}function Ce(t,r,o,n,a){if(!o(t))throw new ReferenceError(`[router.updateRoute] route "${t}" does not exist`);if(null!=r&&"string"==typeof r){if(!o(r))throw new Error(`[router.updateRoute] forwardTo target "${r}" does not exist`);(function(e,t,r){const o=r.getSegmentsByName(e),n=r.getSegmentsByName(t),a=function(e){const t=new Set;for(const r of e)for(const e of r.paramMeta.urlParams)t.add(e);return t}(o),i=[];for(const e of n)for(const t of e.paramMeta.urlParams)i.push(t);const c=i.filter(e=>!a.has(e));if(c.length>0)throw new Error(`[router.addRoute] forwardTo target "${t}" requires params [${c.join(", ")}] that are not available in source route "${e}"`)})(t,r,n),function(t,r,o){const n={...o.forwardMap,[t]:r};e.resolveForwardChain(t,n)}(t,r,a)}}function Le(e,t,r){if(!d(e))throw new TypeError(`[router.makeState] Invalid name: ${y(e)}. Expected string.`);if(void 0!==t&&!u(t))throw new TypeError(`[router.makeState] Invalid params: ${y(t)}. Expected plain object.`);if(void 0!==r&&!d(r))throw new TypeError(`[router.makeState] Invalid path: ${y(r)}. Expected string.`)}function qe(e){return{routes:{validateBuildPathArgs:Me,validateMatchPathArgs:Ne,validateIsActiveRouteArgs:Se,validateShouldUpdateNodeArgs:Fe,validateStateBuilderArgs:Oe,validateAddRouteArgs(e){!function(e){for(const t of e){if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`[router.addRoute] Route must be an object, got ${y(t)}`);pe(t,t.name)}}(e)},validateRoutes(e,t){const r=t;!function(e,t,r){const o=new Set,n=new Map;for(const r of e)le(r,"addRoute",t,"",o,n);t&&r&&be(e,r,t)}(e,r.tree,r.config?.forwardMap)},validateRemoveRouteArgs:Pe,validateUpdateRouteBasicArgs:Ie,validateUpdateRoutePropertyTypes(e,t){!function(e,t,r,o){if(null!=e){if("string"!=typeof e&&"function"!=typeof e)throw new TypeError(`[router.updateRoute] forwardTo must be a string, function, or null, got ${y(e)}`);"function"==typeof e&&De(e,"forwardTo callback")}if(null!=t&&("object"!=typeof t||Array.isArray(t)))throw new TypeError(`[router.updateRoute] defaultParams must be an object or null, got ${y(t)}`);ke(r,"decodeParams"),ke(o,"encodeParams")}(t.forwardTo,t.defaultParams,t.decodeParams,t.encodeParams)},validateUpdateRoute(e,t,r){const o=r;Ce(e,t.forwardTo,e=>o.matcher.hasRoute(e),o.matcher,o.config)},validateParentOption(e,t){!function(e){if("string"!=typeof e||""===e)throw new TypeError(`[router.addRoute] parent option must be a non-empty string, got ${y(e)}`);w(e,"addRoute")}(e);let r=t;for(const t of e.split(".")){const o=r.children.get(t);if(!o)throw new ReferenceError(`[router.addRoute] Parent route "${e}" does not exist`);r=o}},validateRouteName(e,t){w(e,t)},throwIfInternalRoute(e,t){Ee(e,t)},throwIfInternalRouteInArray(e,t){Te(e,t)},validateExistingRoutes:ne,validateForwardToConsistency:ae,validateSetRootPathArgs:je,guardRouteCallbacks:Ae,guardNoAsyncCallbacks:xe},options:{validateLimitValue(e,t){B(e,t,"validate")},validateLimits(e){H(e,"validate")},validateOptions:W},dependencies:{validateDependencyName:m,validateSetDependencyArgs(e,t,r){!function(e){if("string"!=typeof e)throw new TypeError("[router.setDependency] dependency name must be a string, got "+typeof e)}(e)},validateDependenciesObject:h,validateDependencyExists(e,t){const r=t,o=r.dependencies?.[e];!function(e,t){if(void 0===e)throw new ReferenceError(`[router.getDependency] dependency "${t}" not found`)}(o,e)},validateDependencyLimit(e,t){},validateDependenciesStructure:ie,validateDependencyCount:v,validateCloneArgs:$,warnOverwrite:b,warnBatchOverwrite:E,warnRemoveNonExistent:T},plugins:{validatePluginLimit(e,t){!function(e,t,r=50){if(0!==r&&e+t>r)throw new RangeError(`[router.usePlugin] Plugin limit exceeded (${r}). Current: ${e}, Attempting to add: ${t}. This indicates an architectural problem. Consider consolidating plugins.`)}(e,1,t?.maxPlugins)},validateNoDuplicatePlugins(e,t){},validatePluginKeys:Z,validateCountThresholds(t){!function(e,t){if(0===t)return;const{warn:o,error:n}=g(t);e>=n?r.logger.error(G,`${e} plugins registered! This is excessive. Hard limit at ${t}.`):e>=o&&r.logger.warn(G,`${e} plugins registered. Consider if all are necessary.`)}(t,e.getOptions().limits?.maxPlugins??50)},warnBatchDuplicates:Q,warnPluginMethodType:V,warnPluginAfterStart:K,validateAddInterceptorArgs:J},lifecycle:{validateHandler:R,validateNotRegistering(e,t,r){},validateHandlerLimit(e,t,r){!function(e,t,r=200){if(0!==r&&e>=r)throw new RangeError(`[router.${t}] Lifecycle handler limit exceeded (${r}). This indicates too many routes with individual handlers. Consider using plugins for cross-cutting concerns.`)}(e,r,t?.maxLifecycleHandlers)},validateCountThresholds(t,o){!function(e,t,o){if(0===o)return;const{warn:n,error:a}=g(o);e>=a?r.logger.error(`router.${t}`,`${e} lifecycle handlers registered! This is excessive. Hard limit at ${o}.`):e>=n&&r.logger.warn(`router.${t}`,`${e} lifecycle handlers registered. Consider consolidating logic.`)}(t,o,e.getOptions().limits?.maxLifecycleHandlers??200)},warnOverwrite:A,warnAsyncGuardSync:x},navigation:{validateNavigateArgs:S,validateNavigateToDefaultArgs:O,validateNavigationOptions:I,validateParams:D,validateStartArgs:k},state:{validateMakeStateArgs:Le,validateAreStatesEqualArgs(e,t,r){if(!f(e))throw new TypeError(`[router.areStatesEqual] Invalid state1: ${y(e)}. Expected State object.`);if(!f(t))throw new TypeError(`[router.areStatesEqual] Invalid state2: ${y(t)}. Expected State object.`);if(void 0!==r&&!l(r))throw new TypeError(`[router.areStatesEqual] Invalid ignoreQueryParams: ${y(r)}. Expected boolean.`)}},eventBus:{validateEventName:j,validateListenerArgs(e,t){!function(e,t){if(j(e),"function"!=typeof t)throw new TypeError("[router.addEventListener] callback must be a function, got "+typeof t)}(e,t)}}}}exports.validationPlugin=function(){return r=>{const o=t.getInternals(r);if(r.isActive())throw new e.RouterError("VALIDATION_PLUGIN_AFTER_START",{message:"validation-plugin must be registered before router.start()"});o.validator=qe(o);try{const e=o.routeGetStore(),t=o.dependenciesGetStore(),r=o.getOptions();ne(e),ae(e),function(e){const t=X(e,"validateRoutePropertiesStore"),{config:r}=t;for(const[e,t]of Object.entries(r.decoders)){if("function"!=typeof t)throw new TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" decoder must be a function, got ${typeof t}`);oe(t,"decoder",e)}for(const[e,t]of Object.entries(r.encoders)){if("function"!=typeof t)throw new TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" encoder must be a function, got ${typeof t}`);oe(t,"encoder",e)}for(const[e,t]of Object.entries(r.defaultParams))if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" defaultParams must be a plain object, got ${Array.isArray(t)?"array":typeof t}`);for(const[e,t]of Object.entries(r.forwardFnMap)){if("function"!=typeof t)throw new TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" forwardTo callback must be a function, got ${typeof t}`);oe(t,"forwardTo callback",e)}}(e),function(e){const t=X(e,"validateForwardToTargetsStore"),{config:r,tree:o}=t;for(const[e,t]of Object.entries(r.forwardMap))if(!ee(o,t))throw new Error(`[validation-plugin] validateForwardToTargetsStore: forwardTo target "${t}" does not exist for route "${e}"`)}(e),ie(t),function(e,t,r){const o=function(e){const t=e&&"object"==typeof e?e:{};return t.limits&&"object"==typeof t.limits?t.limits:{}}(e);!function(e,t){if(!e||"object"!=typeof e)return;const r=e;if(!Array.isArray(r.definitions))return;const o=r.definitions.length,n=t.maxRoutes;if("number"==typeof n&&n>0&&o>n)throw new RangeError(`[validation-plugin] validateLimitsConsistency: route count (${o}) exceeds configured limit (${n})`)}(t,o),function(e,t){if(!e||"object"!=typeof e)return;const r=e.dependencies,o=e.limits;if(!r||"object"!=typeof r||!o||"object"!=typeof o)return;const n=Object.keys(r).length,a=t.maxDependencies,i="number"==typeof a?a:o.maxDependencies;if("number"==typeof i&&i>0&&n>=i)throw new RangeError(`[validation-plugin] validateLimitsConsistency: dependency count (${n}) reaches or exceeds maxDependencies limit (${i})`)}(r,o)}(r,e,t),o.validator.options.validateOptions(r,"constructor (retrospective)")}catch(e){throw o.validator=null,e}return{teardown(){o.validator=null}}}};//# sourceMappingURL=index.js.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@real-router/core`),t=require(`@real-router/core/validation`),n=require(`@real-router/logger`);const r=[`replace`,`reload`,`force`,`forceDeactivate`,`redirected`];function i(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;for(let e of r){let n=t[e];if(n!==void 0&&typeof n!=`boolean`)return!1}let n=t.signal;return!(n!==void 0&&!(n instanceof AbortSignal))}const a=/\S/,o=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function s(e,t){return TypeError(`[router.${e}] ${t}`)}function c(e){return typeof e==`string`?e===``?!0:e.length>1e4?!1:e.startsWith(`@@`)?!0:o.test(e):!1}function l(e,t=new WeakSet){if(e==null)return!0;let n=typeof e;if(n===`string`||n===`boolean`)return!0;if(n===`number`)return Number.isFinite(e);if(n===`function`||n===`symbol`)return!1;if(Array.isArray(e))return t.has(e)?!1:(t.add(e),e.every(e=>l(e,t)));if(n===`object`){if(t.has(e))return!1;t.add(e);let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype?!1:Object.values(e).every(e=>l(e,t))}return!1}function u(e){if(e==null)return!0;let t=typeof e;return t===`string`||t===`boolean`?!0:t===`number`?Number.isFinite(e):!1}function d(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);if(t!==null&&t!==Object.prototype)return!1;let n=!1;for(let t in e){if(!Object.hasOwn(e,t))continue;let r=e[t];if(!u(r)){let e=typeof r;if(e===`function`||e===`symbol`)return!1;n=!0;break}}return n?l(e):!0}function ee(e){return c(e.name)&&typeof e.path==`string`&&d(e.params)}function f(e){return typeof e!=`object`||!e?!1:ee(e)}function p(e){return typeof e==`string`}function m(e){return typeof e==`boolean`}function te(e,t){return e in t}function h(e,t){if(typeof e!=`string`)throw s(t,`Route name must be a string, got ${typeof e}`);if(e!==``){if(!a.test(e))throw s(t,`Route name cannot contain only whitespace`);if(e.length>1e4)throw s(t,`Route name exceeds maximum length of 10000 characters. This is a technical safety limit.`);if(!e.startsWith(`@@`)&&!o.test(e))throw s(t,`Invalid route name "${e}". Each segment must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens. Segments are separated by dots (e.g., "users.profile").`)}}function g(e){return e===null?`null`:Array.isArray(e)?`array[${e.length}]`:typeof e==`object`?`constructor`in e&&e.constructor.name!==`Object`?e.constructor.name:`object`:typeof e}function _(e){return{warn:Math.floor(e*.2),error:Math.floor(e*.5)}}function ne(e,t){if(typeof e!=`string`)throw TypeError(`[router.${t}] dependency name must be a string, got ${typeof e}`)}function re(e){if(typeof e!=`string`)throw TypeError(`[router.setDependency] dependency name must be a string, got ${typeof e}`)}function ie(e,t){if(!(e&&typeof e==`object`&&e.constructor===Object))throw TypeError(`[router.${t}] Invalid argument: expected plain object, received ${g(e)}`);for(let n in e)if(Object.getOwnPropertyDescriptor(e,n)?.get)throw TypeError(`[router.${t}] Getters not allowed: "${n}"`)}function ae(e,t){if(e===void 0)throw ReferenceError(`[router.getDependency] dependency "${t}" not found`)}function oe(e,t){let r=e,i=r.limits?.maxDependencies??100;if(i===0)return;let a=Object.keys(r.dependencies).length,{warn:o,error:s}=_(i);if(a>=i)throw RangeError(`[router.${t}] Dependency limit exceeded (${i}). Current: ${a}.`);a===s?n.logger.error(`router.${t}`,`${a} dependencies registered! This indicates architectural problems. Hard limit at ${i}.`):a===o&&n.logger.warn(`router.${t}`,`${a} dependencies registered. Consider if all are necessary.`)}function se(e){if(e!==void 0){if(!(e&&typeof e==`object`&&e.constructor===Object))throw TypeError(`[cloneRouter] Invalid dependencies: expected plain object or undefined, received ${typeof e}`);for(let t in e)if(Object.getOwnPropertyDescriptor(e,t)?.get)throw TypeError(`[cloneRouter] Getters not allowed in dependencies: "${t}"`)}}function ce(e,t){n.logger.warn(`router.${t}`,`Router dependency already exists and is being overwritten:`,e)}function le(e,t){n.logger.warn(`router.${t}`,`Overwritten:`,e.join(`, `))}function ue(e){n.logger.warn(`router.removeDependency`,`Attempted to remove non-existent dependency: "${typeof e==`string`?e:String(e)}"`)}const de=new Set([`$start`,`$stop`,`$$start`,`$$cancel`,`$$success`,`$$error`]);function v(e){if(!de.has(e))throw TypeError(`[router.addEventListener] Invalid event name: ${String(e)}. Must be one of: $start, $stop, $$start, $$cancel, $$success, $$error`)}function fe(e,t){if(v(e),typeof t!=`function`)throw TypeError(`[router.addEventListener] callback must be a function, got ${typeof t}`)}function pe(e,t){if(!m(e)&&typeof e!=`function`)throw TypeError(`[router.${t}] Handler must be a boolean or factory function, got ${g(e)}`)}function me(e,t,n){if(e)throw Error(`[router.${n}] Cannot modify route "${t}" during its own registration`)}function he(e,t,n=200){if(n!==0&&e>=n)throw RangeError(`[router.${t}] Lifecycle handler limit exceeded (${n}). This indicates too many routes with individual handlers. Consider using plugins for cross-cutting concerns.`)}function ge(e,t,r){if(r===0)return;let{warn:i,error:a}=_(r);e>=a?n.logger.error(`router.${t}`,`${e} lifecycle handlers registered! This is excessive. Hard limit at ${r}.`):e>=i&&n.logger.warn(`router.${t}`,`${e} lifecycle handlers registered. Consider consolidating logic.`)}function _e(e,t,r){n.logger.warn(`router.${r}`,`Overwriting existing ${t} handler for route "${e}"`)}function ve(e,t){n.logger.warn(`router.${t}`,`Guard for "${e}" returned a Promise. Sync check cannot resolve async guards — returning false.`)}function ye(e){if(typeof e!=`string`)throw TypeError(`[router.navigate] Invalid route name: expected string, got ${g(e)}`)}function be(e){if(e!==void 0&&(typeof e!=`object`||!e))throw TypeError(`[router.navigateToDefault] Invalid options: ${g(e)}. Expected NavigationOptions object.`)}function xe(e,t){if(!i(e))throw TypeError(`[router.${t}] Invalid options: ${g(e)}. Expected NavigationOptions object.`)}function Se(e,t){if(e!==void 0&&!d(e))throw TypeError(`[router.${t}] params must be a plain object, got ${g(e)}`)}function Ce(e){if(e!==void 0&&typeof e!=`string`)throw TypeError(`[router.start] path must be a string, got ${g(e)}.`);if(typeof e==`string`&&e!==``&&!e.startsWith(`/`))throw TypeError(`[router.start] path must start with "/", got "${e}".`)}const y={trailingSlash:[`strict`,`never`,`always`,`preserve`],queryParamsMode:[`default`,`strict`,`loose`],urlParamsEncoding:[`default`,`uri`,`uriComponent`,`none`]},b={arrayFormat:[`none`,`brackets`,`index`,`comma`],booleanFormat:[`none`,`string`,`empty-true`],nullFormat:[`default`,`hidden`],numberFormat:[`none`,`auto`]},x=[`all`,`warn-error`,`error-only`,`none`],we=new Set([`defaultRoute`,`defaultParams`,`trailingSlash`,`queryParamsMode`,`queryParams`,`urlParamsEncoding`,`allowNotFound`,`rewritePathOnMatch`,`logger`,`limits`]),S={maxDependencies:{min:0,max:1e4},maxPlugins:{min:0,max:1e3},maxListeners:{min:0,max:1e5},warnListeners:{min:0,max:1e5},maxEventDepth:{min:0,max:100},maxLifecycleHandlers:{min:0,max:1e4}};function C(e,t,n){if(typeof t!=`number`||!Number.isInteger(t))throw TypeError(`[router.${n}] limit "${e}" must be an integer, got ${String(t)}`);let r=S[e];if(t<r.min||t>r.max)throw RangeError(`[router.${n}] limit "${e}" must be between ${r.min} and ${r.max}, got ${t}`)}function w(e,t){if(!e||typeof e!=`object`||e.constructor!==Object)throw TypeError(`[router.${t}] invalid limits: expected plain object, got ${typeof e}`);for(let[n,r]of Object.entries(e)){if(!Object.hasOwn(S,n))throw TypeError(`[router.${t}] unknown limit: "${n}"`);r!==void 0&&C(n,r,t)}}function T(e,t,n,r){if(e!==void 0&&(typeof e!=`string`||!n.includes(e))){let i=n.map(e=>`"${e}"`).join(`, `);throw TypeError(`[router.${r}] Invalid "${t}": "${typeof e==`string`?e:`(${typeof e})`}". Must be one of: ${i}`)}}function Te(e,t){if(e!==void 0&&typeof e!=`string`&&typeof e!=`function`)throw TypeError(`[router.${t}] Invalid "defaultRoute": expected string or function, got ${typeof e}`)}function E(e,t){if(e!==void 0&&typeof e!=`function`&&(!e||typeof e!=`object`||Array.isArray(e)||e.constructor!==Object))throw TypeError(`[router.${t}] Invalid "defaultParams": expected plain object or function, got ${typeof e}`)}function D(e,t){if(e===void 0)return;if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`[router.${t}] Invalid "queryParams": expected plain object`);let n=e;for(let e of Object.keys(n)){if(!te(e,b))throw TypeError(`[router.${t}] Invalid "queryParams.${e}": unknown option`);T(n[e],`queryParams.${e}`,b[e],t)}}function O(e,t){if(e===void 0)return;if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`[router.${t}] Invalid "logger": expected plain object`);let n=e;if(n.level!==void 0&&!x.includes(n.level)){let e=x.map(e=>`"${e}"`).join(`, `),r=typeof n.level==`string`?n.level:`(${typeof n.level})`;throw TypeError(`[router.${t}] Invalid "logger.level": "${r}". Must be one of: ${e}`)}if(n.callback!==void 0&&typeof n.callback!=`function`)throw TypeError(`[router.${t}] Invalid "logger.callback": expected function`);if(n.callbackIgnoresLevel!==void 0&&typeof n.callbackIgnoresLevel!=`boolean`)throw TypeError(`[router.${t}] Invalid "logger.callbackIgnoresLevel": expected boolean`)}function Ee(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`[router.${t}] Invalid options: expected plain object`);let n=e;for(let e of Object.keys(n))if(!we.has(e))throw TypeError(`[router.${t}] Unknown option: "${e}"`);if(Te(n.defaultRoute,t),E(n.defaultParams,t),T(n.trailingSlash,`trailingSlash`,y.trailingSlash,t),T(n.queryParamsMode,`queryParamsMode`,y.queryParamsMode,t),T(n.urlParamsEncoding,`urlParamsEncoding`,y.urlParamsEncoding,t),n.allowNotFound!==void 0&&typeof n.allowNotFound!=`boolean`)throw TypeError(`[router.${t}] Invalid "allowNotFound": expected boolean, got ${typeof n.allowNotFound}`);if(n.rewritePathOnMatch!==void 0&&typeof n.rewritePathOnMatch!=`boolean`)throw TypeError(`[router.${t}] Invalid "rewritePathOnMatch": expected boolean, got ${typeof n.rewritePathOnMatch}`);D(n.queryParams,t),O(n.logger,t),n.limits!==void 0&&w(n.limits,t)}const k=`router.usePlugin`,De={onStart:!0,onStop:!0,onTransitionStart:!0,onTransitionSuccess:!0,onTransitionError:!0,onTransitionCancel:!0};function Oe(e,t,n=50){if(n!==0&&e+t>n)throw RangeError(`[router.usePlugin] Plugin limit exceeded (${n}). Current: ${e}, Attempting to add: ${t}. This indicates an architectural problem. Consider consolidating plugins.`)}function ke(e,t){if(t===0)return;let{warn:r,error:i}=_(t);e>=i?n.logger.error(k,`${e} plugins registered! This is excessive. Hard limit at ${t}.`):e>=r&&n.logger.warn(k,`${e} plugins registered. Consider if all are necessary.`)}function Ae(e){for(let t in e)if(!(t===`teardown`||t in De))throw TypeError(`[router.usePlugin] Unknown property '${t}'. Plugin must only contain event handlers and optional teardown.`)}function je(){n.logger.warn(k,`Duplicate factory in batch, will be registered once`)}function Me(e){n.logger.warn(k,`Property '${e}' is not a function, skipping`)}function Ne(e){e===`onStart`&&n.logger.warn(k,`Router already started, onStart will not be called`)}function Pe(e,t){let n=[`start`,`buildPath`,`forwardState`];if(typeof e!=`string`||!n.includes(e))throw TypeError(`[router.addInterceptor] Invalid method: "${String(e)}". Must be one of: ${n.join(`, `)}`);if(typeof t!=`function`)throw TypeError(`[router.addInterceptor] interceptor must be a function, got ${typeof t}`)}function A(e,t){if(!e||typeof e!=`object`)throw TypeError(`[validation-plugin] ${t}: store must be an object`);let n=e;if(!Array.isArray(n.definitions))throw TypeError(`[validation-plugin] ${t}: store.definitions must be an array`);if(!n.config||typeof n.config!=`object`)throw TypeError(`[validation-plugin] ${t}: store.config must be an object`);if(!n.tree||typeof n.tree!=`object`)throw TypeError(`[validation-plugin] ${t}: store.tree must be an object`);return n}function j(e,t,n=``){for(let r of e){let e=n?`${n}.${r.name}`:r.name;t(r,e),r.children&&j(r.children,t,e)}}function M(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r=r.children.get(e),!r)return!1;return!0}function Fe(t,n){try{return(0,e.resolveForwardChain)(t,n)}catch(e){throw Error(`[validation-plugin] ${e.message}`,{cause:e})}}function N(e){let t=new Set;for(let n of e){for(let e of n.paramMeta.urlParams)t.add(e);for(let e of n.paramMeta.spatParams)t.add(e)}return t}function P(e,t,n){let r=e;if(r.constructor.name===`AsyncFunction`||r.toString().includes(`__awaiter`))throw TypeError(`[validation-plugin] Route "${n}" ${t} cannot be async`)}function F(e){let t=A(e,`validateExistingRoutes`),n=new Set;j(t.definitions,(e,t)=>{if(typeof e.name!=`string`||!e.name)throw TypeError(`[validation-plugin] validateExistingRoutes: route has invalid name: ${e.name}`);if(typeof e.path!=`string`)throw TypeError(`[validation-plugin] validateExistingRoutes: route "${t}" has non-string path (${typeof e.path})`);if(n.has(t))throw Error(`[validation-plugin] validateExistingRoutes: duplicate route name detected: "${t}"`);n.add(t)})}function I(e){let{config:t,tree:n,matcher:r}=A(e,`validateForwardToConsistency`);for(let[e,i]of Object.entries(t.forwardMap)){if(!M(n,i))throw Error(`[validation-plugin] validateForwardToConsistency: forwardTo target "${i}" does not exist in tree (source route: "${e}")`);let t=r.getSegmentsByName(e),a=r.getSegmentsByName(i);if(t&&a){let n=N(t),r=[...N(a)].filter(e=>!n.has(e));if(r.length>0)throw Error(`[validation-plugin] validateForwardToConsistency: forwardTo target "${i}" requires params [${r.join(`, `)}] not available in source route "${e}"`)}}for(let e of Object.keys(t.forwardMap))Fe(e,t.forwardMap)}function Ie(e){let{config:t}=A(e,`validateRoutePropertiesStore`);for(let[e,n]of Object.entries(t.decoders)){if(typeof n!=`function`)throw TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" decoder must be a function, got ${typeof n}`);P(n,`decoder`,e)}for(let[e,n]of Object.entries(t.encoders)){if(typeof n!=`function`)throw TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" encoder must be a function, got ${typeof n}`);P(n,`encoder`,e)}for(let[e,n]of Object.entries(t.defaultParams))if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" defaultParams must be a plain object, got ${Array.isArray(n)?`array`:typeof n}`);for(let[e,n]of Object.entries(t.forwardFnMap)){if(typeof n!=`function`)throw TypeError(`[validation-plugin] validateRoutePropertiesStore: route "${e}" forwardTo callback must be a function, got ${typeof n}`);P(n,`forwardTo callback`,e)}}function Le(e){let{config:t,tree:n}=A(e,`validateForwardToTargetsStore`);for(let[e,r]of Object.entries(t.forwardMap))if(!M(n,r))throw Error(`[validation-plugin] validateForwardToTargetsStore: forwardTo target "${r}" does not exist for route "${e}"`)}function L(e){if(!e||typeof e!=`object`)throw TypeError(`[validation-plugin] validateDependenciesStructure: deps must be an object`);let t=e;if(!t.dependencies||typeof t.dependencies!=`object`)throw TypeError(`[validation-plugin] validateDependenciesStructure: deps.dependencies must be an object`);let n=t.dependencies;for(let e of Object.keys(n))if(Object.getOwnPropertyDescriptor(n,e)?.get)throw TypeError(`[validation-plugin] validateDependenciesStructure: dependency "${e}" must not use a getter`);if(!t.limits||typeof t.limits!=`object`)throw TypeError(`[validation-plugin] validateDependenciesStructure: deps.limits must be an object`);let r=t.limits;for(let e of[`maxDependencies`,`maxPlugins`,`maxListeners`,`warnListeners`,`maxEventDepth`,`maxLifecycleHandlers`])if(typeof r[e]!=`number`)throw TypeError(`[validation-plugin] validateDependenciesStructure: deps.limits.${e} must be a number, got ${typeof r[e]}`)}function Re(e){let t=e&&typeof e==`object`?e:{};return t.limits&&typeof t.limits==`object`?t.limits:{}}function ze(e,t){if(!e||typeof e!=`object`)return;let n=e;if(!Array.isArray(n.definitions))return;let r=n.definitions.length,i=t.maxRoutes;if(typeof i==`number`&&i>0&&r>i)throw RangeError(`[validation-plugin] validateLimitsConsistency: route count (${r}) exceeds configured limit (${i})`)}function Be(e,t){if(!e||typeof e!=`object`)return;let n=e,r=n.dependencies,i=n.limits;if(!r||typeof r!=`object`||!i||typeof i!=`object`)return;let a=Object.keys(r).length,o=i,s=t.maxDependencies,c=o.maxDependencies,l=typeof s==`number`?s:c;if(typeof l==`number`&&l>0&&a>=l)throw RangeError(`[validation-plugin] validateLimitsConsistency: dependency count (${a}) reaches or exceeds maxDependencies limit (${l})`)}function Ve(e,t,n){let r=Re(e);ze(t,r),Be(n,r)}function He(e,t){let n=[],r=t.includes(`.`)?t.split(`.`):[t];e.path!==``&&n.push(e);let i=e;for(let e of r){let t=i.children.get(e);if(!t)return null;n.push(t),i=t}return n}function R(e,t){return TypeError(`[router.${e}] ${t}`)}function Ue(e,t,n,r){if(typeof e!=`string`){let t;throw t=e===null?`null`:Array.isArray(e)?`array`:typeof e,R(n,`Route path must be a string, got ${t}`)}if(e===``)return;if(/\s/.test(e))throw R(n,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw R(n,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes(`//`))throw R(n,`Invalid path for route "${t}": double slashes not allowed in "${e}"`);let i=r&&Object.values(r.paramTypeMap).includes(`url`);if(e.startsWith(`~`)&&i)throw R(n,`Absolute path "${e}" cannot be used under parent route with URL parameters`)}const We=/^[A-Z_a-z][\w-]*$/,Ge=/\S/,z=1e4;function B(e){return e===null?`null`:typeof e==`object`?`constructor`in e&&e.constructor.name!==`Object`?e.constructor.name:`object`:typeof e}function Ke(e){for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(e,t);if(n&&(n.get||n.set))return!0}return!1}function qe(e,t){if(!e||typeof e!=`object`)throw TypeError(`[router.${t}] Route must be an object, got ${B(e)}`);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`[router.${t}] Route must be a plain object, got ${B(e)}`);if(Ke(e))throw TypeError(`[router.${t}] Route must not have getters or setters`)}function Je(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 Ye(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 Xe(e,t){if(typeof e.name!=`string`)throw TypeError(`[router.${t}] Route name must be a string, got ${B(e.name)}`);let n=e.name;if(n===``)throw TypeError(`[router.${t}] Route name cannot be empty`);if(!Ge.test(n))throw TypeError(`[router.${t}] Route name cannot contain only whitespace`);if(n.length>z)throw TypeError(`[router.${t}] Route name exceeds maximum length of ${z} characters`);if(!n.startsWith(`@@`)){if(n.includes(`.`))throw TypeError(`[router.${t}] Route name "${n}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`);if(!We.test(n))throw TypeError(`[router.${t}] Invalid route name "${n}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}}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 Ze(e,t,n){if(V(e,t))throw Error(`[router.${n}] Route "${t}" already exists`)}function Qe(e,t,n){if(e.has(t))throw Error(`[router.${n}] Duplicate route "${t}" in batch`);e.add(t)}function $e(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 et(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 H(e,t,n,r=``,i,a){qe(e,t);let o=e;Xe(o,t),Ue(o.path,o.name,t,n),Je(o,t),Ye(o,t);let s=o.name,c=r?`${r}.${s}`:s;n&&c&&Ze(n,c,t),i&&Qe(i,c,t);let l=o.path,u=r;if(n&&$e(n,u,l,t),a&&et(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 ${B(o.children)}`);for(let e of o.children)H(e,t,n,c,i,a)}}function tt(e,t){if(e!==void 0&&typeof e==`function`){let n=e.constructor.name===`AsyncFunction`,r=e.toString().includes(`__awaiter`);if(n||r)throw TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${t}". Async functions break matchPath/buildPath.`)}}function U(e,t){if(e.canActivate!==void 0&&typeof e.canActivate!=`function`)throw TypeError(`[router.addRoute] canActivate must be a function for route "${t}", got ${g(e.canActivate)}`);if(e.canDeactivate!==void 0&&typeof e.canDeactivate!=`function`)throw TypeError(`[router.addRoute] canDeactivate must be a function for route "${t}", got ${g(e.canDeactivate)}`);if(e.defaultParams!==void 0){let n=e.defaultParams;if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`[router.addRoute] defaultParams must be an object for route "${t}", got ${g(e.defaultParams)}`)}if(e.decodeParams?.constructor.name===`AsyncFunction`)throw TypeError(`[router.addRoute] decodeParams cannot be async for route "${t}". Async functions break matchPath/buildPath.`);if(e.encodeParams?.constructor.name===`AsyncFunction`)throw TypeError(`[router.addRoute] encodeParams cannot be async for route "${t}". Async functions break matchPath/buildPath.`);if(tt(e.forwardTo,t),e.children)for(let n of e.children)U(n,`${t}.${n.name}`)}function nt(e){let t=new Set,n=/[*:]([A-Z_a-z]\w*)/g,r;for(;(r=n.exec(e))!==null;)t.add(r[1]);return t}function W(e){let t=new Set;for(let n of e)for(let e of nt(n))t.add(e);return t}function G(e,t,n=``,r=[]){for(let i of e){let e=n?`${n}.${i.name}`:i.name,a=[...r,i.path];if(e===t)return a;if(i.children&&t.startsWith(`${e}.`))return G(i.children,t,e,a)}throw Error(`[internal] collectPathsToRoute: route "${t}" not found`)}function K(e,t=``){let n=new Set;for(let r of e){let e=t?`${t}.${r.name}`:r.name;if(n.add(e),r.children)for(let t of K(r.children,e))n.add(t)}return n}function q(e,t=``){let n=new Map;for(let r of e){let e=t?`${t}.${r.name}`:r.name;if(r.forwardTo&&typeof r.forwardTo==`string`&&n.set(e,r.forwardTo),r.children)for(let[t,i]of q(r.children,e))n.set(t,i)}return n}function rt(e){let t=new Set;for(let n of e){for(let e of n.paramMeta.urlParams)t.add(e);for(let e of n.paramMeta.spatParams)t.add(e)}return t}function it(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r=r.children.get(e),!r)return!1;return!0}function at(e,t,n,r){return t?rt(He(n,e)??[]):W(G(r,e))}function ot(e,t,n,r,i){let a=it(i,t),o=r.has(t);if(!a&&!o)throw ReferenceError(`[router.addRoute] forwardTo target "${t}" does not exist for route "${e}"`);let s=W(G(n,e)),c=[...at(t,a,i,n)].filter(e=>!s.has(e));if(c.length>0)throw Error(`[router.addRoute] forwardTo target "${t}" requires params [${c.join(`, `)}] that are not available in source route "${e}"`)}function st(t,n,r){let i=K(t),a=q(t),o={...n};for(let[e,t]of a)o[e]=t;for(let[e,n]of a)ot(e,n,t,i,r);for(let t of Object.keys(o))(0,e.resolveForwardChain)(t,o)}function J(e,t){if(e.startsWith(`@@`))throw Error(`[router.${t}] Route name "${e}" uses the reserved "@@" prefix. Routes with this prefix are internal and cannot be modified through the public API.`)}function Y(e,t){for(let n of e)n&&typeof n==`object`&&typeof n.name==`string`&&(J(n.name,t),n.children&&Y(n.children,t))}function ct(e){h(e,`removeRoute`)}function lt(e){if(typeof e!=`string`)throw TypeError(`[router.setRootPath] rootPath must be a string, got ${g(e)}`)}function X(e){return e.constructor.name===`AsyncFunction`||String(e).includes(`__awaiter`)}function ut(e){let t=e;if(t.canActivate!==void 0&&typeof t.canActivate!=`function`)throw TypeError(`[router.addRoute] canActivate must be a function, got ${g(t.canActivate)}`);if(t.canDeactivate!==void 0&&typeof t.canDeactivate!=`function`)throw TypeError(`[router.addRoute] canDeactivate must be a function, got ${g(t.canDeactivate)}`)}function dt(e){let t=e,n=t.name;if(t.decodeParams!==void 0&&X(t.decodeParams))throw TypeError(`[router.addRoute] decodeParams cannot be async for route "${String(n)}"`);if(t.encodeParams!==void 0&&X(t.encodeParams))throw TypeError(`[router.addRoute] encodeParams cannot be async for route "${String(n)}"`);if(typeof t.forwardTo==`function`&&X(t.forwardTo))throw TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${String(n)}"`)}function ft(e){for(let t of e){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`[router.addRoute] Route must be an object, got ${g(t)}`);U(t,t.name)}}function pt(e){if(typeof e!=`string`||e===``)throw TypeError(`[router.addRoute] parent option must be a non-empty string, got ${g(e)}`);h(e,`addRoute`)}function mt(e,t,n,r){if(!p(e))throw TypeError(`[router.isActiveRoute] name must be a string, got ${typeof e}`);if(t!==void 0&&!d(t))throw TypeError(`[router.isActiveRoute] params must be a plain object, got ${g(t)}`);if(n!==void 0&&typeof n!=`boolean`)throw TypeError(`[router.isActiveRoute] strictEquality must be a boolean, got ${typeof n}`);if(r!==void 0&&typeof r!=`boolean`)throw TypeError(`[router.isActiveRoute] ignoreQueryParams must be a boolean, got ${typeof r}`)}function ht(e,t,n){if(!p(e))throw TypeError(`[router.${n}] Invalid routeName: ${g(e)}. Expected string.`);if(!d(t))throw TypeError(`[router.${n}] Invalid routeParams: ${g(t)}. Expected plain object.`)}function gt(e,t){if(h(e,`updateRoute`),e===``)throw ReferenceError(`[router.updateRoute] Invalid name: empty string. Cannot update root node.`);if(t===null)throw TypeError(`[router.updateRoute] updates must be an object, got null`);if(typeof t!=`object`||Array.isArray(t))throw TypeError(`[router.updateRoute] updates must be an object, got ${g(t)}`)}function Z(e,t){if(e.constructor.name===`AsyncFunction`||e.toString().includes(`__awaiter`))throw TypeError(`[router.updateRoute] ${t} cannot be an async function`)}function Q(e,t){if(e!=null){if(typeof e!=`function`)throw TypeError(`[router.updateRoute] ${t} must be a function or null, got ${typeof e}`);Z(e,t)}}function _t(e,t,n,r){if(e!=null){if(typeof e!=`string`&&typeof e!=`function`)throw TypeError(`[router.updateRoute] forwardTo must be a string, function, or null, got ${g(e)}`);typeof e==`function`&&Z(e,`forwardTo callback`)}if(t!=null&&(typeof t!=`object`||Array.isArray(t)))throw TypeError(`[router.updateRoute] defaultParams must be an object or null, got ${g(t)}`);Q(n,`decodeParams`),Q(r,`encodeParams`)}function vt(e){if(!p(e)||e===``)throw TypeError(`[router.buildPath] route must be a non-empty string, got ${typeof e==`string`?`""`:typeof e}`)}function yt(e){if(!p(e))throw TypeError(`[router.matchPath] path must be a string, got ${typeof e}`)}function $(e){if(!p(e))throw TypeError(`[router.shouldUpdateNode] nodeName must be a string, got ${typeof e}`)}function bt(e,t,n,r){if(r&&t){let e=t;for(let t of r.split(`.`))if(e=e.children.get(t),!e)throw ReferenceError(`[router.addRoute] Parent route "${r}" does not exist`)}let i=new Set,a=new Map;for(let n of e)H(n,`addRoute`,t,r??``,i,a);t&&n&&st(e,n,t)}function xt(e){let t=new Set;for(let n of e)for(let e of n.paramMeta.urlParams)t.add(e);return t}function St(e,t,n){let r=n.getSegmentsByName(e),i=n.getSegmentsByName(t),a=xt(r),o=[];for(let e of i)for(let t of e.paramMeta.urlParams)o.push(t);let s=o.filter(e=>!a.has(e));if(s.length>0)throw Error(`[router.addRoute] forwardTo target "${t}" requires params [${s.join(`, `)}] that are not available in source route "${e}"`)}function Ct(t,n,r){(0,e.resolveForwardChain)(t,{...r.forwardMap,[t]:n})}function wt(e,t,n,r,i){if(!n(e))throw ReferenceError(`[router.updateRoute] route "${e}" does not exist`);if(t!=null&&typeof t==`string`){if(!n(t))throw Error(`[router.updateRoute] forwardTo target "${t}" does not exist`);St(e,t,r),Ct(e,t,i)}}function Tt(e,t,n){if(!p(e))throw TypeError(`[router.makeState] Invalid name: ${g(e)}. Expected string.`);if(t!==void 0&&!d(t))throw TypeError(`[router.makeState] Invalid params: ${g(t)}. Expected plain object.`);if(n!==void 0&&!p(n))throw TypeError(`[router.makeState] Invalid path: ${g(n)}. Expected string.`)}function Et(e){return{routes:{validateBuildPathArgs:vt,validateMatchPathArgs:yt,validateIsActiveRouteArgs:mt,validateShouldUpdateNodeArgs:$,validateStateBuilderArgs:ht,validateAddRouteArgs(e){ft(e)},validateRoutes(e,t){let n=t;bt(e,n.tree,n.config?.forwardMap)},validateRemoveRouteArgs:ct,validateUpdateRouteBasicArgs:gt,validateUpdateRoutePropertyTypes(e,t){let n=t;_t(n.forwardTo,n.defaultParams,n.decodeParams,n.encodeParams)},validateUpdateRoute(e,t,n){let r=n,i=t.forwardTo;wt(e,i,e=>r.matcher.hasRoute(e),r.matcher,r.config)},validateParentOption(e,t){pt(e);let n=t;for(let t of e.split(`.`)){let r=n.children.get(t);if(!r)throw ReferenceError(`[router.addRoute] Parent route "${e}" does not exist`);n=r}},validateRouteName(e,t){h(e,t)},throwIfInternalRoute(e,t){J(e,t)},throwIfInternalRouteInArray(e,t){Y(e,t)},validateExistingRoutes:F,validateForwardToConsistency:I,validateSetRootPathArgs:lt,guardRouteCallbacks:ut,guardNoAsyncCallbacks:dt},options:{validateLimitValue(e,t){C(e,t,`validate`)},validateLimits(e){w(e,`validate`)},validateOptions:Ee},dependencies:{validateDependencyName:ne,validateSetDependencyArgs(e,t,n){re(e)},validateDependenciesObject:ie,validateDependencyExists(e,t){let n=t.dependencies?.[e];ae(n,e)},validateDependencyLimit(e,t){},validateDependenciesStructure:L,validateDependencyCount:oe,validateCloneArgs:se,warnOverwrite:ce,warnBatchOverwrite:le,warnRemoveNonExistent:ue},plugins:{validatePluginLimit(e,t){Oe(e,1,t?.maxPlugins)},validateNoDuplicatePlugins(e,t){},validatePluginKeys:Ae,validateCountThresholds(t){ke(t,e.getOptions().limits?.maxPlugins??50)},warnBatchDuplicates:je,warnPluginMethodType:Me,warnPluginAfterStart:Ne,validateAddInterceptorArgs:Pe},lifecycle:{validateHandler:pe,validateNotRegistering(e,t,n){me(!1,e,n)},validateHandlerLimit(e,t,n){he(e,n,t?.maxLifecycleHandlers)},validateCountThresholds(t,n){ge(t,n,e.getOptions().limits?.maxLifecycleHandlers??200)},warnOverwrite:_e,warnAsyncGuardSync:ve},navigation:{validateNavigateArgs:ye,validateNavigateToDefaultArgs:be,validateNavigationOptions:xe,validateParams:Se,validateStartArgs:Ce},state:{validateMakeStateArgs:Tt,validateAreStatesEqualArgs(e,t,n){if(!f(e))throw TypeError(`[router.areStatesEqual] Invalid state1: ${g(e)}. Expected State object.`);if(!f(t))throw TypeError(`[router.areStatesEqual] Invalid state2: ${g(t)}. Expected State object.`);if(n!==void 0&&!m(n))throw TypeError(`[router.areStatesEqual] Invalid ignoreQueryParams: ${g(n)}. Expected boolean.`)}},eventBus:{validateEventName:v,validateListenerArgs(e,t){fe(e,t)}}}}function Dt(){return n=>{let r=(0,t.getInternals)(n);if(n.isActive())throw new e.RouterError(`VALIDATION_PLUGIN_AFTER_START`,{message:`validation-plugin must be registered before router.start()`});r.validator=Et(r);try{let e=r.routeGetStore(),t=r.dependenciesGetStore(),n=r.getOptions();F(e),I(e),Ie(e),Le(e),L(t),Ve(n,e,t),r.validator.options.validateOptions(n,`constructor (retrospective)`)}catch(e){throw r.validator=null,e}return{teardown(){r.validator=null}}}}exports.validationPlugin=Dt;
2
+ //# sourceMappingURL=index.js.map