@real-router/validation-plugin 0.1.0 → 0.2.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 +1 @@
1
- {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"../type-guards/dist/esm/index.mjs":{"bytes":3451,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":224,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/dependencies.ts":{"bytes":4367,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/eventBus.ts":{"bytes":1358,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/lifecycle.ts":{"bytes":2528,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/navigation.ts":{"bytes":1841,"imports":[{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/options.ts":{"bytes":8080,"imports":[{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/plugins.ts":{"bytes":2819,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/retrospective.ts":{"bytes":18459,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"../path-matcher/dist/esm/index.mjs":{"bytes":9525,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"../search-params/dist/esm/index.mjs":{"bytes":3813,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"../route-tree/dist/esm/index.mjs":{"bytes":6514,"imports":[{"path":"../path-matcher/dist/esm/index.mjs","kind":"import-statement","original":"path-matcher"},{"path":"../search-params/dist/esm/index.mjs","kind":"import-statement","original":"search-params"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/forwardTo.ts":{"bytes":8454,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../route-tree/dist/esm/index.mjs","kind":"import-statement","original":"route-tree"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/routes.ts":{"bytes":17069,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../route-tree/dist/esm/index.mjs","kind":"import-statement","original":"route-tree"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/validators/forwardTo.ts","kind":"import-statement","original":"./forwardTo"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/state.ts":{"bytes":950,"imports":[{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validationPlugin.ts":{"bytes":10706,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core/validation","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/validators/dependencies.ts","kind":"import-statement","original":"./validators/dependencies"},{"path":"src/validators/eventBus.ts","kind":"import-statement","original":"./validators/eventBus"},{"path":"src/validators/lifecycle.ts","kind":"import-statement","original":"./validators/lifecycle"},{"path":"src/validators/navigation.ts","kind":"import-statement","original":"./validators/navigation"},{"path":"src/validators/options.ts","kind":"import-statement","original":"./validators/options"},{"path":"src/validators/plugins.ts","kind":"import-statement","original":"./validators/plugins"},{"path":"src/validators/retrospective.ts","kind":"import-statement","original":"./validators/retrospective"},{"path":"src/validators/routes.ts","kind":"import-statement","original":"./validators/routes"},{"path":"src/validators/state.ts","kind":"import-statement","original":"./validators/state"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":169,"imports":[{"path":"src/validationPlugin.ts","kind":"import-statement","original":"./validationPlugin"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":110019},"dist/cjs/index.js":{"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core/validation","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true}],"exports":["validationPlugin"],"entryPoint":"src/index.ts","inputs":{"src/validationPlugin.ts":{"bytesInOutput":6826},"../type-guards/dist/esm/index.mjs":{"bytesInOutput":3016},"src/validators/dependencies.ts":{"bytesInOutput":3115},"src/helpers.ts":{"bytesInOutput":124},"src/validators/eventBus.ts":{"bytesInOutput":624},"src/validators/lifecycle.ts":{"bytesInOutput":1892},"src/validators/navigation.ts":{"bytesInOutput":1224},"src/validators/options.ts":{"bytesInOutput":6737},"src/validators/plugins.ts":{"bytesInOutput":2433},"src/validators/retrospective.ts":{"bytesInOutput":9714},"src/validators/routes.ts":{"bytesInOutput":9093},"../route-tree/dist/esm/index.mjs":{"bytesInOutput":4666},"src/validators/forwardTo.ts":{"bytesInOutput":6353},"src/validators/state.ts":{"bytesInOutput":659},"src/index.ts":{"bytesInOutput":0}},"bytes":57206}}}
1
+ {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"../type-guards/dist/esm/index.mjs":{"bytes":3269,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/helpers.ts":{"bytes":224,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/dependencies.ts":{"bytes":4367,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/eventBus.ts":{"bytes":1358,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/lifecycle.ts":{"bytes":2528,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/navigation.ts":{"bytes":1841,"imports":[{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/options.ts":{"bytes":8080,"imports":[{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/plugins.ts":{"bytes":2819,"imports":[{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"../helpers"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/retrospective.ts":{"bytes":18459,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"../path-matcher/dist/esm/index.mjs":{"bytes":9525,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"../search-params/dist/esm/index.mjs":{"bytes":3813,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"../route-tree/dist/esm/index.mjs":{"bytes":6514,"imports":[{"path":"../path-matcher/dist/esm/index.mjs","kind":"import-statement","original":"path-matcher"},{"path":"../search-params/dist/esm/index.mjs","kind":"import-statement","original":"search-params"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/forwardTo.ts":{"bytes":8454,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../route-tree/dist/esm/index.mjs","kind":"import-statement","original":"route-tree"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/routes.ts":{"bytes":17069,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"../route-tree/dist/esm/index.mjs","kind":"import-statement","original":"route-tree"},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/validators/forwardTo.ts","kind":"import-statement","original":"./forwardTo"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validators/state.ts":{"bytes":737,"imports":[{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/validationPlugin.ts":{"bytes":10706,"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core/validation","kind":"import-statement","external":true},{"path":"../type-guards/dist/esm/index.mjs","kind":"import-statement","original":"type-guards"},{"path":"src/validators/dependencies.ts","kind":"import-statement","original":"./validators/dependencies"},{"path":"src/validators/eventBus.ts","kind":"import-statement","original":"./validators/eventBus"},{"path":"src/validators/lifecycle.ts","kind":"import-statement","original":"./validators/lifecycle"},{"path":"src/validators/navigation.ts","kind":"import-statement","original":"./validators/navigation"},{"path":"src/validators/options.ts","kind":"import-statement","original":"./validators/options"},{"path":"src/validators/plugins.ts","kind":"import-statement","original":"./validators/plugins"},{"path":"src/validators/retrospective.ts","kind":"import-statement","original":"./validators/retrospective"},{"path":"src/validators/routes.ts","kind":"import-statement","original":"./validators/routes"},{"path":"src/validators/state.ts","kind":"import-statement","original":"./validators/state"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":169,"imports":[{"path":"src/validationPlugin.ts","kind":"import-statement","original":"./validationPlugin"},{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":109687},"dist/cjs/index.js":{"imports":[{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core/validation","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/logger","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true},{"path":"@real-router/core","kind":"import-statement","external":true}],"exports":["validationPlugin"],"entryPoint":"src/index.ts","inputs":{"src/validationPlugin.ts":{"bytesInOutput":6826},"../type-guards/dist/esm/index.mjs":{"bytesInOutput":3016},"src/validators/dependencies.ts":{"bytesInOutput":3115},"src/helpers.ts":{"bytesInOutput":124},"src/validators/eventBus.ts":{"bytesInOutput":624},"src/validators/lifecycle.ts":{"bytesInOutput":1892},"src/validators/navigation.ts":{"bytesInOutput":1224},"src/validators/options.ts":{"bytesInOutput":6737},"src/validators/plugins.ts":{"bytesInOutput":2433},"src/validators/retrospective.ts":{"bytesInOutput":9714},"src/validators/routes.ts":{"bytesInOutput":9093},"../route-tree/dist/esm/index.mjs":{"bytesInOutput":4666},"src/validators/forwardTo.ts":{"bytesInOutput":6353},"src/validators/state.ts":{"bytesInOutput":479},"src/index.ts":{"bytesInOutput":0}},"bytes":57026}}}
@@ -1 +1 @@
1
- import{RouterError as e,resolveForwardChain as t}from"@real-router/core";import{getInternals as r}from"@real-router/core/validation";import{logger as o}from"@real-router/logger";var n=["replace","reload","force","forceDeactivate","redirected"],a=/\S/,i=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function c(e,t){return new TypeError(`[router.${e}] ${t}`)}function s(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=>s(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=>s(e,t))}return!1}function u(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}function f(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(!u(o)){const e=typeof o;if("function"===e||"symbol"===e)return!1;r=!0;break}}return!r||s(e)}function d(e){return"object"==typeof e&&null!==e&&function(e){return function(e){return"string"==typeof e&&(""===e||!(e.length>1e4)&&(!!e.startsWith("@@")||i.test(e)))}(e.name)&&"string"==typeof e.path&&f(e.params)}(e)}function l(e){return"string"==typeof e}function p(e){return"boolean"==typeof e}function w(e,t){return e in t}function y(e,t){if("string"!=typeof e)throw c(t,"Route name must be a string, got "+typeof e);if(""!==e){if(!a.test(e))throw c(t,"Route name cannot contain only whitespace");if(e.length>1e4)throw c(t,"Route name exceeds maximum length of 10000 characters. This is a technical safety limit.");if(!e.startsWith("@@")&&!i.test(e))throw c(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 m(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 h(e){return{warn:Math.floor(.2*e),error:Math.floor(.5*e)}}function g(e,t){if("string"!=typeof e)throw new TypeError(`[router.${t}] dependency name must be a string, got ${typeof e}`)}function v(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}] Invalid argument: expected plain object, received ${m(e)}`);for(const r in e)if(Object.getOwnPropertyDescriptor(e,r)?.get)throw new TypeError(`[router.${t}] Getters not allowed: "${r}"`)}function $(e,t){const r=e,n=r.limits?.maxDependencies??100;if(0===n)return;const a=Object.keys(r.dependencies).length,{warn:i,error:c}=h(n);if(a>=n)throw new RangeError(`[router.${t}] Dependency limit exceeded (${n}). Current: ${a}.`);a===c?o.error(`router.${t}`,`${a} dependencies registered! This indicates architectural problems. Hard limit at ${n}.`):a===i&&o.warn(`router.${t}`,`${a} dependencies registered. Consider if all are necessary.`)}function b(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 E(e,t){o.warn(`router.${t}`,"Router dependency already exists and is being overwritten:",e)}function T(e,t){o.warn(`router.${t}`,"Overwritten:",e.join(", "))}function P(e){o.warn("router.removeDependency",`Attempted to remove non-existent dependency: "${"string"==typeof e?e:String(e)}"`)}var j=new Set(["$start","$stop","$$start","$$cancel","$$success","$$error"]);function R(e){if(!j.has(e))throw new TypeError(`[router.addEventListener] Invalid event name: ${String(e)}. Must be one of: $start, $stop, $$start, $$cancel, $$success, $$error`)}function A(e,t){if(!p(e)&&"function"!=typeof e)throw new TypeError(`[router.${t}] Handler must be a boolean or factory function, got ${m(e)}`)}function x(e,t,r){o.warn(`router.${r}`,`Overwriting existing ${t} handler for route "${e}"`)}function S(e,t){o.warn(`router.${t}`,`Guard for "${e}" returned a Promise. Sync check cannot resolve async guards — returning false.`)}function O(e){if("string"!=typeof e)throw new TypeError(`[router.navigate] Invalid route name: expected string, got ${m(e)}`)}function I(e){if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError(`[router.navigateToDefault] Invalid options: ${m(e)}. Expected NavigationOptions object.`)}function D(e,t){if(!function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=e;for(const e of n){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: ${m(e)}. Expected NavigationOptions object.`)}function k(e,t){if(void 0!==e&&!f(e))throw new TypeError(`[router.${t}] params must be a plain object, got ${m(e)}`)}function M(e){if(void 0!==e&&"string"!=typeof e)throw new TypeError(`[router.start] path must be a string, got ${m(e)}.`);if("string"==typeof e&&""!==e&&!e.startsWith("/"))throw new TypeError(`[router.start] path must start with "/", got "${e}".`)}var N=["strict","never","always","preserve"],L=["default","strict","loose"],F=["default","uri","uriComponent","none"],C={arrayFormat:["none","brackets","index","comma"],booleanFormat:["none","string","empty-true"],nullFormat:["default","hidden"]},q=["all","warn-error","error-only","none"],_=new Set(["defaultRoute","defaultParams","trailingSlash","queryParamsMode","queryParams","urlParamsEncoding","allowNotFound","rewritePathOnMatch","logger","limits"]),B={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 H(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=B[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 U(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(B,r))throw new TypeError(`[router.${t}] unknown limit: "${r}"`);void 0!==o&&H(r,o,t)}}function W(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 G(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(!_.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),W(r.trailingSlash,"trailingSlash",N,t),W(r.queryParamsMode,"queryParamsMode",L,t),W(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(!w(e,C))throw new TypeError(`[router.${t}] Invalid "queryParams.${e}": unknown option`);W(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&&!q.includes(r.level)){const e=q.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&&U(r.limits,t)}var z="router.usePlugin",Z={onStart:!0,onStop:!0,onTransitionStart:!0,onTransitionSuccess:!0,onTransitionError:!0,onTransitionCancel:!0};function Q(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 V(){o.warn(z,"Duplicate factory in batch, will be registered once")}function K(e){o.warn(z,`Property '${e}' is not a function, skipping`)}function J(e){"onStart"===e&&o.warn(z,"Router already started, onStart will not be called")}function X(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 Y(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 ee(e,t,r=""){for(const o of e){const e=r?`${r}.${o.name}`:o.name;t(o,e),o.children&&ee(o.children,t,e)}}function te(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 re(e,r){try{return t(e,r)}catch(e){throw new Error(`[validation-plugin] ${e.message}`,{cause:e})}}function oe(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 ne(e,t,r){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[validation-plugin] Route "${r}" ${t} cannot be async`)}function ae(e){const t=Y(e,"validateExistingRoutes"),r=new Set;ee(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 ie(e){const t=Y(e,"validateForwardToConsistency"),{config:r,tree:o,matcher:n}=t;for(const[e,t]of Object.entries(r.forwardMap)){if(!te(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=oe(r),n=[...oe(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))re(e,r.forwardMap)}function ce(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 se(e,t){return new TypeError(`[router.${e}] ${t}`)}var ue=/^[A-Z_a-z][\w-]*$/,fe=/\S/;function de(e){return null===e?"null":"object"==typeof e?"constructor"in e&&"Object"!==e.constructor.name?e.constructor.name:"object":typeof e}function le(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 pe(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 ${de(e)}`);const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&null!==r)throw new TypeError(`[router.${t}] Route must be a plain object, got ${de(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 ${de(e.name)}`);const r=e.name;if(""===r)throw new TypeError(`[router.${t}] Route name cannot be empty`);if(!fe.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(!ue.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,se(r,`Route path must be a string, got ${t}`)}if(""===e)return;if(/\s/.test(e))throw se(r,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw se(r,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes("//"))throw se(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 se(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(le(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:le(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 ${de(i.children)}`);for(const e of i.children)pe(e,t,r,s,n,a)}}function we(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 ${m(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 ${m(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 ${m(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)we(r,`${t}.${r.name}`)}function ye(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 me(e){const t=new Set;for(const r of e)for(const e of ye(r))t.add(e);return t}function he(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 he(n.children,t,e,a)}throw new Error(`[internal] collectPathsToRoute: route "${t}" not found`)}function ge(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 ge(o.children,e))r.add(t)}return r}function ve(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 ve(o.children,e))r.set(t,n)}return r}function $e(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)??[]):me(he(o,e))}function be(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=me(he(r,e)),s=[...$e(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 Ee(e,r,o){const n=ge(e),a=ve(e),i={...r};for(const[e,t]of a)i[e]=t;for(const[t,r]of a)be(t,r,e,n,o);for(const e of Object.keys(i))t(e,i)}function Te(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 Pe(e,t){for(const r of e)r&&"object"==typeof r&&"string"==typeof r.name&&(Te(r.name,t),r.children&&Pe(r.children,t))}function je(e){y(e,"removeRoute")}function Re(e){if("string"!=typeof e)throw new TypeError(`[router.setRootPath] rootPath must be a string, got ${m(e)}`)}function Ae(e){return"AsyncFunction"===e.constructor.name||String(e).includes("__awaiter")}function xe(e){const t=e;if(void 0!==t.canActivate&&"function"!=typeof t.canActivate)throw new TypeError(`[router.addRoute] canActivate must be a function, got ${m(t.canActivate)}`);if(void 0!==t.canDeactivate&&"function"!=typeof t.canDeactivate)throw new TypeError(`[router.addRoute] canDeactivate must be a function, got ${m(t.canDeactivate)}`)}function Se(e){const t=e,r=t.name;if(void 0!==t.decodeParams&&Ae(t.decodeParams))throw new TypeError(`[router.addRoute] decodeParams cannot be async for route "${String(r)}"`);if(void 0!==t.encodeParams&&Ae(t.encodeParams))throw new TypeError(`[router.addRoute] encodeParams cannot be async for route "${String(r)}"`);if("function"==typeof t.forwardTo&&Ae(t.forwardTo))throw new TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${String(r)}"`)}function Oe(e,t,r,o){if(!l(e))throw new TypeError("[router.isActiveRoute] name must be a string, got "+typeof e);if(void 0!==t&&!f(t))throw new TypeError(`[router.isActiveRoute] params must be a plain object, got ${m(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 Ie(e,t,r){if(!l(e))throw new TypeError(`[router.${r}] Invalid routeName: ${m(e)}. Expected string.`);if(!f(t))throw new TypeError(`[router.${r}] Invalid routeParams: ${m(t)}. Expected plain object.`)}function De(e,t){if(y(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 ${m(t)}`)}function ke(e,t){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[router.updateRoute] ${t} cannot be an async function`)}function Me(e,t){if(null!=e){if("function"!=typeof e)throw new TypeError(`[router.updateRoute] ${t} must be a function or null, got ${typeof e}`);ke(e,t)}}function Ne(e){if(!l(e)||""===e)throw new TypeError("[router.buildPath] route must be a non-empty string, got "+("string"==typeof e?'""':typeof e))}function Le(e){if(!l(e))throw new TypeError("[router.matchPath] path must be a string, got "+typeof e)}function Fe(e){if(!l(e))throw new TypeError("[router.shouldUpdateNode] nodeName must be a string, got "+typeof e)}function Ce(e,r,o,n,a){if(!o(e))throw new ReferenceError(`[router.updateRoute] route "${e}" 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}"`)})(e,r,n),function(e,r,o){const n={...o.forwardMap,[e]:r};t(e,n)}(e,r,a)}}function qe(e,t,r,o){if(!l(e))throw new TypeError(`[router.makeState] Invalid name: ${m(e)}. Expected string.`);if(void 0!==t&&!f(t))throw new TypeError(`[router.makeState] Invalid params: ${m(t)}. Expected plain object.`);if(void 0!==r&&!l(r))throw new TypeError(`[router.makeState] Invalid path: ${m(r)}. Expected string.`);if(void 0!==o&&"number"!=typeof o)throw new TypeError(`[router.makeState] Invalid forceId: ${m(o)}. Expected number.`)}function _e(e){return{routes:{validateBuildPathArgs:Ne,validateMatchPathArgs:Le,validateIsActiveRouteArgs:Oe,validateShouldUpdateNodeArgs:Fe,validateStateBuilderArgs:Ie,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 ${m(t)}`);we(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)pe(r,"addRoute",t,"",o,n);t&&r&&Ee(e,r,t)}(e,r.tree,r.config?.forwardMap)},validateRemoveRouteArgs:je,validateUpdateRouteBasicArgs:De,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 ${m(e)}`);"function"==typeof e&&ke(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 ${m(t)}`);Me(r,"decodeParams"),Me(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 ${m(e)}`);y(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){y(e,t)},throwIfInternalRoute(e,t){Te(e,t)},throwIfInternalRouteInArray(e,t){Pe(e,t)},validateExistingRoutes:ae,validateForwardToConsistency:ie,validateSetRootPathArgs:Re,guardRouteCallbacks:xe,guardNoAsyncCallbacks:Se},options:{validateLimitValue(e,t){H(e,t,"validate")},validateLimits(e){U(e,"validate")},validateOptions:G},dependencies:{validateDependencyName:g,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:v,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:ce,validateDependencyCount:$,validateCloneArgs:b,warnOverwrite:E,warnBatchOverwrite:T,warnRemoveNonExistent:P},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:Q,validateCountThresholds(t){!function(e,t){if(0===t)return;const{warn:r,error:n}=h(t);e>=n?o.error(z,`${e} plugins registered! This is excessive. Hard limit at ${t}.`):e>=r&&o.warn(z,`${e} plugins registered. Consider if all are necessary.`)}(t,e.getOptions().limits?.maxPlugins??50)},warnBatchDuplicates:V,warnPluginMethodType:K,warnPluginAfterStart:J,validateAddInterceptorArgs:X},lifecycle:{validateHandler:A,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,r){!function(e,t,r){if(0===r)return;const{warn:n,error:a}=h(r);e>=a?o.error(`router.${t}`,`${e} lifecycle handlers registered! This is excessive. Hard limit at ${r}.`):e>=n&&o.warn(`router.${t}`,`${e} lifecycle handlers registered. Consider consolidating logic.`)}(t,r,e.getOptions().limits?.maxLifecycleHandlers??200)},warnOverwrite:x,warnAsyncGuardSync:S},navigation:{validateNavigateArgs:O,validateNavigateToDefaultArgs:I,validateNavigationOptions:D,validateParams:k,validateStartArgs:M},state:{validateMakeStateArgs:qe,validateAreStatesEqualArgs(e,t,r){if(!d(e))throw new TypeError(`[router.areStatesEqual] Invalid state1: ${m(e)}. Expected State object.`);if(!d(t))throw new TypeError(`[router.areStatesEqual] Invalid state2: ${m(t)}. Expected State object.`);if(void 0!==r&&!p(r))throw new TypeError(`[router.areStatesEqual] Invalid ignoreQueryParams: ${m(r)}. Expected boolean.`)}},eventBus:{validateEventName:R,validateListenerArgs(e,t){!function(e,t){if(R(e),"function"!=typeof t)throw new TypeError("[router.addEventListener] callback must be a function, got "+typeof t)}(e,t)}}}}function Be(){return t=>{const o=r(t);if(t.isActive())throw new e("VALIDATION_PLUGIN_AFTER_START",{message:"validation-plugin must be registered before router.start()"});o.validator=_e(o);try{const e=o.routeGetStore(),t=o.dependenciesGetStore(),r=o.getOptions();ae(e),ie(e),function(e){const t=Y(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}`);ne(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}`);ne(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}`);ne(t,"forwardTo callback",e)}}(e),function(e){const t=Y(e,"validateForwardToTargetsStore"),{config:r,tree:o}=t;for(const[e,t]of Object.entries(r.forwardMap))if(!te(o,t))throw new Error(`[validation-plugin] validateForwardToTargetsStore: forwardTo target "${t}" does not exist for route "${e}"`)}(e),ce(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}}}}export{Be as validationPlugin};//# sourceMappingURL=index.mjs.map
1
+ import{RouterError as e,resolveForwardChain as t}from"@real-router/core";import{getInternals as r}from"@real-router/core/validation";import{logger as o}from"@real-router/logger";var n=["replace","reload","force","forceDeactivate","redirected"],a=/\S/,i=/^[A-Z_a-z][\w-]*(?:\.[A-Z_a-z][\w-]*)*$/;function c(e,t){return new TypeError(`[router.${e}] ${t}`)}function s(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=>s(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=>s(e,t))}return!1}function u(e){if(null==e)return!0;const t=typeof e;return"string"===t||"boolean"===t||"number"===t&&Number.isFinite(e)}function f(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(!u(o)){const e=typeof o;if("function"===e||"symbol"===e)return!1;r=!0;break}}return!r||s(e)}function d(e){return"object"==typeof e&&null!==e&&function(e){return function(e){return"string"==typeof e&&(""===e||!(e.length>1e4)&&(!!e.startsWith("@@")||i.test(e)))}(e.name)&&"string"==typeof e.path&&f(e.params)}(e)}function l(e){return"string"==typeof e}function p(e){return"boolean"==typeof e}function w(e,t){return e in t}function y(e,t){if("string"!=typeof e)throw c(t,"Route name must be a string, got "+typeof e);if(""!==e){if(!a.test(e))throw c(t,"Route name cannot contain only whitespace");if(e.length>1e4)throw c(t,"Route name exceeds maximum length of 10000 characters. This is a technical safety limit.");if(!e.startsWith("@@")&&!i.test(e))throw c(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 m(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 h(e){return{warn:Math.floor(.2*e),error:Math.floor(.5*e)}}function g(e,t){if("string"!=typeof e)throw new TypeError(`[router.${t}] dependency name must be a string, got ${typeof e}`)}function v(e,t){if(!e||"object"!=typeof e||e.constructor!==Object)throw new TypeError(`[router.${t}] Invalid argument: expected plain object, received ${m(e)}`);for(const r in e)if(Object.getOwnPropertyDescriptor(e,r)?.get)throw new TypeError(`[router.${t}] Getters not allowed: "${r}"`)}function $(e,t){const r=e,n=r.limits?.maxDependencies??100;if(0===n)return;const a=Object.keys(r.dependencies).length,{warn:i,error:c}=h(n);if(a>=n)throw new RangeError(`[router.${t}] Dependency limit exceeded (${n}). Current: ${a}.`);a===c?o.error(`router.${t}`,`${a} dependencies registered! This indicates architectural problems. Hard limit at ${n}.`):a===i&&o.warn(`router.${t}`,`${a} dependencies registered. Consider if all are necessary.`)}function b(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 E(e,t){o.warn(`router.${t}`,"Router dependency already exists and is being overwritten:",e)}function T(e,t){o.warn(`router.${t}`,"Overwritten:",e.join(", "))}function P(e){o.warn("router.removeDependency",`Attempted to remove non-existent dependency: "${"string"==typeof e?e:String(e)}"`)}var j=new Set(["$start","$stop","$$start","$$cancel","$$success","$$error"]);function R(e){if(!j.has(e))throw new TypeError(`[router.addEventListener] Invalid event name: ${String(e)}. Must be one of: $start, $stop, $$start, $$cancel, $$success, $$error`)}function A(e,t){if(!p(e)&&"function"!=typeof e)throw new TypeError(`[router.${t}] Handler must be a boolean or factory function, got ${m(e)}`)}function x(e,t,r){o.warn(`router.${r}`,`Overwriting existing ${t} handler for route "${e}"`)}function S(e,t){o.warn(`router.${t}`,`Guard for "${e}" returned a Promise. Sync check cannot resolve async guards — returning false.`)}function O(e){if("string"!=typeof e)throw new TypeError(`[router.navigate] Invalid route name: expected string, got ${m(e)}`)}function I(e){if(void 0!==e&&("object"!=typeof e||null===e))throw new TypeError(`[router.navigateToDefault] Invalid options: ${m(e)}. Expected NavigationOptions object.`)}function D(e,t){if(!function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;const t=e;for(const e of n){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: ${m(e)}. Expected NavigationOptions object.`)}function k(e,t){if(void 0!==e&&!f(e))throw new TypeError(`[router.${t}] params must be a plain object, got ${m(e)}`)}function M(e){if(void 0!==e&&"string"!=typeof e)throw new TypeError(`[router.start] path must be a string, got ${m(e)}.`);if("string"==typeof e&&""!==e&&!e.startsWith("/"))throw new TypeError(`[router.start] path must start with "/", got "${e}".`)}var N=["strict","never","always","preserve"],L=["default","strict","loose"],F=["default","uri","uriComponent","none"],C={arrayFormat:["none","brackets","index","comma"],booleanFormat:["none","string","empty-true"],nullFormat:["default","hidden"]},q=["all","warn-error","error-only","none"],_=new Set(["defaultRoute","defaultParams","trailingSlash","queryParamsMode","queryParams","urlParamsEncoding","allowNotFound","rewritePathOnMatch","logger","limits"]),B={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 H(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=B[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 U(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(B,r))throw new TypeError(`[router.${t}] unknown limit: "${r}"`);void 0!==o&&H(r,o,t)}}function W(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 G(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(!_.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),W(r.trailingSlash,"trailingSlash",N,t),W(r.queryParamsMode,"queryParamsMode",L,t),W(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(!w(e,C))throw new TypeError(`[router.${t}] Invalid "queryParams.${e}": unknown option`);W(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&&!q.includes(r.level)){const e=q.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&&U(r.limits,t)}var z="router.usePlugin",Z={onStart:!0,onStop:!0,onTransitionStart:!0,onTransitionSuccess:!0,onTransitionError:!0,onTransitionCancel:!0};function Q(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 V(){o.warn(z,"Duplicate factory in batch, will be registered once")}function K(e){o.warn(z,`Property '${e}' is not a function, skipping`)}function J(e){"onStart"===e&&o.warn(z,"Router already started, onStart will not be called")}function X(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 Y(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 ee(e,t,r=""){for(const o of e){const e=r?`${r}.${o.name}`:o.name;t(o,e),o.children&&ee(o.children,t,e)}}function te(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 re(e,r){try{return t(e,r)}catch(e){throw new Error(`[validation-plugin] ${e.message}`,{cause:e})}}function oe(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 ne(e,t,r){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[validation-plugin] Route "${r}" ${t} cannot be async`)}function ae(e){const t=Y(e,"validateExistingRoutes"),r=new Set;ee(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 ie(e){const t=Y(e,"validateForwardToConsistency"),{config:r,tree:o,matcher:n}=t;for(const[e,t]of Object.entries(r.forwardMap)){if(!te(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=oe(r),n=[...oe(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))re(e,r.forwardMap)}function ce(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 se(e,t){return new TypeError(`[router.${e}] ${t}`)}var ue=/^[A-Z_a-z][\w-]*$/,fe=/\S/;function de(e){return null===e?"null":"object"==typeof e?"constructor"in e&&"Object"!==e.constructor.name?e.constructor.name:"object":typeof e}function le(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 pe(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 ${de(e)}`);const r=Object.getPrototypeOf(e);if(r!==Object.prototype&&null!==r)throw new TypeError(`[router.${t}] Route must be a plain object, got ${de(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 ${de(e.name)}`);const r=e.name;if(""===r)throw new TypeError(`[router.${t}] Route name cannot be empty`);if(!fe.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(!ue.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,se(r,`Route path must be a string, got ${t}`)}if(""===e)return;if(/\s/.test(e))throw se(r,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw se(r,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes("//"))throw se(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 se(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(le(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:le(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 ${de(i.children)}`);for(const e of i.children)pe(e,t,r,s,n,a)}}function we(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 ${m(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 ${m(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 ${m(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)we(r,`${t}.${r.name}`)}function ye(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 me(e){const t=new Set;for(const r of e)for(const e of ye(r))t.add(e);return t}function he(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 he(n.children,t,e,a)}throw new Error(`[internal] collectPathsToRoute: route "${t}" not found`)}function ge(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 ge(o.children,e))r.add(t)}return r}function ve(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 ve(o.children,e))r.set(t,n)}return r}function $e(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)??[]):me(he(o,e))}function be(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=me(he(r,e)),s=[...$e(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 Ee(e,r,o){const n=ge(e),a=ve(e),i={...r};for(const[e,t]of a)i[e]=t;for(const[t,r]of a)be(t,r,e,n,o);for(const e of Object.keys(i))t(e,i)}function Te(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 Pe(e,t){for(const r of e)r&&"object"==typeof r&&"string"==typeof r.name&&(Te(r.name,t),r.children&&Pe(r.children,t))}function je(e){y(e,"removeRoute")}function Re(e){if("string"!=typeof e)throw new TypeError(`[router.setRootPath] rootPath must be a string, got ${m(e)}`)}function Ae(e){return"AsyncFunction"===e.constructor.name||String(e).includes("__awaiter")}function xe(e){const t=e;if(void 0!==t.canActivate&&"function"!=typeof t.canActivate)throw new TypeError(`[router.addRoute] canActivate must be a function, got ${m(t.canActivate)}`);if(void 0!==t.canDeactivate&&"function"!=typeof t.canDeactivate)throw new TypeError(`[router.addRoute] canDeactivate must be a function, got ${m(t.canDeactivate)}`)}function Se(e){const t=e,r=t.name;if(void 0!==t.decodeParams&&Ae(t.decodeParams))throw new TypeError(`[router.addRoute] decodeParams cannot be async for route "${String(r)}"`);if(void 0!==t.encodeParams&&Ae(t.encodeParams))throw new TypeError(`[router.addRoute] encodeParams cannot be async for route "${String(r)}"`);if("function"==typeof t.forwardTo&&Ae(t.forwardTo))throw new TypeError(`[router.addRoute] forwardTo callback cannot be async for route "${String(r)}"`)}function Oe(e,t,r,o){if(!l(e))throw new TypeError("[router.isActiveRoute] name must be a string, got "+typeof e);if(void 0!==t&&!f(t))throw new TypeError(`[router.isActiveRoute] params must be a plain object, got ${m(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 Ie(e,t,r){if(!l(e))throw new TypeError(`[router.${r}] Invalid routeName: ${m(e)}. Expected string.`);if(!f(t))throw new TypeError(`[router.${r}] Invalid routeParams: ${m(t)}. Expected plain object.`)}function De(e,t){if(y(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 ${m(t)}`)}function ke(e,t){if("AsyncFunction"===e.constructor.name||e.toString().includes("__awaiter"))throw new TypeError(`[router.updateRoute] ${t} cannot be an async function`)}function Me(e,t){if(null!=e){if("function"!=typeof e)throw new TypeError(`[router.updateRoute] ${t} must be a function or null, got ${typeof e}`);ke(e,t)}}function Ne(e){if(!l(e)||""===e)throw new TypeError("[router.buildPath] route must be a non-empty string, got "+("string"==typeof e?'""':typeof e))}function Le(e){if(!l(e))throw new TypeError("[router.matchPath] path must be a string, got "+typeof e)}function Fe(e){if(!l(e))throw new TypeError("[router.shouldUpdateNode] nodeName must be a string, got "+typeof e)}function Ce(e,r,o,n,a){if(!o(e))throw new ReferenceError(`[router.updateRoute] route "${e}" 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}"`)})(e,r,n),function(e,r,o){const n={...o.forwardMap,[e]:r};t(e,n)}(e,r,a)}}function qe(e,t,r){if(!l(e))throw new TypeError(`[router.makeState] Invalid name: ${m(e)}. Expected string.`);if(void 0!==t&&!f(t))throw new TypeError(`[router.makeState] Invalid params: ${m(t)}. Expected plain object.`);if(void 0!==r&&!l(r))throw new TypeError(`[router.makeState] Invalid path: ${m(r)}. Expected string.`)}function _e(e){return{routes:{validateBuildPathArgs:Ne,validateMatchPathArgs:Le,validateIsActiveRouteArgs:Oe,validateShouldUpdateNodeArgs:Fe,validateStateBuilderArgs:Ie,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 ${m(t)}`);we(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)pe(r,"addRoute",t,"",o,n);t&&r&&Ee(e,r,t)}(e,r.tree,r.config?.forwardMap)},validateRemoveRouteArgs:je,validateUpdateRouteBasicArgs:De,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 ${m(e)}`);"function"==typeof e&&ke(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 ${m(t)}`);Me(r,"decodeParams"),Me(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 ${m(e)}`);y(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){y(e,t)},throwIfInternalRoute(e,t){Te(e,t)},throwIfInternalRouteInArray(e,t){Pe(e,t)},validateExistingRoutes:ae,validateForwardToConsistency:ie,validateSetRootPathArgs:Re,guardRouteCallbacks:xe,guardNoAsyncCallbacks:Se},options:{validateLimitValue(e,t){H(e,t,"validate")},validateLimits(e){U(e,"validate")},validateOptions:G},dependencies:{validateDependencyName:g,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:v,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:ce,validateDependencyCount:$,validateCloneArgs:b,warnOverwrite:E,warnBatchOverwrite:T,warnRemoveNonExistent:P},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:Q,validateCountThresholds(t){!function(e,t){if(0===t)return;const{warn:r,error:n}=h(t);e>=n?o.error(z,`${e} plugins registered! This is excessive. Hard limit at ${t}.`):e>=r&&o.warn(z,`${e} plugins registered. Consider if all are necessary.`)}(t,e.getOptions().limits?.maxPlugins??50)},warnBatchDuplicates:V,warnPluginMethodType:K,warnPluginAfterStart:J,validateAddInterceptorArgs:X},lifecycle:{validateHandler:A,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,r){!function(e,t,r){if(0===r)return;const{warn:n,error:a}=h(r);e>=a?o.error(`router.${t}`,`${e} lifecycle handlers registered! This is excessive. Hard limit at ${r}.`):e>=n&&o.warn(`router.${t}`,`${e} lifecycle handlers registered. Consider consolidating logic.`)}(t,r,e.getOptions().limits?.maxLifecycleHandlers??200)},warnOverwrite:x,warnAsyncGuardSync:S},navigation:{validateNavigateArgs:O,validateNavigateToDefaultArgs:I,validateNavigationOptions:D,validateParams:k,validateStartArgs:M},state:{validateMakeStateArgs:qe,validateAreStatesEqualArgs(e,t,r){if(!d(e))throw new TypeError(`[router.areStatesEqual] Invalid state1: ${m(e)}. Expected State object.`);if(!d(t))throw new TypeError(`[router.areStatesEqual] Invalid state2: ${m(t)}. Expected State object.`);if(void 0!==r&&!p(r))throw new TypeError(`[router.areStatesEqual] Invalid ignoreQueryParams: ${m(r)}. Expected boolean.`)}},eventBus:{validateEventName:R,validateListenerArgs(e,t){!function(e,t){if(R(e),"function"!=typeof t)throw new TypeError("[router.addEventListener] callback must be a function, got "+typeof t)}(e,t)}}}}function Be(){return t=>{const o=r(t);if(t.isActive())throw new e("VALIDATION_PLUGIN_AFTER_START",{message:"validation-plugin must be registered before router.start()"});o.validator=_e(o);try{const e=o.routeGetStore(),t=o.dependenciesGetStore(),r=o.getOptions();ae(e),ie(e),function(e){const t=Y(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}`);ne(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}`);ne(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}`);ne(t,"forwardTo callback",e)}}(e),function(e){const t=Y(e,"validateForwardToTargetsStore"),{config:r,tree:o}=t;for(const[e,t]of Object.entries(r.forwardMap))if(!te(o,t))throw new Error(`[validation-plugin] validateForwardToTargetsStore: forwardTo target "${t}" does not exist for route "${e}"`)}(e),ce(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}}}}export{Be as validationPlugin};//# sourceMappingURL=index.mjs.map